From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8573FA2EDB for ; Tue, 1 Oct 2019 16:49:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3FEBA4CA6; Tue, 1 Oct 2019 16:49:31 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 2206B271 for ; Tue, 1 Oct 2019 16:49:29 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 5506EB40083; Tue, 1 Oct 2019 14:49:27 +0000 (UTC) Received: from [192.168.38.17] (91.220.146.112) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 1 Oct 2019 15:49:21 +0100 To: Simei Su , , , CC: References: <1569740956-69634-1-git-send-email-simei.su@intel.com> <1569940564-311988-1-git-send-email-simei.su@intel.com> <1569940564-311988-3-git-send-email-simei.su@intel.com> From: Andrew Rybchenko Message-ID: <155d1d0d-c5cd-2fc1-ad48-345d219bd02f@solarflare.com> Date: Tue, 1 Oct 2019 17:49:18 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <1569940564-311988-3-git-send-email-simei.su@intel.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-Originating-IP: [91.220.146.112] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24946.003 X-TM-AS-Result: No-10.558700-8.000000-10 X-TMASE-MatchedRID: X4bcv0S75KnmLzc6AOD8DfHkpkyUphL9APiR4btCEeaXbcZfsC7t1C1E Xi73WJBa/xTu/qITlN028sDkxWLWkh6/+Ev3guYHLbjXqdzdtCU/pOSL72dTfwdkFovAReUoaUX s6FguVy1C0EhxBzOYZfm0WOwkfNqKhhfYkJEXQ2z0VCHd+VQiHr/IV1MEmPQjNuBgLEhhaDaYpu G7kpoKR2GLgsB2Jf/Ha282GU2SPAYL0ciyC2MjCRo8wYJxWb0O3V4UShoTXadlmPP/XnGELvBUq 5JsuvxSKklmBHiUEmiVN6RurGl/h+JVhWVfaXeS5venhychcY1/9Mg6o+wMi8OtrkhuZC9Wa1IK 9oKRrbThNoChA1M9WFuSVewUWUqGpUizOemgJpieAiCmPx4NwFkMvWAuahr8+gD2vYtOFhgqtq5 d3cxkNR4XqXjQcxDhml2bdO5uKx1ZQ7t4/OiS3Sh4DRp1aDQhM7guCoxdSLw= X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--10.558700-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24946.003 X-MDID: 1569941368-Rj6SfPOdJRrS Subject: Re: [dpdk-dev] [PATCH v8 2/3] ethdev: extend RSS offload types X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 10/1/19 5:36 PM, Simei Su wrote: > This patch reserves several bits as input set selection from the > high end of the 64 bits. It is combined with exisiting ETH_RSS_* > to represent RSS types. > > Signed-off-by: Simei Su > Reviewed-by: Qi Zhang > Acked-by: Ori Kam > --- > lib/librte_ethdev/rte_ethdev.c | 22 ++++++++++++++++++++++ > lib/librte_ethdev/rte_ethdev.h | 14 ++++++++++++++ > 2 files changed, 36 insertions(+) > > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c > index af82360..5e5a974 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -1269,6 +1269,17 @@ struct rte_eth_dev * > goto rollback; > } > > + /* simplified the SRC/DST_ONLY RSS offload modificaiton */ > + if (dev_conf->rx_adv_conf.rss_conf.rss_hf & ETH_RSS_L3_SRC_ONLY && > + dev_conf->rx_adv_conf.rss_conf.rss_hf & ETH_RSS_L3_DST_ONLY) I'm afraid some compiler versions could bark about missing parenthesis here. Consider to use something like:  (rss_conf->rss_hf & (ETH_RSS_L3_SRC_ONLY | ETH_RSS_L3_DST_ONLY) ==   (ETH_RSS_L3_SRC_ONLY | ETH_RSS_L3_DST_ONLY)) May be parenthesis around & is not required. > + dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf &= > + ~(ETH_RSS_L3_SRC_ONLY | ETH_RSS_L3_DST_ONLY); > + > + if (dev_conf->rx_adv_conf.rss_conf.rss_hf & ETH_RSS_L4_SRC_ONLY && > + dev_conf->rx_adv_conf.rss_conf.rss_hf & ETH_RSS_L4_DST_ONLY) > + dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf &= > + ~(ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY); > + I think it is wrong to duplicate the logic twice (here and below). Helper static function should be used to avoid it. > /* Check that device supports requested rss hash functions. */ > if ((dev_info.flow_type_rss_offloads | > dev_conf->rx_adv_conf.rss_conf.rss_hf) != > @@ -3112,6 +3123,17 @@ struct rte_eth_dev * > if (ret != 0) > return ret; > > + /* simplified the SRC/DST_ONLY RSS offload modificaiton */ > + if (rss_conf->rss_hf & ETH_RSS_L3_SRC_ONLY && > + rss_conf->rss_hf & ETH_RSS_L3_DST_ONLY) > + rss_conf->rss_hf &= > + ~(ETH_RSS_L3_SRC_ONLY | ETH_RSS_L3_DST_ONLY); > + > + if (rss_conf->rss_hf & ETH_RSS_L4_SRC_ONLY && > + rss_conf->rss_hf & ETH_RSS_L4_DST_ONLY) > + rss_conf->rss_hf &= > + ~(ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY); > + > dev = &rte_eth_devices[port_id]; > if ((dev_info.flow_type_rss_offloads | rss_conf->rss_hf) != > dev_info.flow_type_rss_offloads) { > diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h > index 7722f70..6d61b84 100644 > --- a/lib/librte_ethdev/rte_ethdev.h > +++ b/lib/librte_ethdev/rte_ethdev.h > @@ -505,6 +505,20 @@ struct rte_eth_rss_conf { > #define ETH_RSS_GENEVE (1ULL << 20) > #define ETH_RSS_NVGRE (1ULL << 21) > > +/* > + * We use the following macros to combine with above ETH_RSS_* for > + * more specific input set selection. These bits are defined starting > + * from the high end of the 64 bits. > + * Note: If we use above ETH_RSS_* without SRC/DST_ONLY, it represents > + * both SRC and DST are taken into account. If SRC_ONLY and DST_ONLY of > + * the same level be used simultaneously, it is the same case as none of > + * them are added. > + */ > +#define ETH_RSS_L3_SRC_ONLY (1ULL << 63) > +#define ETH_RSS_L3_DST_ONLY (1ULL << 62) > +#define ETH_RSS_L4_SRC_ONLY (1ULL << 61) > +#define ETH_RSS_L4_DST_ONLY (1ULL << 60) > + > #define ETH_RSS_IP ( \ > ETH_RSS_IPV4 | \ > ETH_RSS_FRAG_IPV4 | \