From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Greg Rose <gregory.v.rose@intel.com>,
netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
Catherine Sullivan <catherine.sullivan@intel.com>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 01/16] i40e: Add bridge FDB add/del/dump ops
Date: Tue, 22 Apr 2014 05:39:16 -0700 [thread overview]
Message-ID: <1398170371-3333-2-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1398170371-3333-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Greg Rose <gregory.v.rose@intel.com>
Add the netdev ops to support addition of static FDB entries in the
physical function (PF) MAC/VLAN filter table so that virtual functions
(VFs) can communicate with bridged virtual Ethernet ports such as those
provided by the virtio driver.
Change-ID: Ifbd6817a75074e3b5cdf945a5635f26440bf15df
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_main.c | 97 +++++++++++++++++++++++++++++
1 file changed, 97 insertions(+)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 861b722..10f0f41 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -6644,6 +6644,96 @@ static void i40e_del_vxlan_port(struct net_device *netdev,
}
#endif
+#ifdef HAVE_FDB_OPS
+#ifdef USE_CONST_DEV_UC_CHAR
+static int i40e_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
+ struct net_device *dev,
+ const unsigned char *addr,
+ u16 flags)
+#else
+static int i40e_ndo_fdb_add(struct ndmsg *ndm,
+ struct net_device *dev,
+ unsigned char *addr,
+ u16 flags)
+#endif
+{
+ struct i40e_netdev_priv *np = netdev_priv(dev);
+ struct i40e_pf *pf = np->vsi->back;
+ int err = 0;
+
+ if (!(pf->flags & I40E_FLAG_SRIOV_ENABLED))
+ return -EOPNOTSUPP;
+
+ /* Hardware does not support aging addresses so if a
+ * ndm_state is given only allow permanent addresses
+ */
+ if (ndm->ndm_state && !(ndm->ndm_state & NUD_PERMANENT)) {
+ netdev_info(dev, "FDB only supports static addresses\n");
+ return -EINVAL;
+ }
+
+ if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr))
+ err = dev_uc_add_excl(dev, addr);
+ else if (is_multicast_ether_addr(addr))
+ err = dev_mc_add_excl(dev, addr);
+ else
+ err = -EINVAL;
+
+ /* Only return duplicate errors if NLM_F_EXCL is set */
+ if (err == -EEXIST && !(flags & NLM_F_EXCL))
+ err = 0;
+
+ return err;
+}
+
+#ifndef USE_DEFAULT_FDB_DEL_DUMP
+#ifdef USE_CONST_DEV_UC_CHAR
+static int i40e_ndo_fdb_del(struct ndmsg *ndm,
+ struct net_device *dev,
+ const unsigned char *addr)
+#else
+static int i40e_ndo_fdb_del(struct ndmsg *ndm,
+ struct net_device *dev,
+ unsigned char *addr)
+#endif
+{
+ struct i40e_netdev_priv *np = netdev_priv(dev);
+ struct i40e_pf *pf = np->vsi->back;
+ int err = -EOPNOTSUPP;
+
+ if (ndm->ndm_state & NUD_PERMANENT) {
+ netdev_info(dev, "FDB only supports static addresses\n");
+ return -EINVAL;
+ }
+
+ if (pf->flags & I40E_FLAG_SRIOV_ENABLED) {
+ if (is_unicast_ether_addr(addr))
+ err = dev_uc_del(dev, addr);
+ else if (is_multicast_ether_addr(addr))
+ err = dev_mc_del(dev, addr);
+ else
+ err = -EINVAL;
+ }
+
+ return err;
+}
+
+static int i40e_ndo_fdb_dump(struct sk_buff *skb,
+ struct netlink_callback *cb,
+ struct net_device *dev,
+ int idx)
+{
+ struct i40e_netdev_priv *np = netdev_priv(dev);
+ struct i40e_pf *pf = np->vsi->back;
+
+ if (pf->flags & I40E_FLAG_SRIOV_ENABLED)
+ idx = ndo_dflt_fdb_dump(skb, cb, dev, idx);
+
+ return idx;
+}
+
+#endif /* USE_DEFAULT_FDB_DEL_DUMP */
+#endif /* HAVE_FDB_OPS */
static const struct net_device_ops i40e_netdev_ops = {
.ndo_open = i40e_open,
.ndo_stop = i40e_close,
@@ -6671,6 +6761,13 @@ static const struct net_device_ops i40e_netdev_ops = {
.ndo_add_vxlan_port = i40e_add_vxlan_port,
.ndo_del_vxlan_port = i40e_del_vxlan_port,
#endif
+#ifdef HAVE_FDB_OPS
+ .ndo_fdb_add = i40e_ndo_fdb_add,
+#ifndef USE_DEFAULT_FDB_DEL_DUMP
+ .ndo_fdb_del = i40e_ndo_fdb_del,
+ .ndo_fdb_dump = i40e_ndo_fdb_dump,
+#endif
+#endif
};
/**
--
1.9.0
next prev parent reply other threads:[~2014-04-22 12:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-22 12:39 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2014-04-22 12:39 ` Jeff Kirsher [this message]
2014-04-22 12:39 ` [net-next 02/16] i40e/i40evf: unhide and enable to one prefena field Jeff Kirsher
2014-04-22 12:39 ` [net-next 03/16] i40e: Reset the VF upon conflicting VLAN configuration Jeff Kirsher
2014-04-22 12:39 ` [net-next 04/16] i40e: Enable VF Tx bandwidth setting Jeff Kirsher
2014-04-22 12:39 ` [net-next 05/16] i40e/i40evf: Bump build versions Jeff Kirsher
2014-04-22 12:39 ` [net-next 06/16] i40e: Remove a FW workaround Jeff Kirsher
2014-04-22 12:39 ` [net-next 07/16] i40e: Fix an issue with displaying IPv4 FD filters Jeff Kirsher
2014-04-22 12:39 ` [net-next 08/16] i40e/i40evf: add tracking to NVM busy state Jeff Kirsher
2014-04-22 12:39 ` [net-next 09/16] i40e/i40evf: update AdminQ API Jeff Kirsher
2014-04-22 12:39 ` [net-next 10/16] i40e: prep vsi_open logic for non-netdev cases Jeff Kirsher
2014-04-22 12:39 ` [net-next 11/16] i40e: abstract the close path for better netdev vsis Jeff Kirsher
2014-04-22 12:39 ` [net-next 12/16] i40e: use generic vsi_open to unquiesce vsi Jeff Kirsher
2014-04-22 12:39 ` [net-next 13/16] i40e: rework fdir setup and teardown Jeff Kirsher
2014-04-22 12:39 ` [net-next 14/16] i40e: Cleanup if/else statements Jeff Kirsher
2014-04-22 12:39 ` [net-next 15/16] i40e: Tweak for-loop in i40e_ethtool.c Jeff Kirsher
2014-04-22 12:39 ` [net-next 16/16] i40e/i40evf: Bump build versions Jeff Kirsher
2014-04-23 1:47 ` [net-next 00/16][pull request] Intel Wired LAN Driver Updates David Miller
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=1398170371-3333-2-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=catherine.sullivan@intel.com \
--cc=davem@davemloft.net \
--cc=gospo@redhat.com \
--cc=gregory.v.rose@intel.com \
--cc=netdev@vger.kernel.org \
--cc=sassmann@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.