DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Boyer <aboyer@pensando.io>
To: dev@dpdk.org
Cc: Alfredo Cardigliano <cardigliano@ntop.org>,
	Andrew Boyer <aboyer@pensando.io>
Subject: [dpdk-dev] [PATCH 11/13] net/ionic: convert per-queue offloads into queue flags
Date: Mon, 18 Jan 2021 12:35:06 -0800
Message-ID: <20210118203508.1332-12-aboyer@pensando.io> (raw)
In-Reply-To: <20210118203508.1332-1-aboyer@pensando.io>

This will conserve resources by reducing struct ionic_qcq.

Saving a cacheline or two in the rxq and txq structs helps when
running in embedded configurations where CPU cache space is at a
premium.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
---
 drivers/net/ionic/ionic_lif.h  |  4 +++-
 drivers/net/ionic/ionic_rxtx.c | 35 +++++++++++++++++++---------------
 2 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h
index bf5637afce..8f01aefd60 100644
--- a/drivers/net/ionic/ionic_lif.h
+++ b/drivers/net/ionic/ionic_lif.h
@@ -49,10 +49,12 @@ struct ionic_rx_stats {
 #define IONIC_QCQ_F_INITED	BIT(0)
 #define IONIC_QCQ_F_SG		BIT(1)
 #define IONIC_QCQ_F_DEFERRED	BIT(4)
+#define IONIC_QCQ_F_CSUM_L3	BIT(7)
+#define IONIC_QCQ_F_CSUM_UDP	BIT(8)
+#define IONIC_QCQ_F_CSUM_TCP	BIT(9)
 
 /* Queue / Completion Queue */
 struct ionic_qcq {
-	uint64_t offloads;
 	struct ionic_queue q;        /**< Queue */
 	struct ionic_cq cq;          /**< Completion Queue */
 	struct ionic_lif *lif;       /**< LIF */
diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c
index d0f8954753..918701f463 100644
--- a/drivers/net/ionic/ionic_rxtx.c
+++ b/drivers/net/ionic/ionic_rxtx.c
@@ -63,7 +63,7 @@ ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	struct ionic_queue *q = &txq->q;
 
 	qinfo->nb_desc = q->num_descs;
-	qinfo->conf.offloads = txq->offloads;
+	qinfo->conf.offloads = dev->data->dev_conf.txmode.offloads;
 	qinfo->conf.tx_deferred_start = txq->flags & IONIC_QCQ_F_DEFERRED;
 }
 
@@ -200,7 +200,13 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id,
 	if (tx_conf->tx_deferred_start)
 		txq->flags |= IONIC_QCQ_F_DEFERRED;
 
-	txq->offloads = offloads;
+	/* Convert the offload flags into queue flags */
+	if (offloads & DEV_TX_OFFLOAD_IPV4_CKSUM)
+		txq->flags |= IONIC_QCQ_F_CSUM_L3;
+	if (offloads & DEV_TX_OFFLOAD_TCP_CKSUM)
+		txq->flags |= IONIC_QCQ_F_CSUM_TCP;
+	if (offloads & DEV_TX_OFFLOAD_UDP_CKSUM)
+		txq->flags |= IONIC_QCQ_F_CSUM_UDP;
 
 	eth_dev->data->tx_queues[tx_queue_id] = txq;
 
@@ -320,9 +326,10 @@ ionic_tx_tso_next(struct ionic_queue *q, struct ionic_txq_sg_elem **elem)
 }
 
 static int
-ionic_tx_tso(struct ionic_queue *q, struct rte_mbuf *txm,
-		uint64_t offloads __rte_unused, bool not_xmit_more)
+ionic_tx_tso(struct ionic_qcq *txq, struct rte_mbuf *txm,
+		bool not_xmit_more)
 {
+	struct ionic_queue *q = &txq->q;
 	struct ionic_tx_stats *stats = IONIC_Q_TO_TX_STATS(q);
 	struct ionic_txq_desc *desc;
 	struct ionic_txq_sg_elem *elem;
@@ -442,9 +449,10 @@ ionic_tx_tso(struct ionic_queue *q, struct rte_mbuf *txm,
 }
 
 static int
-ionic_tx(struct ionic_queue *q, struct rte_mbuf *txm,
-		uint64_t offloads, bool not_xmit_more)
+ionic_tx(struct ionic_qcq *txq, struct rte_mbuf *txm,
+		bool not_xmit_more)
 {
+	struct ionic_queue *q = &txq->q;
 	struct ionic_txq_desc *desc_base = q->base;
 	struct ionic_txq_sg_desc_v1 *sg_desc_base = q->sg_base;
 	struct ionic_txq_desc *desc = &desc_base[q->head_idx];
@@ -460,15 +468,15 @@ ionic_tx(struct ionic_queue *q, struct rte_mbuf *txm,
 	uint8_t flags = 0;
 
 	if ((ol_flags & PKT_TX_IP_CKSUM) &&
-	    (offloads & DEV_TX_OFFLOAD_IPV4_CKSUM)) {
+	    (txq->flags & IONIC_QCQ_F_CSUM_L3)) {
 		opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW;
 		flags |= IONIC_TXQ_DESC_FLAG_CSUM_L3;
 	}
 
 	if (((ol_flags & PKT_TX_TCP_CKSUM) &&
-	     (offloads & DEV_TX_OFFLOAD_TCP_CKSUM)) ||
+	     (txq->flags & IONIC_QCQ_F_CSUM_TCP)) ||
 	    ((ol_flags & PKT_TX_UDP_CKSUM) &&
-	     (offloads & DEV_TX_OFFLOAD_UDP_CKSUM))) {
+	     (txq->flags & IONIC_QCQ_F_CSUM_UDP))) {
 		opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW;
 		flags |= IONIC_TXQ_DESC_FLAG_CSUM_L4;
 	}
@@ -536,10 +544,9 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		}
 
 		if (tx_pkts[nb_tx]->ol_flags & PKT_TX_TCP_SEG)
