* [RFC PATCH 0/3] Provide default fdb operation to allow mac filter
@ 2013-02-27 17:46 Vlad Yasevich
2013-02-27 17:46 ` [RFC PATCH 1/3] net: generic fdb support for drivers without ndo_fdb_<op> Vlad Yasevich
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Vlad Yasevich @ 2013-02-27 17:46 UTC (permalink / raw)
To: netdev; +Cc: john.r.fastabend, davem, Vlad Yasevich
This is a short series that now allows mac filter programming on any
card that support IFF_UNICAST_FLT by using the existing FDB interface.
Some existing drivers that had FDB functionality usually supported
it only in SR-IOV mode. Since that's not always enabled, and
we want to take advantage of IFF_UNICAST_FLT support, these drivers
have been converted to call the default handler when not in SRIOV mode.
John Fastabend (1):
net: generic fdb support for drivers without ndo_fdb_<op>
Vlad Yasevich (2):
ixgbe: Use default fdb handlers when not in VF mode.
mlx4: Use default fdb handlers when not multifunction.
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 26 +++-----
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 12 +---
include/linux/rtnetlink.h | 9 +++
net/core/rtnetlink.c | 81 ++++++++++++++++++++++--
4 files changed, 98 insertions(+), 30 deletions(-)
--
1.7.7.6
^ permalink raw reply [flat|nested] 8+ messages in thread
* [RFC PATCH 1/3] net: generic fdb support for drivers without ndo_fdb_<op>
2013-02-27 17:46 [RFC PATCH 0/3] Provide default fdb operation to allow mac filter Vlad Yasevich
@ 2013-02-27 17:46 ` Vlad Yasevich
2013-02-27 17:46 ` [RFC PATCH 2/3] ixgbe: Use default fdb handlers when not in VF mode Vlad Yasevich
2013-02-27 17:46 ` [RFC PATCH 3/3] mlx4: Use default fdb handlers when not multifunction Vlad Yasevich
2 siblings, 0 replies; 8+ messages in thread
From: Vlad Yasevich @ 2013-02-27 17:46 UTC (permalink / raw)
To: netdev; +Cc: john.r.fastabend, davem, Vlad Yasevich
If the driver does not support the ndo_op use the generic
handler for it. This should work in the majority of cases.
Eventually the fdb_dflt_add call gets translated into a
__dev_set_rx_mode() call which should handle hardware
support for filtering via the IFF_UNICAST_FLT flag.
Namely IFF_UNICAST_FLT indicates if the hardware can do
unicast address filtering. If no support is available
the device is put into promisc mode.
CC: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
---
include/linux/rtnetlink.h | 9 +++++
net/core/rtnetlink.c | 81 +++++++++++++++++++++++++++++++++++++++++---
2 files changed, 84 insertions(+), 6 deletions(-)
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 489dd7bb..55d33a3 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -69,6 +69,15 @@ extern int ndo_dflt_fdb_dump(struct sk_buff *skb,
struct netlink_callback *cb,
struct net_device *dev,
int idx);
+extern int ndo_dflt_fdb_add(struct sk_buff *skb,
+ struct nlattr *tb[],
+ struct net_device *dev,
+ const unsigned char *addr,
+ u16 flags);
+extern int ndo_dflt_fdb_del(struct sk_buff *skb,
+ struct nlattr *tb[],
+ struct net_device *dev,
+ const unsigned char *addr);
extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
struct net_device *dev, u16 mode);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index d8aa20f..56b0038 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2049,6 +2049,38 @@ errout:
rtnl_set_sk_err(net, RTNLGRP_NEIGH, err);
}
+/**
+ * ndo_dflt_fdb_add - default netdevice operation to add an FDB entry
+ */
+int ndo_dflt_fdb_add(struct ndmsg *ndm,
+ struct nlattr *tb[],
+ struct net_device *dev,
+ const unsigned char *addr,
+ u16 flags)
+{
+ int err = -EINVAL;
+
+ /* If aging addresses are supported device will need to
+ * implement its own handler for this.
+ */
+ if (ndm->ndm_state && !(ndm->ndm_state & NUD_PERMANENT)) {
+ pr_info("%s: FDB only supports static addresses\n", dev->name);
+ return err;
+ }
+
+ 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);
+
+ /* Only return duplicate errors if NLM_F_EXCL is set */
+ if (err == -EEXIST && !(flags & NLM_F_EXCL))
+ err = 0;
+
+ return err;
+}
+EXPORT_SYMBOL(ndo_dflt_fdb_add);
+
static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct net *net = sock_net(skb->sk);
@@ -2101,10 +2133,13 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
}
/* Embedded bridge, macvlan, and any other device support */
- if ((ndm->ndm_flags & NTF_SELF) && dev->netdev_ops->ndo_fdb_add) {
- err = dev->netdev_ops->ndo_fdb_add(ndm, tb,
- dev, addr,
- nlh->nlmsg_flags);
+ if ((ndm->ndm_flags & NTF_SELF)) {
+ if (dev->netdev_ops->ndo_fdb_add)
+ err = dev->netdev_ops->ndo_fdb_add(ndm, tb, dev, addr,
+ nlh->nlmsg_flags);
+ else
+ err = ndo_dflt_fdb_add(ndm, tb, dev, addr,
+ nlh->nlmsg_flags);
if (!err) {
rtnl_fdb_notify(dev, addr, RTM_NEWNEIGH);
@@ -2115,6 +2150,35 @@ out:
return err;
}
+/**
+ * ndo_dflt_fdb_del - default netdevice operation to delete an FDB entry
+ */
+int ndo_dflt_fdb_del(struct ndmsg *ndm,
+ struct nlattr *tb[],
+ struct net_device *dev,
+ const unsigned char *addr)
+{
+ int err = -EOPNOTSUPP;
+
+ /* If aging addresses are supported device will need to
+ * implement its own handler for this.
+ */
+ if (ndm->ndm_state & NUD_PERMANENT) {
+ pr_info("%s: FDB only supports static addresses\n", dev->name);
+ return -EINVAL;
+ }
+
+ if (is_unicast_ether_addr(addr) || is_link_local_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;
+}
+EXPORT_SYMBOL(ndo_dflt_fdb_del);
+
static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct net *net = sock_net(skb->sk);
@@ -2172,8 +2236,11 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
}
/* Embedded bridge, macvlan, and any other device support */
- if ((ndm->ndm_flags & NTF_SELF) && dev->netdev_ops->ndo_fdb_del) {
- err = dev->netdev_ops->ndo_fdb_del(ndm, tb, dev, addr);
+ if (ndm->ndm_flags & NTF_SELF) {
+ if (dev->netdev_ops->ndo_fdb_del)
+ err = dev->netdev_ops->ndo_fdb_del(ndm, tb, dev, addr);
+ else
+ err = ndo_dflt_fdb_del(ndm, tb, dev, addr);
if (!err) {
rtnl_fdb_notify(dev, addr, RTM_DELNEIGH);
@@ -2258,6 +2325,8 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
if (dev->netdev_ops->ndo_fdb_dump)
idx = dev->netdev_ops->ndo_fdb_dump(skb, cb, dev, idx);
+ else
+ ndo_dflt_fdb_dump(skb, cb, dev, idx);
}
rcu_read_unlock();
--
1.7.7.6
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC PATCH 2/3] ixgbe: Use default fdb handlers when not in VF mode.
2013-02-27 17:46 [RFC PATCH 0/3] Provide default fdb operation to allow mac filter Vlad Yasevich
2013-02-27 17:46 ` [RFC PATCH 1/3] net: generic fdb support for drivers without ndo_fdb_<op> Vlad Yasevich
@ 2013-02-27 17:46 ` Vlad Yasevich
2013-02-28 4:26 ` John Fastabend
2013-02-27 17:46 ` [RFC PATCH 3/3] mlx4: Use default fdb handlers when not multifunction Vlad Yasevich
2 siblings, 1 reply; 8+ messages in thread
From: Vlad Yasevich @ 2013-02-27 17:46 UTC (permalink / raw)
To: netdev; +Cc: john.r.fastabend, davem, Vlad Yasevich
Allow the use of ndo_dflt_fdb_<add|del|dump> when the
adapter does not have VF configured. This allows for
IFF_UNICAST_FLT support and allows VF handling to potentially
do something different.
CC: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 26 ++++++++++--------------
1 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 68478d6..0ae2525 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7007,7 +7007,7 @@ static int ixgbe_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
int err;
if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
- return -EOPNOTSUPP;
+ return ndo_dflt_fdb_add(ndm, tb, dev, addr, flags);
/* Hardware does not support aging addresses so if a
* ndm_state is given only allow permanent addresses
@@ -7045,20 +7045,21 @@ static int ixgbe_ndo_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
struct ixgbe_adapter *adapter = netdev_priv(dev);
int err = -EOPNOTSUPP;
+ if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
+ return ndo_dflt_fdb_del(ndm, tb, dev, addr);
+
if (ndm->ndm_state & NUD_PERMANENT) {
pr_info("%s: FDB only supports static addresses\n",
ixgbe_driver_name);
return -EINVAL;
}
- if (adapter->flags & IXGBE_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;
- }
+ 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;
}
@@ -7068,12 +7069,7 @@ static int ixgbe_ndo_fdb_dump(struct sk_buff *skb,
struct net_device *dev,
int idx)
{
- struct ixgbe_adapter *adapter = netdev_priv(dev);
-
- if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
- idx = ndo_dflt_fdb_dump(skb, cb, dev, idx);
-
- return idx;
+ return ndo_dflt_fdb_dump(skb, cb, dev, idx);
}
static int ixgbe_ndo_bridge_setlink(struct net_device *dev,
--
1.7.7.6
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC PATCH 3/3] mlx4: Use default fdb handlers when not multifunction.
2013-02-27 17:46 [RFC PATCH 0/3] Provide default fdb operation to allow mac filter Vlad Yasevich
2013-02-27 17:46 ` [RFC PATCH 1/3] net: generic fdb support for drivers without ndo_fdb_<op> Vlad Yasevich
2013-02-27 17:46 ` [RFC PATCH 2/3] ixgbe: Use default fdb handlers when not in VF mode Vlad Yasevich
@ 2013-02-27 17:46 ` Vlad Yasevich
2013-02-28 4:27 ` John Fastabend
2 siblings, 1 reply; 8+ messages in thread
From: Vlad Yasevich @ 2013-02-27 17:46 UTC (permalink / raw)
To: netdev; +Cc: john.r.fastabend, davem, Vlad Yasevich, Amir Vadai
Allow the use of ndo_dflt_fdb_<add|del|dump> when the
adapter is not configured with virtual functins (!mlx4_is_mfunc())
This allows proper IFF_UNICAST_FLT support and allows for
additional handling by the driver if needed.
CC: Amir Vadai <amirv@mellanox.com>
Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
---
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 5385474..5732025 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1934,7 +1934,7 @@ static int mlx4_en_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
int err;
if (!mlx4_is_mfunc(mdev))
- return -EOPNOTSUPP;
+ return ndo_dflt_fdb_add(ndm, tb, dev, addr, flags);
/* Hardware does not support aging addresses, allow only
* permanent addresses if ndm_state is given
@@ -1968,7 +1968,7 @@ static int mlx4_en_fdb_del(struct ndmsg *ndm,
int err;
if (!mlx4_is_mfunc(mdev))
- return -EOPNOTSUPP;
+ return ndo_dflt_fdb_del(ndm, tb, dev, addr);
if (ndm->ndm_state && !(ndm->ndm_state & NUD_PERMANENT)) {
en_info(priv, "Del FDB only supports static addresses\n");
@@ -1989,13 +1989,7 @@ static int mlx4_en_fdb_dump(struct sk_buff *skb,
struct netlink_callback *cb,
struct net_device *dev, int idx)
{
- struct mlx4_en_priv *priv = netdev_priv(dev);
- struct mlx4_dev *mdev = priv->mdev->dev;
-
- if (mlx4_is_mfunc(mdev))
- idx = ndo_dflt_fdb_dump(skb, cb, dev, idx);
-
- return idx;
+ return ndo_dflt_fdb_dump(skb, cb, dev, idx);
}
static const struct net_device_ops mlx4_netdev_ops = {
--
1.7.7.6
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [RFC PATCH 2/3] ixgbe: Use default fdb handlers when not in VF mode.
2013-02-27 17:46 ` [RFC PATCH 2/3] ixgbe: Use default fdb handlers when not in VF mode Vlad Yasevich
@ 2013-02-28 4:26 ` John Fastabend
2013-02-28 14:46 ` Vlad Yasevich
0 siblings, 1 reply; 8+ messages in thread
From: John Fastabend @ 2013-02-28 4:26 UTC (permalink / raw)
To: Vlad Yasevich; +Cc: netdev, davem, Rose, Gregory V
On 2/27/2013 9:46 AM, Vlad Yasevich wrote:
> Allow the use of ndo_dflt_fdb_<add|del|dump> when the
> adapter does not have VF configured. This allows for
> IFF_UNICAST_FLT support and allows VF handling to potentially
> do something different.
>
> CC: John Fastabend <john.r.fastabend@intel.com>
> Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 26 ++++++++++--------------
> 1 files changed, 11 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 68478d6..0ae2525 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -7007,7 +7007,7 @@ static int ixgbe_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
With the first patch we can just remove this routine altogether and
let the dflt handler do its work.
CC'd Greg in case I miss something.
> int err;
>
> if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
> - return -EOPNOTSUPP;
> + return ndo_dflt_fdb_add(ndm, tb, dev, addr, flags);
>
> /* Hardware does not support aging addresses so if a
> * ndm_state is given only allow permanent addresses
> @@ -7045,20 +7045,21 @@ static int ixgbe_ndo_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
same here just remove it and use the dflt handler.
> struct ixgbe_adapter *adapter = netdev_priv(dev);
> int err = -EOPNOTSUPP;
>
> + if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
> + return ndo_dflt_fdb_del(ndm, tb, dev, addr);
> +
> if (ndm->ndm_state & NUD_PERMANENT) {
> pr_info("%s: FDB only supports static addresses\n",
> ixgbe_driver_name);
> return -EINVAL;
> }
>
> - if (adapter->flags & IXGBE_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;
> - }
> + 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;
> }
> @@ -7068,12 +7069,7 @@ static int ixgbe_ndo_fdb_dump(struct sk_buff *skb,
> struct net_device *dev,
> int idx)
> {
This is the same as not defining the op at all right? Just
remove it.
> - struct ixgbe_adapter *adapter = netdev_priv(dev);
> -
> - if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
> - idx = ndo_dflt_fdb_dump(skb, cb, dev, idx);
> -
> - return idx;
> + return ndo_dflt_fdb_dump(skb, cb, dev, idx);
> }
>
> static int ixgbe_ndo_bridge_setlink(struct net_device *dev,
>
Then we get a patch with all '-' which is sort of nice.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC PATCH 3/3] mlx4: Use default fdb handlers when not multifunction.
2013-02-27 17:46 ` [RFC PATCH 3/3] mlx4: Use default fdb handlers when not multifunction Vlad Yasevich
@ 2013-02-28 4:27 ` John Fastabend
[not found] ` <CAJZOPZLcphuZEXR+jhT35=qtOq9bfxWzWEokN6UrMorciCvvsA@mail.gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: John Fastabend @ 2013-02-28 4:27 UTC (permalink / raw)
To: Vlad Yasevich, Amir Vadai; +Cc: netdev, davem
On 2/27/2013 9:46 AM, Vlad Yasevich wrote:
> Allow the use of ndo_dflt_fdb_<add|del|dump> when the
> adapter is not configured with virtual functins (!mlx4_is_mfunc())
> This allows proper IFF_UNICAST_FLT support and allows for
> additional handling by the driver if needed.
>
> CC: Amir Vadai <amirv@mellanox.com>
> Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
> ---
> drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 12 +++---------
> 1 files changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> index 5385474..5732025 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> @@ -1934,7 +1934,7 @@ static int mlx4_en_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
Amir are the default ops good enough here?
> int err;
>
> if (!mlx4_is_mfunc(mdev))
> - return -EOPNOTSUPP;
> + return ndo_dflt_fdb_add(ndm, tb, dev, addr, flags);
>
> /* Hardware does not support aging addresses, allow only
> * permanent addresses if ndm_state is given
> @@ -1968,7 +1968,7 @@ static int mlx4_en_fdb_del(struct ndmsg *ndm,
> int err;
>
> if (!mlx4_is_mfunc(mdev))
> - return -EOPNOTSUPP;
> + return ndo_dflt_fdb_del(ndm, tb, dev, addr);
>
> if (ndm->ndm_state && !(ndm->ndm_state & NUD_PERMANENT)) {
> en_info(priv, "Del FDB only supports static addresses\n");
> @@ -1989,13 +1989,7 @@ static int mlx4_en_fdb_dump(struct sk_buff *skb,
> struct netlink_callback *cb,
> struct net_device *dev, int idx)
> {
same comment here. Don't define this op and we get the same behavior?
.John
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [RFC PATCH 3/3] mlx4: Use default fdb handlers when not multifunction.
[not found] ` <CAJZOPZLcphuZEXR+jhT35=qtOq9bfxWzWEokN6UrMorciCvvsA@mail.gmail.com>
@ 2013-02-28 12:32 ` Yan Burman
0 siblings, 0 replies; 8+ messages in thread
From: Yan Burman @ 2013-02-28 12:32 UTC (permalink / raw)
To: john.r.fastabend@intel.com, vyasevic@redhat.com
Cc: Or Gerlitz, Amir Vadai, netdev@vger.kernel.org,
davem@davemloft.net
> From: John Fastabend <john.r.fastabend@intel.com>
> Date: Thu, Feb 28, 2013 at 6:27 AM
> Subject: Re: [RFC PATCH 3/3] mlx4: Use default fdb handlers when not
> multifunction.
> To: Vlad Yasevich <vyasevic@redhat.com>, Amir Vadai <amirv@mellanox.com>
> Cc: netdev@vger.kernel.org, davem@davemloft.net
>
>
> On 2/27/2013 9:46 AM, Vlad Yasevich wrote:
> >
> > Allow the use of ndo_dflt_fdb_<add|del|dump> when the adapter is not
> > configured with virtual functins (!mlx4_is_mfunc()) This allows proper
> > IFF_UNICAST_FLT support and allows for additional handling by the
> > driver if needed.
> >
> > CC: Amir Vadai <amirv@mellanox.com>
> > Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
> > ---
> > drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 12 +++---------
> > 1 files changed, 3 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> > b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> > index 5385474..5732025 100644
> > --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> > +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> > @@ -1934,7 +1934,7 @@ static int mlx4_en_fdb_add(struct ndmsg *ndm,
> > struct nlattr *tb[],
>
>
> Amir are the default ops good enough here?
>
The default ops can be used instead of mlx4 fdb_add, fdb_delete, and fdb_dump.
Yan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC PATCH 2/3] ixgbe: Use default fdb handlers when not in VF mode.
2013-02-28 4:26 ` John Fastabend
@ 2013-02-28 14:46 ` Vlad Yasevich
0 siblings, 0 replies; 8+ messages in thread
From: Vlad Yasevich @ 2013-02-28 14:46 UTC (permalink / raw)
To: John Fastabend; +Cc: netdev, davem, Rose, Gregory V
On 02/27/2013 11:26 PM, John Fastabend wrote:
> On 2/27/2013 9:46 AM, Vlad Yasevich wrote:
>> Allow the use of ndo_dflt_fdb_<add|del|dump> when the
>> adapter does not have VF configured. This allows for
>> IFF_UNICAST_FLT support and allows VF handling to potentially
>> do something different.
>>
>> CC: John Fastabend <john.r.fastabend@intel.com>
>> Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
>> ---
>> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 26
>> ++++++++++--------------
>> 1 files changed, 11 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
>> b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
>> index 68478d6..0ae2525 100644
>> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
>> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
>> @@ -7007,7 +7007,7 @@ static int ixgbe_ndo_fdb_add(struct ndmsg *ndm,
>> struct nlattr *tb[],
>
> With the first patch we can just remove this routine altogether and
> let the dflt handler do its work.
>
> CC'd Greg in case I miss something.
OK. I took the safe approach and kept the functions. The only
difference right now is that right now with VF configured, fdb_add
refuses to add more then IXGBE_MAX_PF_MACVLANS and thus never would
enter into promisc mode. I am not sure if that how its supposed to
be have or not. That's one of the reasons I kept this around.
-vlad
>
>> int err;
>>
>> if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
>> - return -EOPNOTSUPP;
>> + return ndo_dflt_fdb_add(ndm, tb, dev, addr, flags);
>>
>> /* Hardware does not support aging addresses so if a
>> * ndm_state is given only allow permanent addresses
>> @@ -7045,20 +7045,21 @@ static int ixgbe_ndo_fdb_del(struct ndmsg
>> *ndm, struct nlattr *tb[],
>
> same here just remove it and use the dflt handler.
>
>> struct ixgbe_adapter *adapter = netdev_priv(dev);
>> int err = -EOPNOTSUPP;
>>
>> + if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
>> + return ndo_dflt_fdb_del(ndm, tb, dev, addr);
>> +
>> if (ndm->ndm_state & NUD_PERMANENT) {
>> pr_info("%s: FDB only supports static addresses\n",
>> ixgbe_driver_name);
>> return -EINVAL;
>> }
>>
>> - if (adapter->flags & IXGBE_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;
>> - }
>> + 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;
>> }
>> @@ -7068,12 +7069,7 @@ static int ixgbe_ndo_fdb_dump(struct sk_buff *skb,
>> struct net_device *dev,
>> int idx)
>> {
>
> This is the same as not defining the op at all right? Just
> remove it.
>
>> - struct ixgbe_adapter *adapter = netdev_priv(dev);
>> -
>> - if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
>> - idx = ndo_dflt_fdb_dump(skb, cb, dev, idx);
>> -
>> - return idx;
>> + return ndo_dflt_fdb_dump(skb, cb, dev, idx);
>> }
>>
>> static int ixgbe_ndo_bridge_setlink(struct net_device *dev,
>>
>
> Then we get a patch with all '-' which is sort of nice.
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-02-28 14:46 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-27 17:46 [RFC PATCH 0/3] Provide default fdb operation to allow mac filter Vlad Yasevich
2013-02-27 17:46 ` [RFC PATCH 1/3] net: generic fdb support for drivers without ndo_fdb_<op> Vlad Yasevich
2013-02-27 17:46 ` [RFC PATCH 2/3] ixgbe: Use default fdb handlers when not in VF mode Vlad Yasevich
2013-02-28 4:26 ` John Fastabend
2013-02-28 14:46 ` Vlad Yasevich
2013-02-27 17:46 ` [RFC PATCH 3/3] mlx4: Use default fdb handlers when not multifunction Vlad Yasevich
2013-02-28 4:27 ` John Fastabend
[not found] ` <CAJZOPZLcphuZEXR+jhT35=qtOq9bfxWzWEokN6UrMorciCvvsA@mail.gmail.com>
2013-02-28 12:32 ` Yan Burman
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).