netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.r.fastabend@intel.com>
To: jhs@mojatatu.com, shemminger@vyatta.com,
	bhutchings@solarflare.com, roprabhu@cisco.com,
	davem@davemloft.net, jeffrey.t.kirsher@intel.com
Cc: netdev@vger.kernel.org, mst@redhat.com, chrisw@redhat.com,
	gregory.v.rose@intel.com, kvm@vger.kernel.org, sri@us.ibm.com,
	chealy@imsco-us.com
Subject: [net-next PATCH v0 2/5] net: addr_list: add exclusive dev_uc_add
Date: Sun, 18 Mar 2012 23:51:57 -0700	[thread overview]
Message-ID: <20120319065157.10959.32215.stgit@jf-dev1-dcblab> (raw)
In-Reply-To: <20120319064719.10959.93361.stgit@jf-dev1-dcblab>

This adds a dev_uc_add_excl() call similar to the original
dev_uc_add() except it sets the global bit. With this
change the reference count will not be bumped and -EEXIST
will be returned if a duplicate address exists.

This is useful for drivers that support SR-IOV and want
to manage the unicast lists.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---

 include/linux/netdevice.h |    1 +
 net/core/dev_addr_lists.c |   19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4208901..5e43cec 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2571,6 +2571,7 @@ extern int dev_addr_init(struct net_device *dev);
 
 /* Functions used for unicast addresses handling */
 extern int dev_uc_add(struct net_device *dev, unsigned char *addr);
+extern int dev_uc_add_excl(struct net_device *dev, unsigned char *addr);
 extern int dev_uc_del(struct net_device *dev, unsigned char *addr);
 extern int dev_uc_sync(struct net_device *to, struct net_device *from);
 extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
index 29c07fe..c7d27ad 100644
--- a/net/core/dev_addr_lists.c
+++ b/net/core/dev_addr_lists.c
@@ -377,6 +377,25 @@ EXPORT_SYMBOL(dev_addr_del_multiple);
  */
 
 /**
+ *	dev_uc_add_excl - Add a global secondary unicast address
+ *	@dev: device
+ *	@addr: address to add
+ */
+int dev_uc_add_excl(struct net_device *dev, unsigned char *addr)
+{
+	int err;
+
+	netif_addr_lock_bh(dev);
+	err = __hw_addr_add_ex(&dev->uc, addr, dev->addr_len,
+			       NETDEV_HW_ADDR_T_UNICAST, true);
+	if (!err)
+		__dev_set_rx_mode(dev);
+	netif_addr_unlock_bh(dev);
+	return err;
+}
+EXPORT_SYMBOL(dev_uc_add_excl);
+
+/**
  *	dev_uc_add - Add a secondary unicast address
  *	@dev: device
  *	@addr: address to add

  reply	other threads:[~2012-03-19  7:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19  6:51 [net-next PATCH v0 0/5] Series short description John Fastabend
2012-03-19  6:51 ` John Fastabend [this message]
2012-03-25 13:07   ` [net-next PATCH v0 2/5] net: addr_list: add exclusive dev_uc_add Roopa Prabhu
2012-03-19  6:52 ` [net-next PATCH v0 3/5] net: add fdb generic dump routine John Fastabend
2012-03-25 13:09   ` Roopa Prabhu
2012-03-26 21:41     ` John Fastabend
2012-03-19  6:52 ` [net-next PATCH v0 4/5] ixgbe: enable FDB netdevice ops John Fastabend
2012-03-19 22:46   ` Jeff Kirsher
2012-03-19  6:52 ` [net-next PATCH v0 5/5] ixgbe: allow RAR table to be updated in promisc mode John Fastabend
2012-03-19 22:44   ` Jeff Kirsher
2012-03-19 22:38 ` [net-next PATCH v0 0/5] Series short description David Miller
2012-03-19 22:55   ` Stephen Hemminger
2012-03-20  0:27     ` John Fastabend
2012-03-20  0:35       ` David Miller
2012-03-20  2:49         ` John Fastabend
2012-03-20  2:51           ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120319065157.10959.32215.stgit@jf-dev1-dcblab \
    --to=john.r.fastabend@intel.com \
    --cc=bhutchings@solarflare.com \
    --cc=chealy@imsco-us.com \
    --cc=chrisw@redhat.com \
    --cc=davem@davemloft.net \
    --cc=gregory.v.rose@intel.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jhs@mojatatu.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=roprabhu@cisco.com \
    --cc=shemminger@vyatta.com \
    --cc=sri@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).