[dpdk-dev] [PATCH v1] net/i40e: set no drop for traffic class

Rory Sexton rory.sexton at intel.com
Sun Dec 4 14:54:47 CET 2016


From: John McNamara <john.mcnamara at intel.com>

The default traffic class in i40e is set to drop versus on ixgbe
it isset to no drop. This means when packets build up in the RX
SRAM on the NIC, they are dropped, and they do this when the SW
descriptor rings fill up.

This patch changes this behaviour and our testing shows there
are no drops as a result.

Signed-off-by: Rory Sexton <rory.sexton at intel.com>
Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic at intel.com>
---
 drivers/net/i40e/i40e_ethdev.c |  1 +
 drivers/net/i40e/i40e_rxtx.c   | 12 ++++++++++++
 drivers/net/i40e/i40e_rxtx.h   |  1 +
 lib/librte_ether/rte_ethdev.h  | 24 ++++++++++++++++++++++++
 4 files changed, 38 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 67778ba..9702acb 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -553,6 +553,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.get_eeprom                   = i40e_get_eeprom,
 	.mac_addr_set                 = i40e_set_default_mac_addr,
 	.mtu_set                      = i40e_dev_mtu_set,
+	.set_no_drop		      = i40e_set_no_drop,
 };
 
 /* store statistics names and its offset in stats structure */
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 7ae7d9f..02aeff4 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -783,6 +783,18 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 	return nb_rx;
 }
 
+uint32_t
+i40e_set_no_drop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+{
+	struct i40e_rx_queue *rxq = dev->data->rx_queues[rx_queue_id];
+	struct i40e_hw *hw = I40E_VSI_TO_HW(rxq->vsi);
+
+	/* Set No Drop Traffic Class. */
+	I40E_WRITE_REG(hw, 0x1c0980, 0xff);
+
+	return 1;
+}
+
 uint16_t
 i40e_recv_scattered_pkts(void *rx_queue,
 			 struct rte_mbuf **rx_pkts,
diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h
index ecdb13c..47720e5 100644
--- a/drivers/net/i40e/i40e_rxtx.h
+++ b/drivers/net/i40e/i40e_rxtx.h
@@ -196,6 +196,7 @@ union i40e_tx_offload {
 	};
 };
 
+uint32_t i40e_set_no_drop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int i40e_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int i40e_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int i40e_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 9678179..a862101 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1113,6 +1113,10 @@ typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,
 				    uint16_t queue_id);
 /**< @internal Start rx and tx of a queue of an Ethernet device. */
 
+typedef uint32_t (*set_no_drop)(struct rte_eth_dev *dev,
+					uint16_t queue_id);
+/**< @internal Ethernet device configuration. */
+
 typedef int (*eth_queue_stop_t)(struct rte_eth_dev *dev,
 				    uint16_t queue_id);
 /**< @internal Stop rx and tx of a queue of an Ethernet device. */
@@ -1547,6 +1551,8 @@ struct eth_dev_ops {
 	eth_l2_tunnel_eth_type_conf_t l2_tunnel_eth_type_conf;
 	/** Enable/disable l2 tunnel offload functions */
 	eth_l2_tunnel_offload_set_t l2_tunnel_offload_set;
+	/** Read NIC SRAM .*/
+	set_no_drop set_no_drop;
 };
 
 /**
@@ -2730,6 +2736,24 @@ rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)
 }
 
 /**
+ * Sets port to no drop.
+ *
+ * @param port_id
+ *  The port identifier of the Ethernet device.
+ *
+ * @return
+ *  Nic occupancy in kilobytes.
+ */
+static inline uint32_t
+set_no_drop_tc(uint8_t port_id)
+{
+	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	uint32_t limit = (*dev->dev_ops->set_no_drop)(dev, 0);
+
+	return limit;
+}
+
+/**
  * Send a burst of output packets on a transmit queue of an Ethernet device.
  *
  * The rte_eth_tx_burst() function is invoked to transmit output packets
-- 
2.7.4

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.



More information about the dev mailing list