From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-ft2.fr.colt.net (smtp-ft2.fr.colt.net [213.41.78.204]) by dpdk.org (Postfix) with ESMTP id 59450590E for ; Wed, 30 Apr 2014 15:55:30 +0200 (CEST) Received: from smtp-ex3.fr.colt.net (smtp-ex3.fr.colt.net [213.41.78.196]) by smtp-ft2.fr.colt.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id s3UDtTw9030285 for ; Wed, 30 Apr 2014 15:55:29 +0200 Received: from 33.106-14-84.ripe.coltfrance.com ([84.14.106.33] helo=proxy.6wind.com) by smtp-ex3.fr.colt.net with esmtp (Exim) (envelope-from ) id 1WfUyz-0001h6-2i for ; Wed, 30 Apr 2014 15:55:34 +0200 Received: from 6wind.com (unknown [10.16.0.189]) by proxy.6wind.com (Postfix) with SMTP id 6A5A6282F1; Wed, 30 Apr 2014 15:55:32 +0200 (CEST) Received: by 6wind.com (sSMTP sendmail emulation); Wed, 30 Apr 2014 15:55:31 +0200 From: Ivan Boule To: dev@dpdk.org Date: Wed, 30 Apr 2014 15:55:22 +0200 Message-Id: <1398866126-16931-2-git-send-email-ivan.boule@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1398866126-16931-1-git-send-email-ivan.boule@6wind.com> References: <1398866126-16931-1-git-send-email-ivan.boule@6wind.com> X-ACL-Warn: 1/1 recipients OK. Subject: [dpdk-dev] [PATCH 1/5] ethdev: check RX queue indices in RETA config against number of queues X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Apr 2014 13:55:30 -0000 Each entry of the RSS redirection table (RETA) of igb and ixgbe ports contains a 4-bit RX queue index, thus imposing RSS RX queue indices to be strictly lower than 16. In addition, if a RETA entry is configured with a RX queue index that is strictly lower than 16, but is greater or equal to the number of RX queues of the port, then all input packets whose RSS hash value indexes that RETA entry are silently dropped by the NIC. Make the function rte_eth_dev_rss_reta_update() check that RX queue indices that are supplied in the reta_conf argument are strictly lower than ETH_RSS_RETA_MAX_QUEUE (16) and are strictly lower than the number of RX queues of the port. Signed-off-by: Ivan Boule --- lib/librte_ether/rte_ethdev.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index a5727dd..473c98b 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1501,6 +1501,7 @@ int rte_eth_dev_rss_reta_update(uint8_t port_id, struct rte_eth_rss_reta *reta_conf) { struct rte_eth_dev *dev; + uint16_t max_rxq; uint8_t i,j; if (port_id >= nb_ports) { @@ -1514,10 +1515,13 @@ rte_eth_dev_rss_reta_update(uint8_t port_id, struct rte_eth_rss_reta *reta_conf) return (-EINVAL); } + dev = &rte_eth_devices[port_id]; + max_rxq = (dev->data->nb_rx_queues <= ETH_RSS_RETA_MAX_QUEUE) ? + dev->data->nb_rx_queues : ETH_RSS_RETA_MAX_QUEUE; if (reta_conf->mask_lo != 0) { for (i = 0; i < ETH_RSS_RETA_NUM_ENTRIES/2; i++) { if ((reta_conf->mask_lo & (1ULL << i)) && - (reta_conf->reta[i] >= ETH_RSS_RETA_MAX_QUEUE)) { + (reta_conf->reta[i] >= max_rxq)) { PMD_DEBUG_TRACE("RETA hash index output" "configration for port=%d,invalid" "queue=%d\n",port_id,reta_conf->reta[i]); @@ -1533,7 +1537,7 @@ rte_eth_dev_rss_reta_update(uint8_t port_id, struct rte_eth_rss_reta *reta_conf) /* Check if the max entry >= 128 */ if ((reta_conf->mask_hi & (1ULL << i)) && - (reta_conf->reta[j] >= ETH_RSS_RETA_MAX_QUEUE)) { + (reta_conf->reta[j] >= max_rxq)) { PMD_DEBUG_TRACE("RETA hash index output" "configration for port=%d,invalid" "queue=%d\n",port_id,reta_conf->reta[j]); @@ -1543,8 +1547,6 @@ rte_eth_dev_rss_reta_update(uint8_t port_id, struct rte_eth_rss_reta *reta_conf) } } - dev = &rte_eth_devices[port_id]; - FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_update, -ENOTSUP); return (*dev->dev_ops->reta_update)(dev, reta_conf); } -- 1.7.10.4