[v1,1/1] linux-gen: dpdk: conf NICs to drop packets if no descriptors are available

Message ID 1518019212-31901-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • linux-gen: dpdk: conf NICs to drop packets if no descriptors are available
Related show

Commit Message

Github ODP bot Feb. 7, 2018, 4 p.m.
From: Matias Elo <matias.elo@nokia.com>


Configure DPDK NIC RX rings to automatically drop packets if no free
descriptors are available. Without this option being set, some NICs (e.g.
82599, X540) will stop receiving packets from all RX queues if any of the
RX queues is not emptied fast enough.

Fixes: https://bugs.linaro.org/show_bug.cgi?id=3618

Signed-off-by: Matias Elo <matias.elo@nokia.com>

---
/** Email created from pull request 458 (matiaselo:fix/dpdk_packet_drop)
 ** https://github.com/Linaro/odp/pull/458
 ** Patch: https://github.com/Linaro/odp/pull/458.patch
 ** Base sha: 257b08b35ceea41bad5a7f1c626496cf111e657a
 ** Merge commit sha: d0b6e7a51636a0f492165a13e3cc8b14b7440604
 **/
 platform/linux-generic/pktio/dpdk.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch

diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c
index bd6920e6a..53ddf2fc1 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -1402,6 +1402,8 @@  static int dpdk_open(odp_pktio_t id ODP_UNUSED,
 
 static int dpdk_start(pktio_entry_t *pktio_entry)
 {
+	struct rte_eth_dev_info dev_info;
+	struct rte_eth_rxconf *rxconf;
 	pkt_dpdk_t *pkt_dpdk = &pktio_entry->s.pkt_dpdk;
 	uint8_t port_id = pkt_dpdk->port_id;
 	int ret;
@@ -1420,7 +1422,6 @@  static int dpdk_start(pktio_entry_t *pktio_entry)
 	}
 	/* Init TX queues */
 	for (i = 0; i < pktio_entry->s.num_out_queue; i++) {
-		struct rte_eth_dev_info dev_info;
 		const struct rte_eth_txconf *txconf = NULL;
 		int ip_ena  = pktio_entry->s.config.pktout.bit.ipv4_chksum_ena;
 		int udp_ena = pktio_entry->s.config.pktout.bit.udp_chksum_ena;
@@ -1469,10 +1470,13 @@  static int dpdk_start(pktio_entry_t *pktio_entry)
 		}
 	}
 	/* Init RX queues */
+	rte_eth_dev_info_get(port_id, &dev_info);
+	rxconf = &dev_info.default_rxconf;
+	rxconf->rx_drop_en = 1;
 	for (i = 0; i < pktio_entry->s.num_in_queue; i++) {
 		ret = rte_eth_rx_queue_setup(port_id, i, DPDK_NM_RX_DESC,
 					     rte_eth_dev_socket_id(port_id),
-					     NULL, pkt_dpdk->pkt_pool);
+					     rxconf, pkt_dpdk->pkt_pool);
 		if (ret < 0) {
 			ODP_ERR("Queue setup failed: err=%d, port=%" PRIu8 "\n",
 				ret, port_id);