Commit f185de28 authored by Taehee Yoo's avatar Taehee Yoo Committed by David S. Miller
Browse files

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: default avatarCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 88e2ca30
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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;
@@ -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;
+3 −0
Original line number Diff line number Diff line
@@ -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 */
+2 −2
Original line number Diff line number Diff line
@@ -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:
+197 −83

File changed.

Preview size limit exceeded, changes collapsed.