Skip to content

Commit f185de2

Browse files
TaeheeYoodavem330
authored andcommitted
mld: add new workqueues for process mld events
When query/report packets are received, mld module processes them. But they are processed under BH context so it couldn't use sleepable functions. So, in order to switch context, the two workqueues are added which processes query and report event. In the struct inet6_dev, mc_{query | report}_queue are added so it is per-interface queue. And mc_{query | report}_work are workqueue structure. When the query or report event is received, skb is queued to proper queue and worker function is scheduled immediately. Workqueues and queues are protected by spinlock, which is mc_{query | report}_lock, and worker functions are protected by RTNL. Suggested-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Taehee Yoo <ap420073@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 88e2ca3 commit f185de2

File tree

4 files changed

+210
-86
lines changed

4 files changed

+210
-86
lines changed

include/net/if_inet6.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ struct ifmcaddr6 {
125125
unsigned intmca_flags;
126126
intmca_users;
127127
refcount_tmca_refcnt;
128-
spinlock_tmca_lock;
129128
unsigned longmca_cstamp;
130129
unsigned longmca_tstamp;
131130
struct rcu_headrcu;
@@ -183,6 +182,14 @@ struct inet6_dev {
183182
struct delayed_workmc_gq_work;/* general query work */
184183
struct delayed_workmc_ifc_work;/* interface change work */
185184
struct delayed_workmc_dad_work;/* dad complete mc work */
185+
struct delayed_workmc_query_work;/* mld query work */
186+
struct delayed_workmc_report_work;/* mld report work */
187+
188+
struct sk_buff_headmc_query_queue;/* mld query queue */
189+
struct sk_buff_headmc_report_queue;/* mld report queue */
190+
191+
spinlock_tmc_query_lock;/* mld query queue lock */
192+
spinlock_tmc_report_lock;/* mld query report lock */
186193

187194
struct ifacaddr6*ac_list;
188195
rwlock_tlock;

include/net/mld.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ struct mld2_query {
9292
#define MLD_EXP_MIN_LIMIT32768UL
9393
#define MLDV1_MRD_MAX_COMPAT(MLD_EXP_MIN_LIMIT - 1)
9494

95+
#define MLD_MAX_QUEUE8
96+
#define MLD_MAX_SKBS32
97+
9598
static inline unsigned long mldv2_mrc(const struct mld2_query *mlh2)
9699
{
97100
/* RFC3810, 5.1.3. Maximum Response Code */

net/ipv6/icmp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -944,11 +944,11 @@ static int icmpv6_rcv(struct sk_buff *skb)
944944

945945
case ICMPV6_MGM_QUERY:
946946
igmp6_event_query(skb);
947-
break;
947+
return 0;
948948

949949
case ICMPV6_MGM_REPORT:
950950
igmp6_event_report(skb);
951-
break;
951+
return 0;
952952

953953
case ICMPV6_MGM_REDUCTION:
954954
case ICMPV6_NI_QUERY:

0 commit comments

Comments
 (0)