All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Jiawen Wu <jiawenwu@trustnetic.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, rmk+kernel@armlinux.org.uk, andrew@lunn.ch,
	netdev@vger.kernel.org, mengyuanlou@net-swift.com,
	duanqiangwen@net-swift.com
Subject: Re: [PATCH net 5/5] net: txgbe: fix to control VLAN strip
Date: Thu, 18 Apr 2024 20:54:58 +0100	[thread overview]
Message-ID: <20240418195458.GR3975545@kernel.org> (raw)
In-Reply-To: <20240416062952.14196-6-jiawenwu@trustnetic.com>

On Tue, Apr 16, 2024 at 02:29:52PM +0800, Jiawen Wu wrote:
> When VLAN tag strip is changed to enable or disable, the hardware requires
> the Rx ring to be in a disabled state, otherwise the feature cannot be
> changed.
> 
> Fixes: f3b03c655f67 ("net: wangxun: Implement vlan add and kill functions")
> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
> ---
>  .../net/ethernet/wangxun/txgbe/txgbe_main.c   | 58 ++++++++++++++++++-
>  1 file changed, 57 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> index af0c548e52b0..2a6b35036fce 100644
> --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c

...

> +static int txgbe_set_features(struct net_device *netdev, netdev_features_t features)

There seems to be a lot of overlap between this function and
wx_set_features(). To aid maintenance, the common code be
factored out into a shared function?

> +{
> +	netdev_features_t changed = netdev->features ^ features;
> +	struct wx *wx = netdev_priv(netdev);
> +
> +	if (features & NETIF_F_RXHASH) {
> +		wr32m(wx, WX_RDB_RA_CTL, WX_RDB_RA_CTL_RSS_EN,
> +		      WX_RDB_RA_CTL_RSS_EN);
> +		wx->rss_enabled = true;
> +	} else {
> +		wr32m(wx, WX_RDB_RA_CTL, WX_RDB_RA_CTL_RSS_EN, 0);
> +		wx->rss_enabled = false;
> +	}
> +
> +	netdev->features = features;
> +
> +	if (changed & NETIF_F_HW_VLAN_CTAG_RX)
> +		txgbe_do_reset(netdev);
> +	else if (changed & NETIF_F_HW_VLAN_CTAG_FILTER)
> +		wx_set_rx_mode(netdev);

I see the following in wx_set_features():

        if (changed &
	    (NETIF_F_HW_VLAN_CTAG_RX |
	     NETIF_F_HW_VLAN_STAG_RX))
		wx_set_rx_mode(netdev);

Should NETIF_F_HW_VLAN_STAG_RX and NETIF_F_HW_VLAN_STAG_FILTER
also be checked in this function?

> +
> +	return 0;
> +}
> +
>  static const struct net_device_ops txgbe_netdev_ops = {
>  	.ndo_open               = txgbe_open,
>  	.ndo_stop               = txgbe_close,
>  	.ndo_change_mtu         = wx_change_mtu,
>  	.ndo_start_xmit         = wx_xmit_frame,
>  	.ndo_set_rx_mode        = wx_set_rx_mode,
> -	.ndo_set_features       = wx_set_features,
> +	.ndo_set_features       = txgbe_set_features,
>  	.ndo_fix_features       = wx_fix_features,
>  	.ndo_validate_addr      = eth_validate_addr,
>  	.ndo_set_mac_address    = wx_set_mac,
> -- 
> 2.27.0
> 
> 

      reply	other threads:[~2024-04-18 19:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16  6:29 [PATCH net 0/5] Wangxun fixes Jiawen Wu
2024-04-16  6:29 ` [PATCH net 1/5] net: wangxun: fix the incorrect display of queue number in statistics Jiawen Wu
2024-04-16 10:16   ` Francois Romieu
2024-04-16  6:29 ` [PATCH net 2/5] net: wangxun: fix error statistics when the device is reset Jiawen Wu
2024-04-16 10:17   ` Francois Romieu
2024-04-16 14:56   ` Andrew Lunn
2024-04-24  7:53     ` Jiawen Wu
2024-04-16  6:29 ` [PATCH net 3/5] net: wangxun: fix to change Rx features Jiawen Wu
2024-04-16 15:01   ` Andrew Lunn
2024-04-16  6:29 ` [PATCH net 4/5] net: wangxun: change NETIF_F_HW_VLAN_STAG_* to fixed features Jiawen Wu
2024-04-18 18:58   ` Simon Horman
2024-04-25  6:53     ` Jiawen Wu
2024-04-26  7:07       ` Simon Horman
2024-04-16  6:29 ` [PATCH net 5/5] net: txgbe: fix to control VLAN strip Jiawen Wu
2024-04-18 19:54   ` Simon Horman [this message]

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=20240418195458.GR3975545@kernel.org \
    --to=horms@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=duanqiangwen@net-swift.com \
    --cc=edumazet@google.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=kuba@kernel.org \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rmk+kernel@armlinux.org.uk \
    /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.