DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD
@ 2015-10-02 11:16 Rahul Lakkireddy
  2015-10-02 11:16 ` [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G Rahul Lakkireddy
                   ` (6 more replies)
  0 siblings, 7 replies; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-02 11:16 UTC (permalink / raw)
  To: dev; +Cc: Kumar Sanghvi, Felix Marti, Nirranjan Kirubaharan

This series of patches improve forwarding performance for Chelsio T5 40GbE
cards and add Jumbo Frame support for cxgbe pmd. Also update documentation
and release notes.

Rahul Lakkireddy (6):
  cxgbe: Optimize forwarding performance for 40G
  cxgbe: Update device info and perform sanity checks to enable jumbo
    frames
  cxgbe: Update tx path to transmit jumbo frames
  cxgbe: Update rx path to receive jumbo frames
  cxgbe: Allow apps to change mtu
  doc: Update cxgbe documentation and release notes

 doc/guides/nics/cxgbe.rst            |  81 ++++++++++++-----
 doc/guides/rel_notes/release_2_2.rst |   5 +
 drivers/net/cxgbe/base/t4_regs.h     |  16 ++++
 drivers/net/cxgbe/cxgbe.h            |   3 +
 drivers/net/cxgbe/cxgbe_ethdev.c     |  52 ++++++++++-
 drivers/net/cxgbe/cxgbe_main.c       |  10 +-
 drivers/net/cxgbe/sge.c              | 171 ++++++++++++++++++++++++++---------
 7 files changed, 268 insertions(+), 70 deletions(-)

