diff mbox series

[13/14] net/ionic: fix Tx fragment limit check

Message ID 20210204195853.13411-14-aboyer@pensando.io (mailing list archive)
State Superseded
Delegated to: Ferruh Yigit
Headers show
Series net/ionic: struct optimizations, fixes | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andrew Boyer Feb. 4, 2021, 7:58 p.m. UTC
This was missed when updating to the v1 Tx queue structures.

Store the value in the queue for easy access.

Fixes: 786c64763b50 ("net/ionic: clean up Tx queue version support")
Signed-off-by: Andrew Boyer <aboyer@pensando.io>
---
 drivers/net/ionic/ionic_lif.c  | 6 +++++-
 drivers/net/ionic/ionic_lif.h  | 1 +
 drivers/net/ionic/ionic_rxtx.c | 6 +++---
 3 files changed, 9 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c
index dd79068948..b8023e0632 100644
--- a/drivers/net/ionic/ionic_lif.c
+++ b/drivers/net/ionic/ionic_lif.c
@@ -757,10 +757,13 @@  ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 		uint16_t ntxq_descs, struct ionic_tx_qcq **txq_out)
 {
 	struct ionic_tx_qcq *txq;
-	uint16_t flags;
+	uint16_t flags, num_segs_fw;
 	int err;
 
 	flags = IONIC_QCQ_F_SG;
+
+	num_segs_fw = IONIC_TX_MAX_SG_ELEMS_V1 + 1;
+
 	err = ionic_qcq_alloc(lif,
 		IONIC_QTYPE_TXQ,
 		sizeof(struct ionic_tx_qcq),
@@ -777,6 +780,7 @@  ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 		return err;
 
 	txq->flags = flags;
+	txq->num_segs_fw = num_segs_fw;
 
 	lif->txqcqs[index] = txq;
 	*txq_out = txq;
diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h
index 5885aa1546..9f00ba2973 100644
--- a/drivers/net/ionic/ionic_lif.h
+++ b/drivers/net/ionic/ionic_lif.h
@@ -92,6 +92,7 @@  struct ionic_tx_qcq {
 	struct ionic_qcq qcq;
 
 	/* cacheline2 */
+	uint16_t num_segs_fw;	/* # segs supported by current FW */
 	uint16_t flags;
 
 	struct ionic_tx_stats stats;
diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c
index 81182b5dc4..b83ea1bcaa 100644
--- a/drivers/net/ionic/ionic_rxtx.c
+++ b/drivers/net/ionic/ionic_rxtx.c
@@ -598,9 +598,9 @@  ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	(PKT_TX_OFFLOAD_MASK ^ IONIC_TX_OFFLOAD_MASK)
 
 uint16_t
-ionic_prep_pkts(void *tx_queue __rte_unused, struct rte_mbuf **tx_pkts,
-		uint16_t nb_pkts)
+ionic_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
+	struct ionic_tx_qcq *txq = tx_queue;
 	struct rte_mbuf *txm;
 	uint64_t offloads;
 	int i = 0;
@@ -608,7 +608,7 @@  ionic_prep_pkts(void *tx_queue __rte_unused, struct rte_mbuf **tx_pkts,
 	for (i = 0; i < nb_pkts; i++) {
 		txm = tx_pkts[i];
 
-		if (txm->nb_segs > IONIC_TX_MAX_SG_ELEMS) {
+		if (txm->nb_segs > txq->num_segs_fw) {
 			rte_errno = -EINVAL;
 			break;
 		}