diff mbox

[RFC,3/3] mlx4: Use default fdb handlers when not multifunction.

Message ID 1361987164-15280-4-git-send-email-vyasevic@redhat.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Vlad Yasevich Feb. 27, 2013, 5:46 p.m. UTC
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(-)

Comments

John Fastabend Feb. 28, 2013, 4:27 a.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yan Burman Feb. 28, 2013, 12:32 p.m. UTC | #2
> 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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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 = {