[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250828155004.GA31759@horms.kernel.org>
Date: Thu, 28 Aug 2025 16:50:04 +0100
From: Simon Horman <horms@...nel.org>
To: Jiawen Wu <jiawenwu@...stnetic.com>
Cc: netdev@...r.kernel.org, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Mengyuan Lou <mengyuanlou@...-swift.com>
Subject: Re: [PATCH net-next 1/2] net: libwx: support multiple RSS for every
pool
On Wed, Aug 27, 2025 at 02:46:33PM +0800, Jiawen Wu wrote:
> For those devices which support 64 pools, they also support PF and VF
> (i.e. different pools) to configure different RSS key. Enable multiple
> RSS, use up to 64 RSS keys and that is one key per pool.
>
> Signed-off-by: Jiawen Wu <jiawenwu@...stnetic.com>
...
> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_hw.c b/drivers/net/ethernet/wangxun/libwx/wx_hw.c
...
> @@ -2046,6 +2074,50 @@ static void wx_setup_reta(struct wx *wx)
> wx_store_reta(wx);
> }
>
> +void wx_config_rss_field(struct wx *wx)
> +{
> + u32 rss_field;
> +
> + if (test_bit(WX_FLAG_SRIOV_ENABLED, wx->flags) &&
> + test_bit(WX_FLAG_MULTI_64_FUNC, wx->flags)) {
> + rss_field = rd32(wx, WX_RDB_PL_CFG(wx->num_vfs));
> + rss_field &= ~WX_RDB_PL_CFG_RSS_MASK;
> + rss_field |= wx->rss_flags << WX_RSS_FIELD_SHIFT;
Hi Jiawen,
I expect you can use something like the following here,
and drop WX_RX_FIELD_SHIFT entirely.
rss_field |= FIELD_PREP(WX_RDB_PL_CFG_RSS_MASK, wx->rss_flags);
> + wr32(wx, WX_RDB_PL_CFG(wx->num_vfs), rss_field);
> +
> + /* Enable global RSS and multiple RSS to make the RSS
> + * field of each pool take effect.
> + */
> + wr32m(wx, WX_RDB_RA_CTL,
> + WX_RDB_RA_CTL_MULTI_RSS | WX_RDB_RA_CTL_RSS_EN,
> + WX_RDB_RA_CTL_MULTI_RSS | WX_RDB_RA_CTL_RSS_EN);
> + } else {
> + rss_field = rd32(wx, WX_RDB_RA_CTL);
> + rss_field &= ~WX_RDB_RA_CTL_RSS_MASK;
> + rss_field |= wx->rss_flags << WX_RSS_FIELD_SHIFT;
> + wr32(wx, WX_RDB_RA_CTL, rss_field);
> + }
> +}
...
> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_type.h b/drivers/net/ethernet/wangxun/libwx/wx_type.h
> index ec63e7ec8b24..9fd0f3a5a48c 100644
> --- a/drivers/net/ethernet/wangxun/libwx/wx_type.h
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_type.h
> @@ -168,9 +168,12 @@
> #define WX_RDB_PL_CFG_L2HDR BIT(3)
> #define WX_RDB_PL_CFG_TUN_TUNHDR BIT(4)
> #define WX_RDB_PL_CFG_TUN_OUTL2HDR BIT(5)
> +#define WX_RDB_PL_CFG_RSS_EN BIT(24)
> +#define WX_RDB_PL_CFG_RSS_MASK GENMASK(23, 16)
> #define WX_RDB_RSSTBL(_i) (0x19400 + ((_i) * 4))
> #define WX_RDB_RSSRK(_i) (0x19480 + ((_i) * 4))
> #define WX_RDB_RA_CTL 0x194F4
> +#define WX_RDB_RA_CTL_MULTI_RSS BIT(0)
> #define WX_RDB_RA_CTL_RSS_EN BIT(2) /* RSS Enable */
> #define WX_RDB_RA_CTL_RSS_IPV4_TCP BIT(16)
> #define WX_RDB_RA_CTL_RSS_IPV4 BIT(17)
...
> @@ -1192,6 +1199,16 @@ struct vf_macvlans {
> u8 vf_macvlan[ETH_ALEN];
> };
>
> +#define WX_RSS_FIELD_SHIFT 16
> +#define WX_RSS_FIELD_IPV4_TCP BIT(0)
> +#define WX_RSS_FIELD_IPV4 BIT(1)
> +#define WX_RSS_FIELD_IPV4_SCTP BIT(2)
> +#define WX_RSS_FIELD_IPV6_SCTP BIT(3)
> +#define WX_RSS_FIELD_IPV6_TCP BIT(4)
> +#define WX_RSS_FIELD_IPV6 BIT(5)
> +#define WX_RSS_FIELD_IPV4_UDP BIT(6)
> +#define WX_RSS_FIELD_IPV6_UDP BIT(7)
> +
> enum wx_pf_flags {
> WX_FLAG_MULTI_64_FUNC,
> WX_FLAG_SWFW_RING,
...
Powered by blists - more mailing lists