Skip to content

Commit

Permalink
mld: add new workqueues for process mld events
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
TaeheeYoo authored and davem330 committed Mar 26, 2021
1 parent 88e2ca3 commit f185de2
Show file tree
Hide file tree
Showing 4 changed files with 210 additions and 86 deletions.
9 changes: 8 additions & 1 deletion include/net/if_inet6.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ struct ifmcaddr6 {
unsigned int mca_flags;
int mca_users;
refcount_t mca_refcnt;
spinlock_t mca_lock;
unsigned long mca_cstamp;
unsigned long mca_tstamp;
struct rcu_head rcu;
Expand Down Expand Up @@ -183,6 +182,14 @@ struct inet6_dev {
struct delayed_work mc_gq_work; /* general query work */
struct delayed_work mc_ifc_work; /* interface change work */
struct delayed_work mc_dad_work; /* dad complete mc work */
struct delayed_work mc_query_work; /* mld query work */
struct delayed_work mc_report_work; /* mld report work */

struct sk_buff_head mc_query_queue; /* mld query queue */
struct sk_buff_head mc_report_queue; /* mld report queue */

spinlock_t mc_query_lock; /* mld query queue lock */
spinlock_t mc_report_lock; /* mld query report lock */

struct ifacaddr6 *ac_list;
rwlock_t lock;
Expand Down
3 changes: 3 additions & 0 deletions include/net/mld.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ struct mld2_query {
#define MLD_EXP_MIN_LIMIT 32768UL
#define MLDV1_MRD_MAX_COMPAT (MLD_EXP_MIN_LIMIT - 1)

#define MLD_MAX_QUEUE 8
#define MLD_MAX_SKBS 32

static inline unsigned long mldv2_mrc(const struct mld2_query *mlh2)
{
/* RFC3810, 5.1.3. Maximum Response Code */
Expand Down
4 changes: 2 additions & 2 deletions net/ipv6/icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,11 +944,11 @@ static int icmpv6_rcv(struct sk_buff *skb)

case ICMPV6_MGM_QUERY:
igmp6_event_query(skb);
break;
return 0;

case ICMPV6_MGM_REPORT:
igmp6_event_report(skb);
break;
return 0;

case ICMPV6_MGM_REDUCTION:
case ICMPV6_NI_QUERY:
Expand Down

0 comments on commit f185de2

Please sign in to comment.