DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
To: dev@dpdk.org
Cc: Kumar Sanghvi <kumaras@chelsio.com>,
	Felix Marti <felix@chelsio.com>,
	Nirranjan Kirubaharan <nirranjan@chelsio.com>
Subject: [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G
Date: Fri,  2 Oct 2015 16:46:50 +0530	[thread overview]
Message-ID: <318fc8559675b1157e7f049a6a955a6a2059bac7.1443704150.git.rahul.lakkireddy@chelsio.com> (raw)
In-Reply-To: <cover.1443704150.git.rahul.lakkireddy@chelsio.com>
In-Reply-To: <cover.1443704150.git.rahul.lakkireddy@chelsio.com>

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

  reply	other threads:[~2015-10-02 11:17 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-10-02 21:48   ` [dpdk-dev] [PATCH 1/6] cxgbe: Optimize forwarding performance for 40G 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=318fc8559675b1157e7f049a6a955a6a2059bac7.1443704150.git.rahul.lakkireddy@chelsio.com \
    --to=rahul.lakkireddy@chelsio.com \
    --cc=dev@dpdk.org \
    --cc=felix@chelsio.com \
    --cc=kumaras@chelsio.com \
    --cc=nirranjan@chelsio.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).