From patchwork Sat Mar 10 22:48:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Lakkireddy X-Patchwork-Id: 35952 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 63A4AAAD9; Sat, 10 Mar 2018 23:50:00 +0100 (CET) Received: from stargate.chelsio.com (stargate.chelsio.com [12.32.117.8]) by dpdk.org (Postfix) with ESMTP id F12ADAAD9 for ; Sat, 10 Mar 2018 23:49:58 +0100 (CET) Received: from localhost (scalar.blr.asicdesigners.com [10.193.185.94]) by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id w2AMnsVu014074; Sat, 10 Mar 2018 14:49:55 -0800 From: Rahul Lakkireddy To: dev@dpdk.org Cc: kumaras@chelsio.com, nirranjan@chelsio.com, indranil@chelsio.com Date: Sun, 11 Mar 2018 04:18:29 +0530 Message-Id: <4d1616b2f7dd81859b3c88d974c2ab8aade396b1.1520720053.git.rahul.lakkireddy@chelsio.com> X-Mailer: git-send-email 2.5.3 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 11/13] cxgbe: export supported RSS hash functions 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" Export supported RSS hash functions in device info. Also add check to prevent configuring unsupported RSS hash functions. Fixes: 58c5a23c1c4f ("net/cxgbe: support updating RSS hash configuration and key") Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/cxgbe.h | 5 +++++ drivers/net/cxgbe/cxgbe_ethdev.c | 1 + drivers/net/cxgbe/cxgbe_main.c | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/cxgbe/cxgbe.h b/drivers/net/cxgbe/cxgbe.h index da8bdd03c..9438239bc 100644 --- a/drivers/net/cxgbe/cxgbe.h +++ b/drivers/net/cxgbe/cxgbe.h @@ -47,6 +47,11 @@ #define CXGBE_MAX_RX_PKTLEN (9000 + ETHER_HDR_LEN + ETHER_CRC_LEN) /* max pkt */ #define CXGBE_DEFAULT_RSS_KEY_LEN 40 /* 320-bits */ +#define CXGBE_RSS_HF_ALL (ETH_RSS_IPV4 | ETH_RSS_IPV6 | \ + ETH_RSS_NONFRAG_IPV4_TCP | \ + ETH_RSS_NONFRAG_IPV4_UDP | \ + ETH_RSS_NONFRAG_IPV6_TCP | \ + ETH_RSS_NONFRAG_IPV6_UDP) int cxgbe_probe(struct adapter *adapter); int cxgbevf_probe(struct adapter *adapter); diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index fdea65ba6..2610d62ef 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -173,6 +173,7 @@ void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev, device_info->reta_size = pi->rss_size; device_info->hash_key_size = CXGBE_DEFAULT_RSS_KEY_LEN; + device_info->flow_type_rss_offloads = CXGBE_RSS_HF_ALL; device_info->rx_desc_lim = cxgbe_desc_lim; device_info->tx_desc_lim = cxgbe_desc_lim; diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index b3b2b006a..138e1c159 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -365,7 +365,7 @@ int init_rss(struct adapter *adap) if (!pi->rss) return -ENOMEM; - pi->rss_hf = ETH_RSS_TCP | ETH_RSS_UDP; + pi->rss_hf = CXGBE_RSS_HF_ALL; } return 0; } @@ -957,6 +957,10 @@ int cxgbe_write_rss_conf(const struct port_info *pi, uint64_t rss_hf) return -EINVAL; } + /* Don't allow unsupported hash functions */ + if (rss_hf & ~CXGBE_RSS_HF_ALL) + return -EINVAL; + if (rss_hf & ETH_RSS_IPV4) flags |= F_FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN;