From patchwork Thu Oct 22 13:52:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 55352 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9MDqhT2020910 for ; Thu, 22 Oct 2009 13:52:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755949AbZJVNwg (ORCPT ); Thu, 22 Oct 2009 09:52:36 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755734AbZJVNwg (ORCPT ); Thu, 22 Oct 2009 09:52:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23986 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755413AbZJVNwf (ORCPT ); Thu, 22 Oct 2009 09:52:35 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9MDqHtf008749; Thu, 22 Oct 2009 09:52:17 -0400 Received: from localhost (psychotron.englab.brq.redhat.com [10.34.32.135]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9MDqGob015117; Thu, 22 Oct 2009 09:52:17 -0400 Date: Thu, 22 Oct 2009 15:52:21 +0200 From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, eric.dumazet@gmail.com, jeffrey.t.kirsher@intel.com, jesse.brandeburg@intel.com, bruce.w.allan@intel.com, peter.p.waskiewicz.jr@intel.com, john.ronciak@intel.com, e1000-devel@lists.sourceforge.net, mchehab@infradead.org, linux-media@vger.kernel.org Subject: [PATCH net-next-2.6 1/4] net: introduce mc list helpers Message-ID: <20091022135220.GD2868@psychotron.lab.eng.brq.redhat.com> References: <20091022135120.GC2868@psychotron.lab.eng.brq.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091022135120.GC2868@psychotron.lab.eng.brq.redhat.com> User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 8380009..7edc4a6 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -921,6 +921,28 @@ struct net_device #define NETDEV_ALIGN 32 +static inline int netdev_mc_count(struct net_device *dev) +{ + return dev->mc_count; +} + +static inline bool netdev_mc_empty(struct net_device *dev) +{ + return netdev_mc_count(dev) == 0; +} + +static inline void netdev_mc_walk(struct net_device *dev, + void (*func)(void *, unsigned char *), + void *data) +{ + struct dev_addr_list *mclist; + int i; + + for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; + i++, mclist = mclist->next) + func(data, mclist->dmi_addr); +} + static inline struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, unsigned int index)