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 479F8A2EFC for ; Tue, 15 Oct 2019 15:08:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1D2BC1E996; Tue, 15 Oct 2019 15:08:13 +0200 (CEST) Received: from dispatchb-us1.ppe-hosted.com (dispatchb-us1.ppe-hosted.com [148.163.129.53]) by dpdk.org (Postfix) with ESMTP id 4E3C51E990 for ; Tue, 15 Oct 2019 15:08:11 +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-us5.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 961CC800075; Tue, 15 Oct 2019 13:08:09 +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, 15 Oct 2019 14:08:03 +0100 To: Simei Su , , , CC: References: <1571060169-311974-1-git-send-email-simei.su@intel.com> <1571144219-208697-1-git-send-email-simei.su@intel.com> <1571144219-208697-3-git-send-email-simei.su@intel.com> From: Andrew Rybchenko Message-ID: <99258e77-ff1e-aaea-c34a-437f8c332b6f@solarflare.com> Date: Tue, 15 Oct 2019 16:07:59 +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: <1571144219-208697-3-git-send-email-simei.su@intel.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit 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-24978.003 X-TM-AS-Result: No-7.213200-8.000000-10 X-TMASE-MatchedRID: u7Yf2n7Ca/3mLzc6AOD8DfHkpkyUphL9APiR4btCEeaXbcZfsC7t1C1E Xi73WJBa/xTu/qITlN028sDkxWLWknD1AgDzNq7tPaBTJyy84wVp4xorO9dSmQaYevV4zG3ZQBz oPKhLashO9UxJ8vboSYMbgi+POklc19DsBT1i13i0pHkVd9vKzFjWwaUPviNZV8ukjx868O5FAP lc4VGMQs7w9dYcCDW5w8jKYX5YfIK4hnMwfpFZA8zSKGx9g8xh/qWl+m17jWGnk8VVpU1FNsuOq s00obe3lpKpNiL4Llp1AygnTRz9rsLTgNYPIB+FngIgpj8eDcC063Wh9WVqgtQdB5NUNSsi1GcR AJRT6POOhzOa6g8KrT+xicmd+h/0F5lZjpwm8eVLqdx5nM5ENfOhRXuDkSIrUxTuZUqLJEOM+kv 5gKyIomy1MyQnxBVOW7SR+j+/M4YBGNOEKqIvkuL59MzH0po2K2yzo9Rrj9wPoYC35RuihKPUI7 hfQSp5eCBcUCG1aJiUTGVAhB5EbQ== X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--7.213200-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24978.003 X-MDID: 1571144890-AgM4X4Z689KN Subject: Re: [dpdk-dev] [PATCH v13 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/15/19 3:56 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. This patch also checks the simultaneous > use of SRC_ONLY and DST_ONLY of the same level. > > Signed-off-by: Simei Su > Reviewed-by: Qi Zhang > Acked-by: Ori Kam One nit below Reviewed-by: Andrew Rybchenko > --- > lib/librte_ethdev/rte_ethdev.c | 5 +++++ > lib/librte_ethdev/rte_ethdev.h | 35 +++++++++++++++++++++++++++++++++++ > 2 files changed, 40 insertions(+) > > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c > index 7caaa0b..3f989df 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -1269,6 +1269,9 @@ struct rte_eth_dev * > goto rollback; > } > > + dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf = > + rte_eth_rss_hf_refine(dev_conf->rx_adv_conf.rss_conf.rss_hf); > + > /* 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 +3115,8 @@ struct rte_eth_dev * > if (ret != 0) > return ret; > > + rss_conf->rss_hf = rte_eth_rss_hf_refine(rss_conf->rss_hf); > + > 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 40aa6a3..57fe78b 100644 > --- a/lib/librte_ethdev/rte_ethdev.h > +++ b/lib/librte_ethdev/rte_ethdev.h > @@ -507,6 +507,20 @@ struct rte_eth_rss_conf { > #define ETH_RSS_NVGRE (1ULL << 21) > #define ETH_RSS_GTPU (1ULL << 23) > > +/* > + * 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 are 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 | \ > @@ -4036,6 +4050,27 @@ int rte_eth_dev_adjust_nb_rx_tx_desc(uint16_t port_id, > void * > rte_eth_dev_get_sec_ctx(uint16_t port_id); > > +/** > + * For input set change of hash filter, if SRC_ONLY and DST_ONLY of > + * the same level are used simultaneously, it is the same case as > + * none of them are added. > + * > + * @param rss_hf > + * RSS types with SRC/DST_ONLY. > + * @return > + * RSS types. > + */ > +static inline uint64_t > +rte_eth_rss_hf_refine(uint64_t rss_hf) > +{ > + if ((rss_hf & ETH_RSS_L3_SRC_ONLY) && (rss_hf & ETH_RSS_L3_DST_ONLY)) > + rss_hf &= ~(ETH_RSS_L3_SRC_ONLY | ETH_RSS_L3_DST_ONLY); > + > + if ((rss_hf & ETH_RSS_L4_SRC_ONLY) && (rss_hf & ETH_RSS_L4_DST_ONLY)) > + rss_hf &= ~(ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY); > + > + return rss_hf; > +} May I suggest to put the function just after ETH_RSS defines. > #include >