[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200114101949.GB22304@unicorn.suse.cz>
Date: Tue, 14 Jan 2020 11:19:49 +0100
From: Michal Kubecek <mkubecek@...e.cz>
To: netdev@...r.kernel.org
Cc: sunil.kovvuri@...il.com, davem@...emloft.net, kubakici@...pl,
Sunil Goutham <sgoutham@...vell.com>,
Prakash Brahmajyosyula <bprakash@...vell.com>
Subject: Re: [PATCH v2 15/17] octeontx2-pf: ethtool RSS config support
On Tue, Jan 14, 2020 at 12:32:18PM +0530, sunil.kovvuri@...il.com wrote:
> From: Sunil Goutham <sgoutham@...vell.com>
>
> Added support to show or configure RSS hash key, indirection table,
> 2,4 tuple via ethtool. Also added debug msg_level support
> to dump messages when HW reports errors in packet received
> or transmitted.
>
> Signed-off-by: Prakash Brahmajyosyula <bprakash@...vell.com>
> Signed-off-by: Sunil Goutham <sgoutham@...vell.com>
> ---
[...]
> +static int otx2_set_rss_hash_opts(struct otx2_nic *pfvf,
> + struct ethtool_rxnfc *nfc)
> +{
> + struct otx2_rss_info *rss = &pfvf->hw.rss_info;
> + u32 rxh_l4 = RXH_L4_B_0_1 | RXH_L4_B_2_3;
> + u32 rss_cfg = rss->flowkey_cfg;
> +
> + if (!rss->enable)
> + netdev_err(pfvf->netdev, "RSS is disabled, cmd ignored\n");
> +
> + /* Mimimum is IPv4 and IPv6, SIP/DIP */
> + if (!(nfc->data & RXH_IP_SRC) || !(nfc->data & RXH_IP_DST))
> + return -EINVAL;
> +
> + switch (nfc->flow_type) {
> + case TCP_V4_FLOW:
> + case TCP_V6_FLOW:
> + /* Different config for v4 and v6 is not supported.
> + * Both of them have to be either 4-tuple or 2-tuple.
> + */
> + if ((nfc->data & rxh_l4) == rxh_l4)
> + rss_cfg |= NIX_FLOW_KEY_TYPE_TCP;
> + else
> + rss_cfg &= ~NIX_FLOW_KEY_TYPE_TCP;
> + break;
IMHO it would be cleaner to reject requests with only one bit set than
to silently clear the bit (same for UDP and SCTP). You also shouldn't
silently ignore unsupported bits.
Michal Kubecek
> + case UDP_V4_FLOW:
> + case UDP_V6_FLOW:
> + if ((nfc->data & rxh_l4) == rxh_l4)
> + rss_cfg |= NIX_FLOW_KEY_TYPE_UDP;
> + else
> + rss_cfg &= ~NIX_FLOW_KEY_TYPE_UDP;
> + break;
> + case SCTP_V4_FLOW:
> + case SCTP_V6_FLOW:
> + if ((nfc->data & rxh_l4) == rxh_l4)
> + rss_cfg |= NIX_FLOW_KEY_TYPE_SCTP;
> + else
> + rss_cfg &= ~NIX_FLOW_KEY_TYPE_SCTP;
> + break;
> + case AH_ESP_V4_FLOW:
> + case AH_V4_FLOW:
> + case ESP_V4_FLOW:
> + case IPV4_FLOW:
> + case AH_ESP_V6_FLOW:
> + case AH_V6_FLOW:
> + case ESP_V6_FLOW:
> + case IPV6_FLOW:
> + rss_cfg = NIX_FLOW_KEY_TYPE_IPV4 | NIX_FLOW_KEY_TYPE_IPV6;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + rss->flowkey_cfg = rss_cfg;
> + otx2_set_flowkey_cfg(pfvf);
> + return 0;
> +}
Powered by blists - more mailing lists