-- 
2.5.3

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G
  2015-10-02 11:16 [dpdk-dev] [PATCH 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
@ 2015-10-02 11:16 ` Rahul Lakkireddy
  2015-10-02 21:48   ` Aaron Conole
  2015-10-02 11:16 ` [dpdk-dev] [PATCH 2/6] cxgbe: Update device info and perform sanity checks to enable jumbo frames Rahul Lakkireddy
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-02 11:16 UTC (permalink / raw)
  To: dev; +Cc: Kumar Sanghvi, Felix Marti, Nirranjan Kirubaharan

Update sge initialization with respect to free-list manager configuration
and ingress arbiter. Also update refill logic to refill mbufs only after
a certain threshold for rx.  Optimize tx packet prefetch and free.

Approx. 4 MPPS improvement seen in forwarding performance after the
optimization.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
 drivers/net/cxgbe/base/t4_regs.h | 16 ++++++++++++++++
 drivers/net/cxgbe/cxgbe_main.c   |  7 +++++++
 drivers/net/cxgbe/sge.c          | 17 ++++++++++++-----
 3 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/drivers/net/cxgbe/base/t4_regs.h b/drivers/net/cxgbe/base/t4_regs.h
index cd28b59..9057e40 100644
--- a/drivers/net/cxgbe/base/t4_regs.h
+++ b/drivers/net/cxgbe/base/t4_regs.h
@@ -266,6 +266,18 @@
 #define A_SGE_FL_BUFFER_SIZE2 0x104c
 #define A_SGE_FL_BUFFER_SIZE3 0x1050
 
+#define A_SGE_FLM_CFG 0x1090
+
+#define S_CREDITCNT    4
+#define M_CREDITCNT    0x3U
+#define V_CREDITCNT(x) ((x) << S_CREDITCNT)
+#define G_CREDITCNT(x) (((x) >> S_CREDITCNT) & M_CREDITCNT)
+
+#define S_CREDITCNTPACKING    2
+#define M_CREDITCNTPACKING    0x3U
+#define V_CREDITCNTPACKING(x) ((x) << S_CREDITCNTPACKING)
+#define G_CREDITCNTPACKING(x) (((x) >> S_CREDITCNTPACKING) & M_CREDITCNTPACKING)
+
 #define A_SGE_CONM_CTRL 0x1094
 
 #define S_EGRTHRESHOLD    8
@@ -361,6 +373,10 @@
 
 #define A_SGE_CONTROL2 0x1124
 
+#define S_IDMAARBROUNDROBIN    19
+#define V_IDMAARBROUNDROBIN(x) ((x) << S_IDMAARBROUNDROBIN)
+#define F_IDMAARBROUNDROBIN    V_IDMAARBROUNDROBIN(1U)
+
 #define S_INGPACKBOUNDARY    16
 #define M_INGPACKBOUNDARY    0x7U
 #define V_INGPACKBOUNDARY(x) ((x) << S_INGPACKBOUNDARY)
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 3755444..316b87d 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -422,6 +422,13 @@ static int adap_init0_tweaks(struct adapter *adapter)
 	t4_set_reg_field(adapter, A_SGE_CONTROL, V_PKTSHIFT(M_PKTSHIFT),
 			 V_PKTSHIFT(rx_dma_offset));
 
+	t4_set_reg_field(adapter, A_SGE_FLM_CFG,
+			 V_CREDITCNT(M_CREDITCNT) | M_CREDITCNTPACKING,
+			 V_CREDITCNT(3) | V_CREDITCNTPACKING(1));
+
+	t4_set_reg_field(adapter, A_SGE_CONTROL2, V_IDMAARBROUNDROBIN(1U),
+			 V_IDMAARBROUNDROBIN(1U));
+
 	/*
 	 * Don't include the "IP Pseudo Header" in CPL_RX_PKT checksums: Linux
 	 * adds the pseudo header itself.
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index 6eb1244..e540881 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -286,8 +286,7 @@ static void unmap_rx_buf(struct sge_fl *q)
 
 static inline void ring_fl_db(struct adapter *adap, struct sge_fl *q)
 {
-	/* see if we have exceeded q->size / 4 */
-	if (q->pend_cred >= (q->size / 4)) {
+	if (q->pend_cred >= 64) {
 		u32 val = adap->params.arch.sge_fl_db;
 
 		if (is_t4(adap->params.chip))
@@ -995,7 +994,14 @@ static inline int tx_do_packet_coalesce(struct sge_eth_txq *txq,
 			int i;
 
 			for (i = 0; i < sd->coalesce.idx; i++) {
-				rte_pktmbuf_free(sd->coalesce.mbuf[i]);
+				struct rte_mbuf *tmp = sd->coalesce.mbuf[i];
+
+				do {
+					struct rte_mbuf *next = tmp->next;
+
+					rte_pktmbuf_free_seg(tmp);
+					tmp = next;
+				} while (tmp);
 				sd->coalesce.mbuf[i] = NULL;
 			}
 		}
@@ -1054,7 +1060,6 @@ out_free:
 		return 0;
 	}
 
-	rte_prefetch0(&((&txq->q)->sdesc->mbuf->pool));
 	pi = (struct port_info *)txq->eth_dev->data->dev_private;
 	adap = pi->adapter;
 
@@ -1070,6 +1075,7 @@ out_free:
 				txq->stats.mapping_err++;
 				goto out_free;
 			}
+			rte_prefetch0((volatile void *)addr);
 			return tx_do_packet_coalesce(txq, mbuf, cflits, adap,
 						     pi, addr);
 		} else {
@@ -1454,7 +1460,8 @@ static int process_responses(struct sge_rspq *q, int budget,
 			unsigned int params;
 			u32 val;
 
-			__refill_fl(q->adapter, &rxq->fl);
+			if (fl_cap(&rxq->fl) - rxq->fl.avail >= 64)
+				__refill_fl(q->adapter, &rxq->fl);
 			params = V_QINTR_TIMER_IDX(X_TIMERREG_UPDATE_CIDX);
 			q->next_intr_params = params;
 			val = V_CIDXINC(cidx_inc) | V_SEINTARM(params);
-- 
2.5.3

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [dpdk-dev] [PATCH 2/6] cxgbe: Update device info and perform sanity checks to enable jumbo frames
  2015-10-02 11:16 [dpdk-dev] [PATCH 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
  2015-10-02 11:16 ` [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G Rahul Lakkireddy
@ 2015-10-02 11:16 ` Rahul Lakkireddy
  2015-10-02 11:16 ` [dpdk-dev] [PATCH 3/6] cxgbe: Update tx path to transmit " Rahul Lakkireddy
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-02 11:16 UTC (permalink / raw)
  To: dev; +Cc: Kumar Sanghvi, Felix Marti, Nirranjan Kirubaharan

Increase max_rx_pktlen to accommodate jumbo frame size. Perform sanity
checks and enable jumbo mode in rx queue setup. Set link mtu based on
max_rx_pktlen.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
 drivers/net/cxgbe/cxgbe.h        |  3 +++
 drivers/net/cxgbe/cxgbe_ethdev.c | 23 +++++++++++++++++++++--
 drivers/net/cxgbe/cxgbe_main.c   |  3 ++-
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/drivers/net/cxgbe/cxgbe.h b/drivers/net/cxgbe/cxgbe.h
index 97c37d2..adc0d92 100644
--- a/drivers/net/cxgbe/cxgbe.h
+++ b/drivers/net/cxgbe/cxgbe.h
@@ -43,6 +43,9 @@
 #define CXGBE_DEFAULT_TX_DESC_SIZE    1024 /* Default TX ring size */
 #define CXGBE_DEFAULT_RX_DESC_SIZE    1024 /* Default RX ring size */
 
+#define CXGBE_MIN_RX_BUFSIZE ETHER_MIN_MTU /* min buf size */
+#define CXGBE_MAX_RX_PKTLEN (9000 + ETHER_HDR_LEN + ETHER_CRC_LEN) /* max pkt */
+
 int cxgbe_probe(struct adapter *adapter);
 int cxgbe_up(struct adapter *adap);
 int cxgbe_down(struct port_info *pi);
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 478051a..6d7b29c 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -141,8 +141,8 @@ static void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 	struct adapter *adapter = pi->adapter;
 	int max_queues = adapter->sge.max_ethqsets / adapter->params.nports;
 
-	device_info->min_rx_bufsize = 68; /* XXX: Smallest pkt size */
-	device_info->max_rx_pktlen = 1500; /* XXX: For now we support mtu */
+	device_info->min_rx_bufsize = CXGBE_MIN_RX_BUFSIZE;
+	device_info->max_rx_pktlen = CXGBE_MAX_RX_PKTLEN;
 	device_info->max_rx_queues = max_queues;
 	device_info->max_tx_queues = max_queues;
 	device_info->max_mac_addrs = 1;
@@ -498,6 +498,8 @@ static int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	int err = 0;
 	int msi_idx = 0;
 	unsigned int temp_nb_desc;
+	struct rte_eth_dev_info dev_info;
+	unsigned int pkt_len = eth_dev->data->dev_conf.rxmode.max_rx_pkt_len;
 
 	RTE_SET_USED(rx_conf);
 
@@ -505,6 +507,17 @@ static int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 		  __func__, eth_dev->data->nb_rx_queues, queue_idx, nb_desc,
 		  socket_id, mp);
 
+	cxgbe_dev_info_get(eth_dev, &dev_info);
+
+	/* Must accommodate at least ETHER_MIN_MTU */
+	if ((pkt_len < dev_info.min_rx_bufsize) ||
+	    (pkt_len > dev_info.max_rx_pktlen)) {
+		dev_err(adap, "%s: max pkt len must be > %d and <= %d\n",
+			__func__, dev_info.min_rx_bufsize,
+			dev_info.max_rx_pktlen);
+		return -EINVAL;
+	}
+
 	/*  Free up the existing queue  */
 	if (eth_dev->data->rx_queues[queue_idx]) {
 		cxgbe_dev_rx_queue_release(eth_dev->data->rx_queues[queue_idx]);
@@ -534,6 +547,12 @@ static int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	if ((&rxq->fl) != NULL)
 		rxq->fl.size = temp_nb_desc;
 
+	/* Set to jumbo mode if necessary */
+	if (pkt_len > ETHER_MAX_LEN)
+		eth_dev->data->dev_conf.rxmode.jumbo_frame = 1;
+	else
+		eth_dev->data->dev_conf.rxmode.jumbo_frame = 0;
+
 	err = t4_sge_alloc_rxq(adapter, &rxq->rspq, false, eth_dev, msi_idx,
 			       &rxq->fl, t4_ethrx_handler,
 			       t4_get_mps_bg_map(adapter, pi->tx_chan), mp,
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 316b87d..aff23d0 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -855,12 +855,13 @@ int link_start(struct port_info *pi)
 {
 	struct adapter *adapter = pi->adapter;
 	int ret;
+	unsigned int mtu = pi->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len;
 
 	/*
 	 * We do not set address filters and promiscuity here, the stack does
 	 * that step explicitly.
 	 */
-	ret = t4_set_rxmode(adapter, adapter->mbox, pi->viid, 1500, -1, -1,
+	ret = t4_set_rxmode(adapter, adapter->mbox, pi->viid, mtu, -1, -1,
 			    -1, 1, true);
 	if (ret == 0) {
 		ret = t4_change_mac(adapter, adapter->mbox, pi->viid,
-- 
2.5.3

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [dpdk-dev] [PATCH 3/6] cxgbe: Update tx path to transmit jumbo frames
  2015-10-02 11:16 [dpdk-dev] [PATCH 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
  2015-10-02 11:16 ` [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G Rahul Lakkireddy
  2015-10-02 11:16 ` [dpdk-dev] [PATCH 2/6] cxgbe: Update device info and perform sanity checks to enable jumbo frames Rahul Lakkireddy
@ 2015-10-02 11:16 ` Rahul Lakkireddy
  2015-10-02 11:16 ` [dpdk-dev] [PATCH 4/6] cxgbe: Update rx path to receive " Rahul Lakkireddy
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-02 11:16 UTC (permalink / raw)
  To: dev; +Cc: Kumar Sanghvi, Felix Marti, Nirranjan Kirubaharan

Add a non-coalesce path.  Skip coalescing for Jumbo Frames, and send the
packet through non-coalesced path if there are enough credits.  Also,
free these non-coalesced packets while reclaiming credits.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
 drivers/net/cxgbe/sge.c | 96 ++++++++++++++++++++++++++++++++-----------------
 1 file changed, 64 insertions(+), 32 deletions(-)

diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index e540881..921173a 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -199,11 +199,20 @@ static void free_tx_desc(struct sge_txq *q, unsigned int n)
 
 static void reclaim_tx_desc(struct sge_txq *q, unsigned int n)
 {
+	struct tx_sw_desc *d;
 	unsigned int cidx = q->cidx;
 
+	d = &q->sdesc[cidx];
 	while (n--) {
-		if (++cidx == q->size)
+		if (d->mbuf) {                       /* an SGL is present */
+			rte_pktmbuf_free(d->mbuf);
+			d->mbuf = NULL;
+		}
+		++d;
+		if (++cidx == q->size) {
 			cidx = 0;
+			d = q->sdesc;
+		}
 	}
 	q->cidx = cidx;
 }
@@ -1045,6 +1054,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf)
 	u32 wr_mid;
 	u64 cntrl, *end;
 	bool v6;
+	u32 max_pkt_len = txq->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len;
 
 	/* Reject xmit if queue is stopped */
 	if (unlikely(txq->flags & EQ_STOPPED))
@@ -1060,6 +1070,10 @@ out_free:
 		return 0;
 	}
 
+	if ((!(m->ol_flags & PKT_TX_TCP_SEG)) &&
+	    (unlikely(m->pkt_len > max_pkt_len)))
+		goto out_free;
+
 	pi = (struct port_info *)txq->eth_dev->data->dev_private;
 	adap = pi->adapter;
 
@@ -1067,7 +1081,7 @@ out_free:
 	/* align the end of coalesce WR to a 512 byte boundary */
 	txq->q.coalesce.max = (8 - (txq->q.pidx & 7)) * 8;
 
-	if (!(m->ol_flags & PKT_TX_TCP_SEG)) {
+	if (!((m->ol_flags & PKT_TX_TCP_SEG) || (m->pkt_len > ETHER_MAX_LEN))) {
 		if (should_tx_packet_coalesce(txq, mbuf, &cflits, adap)) {
 			if (unlikely(map_mbuf(mbuf, addr) < 0)) {
 				dev_warn(adap, "%s: mapping err for coalesce\n",
@@ -1114,33 +1128,46 @@ out_free:
 
 	len = 0;
 	len += sizeof(*cpl);
-	lso = (void *)(wr + 1);
-	v6 = (m->ol_flags & PKT_TX_IPV6) != 0;
-	l3hdr_len = m->l3_len;
-	l4hdr_len = m->l4_len;
-	eth_xtra_len = m->l2_len - ETHER_HDR_LEN;
-	len += sizeof(*lso);
-	wr->op_immdlen = htonl(V_FW_WR_OP(FW_ETH_TX_PKT_WR) |
-			       V_FW_WR_IMMDLEN(len));
-	lso->lso_ctrl = htonl(V_LSO_OPCODE(CPL_TX_PKT_LSO) |
-			      F_LSO_FIRST_SLICE | F_LSO_LAST_SLICE |
-			      V_LSO_IPV6(v6) |
-			      V_LSO_ETHHDR_LEN(eth_xtra_len / 4) |
-			      V_LSO_IPHDR_LEN(l3hdr_len / 4) |
-			      V_LSO_TCPHDR_LEN(l4hdr_len / 4));
-	lso->ipid_ofst = htons(0);
-	lso->mss = htons(m->tso_segsz);
-	lso->seqno_offset = htonl(0);
-	if (is_t4(adap->params.chip))
-		lso->len = htonl(m->pkt_len);
-	else
-		lso->len = htonl(V_LSO_T5_XFER_SIZE(m->pkt_len));
-	cpl = (void *)(lso + 1);
-	cntrl = V_TXPKT_CSUM_TYPE(v6 ? TX_CSUM_TCPIP6 : TX_CSUM_TCPIP) |
-				  V_TXPKT_IPHDR_LEN(l3hdr_len) |
-				  V_TXPKT_ETHHDR_LEN(eth_xtra_len);
-	txq->stats.tso++;
-	txq->stats.tx_cso += m->tso_segsz;
+
+	/* Coalescing skipped and we send through normal path */
+	if (!(m->ol_flags & PKT_TX_TCP_SEG)) {
+		wr->op_immdlen = htonl(V_FW_WR_OP(FW_ETH_TX_PKT_WR) |
+				       V_FW_WR_IMMDLEN(len));
+		cpl = (void *)(wr + 1);
+		if (m->ol_flags & PKT_TX_IP_CKSUM) {
+			cntrl = hwcsum(adap->params.chip, m) |
+				F_TXPKT_IPCSUM_DIS;
+			txq->stats.tx_cso++;
+		}
+	} else {
+		lso = (void *)(wr + 1);
+		v6 = (m->ol_flags & PKT_TX_IPV6) != 0;
+		l3hdr_len = m->l3_len;
+		l4hdr_len = m->l4_len;
+		eth_xtra_len = m->l2_len - ETHER_HDR_LEN;
+		len += sizeof(*lso);
+		wr->op_immdlen = htonl(V_FW_WR_OP(FW_ETH_TX_PKT_WR) |
+				       V_FW_WR_IMMDLEN(len));
+		lso->lso_ctrl = htonl(V_LSO_OPCODE(CPL_TX_PKT_LSO) |
+				      F_LSO_FIRST_SLICE | F_LSO_LAST_SLICE |
+				      V_LSO_IPV6(v6) |
+				      V_LSO_ETHHDR_LEN(eth_xtra_len / 4) |
+				      V_LSO_IPHDR_LEN(l3hdr_len / 4) |
+				      V_LSO_TCPHDR_LEN(l4hdr_len / 4));
+		lso->ipid_ofst = htons(0);
+		lso->mss = htons(m->tso_segsz);
+		lso->seqno_offset = htonl(0);
+		if (is_t4(adap->params.chip))
+			lso->len = htonl(m->pkt_len);
+		else
+			lso->len = htonl(V_LSO_T5_XFER_SIZE(m->pkt_len));
+		cpl = (void *)(lso + 1);
+		cntrl = V_TXPKT_CSUM_TYPE(v6 ? TX_CSUM_TCPIP6 : TX_CSUM_TCPIP) |
+			V_TXPKT_IPHDR_LEN(l3hdr_len) |
+			V_TXPKT_ETHHDR_LEN(eth_xtra_len);
+		txq->stats.tso++;
+		txq->stats.tx_cso += m->tso_segsz;
+	}
 
 	if (m->ol_flags & PKT_TX_VLAN_PKT) {
 		txq->stats.vlan_ins++;
@@ -1161,9 +1188,14 @@ out_free:
 		last_desc -= txq->q.size;
 
 	d = &txq->q.sdesc[last_desc];
-	if (d->mbuf) {
-		rte_pktmbuf_free(d->mbuf);
-		d->mbuf = NULL;
+	if (d->coalesce.idx) {
+		int i;
+
+		for (i = 0; i < d->coalesce.idx; i++) {
+			rte_pktmbuf_free(d->coalesce.mbuf[i]);
+			d->coalesce.mbuf[i] = NULL;
+		}
+		d->coalesce.idx = 0;
 	}
 	write_sgl(m, &txq->q, (struct ulptx_sgl *)(cpl + 1), end, 0,
 		  addr);
-- 
2.5.3

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [dpdk-dev] [PATCH 4/6] cxgbe: Update rx path to receive jumbo frames
  2015-10-02 11:16 [dpdk-dev] [PATCH 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
                   ` (2 preceding siblings ...)
  2015-10-02 11:16 ` [dpdk-dev] [PATCH 3/6] cxgbe: Update tx path to transmit " Rahul Lakkireddy
@ 2015-10-02 11:16 ` Rahul Lakkireddy
  2015-10-02 11:16 ` [dpdk-dev] [PATCH 5/6] cxgbe: Allow apps to change mtu Rahul Lakkireddy
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-02 11:16 UTC (permalink / raw)
  To: dev; +Cc: Kumar Sanghvi, Felix Marti, Nirranjan Kirubaharan

Ensure jumbo mode is enabled and that the mbuf data room size can
accommodate jumbo size.  If the mbuf data room size can't accommodate
jumbo size, chain mbufs to jumbo size.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
 drivers/net/cxgbe/sge.c | 58 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 53 insertions(+), 5 deletions(-)

diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index 921173a..91ef363 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -247,6 +247,29 @@ static inline bool fl_starving(const struct adapter *adapter,
 	return fl->avail - fl->pend_cred <= s->fl_starve_thres;
 }
 
+static inline unsigned int get_buf_size(struct adapter *adapter,
+					const struct rx_sw_desc *d)
+{
+	unsigned int rx_buf_size_idx = d->dma_addr & RX_BUF_SIZE;
+	unsigned int buf_size = 0;
+
+	switch (rx_buf_size_idx) {
+	case RX_SMALL_MTU_BUF:
+		buf_size = FL_MTU_SMALL_BUFSIZE(adapter);
+		break;
+
+	case RX_LARGE_MTU_BUF:
+		buf_size = FL_MTU_LARGE_BUFSIZE(adapter);
+		break;
+
+	default:
+		BUG_ON(1);
+		/* NOT REACHED */
+	}
+
+	return buf_size;
+}
+
 /**
  * free_rx_bufs - free the Rx buffers on an SGE free list
  * @q: the SGE free list to free buffers from
@@ -362,6 +385,14 @@ static unsigned int refill_fl_usembufs(struct adapter *adap, struct sge_fl *q,
 	unsigned int buf_size_idx = RX_SMALL_MTU_BUF;
 	struct rte_mbuf *buf_bulk[n];
 	int ret, i;
+	struct rte_pktmbuf_pool_private *mbp_priv;
+	u8 jumbo_en = rxq->rspq.eth_dev->data->dev_conf.rxmode.jumbo_frame;
+
+	/* Use jumbo mtu buffers iff mbuf data room size can fit jumbo data. */
+	mbp_priv = rte_mempool_get_priv(rxq->rspq.mb_pool);
+	if (jumbo_en &&
+	    ((mbp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM) >= 9000))
+		buf_size_idx = RX_LARGE_MTU_BUF;
 
 	ret = rte_mempool_get_bulk(rxq->rspq.mb_pool, (void *)buf_bulk, n);
 	if (unlikely(ret != 0)) {
@@ -1439,14 +1470,31 @@ static int process_responses(struct sge_rspq *q, int budget,
 			const struct cpl_rx_pkt *cpl =
 						(const void *)&q->cur_desc[1];
 			bool csum_ok = cpl->csum_calc && !cpl->err_vec;
-			struct rte_mbuf *pkt;
-			u32 len = ntohl(rc->pldbuflen_qid);
+			struct rte_mbuf *pkt, *npkt;
+			u32 len, bufsz;
 
+			len = ntohl(rc->pldbuflen_qid);
 			BUG_ON(!(len & F_RSPD_NEWBUF));
 			pkt = rsd->buf;
-			pkt->data_len = G_RSPD_LEN(len);
-			pkt->pkt_len = pkt->data_len;
-			unmap_rx_buf(&rxq->fl);
+			npkt = pkt;
+			len = G_RSPD_LEN(len);
+			pkt->pkt_len = len;
+
+			/* Chain mbufs into len if necessary */
+			while (len) {
+				struct rte_mbuf *new_pkt = rsd->buf;
+
+				bufsz = min(get_buf_size(q->adapter, rsd), len);
+				new_pkt->data_len = bufsz;
+				unmap_rx_buf(&rxq->fl);
+				len -= bufsz;
+				npkt->next = new_pkt;
+				npkt = new_pkt;
+				pkt->nb_segs++;
+				rsd = &rxq->fl.sdesc[rxq->fl.cidx];
+			}
+			npkt->next = NULL;
+			pkt->nb_segs--;
 
 			if (cpl->l2info & htonl(F_RXF_IP)) {
 				pkt->packet_type = RTE_PTYPE_L3_IPV4;
-- 
2.5.3

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [dpdk-dev] [PATCH 5/6] cxgbe: Allow apps to change mtu
  2015-10-02 11:16 [dpdk-dev] [PATCH 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
                   ` (3 preceding siblings ...)
  2015-10-02 11:16 ` [dpdk-dev] [PATCH 4/6] cxgbe: Update rx path to receive " Rahul Lakkireddy
@ 2015-10-02 11:16 ` Rahul Lakkireddy
  2015-10-02 11:16 ` [dpdk-dev] [PATCH 6/6] doc: Update cxgbe documentation and release notes Rahul Lakkireddy
  2015-10-08 13:46 ` [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
  6 siblings, 0 replies; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-02 11:16 UTC (permalink / raw)
  To: dev; +Cc: Kumar Sanghvi, Felix Marti, Nirranjan Kirubaharan

Add a mtu_set() eth_dev_ops to allow DPDK apps to modify device mtu.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
 drivers/net/cxgbe/cxgbe_ethdev.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 6d7b29c..a8e057b 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -225,6 +225,34 @@ static int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev,
 	return 0;
 }
 
+static int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+	struct rte_eth_dev_info dev_info;
+	int err;
+	uint16_t new_mtu = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+
+	cxgbe_dev_info_get(eth_dev, &dev_info);
+
+	/* Must accommodate at least ETHER_MIN_MTU */
+	if ((new_mtu < ETHER_MIN_MTU) || (new_mtu > dev_info.max_rx_pktlen))
+		return -EINVAL;
+
+	/* set to jumbo mode if needed */
+	if (new_mtu > ETHER_MAX_LEN)
+		eth_dev->data->dev_conf.rxmode.jumbo_frame = 1;
+	else
+		eth_dev->data->dev_conf.rxmode.jumbo_frame = 0;
+
+	err = t4_set_rxmode(adapter, adapter->mbox, pi->viid, new_mtu, -1, -1,
+			    -1, -1, true);
+	if (!err)
+		eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = new_mtu;
+
+	return err;
+}
+
 static int cxgbe_dev_tx_queue_start(struct rte_eth_dev *eth_dev,
 				    uint16_t tx_queue_id);
 static int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev,
@@ -724,6 +752,7 @@ static struct eth_dev_ops cxgbe_eth_dev_ops = {
 	.dev_configure		= cxgbe_dev_configure,
 	.dev_infos_get		= cxgbe_dev_info_get,
 	.link_update		= cxgbe_dev_link_update,
+	.mtu_set		= cxgbe_dev_mtu_set,
 	.tx_queue_setup         = cxgbe_dev_tx_queue_setup,
 	.tx_queue_start		= cxgbe_dev_tx_queue_start,
 	.tx_queue_stop		= cxgbe_dev_tx_queue_stop,
-- 
2.5.3

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [dpdk-dev] [PATCH 6/6] doc: Update cxgbe documentation and release notes
  2015-10-02 11:16 [dpdk-dev] [PATCH 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
                   ` (4 preceding siblings ...)
  2015-10-02 11:16 ` [dpdk-dev] [PATCH 5/6] cxgbe: Allow apps to change mtu Rahul Lakkireddy
@ 2015-10-02 11:16 ` Rahul Lakkireddy
  2015-10-08 13:46 ` [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
  6 siblings, 0 replies; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-02 11:16 UTC (permalink / raw)
  To: dev; +Cc: Kumar Sanghvi, Felix Marti, Nirranjan Kirubaharan

- Add a missed step to mount huge pages in Linux.
- Re-structure Sample Application Notes.
- Add Jumbo Frame support to list of supported features and instructions
  on how to enable it via testpmd.
- Update release notes.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
 doc/guides/nics/cxgbe.rst            | 81 +++++++++++++++++++++++++-----------
 doc/guides/rel_notes/release_2_2.rst |  5 +++
 2 files changed, 61 insertions(+), 25 deletions(-)

diff --git a/doc/guides/nics/cxgbe.rst b/doc/guides/nics/cxgbe.rst
index 148cd25..d718f19 100644
--- a/doc/guides/nics/cxgbe.rst
+++ b/doc/guides/nics/cxgbe.rst
@@ -50,6 +50,7 @@ CXGBE PMD has support for:
 - Promiscuous mode
 - All multicast mode
 - Port hardware statistics
+- Jumbo frames
 
 Limitations
 -----------
@@ -211,8 +212,8 @@ Unified Wire package for Linux operating system are as follows:
 
       firmware-version: 1.13.32.0, TP 0.1.4.8
 
-Sample Application Notes
-~~~~~~~~~~~~~~~~~~~~~~~~
+Running testpmd
+~~~~~~~~~~~~~~~
 
 This section demonstrates how to launch **testpmd** with Chelsio T5
 devices managed by librte_pmd_cxgbe in Linux operating system.
@@ -260,6 +261,13 @@ devices managed by librte_pmd_cxgbe in Linux operating system.
 
       echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages/nr_hugepages
 
+#. Mount huge pages:
+
+   .. code-block:: console
+
+      mkdir /mnt/huge
+      mount -t hugetlbfs nodev /mnt/huge
+
 #. Load igb_uio or vfio-pci driver:
 
    .. code-block:: console
@@ -329,19 +337,7 @@ devices managed by librte_pmd_cxgbe in Linux operating system.
 .. note::
 
    Flow control pause TX/RX is disabled by default and can be enabled via
-   testpmd as follows:
-
-   .. code-block:: console
-
-      testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 0
-      testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 1
-
-   To disable again, use:
-
-   .. code-block:: console
-
-      testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 0
-      testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 1
+   testpmd. Refer section :ref:`flow-control` for more details.
 
 FreeBSD
 -------
@@ -409,8 +405,8 @@ Unified Wire package for FreeBSD operating system are as follows:
 
       dev.t5nex.0.firmware_version: 1.13.32.0
 
-Sample Application Notes
-~~~~~~~~~~~~~~~~~~~~~~~~
+Running testpmd
+~~~~~~~~~~~~~~~
 
 This section demonstrates how to launch **testpmd** with Chelsio T5
 devices managed by librte_pmd_cxgbe in FreeBSD operating system.
@@ -543,16 +539,51 @@ devices managed by librte_pmd_cxgbe in FreeBSD operating system.
 .. note::
 
    Flow control pause TX/RX is disabled by default and can be enabled via
-   testpmd as follows:
+   testpmd. Refer section :ref:`flow-control` for more details.
 
-   .. code-block:: console
+Sample Application Notes
+------------------------
 
-      testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 0
-      testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 1
+.. _flow-control:
 
-   To disable again, use:
+Enable/Disable Flow Control
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-   .. code-block:: console
+Flow control pause TX/RX is disabled by default and can be enabled via
+testpmd as follows:
+
+.. code-block:: console
+
+   testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 0
+   testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 1
+
+To disable again, run:
+
+.. code-block:: console
+
+   testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 0
+   testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 1
+
+Jumbo Mode
+~~~~~~~~~~
+
+There are two ways to enable sending and receiving of jumbo frames via testpmd.
+One method involves using the **mtu** command, which changes the mtu of an
+individual port without having to stop the selected port. Another method
+involves stopping all the ports first and then running **max-pkt-len** command
+to configure the mtu of all the ports with a single command.
+
+- To configure each port individually, run the mtu command as follows:
+
+  .. code-block:: console
+
+     testpmd> port config mtu 0 9000
+     testpmd> port config mtu 1 9000
+
+- To configure all the ports at once, stop all the ports first and run the
+  max-pkt-len command as follows:
+
+  .. code-block:: console
 
-      testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 0
-      testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 1
+     testpmd> port stop all
+     testpmd> port config all max-pkt-len 9000
diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index 5687676..a3f4f77 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -4,6 +4,11 @@ DPDK Release 2.2
 New Features
 ------------
 
+* **Enhanced support for the Chelsio CXGBE driver.**
+
+  *  Added support for Jumbo Frames.
+  *  Optimize forwarding performance for Chelsio T5 40GbE cards.
+
 
 Resolved Issues
 ---------------
-- 
2.5.3

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G
  2015-10-02 11:16 ` [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G Rahul Lakkireddy
@ 2015-10-02 21:48   ` Aaron Conole
  2015-10-05 10:06     ` Rahul Lakkireddy
  0 siblings, 1 reply; 23+ messages in thread
From: Aaron Conole @ 2015-10-02 21:48 UTC (permalink / raw)
  To: Rahul Lakkireddy; +Cc: dev, Felix Marti, Kumar Sanghvi, Nirranjan Kirubaharan

Hi Rahul,

Rahul Lakkireddy <rahul.lakkireddy@chelsio.com> writes:

> Update sge initialization with respect to free-list manager configuration
> and ingress arbiter. Also update refill logic to refill mbufs only after
> a certain threshold for rx.  Optimize tx packet prefetch and free.
<<snip>>
>  			for (i = 0; i < sd->coalesce.idx; i++) {
> -				rte_pktmbuf_free(sd->coalesce.mbuf[i]);
> +				struct rte_mbuf *tmp = sd->coalesce.mbuf[i];
> +
> +				do {
> +					struct rte_mbuf *next = tmp->next;
> +
> +					rte_pktmbuf_free_seg(tmp);
> +					tmp = next;
> +				} while (tmp);
>  				sd->coalesce.mbuf[i] = NULL;
Pardon my ignorance here, but rte_pktmbuf_free does this work. I can't
actually see much difference between your rewrite of this block, and
the implementation of rte_pktmbuf_free() (apart from moving your branch
to the end of the function). Did your microbenchmarking really show this
as an improvement? 

Thanks for your time,
Aaron

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G
  2015-10-02 21:48   ` Aaron Conole
@ 2015-10-05 10:06     ` Rahul Lakkireddy
  2015-10-05 11:46       ` Ananyev, Konstantin
  0 siblings, 1 reply; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-05 10:06 UTC (permalink / raw)
  To: Aaron Conole; +Cc: dev, Felix Marti, Kumar A S, Nirranjan Kirubaharan

Hi Aaron,

On Friday, October 10/02/15, 2015 at 14:48:28 -0700, Aaron Conole wrote:
> Hi Rahul,
> 
> Rahul Lakkireddy <rahul.lakkireddy@chelsio.com> writes:
> 
> > Update sge initialization with respect to free-list manager configuration
> > and ingress arbiter. Also update refill logic to refill mbufs only after
> > a certain threshold for rx.  Optimize tx packet prefetch and free.
> <<snip>>
> >  			for (i = 0; i < sd->coalesce.idx; i++) {
> > -				rte_pktmbuf_free(sd->coalesce.mbuf[i]);
> > +				struct rte_mbuf *tmp = sd->coalesce.mbuf[i];
> > +
> > +				do {
> > +					struct rte_mbuf *next = tmp->next;
> > +
> > +					rte_pktmbuf_free_seg(tmp);
> > +					tmp = next;
> > +				} while (tmp);
> >  				sd->coalesce.mbuf[i] = NULL;
> Pardon my ignorance here, but rte_pktmbuf_free does this work. I can't
> actually see much difference between your rewrite of this block, and
> the implementation of rte_pktmbuf_free() (apart from moving your branch
> to the end of the function). Did your microbenchmarking really show this
> as an improvement? 
> 
> Thanks for your time,
> Aaron

rte_pktmbuf_free calls rte_mbuf_sanity_check which does a lot of
checks.  This additional check seems redundant for single segment
packets since rte_pktmbuf_free_seg also performs rte_mbuf_sanity_check.

Several PMDs already prefer to use rte_pktmbuf_free_seg directly over
rte_pktmbuf_free as it is faster.

The forwarding perf. improvement with only this particular block is
around 1 Mpps for 64B packets when using l3fwd with 8 queues.

Thanks,
Rahul

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G
  2015-10-05 10:06     ` Rahul Lakkireddy
@ 2015-10-05 11:46       ` Ananyev, Konstantin
  2015-10-05 12:42         ` Rahul Lakkireddy
  0 siblings, 1 reply; 23+ messages in thread
From: Ananyev, Konstantin @ 2015-10-05 11:46 UTC (permalink / raw)
  To: Rahul Lakkireddy, Aaron Conole
  Cc: dev, Felix Marti, Nirranjan Kirubaharan, Kumar A S



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Rahul Lakkireddy
> Sent: Monday, October 05, 2015 11:06 AM
> To: Aaron Conole
> Cc: dev@dpdk.org; Felix Marti; Kumar A S; Nirranjan Kirubaharan
> Subject: Re: [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G
> 
> Hi Aaron,
> 
> On Friday, October 10/02/15, 2015 at 14:48:28 -0700, Aaron Conole wrote:
> > Hi Rahul,
> >
> > Rahul Lakkireddy <rahul.lakkireddy@chelsio.com> writes:
> >
> > > Update sge initialization with respect to free-list manager configuration
> > > and ingress arbiter. Also update refill logic to refill mbufs only after
> > > a certain threshold for rx.  Optimize tx packet prefetch and free.
> > <<snip>>
> > >  			for (i = 0; i < sd->coalesce.idx; i++) {
> > > -				rte_pktmbuf_free(sd->coalesce.mbuf[i]);
> > > +				struct rte_mbuf *tmp = sd->coalesce.mbuf[i];
> > > +
> > > +				do {
> > > +					struct rte_mbuf *next = tmp->next;
> > > +
> > > +					rte_pktmbuf_free_seg(tmp);
> > > +					tmp = next;
> > > +				} while (tmp);
> > >  				sd->coalesce.mbuf[i] = NULL;
> > Pardon my ignorance here, but rte_pktmbuf_free does this work. I can't
> > actually see much difference between your rewrite of this block, and
> > the implementation of rte_pktmbuf_free() (apart from moving your branch
> > to the end of the function). Did your microbenchmarking really show this
> > as an improvement?
> >
> > Thanks for your time,
> > Aaron
> 
> rte_pktmbuf_free calls rte_mbuf_sanity_check which does a lot of
> checks. 

Only when RTE_LIBRTE_MBUF_DEBUG is enabled in your config.
By default it is switched off. 

> This additional check seems redundant for single segment
> packets since rte_pktmbuf_free_seg also performs rte_mbuf_sanity_check.
> 
> Several PMDs already prefer to use rte_pktmbuf_free_seg directly over
> rte_pktmbuf_free as it is faster.

Other PMDs use rte_pktmbuf_free_seg() as each TD has an associated 
with it segment. So as HW is done with the TD, SW frees associated segment.
In your case I don't see any point in re-implementing rte_pktmbuf_free() manually,
and I don't think it would be any faster.

Konstantin  

> 
> The forwarding perf. improvement with only this particular block is
> around 1 Mpps for 64B packets when using l3fwd with 8 queues.
> 
> Thanks,
> Rahul

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G
  2015-10-05 11:46       ` Ananyev, Konstantin
@ 2015-10-05 12:42         ` Rahul Lakkireddy
  2015-10-05 14:09           ` Ananyev, Konstantin
  0 siblings, 1 reply; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-05 12:42 UTC (permalink / raw)
  To: Ananyev, Konstantin; +Cc: dev, Felix Marti, Nirranjan Kirubaharan, Kumar A S

Hi Konstantin,

On Monday, October 10/05/15, 2015 at 04:46:40 -0700, Ananyev, Konstantin wrote:
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Rahul Lakkireddy
> > Sent: Monday, October 05, 2015 11:06 AM
> > To: Aaron Conole
> > Cc: dev@dpdk.org; Felix Marti; Kumar A S; Nirranjan Kirubaharan
> > Subject: Re: [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G
> > 
> > Hi Aaron,
> > 
> > On Friday, October 10/02/15, 2015 at 14:48:28 -0700, Aaron Conole wrote:
> > > Hi Rahul,
> > >
> > > Rahul Lakkireddy <rahul.lakkireddy@chelsio.com> writes:
> > >
> > > > Update sge initialization with respect to free-list manager configuration
> > > > and ingress arbiter. Also update refill logic to refill mbufs only after
> > > > a certain threshold for rx.  Optimize tx packet prefetch and free.
> > > <<snip>>
> > > >  			for (i = 0; i < sd->coalesce.idx; i++) {
> > > > -				rte_pktmbuf_free(sd->coalesce.mbuf[i]);
> > > > +				struct rte_mbuf *tmp = sd->coalesce.mbuf[i];
> > > > +
> > > > +				do {
> > > > +					struct rte_mbuf *next = tmp->next;
> > > > +
> > > > +					rte_pktmbuf_free_seg(tmp);
> > > > +					tmp = next;
> > > > +				} while (tmp);
> > > >  				sd->coalesce.mbuf[i] = NULL;
> > > Pardon my ignorance here, but rte_pktmbuf_free does this work. I can't
> > > actually see much difference between your rewrite of this block, and
> > > the implementation of rte_pktmbuf_free() (apart from moving your branch
> > > to the end of the function). Did your microbenchmarking really show this
> > > as an improvement?
> > >
> > > Thanks for your time,
> > > Aaron
> > 
> > rte_pktmbuf_free calls rte_mbuf_sanity_check which does a lot of
> > checks. 
> 
> Only when RTE_LIBRTE_MBUF_DEBUG is enabled in your config.
> By default it is switched off. 

Right. I clearly missed this.
I am running with default config only btw.

> 
> > This additional check seems redundant for single segment
> > packets since rte_pktmbuf_free_seg also performs rte_mbuf_sanity_check.
> > 
> > Several PMDs already prefer to use rte_pktmbuf_free_seg directly over
> > rte_pktmbuf_free as it is faster.
> 
> Other PMDs use rte_pktmbuf_free_seg() as each TD has an associated 
> with it segment. So as HW is done with the TD, SW frees associated segment.
> In your case I don't see any point in re-implementing rte_pktmbuf_free() manually,
> and I don't think it would be any faster.
> 
> Konstantin  

As I mentioned below, I am clearly seeing a difference of 1 Mpps. And 1
Mpps is not a small difference IMHO.

When running l3fwd with 8 queues, I also collected a perf report.
When using rte_pktmbuf_free, I see that it eats up around 6% cpu as
below in perf top report:-
--------------------
32.00%  l3fwd                        [.] cxgbe_poll
22.25%  l3fwd                        [.] t4_eth_xmit
20.30%  l3fwd                        [.] main_loop
 6.77%  l3fwd                        [.] rte_pktmbuf_free
 4.86%  l3fwd                        [.] refill_fl_usembufs
 2.00%  l3fwd                        [.] write_sgl
.....
--------------------

While, when using rte_pktmbuf_free_seg directly, I don't see above
problem. perf top report now comes as:-
-------------------
33.36%  l3fwd                        [.] cxgbe_poll
32.69%  l3fwd                        [.] t4_eth_xmit
19.05%  l3fwd                        [.] main_loop
 5.21%  l3fwd                        [.] refill_fl_usembufs
 2.40%  l3fwd                        [.] write_sgl
....
-------------------

I obviously missed the debug flag for rte_mbuf_sanity_check.
However, there is a clear difference of 1 Mpps. I don't know if its the
change between while construct used in rte_pktmbuf_free and the
do..while construct that I used - is making the difference.


> 
> > 
> > The forwarding perf. improvement with only this particular block is
> > around 1 Mpps for 64B packets when using l3fwd with 8 queues.
> > 
> > Thanks,
> > Rahul

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G
  2015-10-05 12:42         ` Rahul Lakkireddy
@ 2015-10-05 14:09           ` Ananyev, Konstantin
  2015-10-05 15:07             ` Rahul Lakkireddy
  0 siblings, 1 reply; 23+ messages in thread
From: Ananyev, Konstantin @ 2015-10-05 14:09 UTC (permalink / raw)
  To: Rahul Lakkireddy; +Cc: dev, Felix Marti, Nirranjan Kirubaharan, Kumar A S

Hi Rahul,

> -----Original Message-----
> From: Rahul Lakkireddy [mailto:rahul.lakkireddy@chelsio.com]
> Sent: Monday, October 05, 2015 1:42 PM
> To: Ananyev, Konstantin
> Cc: Aaron Conole; dev@dpdk.org; Felix Marti; Kumar A S; Nirranjan Kirubaharan
> Subject: Re: [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G
> 
> Hi Konstantin,
> 
> On Monday, October 10/05/15, 2015 at 04:46:40 -0700, Ananyev, Konstantin wrote:
> >
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Rahul Lakkireddy
> > > Sent: Monday, October 05, 2015 11:06 AM
> > > To: Aaron Conole
> > > Cc: dev@dpdk.org; Felix Marti; Kumar A S; Nirranjan Kirubaharan
> > > Subject: Re: [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G
> > >
> > > Hi Aaron,
> > >
> > > On Friday, October 10/02/15, 2015 at 14:48:28 -0700, Aaron Conole wrote:
> > > > Hi Rahul,
> > > >
> > > > Rahul Lakkireddy <rahul.lakkireddy@chelsio.com> writes:
> > > >
> > > > > Update sge initialization with respect to free-list manager configuration
> > > > > and ingress arbiter. Also update refill logic to refill mbufs only after
> > > > > a certain threshold for rx.  Optimize tx packet prefetch and free.
> > > > <<snip>>
> > > > >  			for (i = 0; i < sd->coalesce.idx; i++) {
> > > > > -				rte_pktmbuf_free(sd->coalesce.mbuf[i]);
> > > > > +				struct rte_mbuf *tmp = sd->coalesce.mbuf[i];
> > > > > +
> > > > > +				do {
> > > > > +					struct rte_mbuf *next = tmp->next;
> > > > > +
> > > > > +					rte_pktmbuf_free_seg(tmp);
> > > > > +					tmp = next;
> > > > > +				} while (tmp);
> > > > >  				sd->coalesce.mbuf[i] = NULL;
> > > > Pardon my ignorance here, but rte_pktmbuf_free does this work. I can't
> > > > actually see much difference between your rewrite of this block, and
> > > > the implementation of rte_pktmbuf_free() (apart from moving your branch
> > > > to the end of the function). Did your microbenchmarking really show this
> > > > as an improvement?
> > > >
> > > > Thanks for your time,
> > > > Aaron
> > >
> > > rte_pktmbuf_free calls rte_mbuf_sanity_check which does a lot of
> > > checks.
> >
> > Only when RTE_LIBRTE_MBUF_DEBUG is enabled in your config.
> > By default it is switched off.
> 
> Right. I clearly missed this.
> I am running with default config only btw.
> 
> >
> > > This additional check seems redundant for single segment
> > > packets since rte_pktmbuf_free_seg also performs rte_mbuf_sanity_check.
> > >
> > > Several PMDs already prefer to use rte_pktmbuf_free_seg directly over
> > > rte_pktmbuf_free as it is faster.
> >
> > Other PMDs use rte_pktmbuf_free_seg() as each TD has an associated
> > with it segment. So as HW is done with the TD, SW frees associated segment.
> > In your case I don't see any point in re-implementing rte_pktmbuf_free() manually,
> > and I don't think it would be any faster.
> >
> > Konstantin
> 
> As I mentioned below, I am clearly seeing a difference of 1 Mpps. And 1
> Mpps is not a small difference IMHO.

Agree with you here - it is a significant difference.

> 
> When running l3fwd with 8 queues, I also collected a perf report.
> When using rte_pktmbuf_free, I see that it eats up around 6% cpu as
> below in perf top report:-
> --------------------
> 32.00%  l3fwd                        [.] cxgbe_poll
> 22.25%  l3fwd                        [.] t4_eth_xmit
> 20.30%  l3fwd                        [.] main_loop
>  6.77%  l3fwd                        [.] rte_pktmbuf_free
>  4.86%  l3fwd                        [.] refill_fl_usembufs
>  2.00%  l3fwd                        [.] write_sgl
> .....
> --------------------
> 
> While, when using rte_pktmbuf_free_seg directly, I don't see above
> problem. perf top report now comes as:-
> -------------------
> 33.36%  l3fwd                        [.] cxgbe_poll
> 32.69%  l3fwd                        [.] t4_eth_xmit
> 19.05%  l3fwd                        [.] main_loop
>  5.21%  l3fwd                        [.] refill_fl_usembufs
>  2.40%  l3fwd                        [.] write_sgl
> ....
> -------------------

I don't think these 6% disappeared anywhere.
As I can see, now t4_eth_xmit() increased by roughly same amount
(you still have same job to do).
To me it looks like in that case compiler didn't really inline rte_pktmbuf_free().
Wonder can you add 'always_inline' attribute to the  rte_pktmbuf_free(),
and see would it make any difference?

Konstantin 

> 
> I obviously missed the debug flag for rte_mbuf_sanity_check.
> However, there is a clear difference of 1 Mpps. I don't know if its the
> change between while construct used in rte_pktmbuf_free and the
> do..while construct that I used - is making the difference.
> 
> 
> >
> > >
> > > The forwarding perf. improvement with only this particular block is
> > > around 1 Mpps for 64B packets when using l3fwd with 8 queues.
> > >
> > > Thanks,
> > > Rahul

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G
  2015-10-05 14:09           ` Ananyev, Konstantin
@ 2015-10-05 15:07             ` Rahul Lakkireddy
  2015-10-07 15:27               ` Rahul Lakkireddy
  0 siblings, 1 reply; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-05 15:07 UTC (permalink / raw)
  To: Ananyev, Konstantin; +Cc: dev, Felix Marti, Nirranjan Kirubaharan, Kumar A S

On Monday, October 10/05/15, 2015 at 07:09:27 -0700, Ananyev, Konstantin wrote:
> Hi Rahul,

[...]

> > > > This additional check seems redundant for single segment
> > > > packets since rte_pktmbuf_free_seg also performs rte_mbuf_sanity_check.
> > > >
> > > > Several PMDs already prefer to use rte_pktmbuf_free_seg directly over
> > > > rte_pktmbuf_free as it is faster.
> > >
> > > Other PMDs use rte_pktmbuf_free_seg() as each TD has an associated
> > > with it segment. So as HW is done with the TD, SW frees associated segment.
> > > In your case I don't see any point in re-implementing rte_pktmbuf_free() manually,
> > > and I don't think it would be any faster.
> > >
> > > Konstantin
> > 
> > As I mentioned below, I am clearly seeing a difference of 1 Mpps. And 1
> > Mpps is not a small difference IMHO.
> 
> Agree with you here - it is a significant difference.
> 
> > 
> > When running l3fwd with 8 queues, I also collected a perf report.
> > When using rte_pktmbuf_free, I see that it eats up around 6% cpu as
> > below in perf top report:-
> > --------------------
> > 32.00%  l3fwd                        [.] cxgbe_poll
> > 22.25%  l3fwd                        [.] t4_eth_xmit
> > 20.30%  l3fwd                        [.] main_loop
> >  6.77%  l3fwd                        [.] rte_pktmbuf_free
> >  4.86%  l3fwd                        [.] refill_fl_usembufs
> >  2.00%  l3fwd                        [.] write_sgl
> > .....
> > --------------------
> > 
> > While, when using rte_pktmbuf_free_seg directly, I don't see above
> > problem. perf top report now comes as:-
> > -------------------
> > 33.36%  l3fwd                        [.] cxgbe_poll
> > 32.69%  l3fwd                        [.] t4_eth_xmit
> > 19.05%  l3fwd                        [.] main_loop
> >  5.21%  l3fwd                        [.] refill_fl_usembufs
> >  2.40%  l3fwd                        [.] write_sgl
> > ....
> > -------------------
> 
> I don't think these 6% disappeared anywhere.
> As I can see, now t4_eth_xmit() increased by roughly same amount
> (you still have same job to do).

Right.

> To me it looks like in that case compiler didn't really inline rte_pktmbuf_free().
> Wonder can you add 'always_inline' attribute to the  rte_pktmbuf_free(),
> and see would it make any difference?
> 
> Konstantin 

I will try out above and update further.


Thanks,
Rahul.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G
  2015-10-05 15:07             ` Rahul Lakkireddy
@ 2015-10-07 15:27               ` Rahul Lakkireddy
  0 siblings, 0 replies; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-07 15:27 UTC (permalink / raw)
  To: Ananyev, Konstantin; +Cc: dev, Felix Marti, Nirranjan Kirubaharan, Kumar A S

On Monday, October 10/05/15, 2015 at 20:37:31 +0530, Rahul Lakkireddy wrote:
> On Monday, October 10/05/15, 2015 at 07:09:27 -0700, Ananyev, Konstantin wrote:
> > Hi Rahul,
> 
> [...]
> 
> > > > > This additional check seems redundant for single segment
> > > > > packets since rte_pktmbuf_free_seg also performs rte_mbuf_sanity_check.
> > > > >
> > > > > Several PMDs already prefer to use rte_pktmbuf_free_seg directly over
> > > > > rte_pktmbuf_free as it is faster.
> > > >
> > > > Other PMDs use rte_pktmbuf_free_seg() as each TD has an associated
> > > > with it segment. So as HW is done with the TD, SW frees associated segment.
> > > > In your case I don't see any point in re-implementing rte_pktmbuf_free() manually,
> > > > and I don't think it would be any faster.
> > > >
> > > > Konstantin
> > > 
> > > As I mentioned below, I am clearly seeing a difference of 1 Mpps. And 1
> > > Mpps is not a small difference IMHO.
> > 
> > Agree with you here - it is a significant difference.
> > 
> > > 
> > > When running l3fwd with 8 queues, I also collected a perf report.
> > > When using rte_pktmbuf_free, I see that it eats up around 6% cpu as
> > > below in perf top report:-
> > > --------------------
> > > 32.00%  l3fwd                        [.] cxgbe_poll
> > > 22.25%  l3fwd                        [.] t4_eth_xmit
> > > 20.30%  l3fwd                        [.] main_loop
> > >  6.77%  l3fwd                        [.] rte_pktmbuf_free
> > >  4.86%  l3fwd                        [.] refill_fl_usembufs
> > >  2.00%  l3fwd                        [.] write_sgl
> > > .....
> > > --------------------
> > > 
> > > While, when using rte_pktmbuf_free_seg directly, I don't see above
> > > problem. perf top report now comes as:-
> > > -------------------
> > > 33.36%  l3fwd                        [.] cxgbe_poll
> > > 32.69%  l3fwd                        [.] t4_eth_xmit
> > > 19.05%  l3fwd                        [.] main_loop
> > >  5.21%  l3fwd                        [.] refill_fl_usembufs
> > >  2.40%  l3fwd                        [.] write_sgl
> > > ....
> > > -------------------
> > 
> > I don't think these 6% disappeared anywhere.
> > As I can see, now t4_eth_xmit() increased by roughly same amount
> > (you still have same job to do).
> 
> Right.
> 
> > To me it looks like in that case compiler didn't really inline rte_pktmbuf_free().
> > Wonder can you add 'always_inline' attribute to the  rte_pktmbuf_free(),
> > and see would it make any difference?
> > 
> > Konstantin 
> 
> I will try out above and update further.
> 

Tried always_inline and didn't see any difference in performance in
RHEL 6.4 with gcc 4.4.7, but was seeing 1 MPPS improvement with the
above block.

I've moved to latest RHEL 7.1 with gcc 4.8.3 and tried both
always_inline and the above block and I'm not seeing any difference
for both.

Will drop this block and submit a v2.

Thanks for the review Aaron and Konstantin.

Thanks,
Rahul

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD
  2015-10-02 11:16 [dpdk-dev] [PATCH 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
                   ` (5 preceding siblings ...)
  2015-10-02 11:16 ` [dpdk-dev] [PATCH 6/6] doc: Update cxgbe documentation and release notes Rahul Lakkireddy
@ 2015-10-08 13:46 ` Rahul Lakkireddy
  2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 1/6] cxgbe: Optimize forwarding performance for 40G Rahul Lakkireddy
                     ` (6 more replies)
  6 siblings, 7 replies; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-08 13:46 UTC (permalink / raw)
  To: dev; +Cc: Felix Marti, Kumar Sanghvi, Nirranjan Kirubaharan

This series of patches improve forwarding performance for Chelsio T5 40GbE
cards and add Jumbo Frame support for cxgbe pmd. Also update documentation
and release notes.

---
v2:
- Don't re-define rte_pktmbuf_free() locally.  Thanks to review by
  Aaron Conole <aconole@redhat.com> and Konstantin Ananyev
  <konstantin.ananyev@intel.com>

Rahul Lakkireddy (6):
  cxgbe: Optimize forwarding performance for 40G
  cxgbe: Update device info and perform sanity checks to enable jumbo
    frames
  cxgbe: Update tx path to transmit jumbo frames
  cxgbe: Update rx path to receive jumbo frames
  cxgbe: Allow apps to change mtu
  doc: Update cxgbe documentation and release notes

 doc/guides/nics/cxgbe.rst            |  81 ++++++++++++------
 doc/guides/rel_notes/release_2_2.rst |   5 ++
 drivers/net/cxgbe/base/t4_regs.h     |  16 ++++
 drivers/net/cxgbe/cxgbe.h            |   3 +
 drivers/net/cxgbe/cxgbe_ethdev.c     |  52 ++++++++++-
 drivers/net/cxgbe/cxgbe_main.c       |  10 ++-
 drivers/net/cxgbe/sge.c              | 162 ++++++++++++++++++++++++++---------
 7 files changed, 260 insertions(+), 69 deletions(-)

-- 
2.5.3

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [dpdk-dev] [PATCH v2 1/6] cxgbe: Optimize forwarding performance for 40G
  2015-10-08 13:46 ` [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
@ 2015-10-08 13:46   ` Rahul Lakkireddy
  2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 2/6] cxgbe: Update device info and perform sanity checks to enable jumbo frames Rahul Lakkireddy
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-08 13:46 UTC (permalink / raw)
  To: dev; +Cc: Felix Marti, Kumar Sanghvi, Nirranjan Kirubaharan

Update sge initialization with respect to free-list manager configuration
and ingress arbiter. Also update refill logic to refill mbufs only after
a certain threshold for rx.  Optimize tx packet prefetch.

Approx. 3 MPPS improvement seen in forwarding performance after the
optimization.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
v2:
- Don't re-define rte_pktmbuf_free() locally.  Thanks to review by
  Aaron Conole <aconole@redhat.com> and Konstantin Ananyev
  <konstantin.ananyev@intel.com>

 drivers/net/cxgbe/base/t4_regs.h | 16 ++++++++++++++++
 drivers/net/cxgbe/cxgbe_main.c   |  7 +++++++
 drivers/net/cxgbe/sge.c          |  8 ++++----
 3 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/drivers/net/cxgbe/base/t4_regs.h b/drivers/net/cxgbe/base/t4_regs.h
index cd28b59..9057e40 100644
--- a/drivers/net/cxgbe/base/t4_regs.h
+++ b/drivers/net/cxgbe/base/t4_regs.h
@@ -266,6 +266,18 @@
 #define A_SGE_FL_BUFFER_SIZE2 0x104c
 #define A_SGE_FL_BUFFER_SIZE3 0x1050
 
+#define A_SGE_FLM_CFG 0x1090
+
+#define S_CREDITCNT    4
+#define M_CREDITCNT    0x3U
+#define V_CREDITCNT(x) ((x) << S_CREDITCNT)
+#define G_CREDITCNT(x) (((x) >> S_CREDITCNT) & M_CREDITCNT)
+
+#define S_CREDITCNTPACKING    2
+#define M_CREDITCNTPACKING    0x3U
+#define V_CREDITCNTPACKING(x) ((x) << S_CREDITCNTPACKING)
+#define G_CREDITCNTPACKING(x) (((x) >> S_CREDITCNTPACKING) & M_CREDITCNTPACKING)
+
 #define A_SGE_CONM_CTRL 0x1094
 
 #define S_EGRTHRESHOLD    8
@@ -361,6 +373,10 @@
 
 #define A_SGE_CONTROL2 0x1124
 
+#define S_IDMAARBROUNDROBIN    19
+#define V_IDMAARBROUNDROBIN(x) ((x) << S_IDMAARBROUNDROBIN)
+#define F_IDMAARBROUNDROBIN    V_IDMAARBROUNDROBIN(1U)
+
 #define S_INGPACKBOUNDARY    16
 #define M_INGPACKBOUNDARY    0x7U
 #define V_INGPACKBOUNDARY(x) ((x) << S_INGPACKBOUNDARY)
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 3755444..316b87d 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -422,6 +422,13 @@ static int adap_init0_tweaks(struct adapter *adapter)
 	t4_set_reg_field(adapter, A_SGE_CONTROL, V_PKTSHIFT(M_PKTSHIFT),
 			 V_PKTSHIFT(rx_dma_offset));
 
+	t4_set_reg_field(adapter, A_SGE_FLM_CFG,
+			 V_CREDITCNT(M_CREDITCNT) | M_CREDITCNTPACKING,
+			 V_CREDITCNT(3) | V_CREDITCNTPACKING(1));
+
+	t4_set_reg_field(adapter, A_SGE_CONTROL2, V_IDMAARBROUNDROBIN(1U),
+			 V_IDMAARBROUNDROBIN(1U));
+
 	/*
 	 * Don't include the "IP Pseudo Header" in CPL_RX_PKT checksums: Linux
 	 * adds the pseudo header itself.
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index 6eb1244..69ab487 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -286,8 +286,7 @@ static void unmap_rx_buf(struct sge_fl *q)
 
 static inline void ring_fl_db(struct adapter *adap, struct sge_fl *q)
 {
-	/* see if we have exceeded q->size / 4 */
-	if (q->pend_cred >= (q->size / 4)) {
+	if (q->pend_cred >= 64) {
 		u32 val = adap->params.arch.sge_fl_db;
 
 		if (is_t4(adap->params.chip))
@@ -1054,7 +1053,6 @@ out_free:
 		return 0;
 	}
 
-	rte_prefetch0(&((&txq->q)->sdesc->mbuf->pool));
 	pi = (struct port_info *)txq->eth_dev->data->dev_private;
 	adap = pi->adapter;
 
@@ -1070,6 +1068,7 @@ out_free:
 				txq->stats.mapping_err++;
 				goto out_free;
 			}
+			rte_prefetch0((volatile void *)addr);
 			return tx_do_packet_coalesce(txq, mbuf, cflits, adap,
 						     pi, addr);
 		} else {
@@ -1454,7 +1453,8 @@ static int process_responses(struct sge_rspq *q, int budget,
 			unsigned int params;
 			u32 val;
 
-			__refill_fl(q->adapter, &rxq->fl);
+			if (fl_cap(&rxq->fl) - rxq->fl.avail >= 64)
+				__refill_fl(q->adapter, &rxq->fl);
 			params = V_QINTR_TIMER_IDX(X_TIMERREG_UPDATE_CIDX);
 			q->next_intr_params = params;
 			val = V_CIDXINC(cidx_inc) | V_SEINTARM(params);
-- 
2.5.3

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [dpdk-dev] [PATCH v2 2/6] cxgbe: Update device info and perform sanity checks to enable jumbo frames
  2015-10-08 13:46 ` [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
  2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 1/6] cxgbe: Optimize forwarding performance for 40G Rahul Lakkireddy
@ 2015-10-08 13:46   ` Rahul Lakkireddy
  2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 3/6] cxgbe: Update tx path to transmit " Rahul Lakkireddy
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-08 13:46 UTC (permalink / raw)
  To: dev; +Cc: Felix Marti, Kumar Sanghvi, Nirranjan Kirubaharan

Increase max_rx_pktlen to accommodate jumbo frame size. Perform sanity
checks and enable jumbo mode in rx queue setup. Set link mtu based on
max_rx_pktlen.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
v2:
- No change

 drivers/net/cxgbe/cxgbe.h        |  3 +++
 drivers/net/cxgbe/cxgbe_ethdev.c | 23 +++++++++++++++++++++--
 drivers/net/cxgbe/cxgbe_main.c   |  3 ++-
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/drivers/net/cxgbe/cxgbe.h b/drivers/net/cxgbe/cxgbe.h
index 97c37d2..adc0d92 100644
--- a/drivers/net/cxgbe/cxgbe.h
+++ b/drivers/net/cxgbe/cxgbe.h
@@ -43,6 +43,9 @@
 #define CXGBE_DEFAULT_TX_DESC_SIZE    1024 /* Default TX ring size */
 #define CXGBE_DEFAULT_RX_DESC_SIZE    1024 /* Default RX ring size */
 
+#define CXGBE_MIN_RX_BUFSIZE ETHER_MIN_MTU /* min buf size */
+#define CXGBE_MAX_RX_PKTLEN (9000 + ETHER_HDR_LEN + ETHER_CRC_LEN) /* max pkt */
+
 int cxgbe_probe(struct adapter *adapter);
 int cxgbe_up(struct adapter *adap);
 int cxgbe_down(struct port_info *pi);
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 478051a..6d7b29c 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -141,8 +141,8 @@ static void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 	struct adapter *adapter = pi->adapter;
 	int max_queues = adapter->sge.max_ethqsets / adapter->params.nports;
 
-	device_info->min_rx_bufsize = 68; /* XXX: Smallest pkt size */
-	device_info->max_rx_pktlen = 1500; /* XXX: For now we support mtu */
+	device_info->min_rx_bufsize = CXGBE_MIN_RX_BUFSIZE;
+	device_info->max_rx_pktlen = CXGBE_MAX_RX_PKTLEN;
 	device_info->max_rx_queues = max_queues;
 	device_info->max_tx_queues = max_queues;
 	device_info->max_mac_addrs = 1;
@@ -498,6 +498,8 @@ static int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	int err = 0;
 	int msi_idx = 0;
 	unsigned int temp_nb_desc;
+	struct rte_eth_dev_info dev_info;
+	unsigned int pkt_len = eth_dev->data->dev_conf.rxmode.max_rx_pkt_len;
 
 	RTE_SET_USED(rx_conf);
 
@@ -505,6 +507,17 @@ static int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 		  __func__, eth_dev->data->nb_rx_queues, queue_idx, nb_desc,
 		  socket_id, mp);
 
+	cxgbe_dev_info_get(eth_dev, &dev_info);
+
+	/* Must accommodate at least ETHER_MIN_MTU */
+	if ((pkt_len < dev_info.min_rx_bufsize) ||
+	    (pkt_len > dev_info.max_rx_pktlen)) {
+		dev_err(adap, "%s: max pkt len must be > %d and <= %d\n",
+			__func__, dev_info.min_rx_bufsize,
+			dev_info.max_rx_pktlen);
+		return -EINVAL;
+	}
+
 	/*  Free up the existing queue  */
 	if (eth_dev->data->rx_queues[queue_idx]) {
 		cxgbe_dev_rx_queue_release(eth_dev->data->rx_queues[queue_idx]);
@@ -534,6 +547,12 @@ static int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	if ((&rxq->fl) != NULL)
 		rxq->fl.size = temp_nb_desc;
 
+	/* Set to jumbo mode if necessary */
+	if (pkt_len > ETHER_MAX_LEN)
+		eth_dev->data->dev_conf.rxmode.jumbo_frame = 1;
+	else
+		eth_dev->data->dev_conf.rxmode.jumbo_frame = 0;
+
 	err = t4_sge_alloc_rxq(adapter, &rxq->rspq, false, eth_dev, msi_idx,
 			       &rxq->fl, t4_ethrx_handler,
 			       t4_get_mps_bg_map(adapter, pi->tx_chan), mp,
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 316b87d..aff23d0 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -855,12 +855,13 @@ int link_start(struct port_info *pi)
 {
 	struct adapter *adapter = pi->adapter;
 	int ret;
+	unsigned int mtu = pi->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len;
 
 	/*
 	 * We do not set address filters and promiscuity here, the stack does
 	 * that step explicitly.
 	 */
-	ret = t4_set_rxmode(adapter, adapter->mbox, pi->viid, 1500, -1, -1,
+	ret = t4_set_rxmode(adapter, adapter->mbox, pi->viid, mtu, -1, -1,
 			    -1, 1, true);
 	if (ret == 0) {
 		ret = t4_change_mac(adapter, adapter->mbox, pi->viid,
-- 
2.5.3

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [dpdk-dev] [PATCH v2 3/6] cxgbe: Update tx path to transmit jumbo frames
  2015-10-08 13:46 ` [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
  2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 1/6] cxgbe: Optimize forwarding performance for 40G Rahul Lakkireddy
  2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 2/6] cxgbe: Update device info and perform sanity checks to enable jumbo frames Rahul Lakkireddy
@ 2015-10-08 13:46   ` Rahul Lakkireddy
  2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 4/6] cxgbe: Update rx path to receive " Rahul Lakkireddy
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-08 13:46 UTC (permalink / raw)
  To: dev; +Cc: Felix Marti, Kumar Sanghvi, Nirranjan Kirubaharan

Add a non-coalesce path.  Skip coalescing for Jumbo Frames, and send the
packet through non-coalesced path if there are enough credits.  Also,
free these non-coalesced packets while reclaiming credits.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
v2:
- No change

 drivers/net/cxgbe/sge.c | 96 ++++++++++++++++++++++++++++++++-----------------
 1 file changed, 64 insertions(+), 32 deletions(-)

diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index 69ab487..b1d0ea6 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -199,11 +199,20 @@ static void free_tx_desc(struct sge_txq *q, unsigned int n)
 
 static void reclaim_tx_desc(struct sge_txq *q, unsigned int n)
 {
+	struct tx_sw_desc *d;
 	unsigned int cidx = q->cidx;
 
+	d = &q->sdesc[cidx];
 	while (n--) {
-		if (++cidx == q->size)
+		if (d->mbuf) {                       /* an SGL is present */
+			rte_pktmbuf_free(d->mbuf);
+			d->mbuf = NULL;
+		}
+		++d;
+		if (++cidx == q->size) {
 			cidx = 0;
+			d = q->sdesc;
+		}
 	}
 	q->cidx = cidx;
 }
@@ -1038,6 +1047,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf)
 	u32 wr_mid;
 	u64 cntrl, *end;
 	bool v6;
+	u32 max_pkt_len = txq->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len;
 
 	/* Reject xmit if queue is stopped */
 	if (unlikely(txq->flags & EQ_STOPPED))
@@ -1053,6 +1063,10 @@ out_free:
 		return 0;
 	}
 
+	if ((!(m->ol_flags & PKT_TX_TCP_SEG)) &&
+	    (unlikely(m->pkt_len > max_pkt_len)))
+		goto out_free;
+
 	pi = (struct port_info *)txq->eth_dev->data->dev_private;
 	adap = pi->adapter;
 
@@ -1060,7 +1074,7 @@ out_free:
 	/* align the end of coalesce WR to a 512 byte boundary */
 	txq->q.coalesce.max = (8 - (txq->q.pidx & 7)) * 8;
 
-	if (!(m->ol_flags & PKT_TX_TCP_SEG)) {
+	if (!((m->ol_flags & PKT_TX_TCP_SEG) || (m->pkt_len > ETHER_MAX_LEN))) {
 		if (should_tx_packet_coalesce(txq, mbuf, &cflits, adap)) {
 			if (unlikely(map_mbuf(mbuf, addr) < 0)) {
 				dev_warn(adap, "%s: mapping err for coalesce\n",
@@ -1107,33 +1121,46 @@ out_free:
 
 	len = 0;
 	len += sizeof(*cpl);
-	lso = (void *)(wr + 1);
-	v6 = (m->ol_flags & PKT_TX_IPV6) != 0;
-	l3hdr_len = m->l3_len;
-	l4hdr_len = m->l4_len;
-	eth_xtra_len = m->l2_len - ETHER_HDR_LEN;
-	len += sizeof(*lso);
-	wr->op_immdlen = htonl(V_FW_WR_OP(FW_ETH_TX_PKT_WR) |
-			       V_FW_WR_IMMDLEN(len));
-	lso->lso_ctrl = htonl(V_LSO_OPCODE(CPL_TX_PKT_LSO) |
-			      F_LSO_FIRST_SLICE | F_LSO_LAST_SLICE |
-			      V_LSO_IPV6(v6) |
-			      V_LSO_ETHHDR_LEN(eth_xtra_len / 4) |
-			      V_LSO_IPHDR_LEN(l3hdr_len / 4) |
-			      V_LSO_TCPHDR_LEN(l4hdr_len / 4));
-	lso->ipid_ofst = htons(0);
-	lso->mss = htons(m->tso_segsz);
-	lso->seqno_offset = htonl(0);
-	if (is_t4(adap->params.chip))
-		lso->len = htonl(m->pkt_len);
-	else
-		lso->len = htonl(V_LSO_T5_XFER_SIZE(m->pkt_len));
-	cpl = (void *)(lso + 1);
-	cntrl = V_TXPKT_CSUM_TYPE(v6 ? TX_CSUM_TCPIP6 : TX_CSUM_TCPIP) |
-				  V_TXPKT_IPHDR_LEN(l3hdr_len) |
-				  V_TXPKT_ETHHDR_LEN(eth_xtra_len);
-	txq->stats.tso++;
-	txq->stats.tx_cso += m->tso_segsz;
+
+	/* Coalescing skipped and we send through normal path */
+	if (!(m->ol_flags & PKT_TX_TCP_SEG)) {
+		wr->op_immdlen = htonl(V_FW_WR_OP(FW_ETH_TX_PKT_WR) |
+				       V_FW_WR_IMMDLEN(len));
+		cpl = (void *)(wr + 1);
+		if (m->ol_flags & PKT_TX_IP_CKSUM) {
+			cntrl = hwcsum(adap->params.chip, m) |
+				F_TXPKT_IPCSUM_DIS;
+			txq->stats.tx_cso++;
+		}
+	} else {
+		lso = (void *)(wr + 1);
+		v6 = (m->ol_flags & PKT_TX_IPV6) != 0;
+		l3hdr_len = m->l3_len;
+		l4hdr_len = m->l4_len;
+		eth_xtra_len = m->l2_len - ETHER_HDR_LEN;
+		len += sizeof(*lso);
+		wr->op_immdlen = htonl(V_FW_WR_OP(FW_ETH_TX_PKT_WR) |
+				       V_FW_WR_IMMDLEN(len));
+		lso->lso_ctrl = htonl(V_LSO_OPCODE(CPL_TX_PKT_LSO) |
+				      F_LSO_FIRST_SLICE | F_LSO_LAST_SLICE |
+				      V_LSO_IPV6(v6) |
+				      V_LSO_ETHHDR_LEN(eth_xtra_len / 4) |
+				      V_LSO_IPHDR_LEN(l3hdr_len / 4) |
+				      V_LSO_TCPHDR_LEN(l4hdr_len / 4));
+		lso->ipid_ofst = htons(0);
+		lso->mss = htons(m->tso_segsz);
+		lso->seqno_offset = htonl(0);
+		if (is_t4(adap->params.chip))
+			lso->len = htonl(m->pkt_len);
+		else
+			lso->len = htonl(V_LSO_T5_XFER_SIZE(m->pkt_len));
+		cpl = (void *)(lso + 1);
+		cntrl = V_TXPKT_CSUM_TYPE(v6 ? TX_CSUM_TCPIP6 : TX_CSUM_TCPIP) |
+			V_TXPKT_IPHDR_LEN(l3hdr_len) |
+			V_TXPKT_ETHHDR_LEN(eth_xtra_len);
+		txq->stats.tso++;
+		txq->stats.tx_cso += m->tso_segsz;
+	}
 
 	if (m->ol_flags & PKT_TX_VLAN_PKT) {
 		txq->stats.vlan_ins++;
@@ -1154,9 +1181,14 @@ out_free:
 		last_desc -= txq->q.size;
 
 	d = &txq->q.sdesc[last_desc];
-	if (d->mbuf) {
-		rte_pktmbuf_free(d->mbuf);
-		d->mbuf = NULL;
+	if (d->coalesce.idx) {
+		int i;
+
+		for (i = 0; i < d->coalesce.idx; i++) {
+			rte_pktmbuf_free(d->coalesce.mbuf[i]);
+			d->coalesce.mbuf[i] = NULL;
+		}
+		d->coalesce.idx = 0;
 	}
 	write_sgl(m, &txq->q, (struct ulptx_sgl *)(cpl + 1), end, 0,
 		  addr);
-- 
2.5.3

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [dpdk-dev] [PATCH v2 4/6] cxgbe: Update rx path to receive jumbo frames
  2015-10-08 13:46 ` [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
                     ` (2 preceding siblings ...)
  2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 3/6] cxgbe: Update tx path to transmit " Rahul Lakkireddy
@ 2015-10-08 13:46   ` Rahul Lakkireddy
  2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 5/6] cxgbe: Allow apps to change mtu Rahul Lakkireddy
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-08 13:46 UTC (permalink / raw)
  To: dev; +Cc: Felix Marti, Kumar Sanghvi, Nirranjan Kirubaharan

Ensure jumbo mode is enabled and that the mbuf data room size can
accommodate jumbo size.  If the mbuf data room size can't accommodate
jumbo size, chain mbufs to jumbo size.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
v2:
- No change

 drivers/net/cxgbe/sge.c | 58 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 53 insertions(+), 5 deletions(-)

diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index b1d0ea6..aa0c2e5 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -247,6 +247,29 @@ static inline bool fl_starving(const struct adapter *adapter,
 	return fl->avail - fl->pend_cred <= s->fl_starve_thres;
 }
 
+static inline unsigned int get_buf_size(struct adapter *adapter,
+					const struct rx_sw_desc *d)
+{
+	unsigned int rx_buf_size_idx = d->dma_addr & RX_BUF_SIZE;
+	unsigned int buf_size = 0;
+
+	switch (rx_buf_size_idx) {
+	case RX_SMALL_MTU_BUF:
+		buf_size = FL_MTU_SMALL_BUFSIZE(adapter);
+		break;
+
+	case RX_LARGE_MTU_BUF:
+		buf_size = FL_MTU_LARGE_BUFSIZE(adapter);
+		break;
+
+	default:
+		BUG_ON(1);
+		/* NOT REACHED */
+	}
+
+	return buf_size;
+}
+
 /**
  * free_rx_bufs - free the Rx buffers on an SGE free list
  * @q: the SGE free list to free buffers from
@@ -362,6 +385,14 @@ static unsigned int refill_fl_usembufs(struct adapter *adap, struct sge_fl *q,
 	unsigned int buf_size_idx = RX_SMALL_MTU_BUF;
 	struct rte_mbuf *buf_bulk[n];
 	int ret, i;
+	struct rte_pktmbuf_pool_private *mbp_priv;
+	u8 jumbo_en = rxq->rspq.eth_dev->data->dev_conf.rxmode.jumbo_frame;
+
+	/* Use jumbo mtu buffers iff mbuf data room size can fit jumbo data. */
+	mbp_priv = rte_mempool_get_priv(rxq->rspq.mb_pool);
+	if (jumbo_en &&
+	    ((mbp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM) >= 9000))
+		buf_size_idx = RX_LARGE_MTU_BUF;
 
 	ret = rte_mempool_get_bulk(rxq->rspq.mb_pool, (void *)buf_bulk, n);
 	if (unlikely(ret != 0)) {
@@ -1432,14 +1463,31 @@ static int process_responses(struct sge_rspq *q, int budget,
 			const struct cpl_rx_pkt *cpl =
 						(const void *)&q->cur_desc[1];
 			bool csum_ok = cpl->csum_calc && !cpl->err_vec;
-			struct rte_mbuf *pkt;
-			u32 len = ntohl(rc->pldbuflen_qid);
+			struct rte_mbuf *pkt, *npkt;
+			u32 len, bufsz;
 
+			len = ntohl(rc->pldbuflen_qid);
 			BUG_ON(!(len & F_RSPD_NEWBUF));
 			pkt = rsd->buf;
-			pkt->data_len = G_RSPD_LEN(len);
-			pkt->pkt_len = pkt->data_len;
-			unmap_rx_buf(&rxq->fl);
+			npkt = pkt;
+			len = G_RSPD_LEN(len);
+			pkt->pkt_len = len;
+
+			/* Chain mbufs into len if necessary */
+			while (len) {
+				struct rte_mbuf *new_pkt = rsd->buf;
+
+				bufsz = min(get_buf_size(q->adapter, rsd), len);
+				new_pkt->data_len = bufsz;
+				unmap_rx_buf(&rxq->fl);
+				len -= bufsz;
+				npkt->next = new_pkt;
+				npkt = new_pkt;
+				pkt->nb_segs++;
+				rsd = &rxq->fl.sdesc[rxq->fl.cidx];
+			}
+			npkt->next = NULL;
+			pkt->nb_segs--;
 
 			if (cpl->l2info & htonl(F_RXF_IP)) {
 				pkt->packet_type = RTE_PTYPE_L3_IPV4;
-- 
2.5.3

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [dpdk-dev] [PATCH v2 5/6] cxgbe: Allow apps to change mtu
  2015-10-08 13:46 ` [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
                     ` (3 preceding siblings ...)
  2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 4/6] cxgbe: Update rx path to receive " Rahul Lakkireddy
@ 2015-10-08 13:46   ` Rahul Lakkireddy
  2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 6/6] doc: Update cxgbe documentation and release notes Rahul Lakkireddy
  2015-10-20 16:51   ` [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Thomas Monjalon
  6 siblings, 0 replies; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-08 13:46 UTC (permalink / raw)
  To: dev; +Cc: Felix Marti, Kumar Sanghvi, Nirranjan Kirubaharan

Add a mtu_set() eth_dev_ops to allow DPDK apps to modify device mtu.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
v2:
- No change

 drivers/net/cxgbe/cxgbe_ethdev.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 6d7b29c..a8e057b 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -225,6 +225,34 @@ static int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev,
 	return 0;
 }
 
+static int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+	struct rte_eth_dev_info dev_info;
+	int err;
+	uint16_t new_mtu = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+
+	cxgbe_dev_info_get(eth_dev, &dev_info);
+
+	/* Must accommodate at least ETHER_MIN_MTU */
+	if ((new_mtu < ETHER_MIN_MTU) || (new_mtu > dev_info.max_rx_pktlen))
+		return -EINVAL;
+
+	/* set to jumbo mode if needed */
+	if (new_mtu > ETHER_MAX_LEN)
+		eth_dev->data->dev_conf.rxmode.jumbo_frame = 1;
+	else
+		eth_dev->data->dev_conf.rxmode.jumbo_frame = 0;
+
+	err = t4_set_rxmode(adapter, adapter->mbox, pi->viid, new_mtu, -1, -1,
+			    -1, -1, true);
+	if (!err)
+		eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = new_mtu;
+
+	return err;
+}
+
 static int cxgbe_dev_tx_queue_start(struct rte_eth_dev *eth_dev,
 				    uint16_t tx_queue_id);
 static int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev,
@@ -724,6 +752,7 @@ static struct eth_dev_ops cxgbe_eth_dev_ops = {
 	.dev_configure		= cxgbe_dev_configure,
 	.dev_infos_get		= cxgbe_dev_info_get,
 	.link_update		= cxgbe_dev_link_update,
+	.mtu_set		= cxgbe_dev_mtu_set,
 	.tx_queue_setup         = cxgbe_dev_tx_queue_setup,
 	.tx_queue_start		= cxgbe_dev_tx_queue_start,
 	.tx_queue_stop		= cxgbe_dev_tx_queue_stop,
-- 
2.5.3

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [dpdk-dev] [PATCH v2 6/6] doc: Update cxgbe documentation and release notes
  2015-10-08 13:46 ` [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
                     ` (4 preceding siblings ...)
  2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 5/6] cxgbe: Allow apps to change mtu Rahul Lakkireddy
@ 2015-10-08 13:46   ` Rahul Lakkireddy
  2015-10-20 16:51   ` [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Thomas Monjalon
  6 siblings, 0 replies; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-08 13:46 UTC (permalink / raw)
  To: dev; +Cc: Felix Marti, Kumar Sanghvi, Nirranjan Kirubaharan

- Add a missed step to mount huge pages in Linux.
- Re-structure Sample Application Notes.
- Add Jumbo Frame support to list of supported features and instructions
  on how to enable it via testpmd.
- Update release notes.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
v2:
- No change

 doc/guides/nics/cxgbe.rst            | 81 +++++++++++++++++++++++++-----------
 doc/guides/rel_notes/release_2_2.rst |  5 +++
 2 files changed, 61 insertions(+), 25 deletions(-)

diff --git a/doc/guides/nics/cxgbe.rst b/doc/guides/nics/cxgbe.rst
index 148cd25..d718f19 100644
--- a/doc/guides/nics/cxgbe.rst
+++ b/doc/guides/nics/cxgbe.rst
@@ -50,6 +50,7 @@ CXGBE PMD has support for:
 - Promiscuous mode
 - All multicast mode
 - Port hardware statistics
+- Jumbo frames
 
 Limitations
 -----------
@@ -211,8 +212,8 @@ Unified Wire package for Linux operating system are as follows:
 
       firmware-version: 1.13.32.0, TP 0.1.4.8
 
-Sample Application Notes
-~~~~~~~~~~~~~~~~~~~~~~~~
+Running testpmd
+~~~~~~~~~~~~~~~
 
 This section demonstrates how to launch **testpmd** with Chelsio T5
 devices managed by librte_pmd_cxgbe in Linux operating system.
@@ -260,6 +261,13 @@ devices managed by librte_pmd_cxgbe in Linux operating system.
 
       echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages/nr_hugepages
 
+#. Mount huge pages:
+
+   .. code-block:: console
+
+      mkdir /mnt/huge
+      mount -t hugetlbfs nodev /mnt/huge
+
 #. Load igb_uio or vfio-pci driver:
 
    .. code-block:: console
@@ -329,19 +337,7 @@ devices managed by librte_pmd_cxgbe in Linux operating system.
 .. note::
 
    Flow control pause TX/RX is disabled by default and can be enabled via
-   testpmd as follows:
-
-   .. code-block:: console
-
-      testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 0
-      testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 1
-
-   To disable again, use:
-
-   .. code-block:: console
-
-      testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 0
-      testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 1
+   testpmd. Refer section :ref:`flow-control` for more details.
 
 FreeBSD
 -------
@@ -409,8 +405,8 @@ Unified Wire package for FreeBSD operating system are as follows:
 
       dev.t5nex.0.firmware_version: 1.13.32.0
 
-Sample Application Notes
-~~~~~~~~~~~~~~~~~~~~~~~~
+Running testpmd
+~~~~~~~~~~~~~~~
 
 This section demonstrates how to launch **testpmd** with Chelsio T5
 devices managed by librte_pmd_cxgbe in FreeBSD operating system.
@@ -543,16 +539,51 @@ devices managed by librte_pmd_cxgbe in FreeBSD operating system.
 .. note::
 
    Flow control pause TX/RX is disabled by default and can be enabled via
-   testpmd as follows:
+   testpmd. Refer section :ref:`flow-control` for more details.
 
-   .. code-block:: console
+Sample Application Notes
+------------------------
 
-      testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 0
-      testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 1
+.. _flow-control:
 
-   To disable again, use:
+Enable/Disable Flow Control
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-   .. code-block:: console
+Flow control pause TX/RX is disabled by default and can be enabled via
+testpmd as follows:
+
+.. code-block:: console
+
+   testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 0
+   testpmd> set flow_ctrl rx on tx on 0 0 0 0 mac_ctrl_frame_fwd off autoneg on 1
+
+To disable again, run:
+
+.. code-block:: console
+
+   testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 0
+   testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 1
+
+Jumbo Mode
+~~~~~~~~~~
+
+There are two ways to enable sending and receiving of jumbo frames via testpmd.
+One method involves using the **mtu** command, which changes the mtu of an
+individual port without having to stop the selected port. Another method
+involves stopping all the ports first and then running **max-pkt-len** command
+to configure the mtu of all the ports with a single command.
+
+- To configure each port individually, run the mtu command as follows:
+
+  .. code-block:: console
+
+     testpmd> port config mtu 0 9000
+     testpmd> port config mtu 1 9000
+
+- To configure all the ports at once, stop all the ports first and run the
+  max-pkt-len command as follows:
+
+  .. code-block:: console
 
-      testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 0
-      testpmd> set flow_ctrl rx off tx off 0 0 0 0 mac_ctrl_frame_fwd off autoneg off 1
+     testpmd> port stop all
+     testpmd> port config all max-pkt-len 9000
diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index 5687676..a3f4f77 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -4,6 +4,11 @@ DPDK Release 2.2
 New Features
 ------------
 
+* **Enhanced support for the Chelsio CXGBE driver.**
+
+  *  Added support for Jumbo Frames.
+  *  Optimize forwarding performance for Chelsio T5 40GbE cards.
+
 
 Resolved Issues
 ---------------
-- 
2.5.3

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD
  2015-10-08 13:46 ` [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
                     ` (5 preceding siblings ...)
  2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 6/6] doc: Update cxgbe documentation and release notes Rahul Lakkireddy
@ 2015-10-20 16:51   ` Thomas Monjalon
  2015-10-21  6:14     ` Rahul Lakkireddy
  6 siblings, 1 reply; 23+ messages in thread
From: Thomas Monjalon @ 2015-10-20 16:51 UTC (permalink / raw)
  To: Rahul Lakkireddy; +Cc: dev, Felix Marti, Nirranjan Kirubaharan, Kumar Sanghvi

2015-10-08 19:16, Rahul Lakkireddy:
> This series of patches improve forwarding performance for Chelsio T5 40GbE
> cards and add Jumbo Frame support for cxgbe pmd. Also update documentation
> and release notes.

Applied, thanks.

What are the performance numbers with these patches?

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD
  2015-10-20 16:51   ` [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Thomas Monjalon
@ 2015-10-21  6:14     ` Rahul Lakkireddy
  0 siblings, 0 replies; 23+ messages in thread
From: Rahul Lakkireddy @ 2015-10-21  6:14 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Felix Marti, Nirranjan Kirubaharan, Kumar A S

Hi Thomas,

On Tuesday, October 10/20/15, 2015 at 09:51:07 -0700, Thomas Monjalon wrote:
> 2015-10-08 19:16, Rahul Lakkireddy:
> > This series of patches improve forwarding performance for Chelsio T5 40GbE
> > cards and add Jumbo Frame support for cxgbe pmd. Also update documentation
> > and release notes.
> 
> Applied, thanks.
> 
> What are the performance numbers with these patches?

Without this patch series, the l3fwd perf with 8 queues for 64B was ~28 MPPS.
With this patch series, the perf has improved to ~31 MPPS.

Thanks,
Rahul

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2015-10-21  6:14 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-02 11:16 [dpdk-dev] [PATCH 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
2015-10-02 11:16 ` [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G Rahul Lakkireddy
2015-10-02 21:48   ` Aaron Conole
2015-10-05 10:06     ` Rahul Lakkireddy
2015-10-05 11:46       ` Ananyev, Konstantin
2015-10-05 12:42         ` Rahul Lakkireddy
2015-10-05 14:09           ` Ananyev, Konstantin
2015-10-05 15:07             ` Rahul Lakkireddy
2015-10-07 15:27               ` Rahul Lakkireddy
2015-10-02 11:16 ` [dpdk-dev] [PATCH 2/6] cxgbe: Update device info and perform sanity checks to enable jumbo frames Rahul Lakkireddy
2015-10-02 11:16 ` [dpdk-dev] [PATCH 3/6] cxgbe: Update tx path to transmit " Rahul Lakkireddy
2015-10-02 11:16 ` [dpdk-dev] [PATCH 4/6] cxgbe: Update rx path to receive " Rahul Lakkireddy
2015-10-02 11:16 ` [dpdk-dev] [PATCH 5/6] cxgbe: Allow apps to change mtu Rahul Lakkireddy
2015-10-02 11:16 ` [dpdk-dev] [PATCH 6/6] doc: Update cxgbe documentation and release notes Rahul Lakkireddy
2015-10-08 13:46 ` [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Rahul Lakkireddy
2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 1/6] cxgbe: Optimize forwarding performance for 40G Rahul Lakkireddy
2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 2/6] cxgbe: Update device info and perform sanity checks to enable jumbo frames Rahul Lakkireddy
2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 3/6] cxgbe: Update tx path to transmit " Rahul Lakkireddy
2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 4/6] cxgbe: Update rx path to receive " Rahul Lakkireddy
2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 5/6] cxgbe: Allow apps to change mtu Rahul Lakkireddy
2015-10-08 13:46   ` [dpdk-dev] [PATCH v2 6/6] doc: Update cxgbe documentation and release notes Rahul Lakkireddy
2015-10-20 16:51   ` [dpdk-dev] [PATCH v2 0/6] cxgbe: Optimize tx/rx for 40GbE and add Jumbo Frame support for CXGBE PMD Thomas Monjalon
2015-10-21  6:14     ` Rahul Lakkireddy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).