-			err = ionic_tx_tso(q, tx_pkts[nb_tx], txq->offloads,
-				last);
+			err = ionic_tx_tso(txq, tx_pkts[nb_tx], last);
 		else
-			err = ionic_tx(q, tx_pkts[nb_tx], txq->offloads, last);
+			err = ionic_tx(txq, tx_pkts[nb_tx], last);
 		if (err) {
 			stats->drop += nb_pkts - nb_tx;
 			if (nb_tx > 0)
@@ -621,7 +628,7 @@ ionic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	qinfo->scattered_rx = dev->data->scattered_rx;
 	qinfo->nb_desc = q->num_descs;
 	qinfo->conf.rx_deferred_start = rxq->flags & IONIC_QCQ_F_DEFERRED;
-	qinfo->conf.offloads = rxq->offloads;
+	qinfo->conf.offloads = dev->data->dev_conf.rxmode.offloads;
 }
 
 static void __rte_cold
@@ -724,8 +731,6 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	if (rx_conf->rx_deferred_start)
 		rxq->flags |= IONIC_QCQ_F_DEFERRED;
 
-	rxq->offloads = offloads;
-
 	eth_dev->data->rx_queues[rx_queue_id] = rxq;
 
 	return 0;
-- 
2.17.1


  parent reply	other threads:[~2021-01-18 20:36 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18 20:34 [dpdk-dev] [PATCH 00/13] net/ionic: fixes and optimizations Andrew Boyer
2021-01-18 20:34 ` [dpdk-dev] [PATCH 01/13] net/ionic: strip out unneeded interrupt code Andrew Boyer
2021-01-18 20:34 ` [dpdk-dev] [PATCH 02/13] net/ionic: observe endianness in firmware commands Andrew Boyer
2021-01-18 20:34 ` [dpdk-dev] [PATCH 03/13] net/ionic: observe endianness in Rx filter code Andrew Boyer
2021-01-18 20:34 ` [dpdk-dev] [PATCH 04/13] net/ionic: add an array-size macro Andrew Boyer
2021-01-27 17:22   ` Ferruh Yigit
2021-01-27 17:40     ` Andrew Boyer
2021-01-29 22:44   ` [dpdk-dev] [PATCH v2 4/13] net/ionic: use the existing " Andrew Boyer
2021-02-02 12:45     ` Ferruh Yigit
2021-01-18 20:35 ` [dpdk-dev] [PATCH 05/13] net/ionic: query firmware for supported queue versions Andrew Boyer
2021-01-18 20:35 ` [dpdk-dev] [PATCH 06/13] net/ionic: clean up Tx queue version support Andrew Boyer
2021-01-27 17:30   ` Ferruh Yigit
2021-01-27 17:46     ` Andrew Boyer
2021-01-29 22:44   ` [dpdk-dev] [PATCH v2 6/13] " Andrew Boyer
2021-02-02 12:46     ` Ferruh Yigit
2021-02-05 20:20     ` Thomas Monjalon
2021-02-05 20:26       ` Andrew Boyer
2021-02-05 20:34         ` Thomas Monjalon
2021-01-18 20:35 ` [dpdk-dev] [PATCH 07/13] net/ionic: inline queue flush function Andrew Boyer
2021-01-27 17:36   ` Ferruh Yigit
2021-01-27 17:43     ` Andrew Boyer
2021-01-27 17:50       ` Ferruh Yigit
2021-01-18 20:35 ` [dpdk-dev] [PATCH 08/13] net/ionic: inline queue space function Andrew Boyer
2021-01-18 20:35 ` [dpdk-dev] [PATCH 09/13] net/ionic: observe endiannness in ioread/iowrite Andrew Boyer
2021-01-18 20:35 ` [dpdk-dev] [PATCH 10/13] net/ionic: fix to allow separate L3 and L4 csum offload Andrew Boyer
2021-01-18 20:35 ` Andrew Boyer [this message]
2021-01-18 20:35 ` [dpdk-dev] [PATCH 12/13] net/ionic: fix up function attribute tags Andrew Boyer
2021-01-18 20:35 ` [dpdk-dev] [PATCH 13/13] net/ionic: fix address handling in transmit code Andrew Boyer
2021-01-27 18:02 ` [dpdk-dev] [PATCH 00/13] net/ionic: fixes and optimizations Ferruh Yigit
2021-01-27 18:10   ` Andrew Boyer
2021-01-27 22:23     ` Ferruh Yigit
2021-01-27 22:25       ` Ferruh Yigit
2021-01-29 22:44 [dpdk-dev] [PATCH] net: redefine array size macros Andrew Boyer
2021-02-01 22:28 ` Thomas Monjalon
2021-02-01 22:32   ` Andrew Boyer
2021-02-02 12:30     ` Ferruh Yigit
2021-02-22 17:09       ` Ferruh Yigit

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=20210118203508.1332-12-aboyer@pensando.io \
    --to=aboyer@pensando.io \
    --cc=cardigliano@ntop.org \
    --cc=dev@dpdk.org \
    /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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git