Skip to contentSkip to conversation

net/ionic: updates for 22.11 release

PATCH In review Andrew Boyer 2 participants 113 messages Oct 7, 2022 – Oct 18, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover net/ionic: updates for 22.11 release

This patch series provides features and performance improvements relevant for the upstream release of DPDK 22.11.

There are some bits (like struct ionic_dev_intf) only useful for drivers and device types which have not yet been upstreamed. All of the changes are confined to the ionic PMD.

Links to the product brief PDFs in patch 6 will be added as soon as they are available.

Andrew Boyer (35):
net/ionic: fix up endianness for Rx and Tx handling net/ionic: fix up endianness for RSS
net/ionic: fix to set the adapter name for logging net/ionic: fix up the Rx filter save API net/ionic: fix up reported error stats net/ionic: update documentation and copyrights net/ionic: update license terms to remove GPL net/ionic: update MTU calculations
net/ionic: simplify code by removing doorbell map helper net/ionic: remove unused identifiers
net/ionic: only allocate interrupts if required net/ionic: move PCI-specific code to a separate file net/ionic: only request notifyq interrupt if supported net/ionic: replace void pointer with actual type net/ionic: free all buffers during Rx queue stop net/ionic: precalculate segment lengths on receive side net/ionic: use a helper variable in packet Tx function net/ionic: do one-time init of receive descriptors net/ionic: overhaul receive side for performance net/ionic: overhaul transmit side for performance net/ionic: add support for mbuf fast free net/ionic: do bulk allocations of receive mbufs net/ionic: add a lookup table for packet type net/ionic: add a lookup table for checksum flags net/ionic: advertise supported packet types net/ionic: add Rx descriptor status functions net/ionic: add Tx descriptor status function net/ionic: add Q-in-CMB option controlled by devarg net/ionic: update array allocations to use calloc net/ionic: add alignment and socket info in allocations net/ionic: allow client to specify Tx free threshold net/ionic: add optimized handlers for non-scattered Rx/Tx net/ionic: use a helper variable for page size net/ionic: retry init commands up to five times net/ionic: add watchdogs to protect each queue type

 MAINTAINERS                            |   4 +-
 doc/guides/nics/features/ionic.ini     |   3 +
 doc/guides/nics/ionic.rst              |  28 +-
 doc/guides/rel_notes/release_22_11.rst |  11 +
 drivers/net/ionic/ionic.h              |  27 +-
 drivers/net/ionic/ionic_dev.c          |  79 +--
 drivers/net/ionic/ionic_dev.h          |  40 +-
 drivers/net/ionic/ionic_dev_pci.c      | 274 ++++++++
 drivers/net/ionic/ionic_ethdev.c       | 254 +++----
 drivers/net/ionic/ionic_ethdev.h       |  15 +-
 drivers/net/ionic/ionic_if.h           |  13 +-
 drivers/net/ionic/ionic_lif.c          | 310 ++++++---
 drivers/net/ionic/ionic_lif.h          |  33 +-
 drivers/net/ionic/ionic_logs.h         |   4 +-
 drivers/net/ionic/ionic_mac_api.c      |   4 +-
 drivers/net/ionic/ionic_mac_api.h      |   4 +-
 drivers/net/ionic/ionic_main.c         |  32 +-
 drivers/net/ionic/ionic_osdep.h        |   4 +-
 drivers/net/ionic/ionic_regs.h         |   4 +-
 drivers/net/ionic/ionic_rx_filter.c    |   9 +-
 drivers/net/ionic/ionic_rx_filter.h    |   4 +-
 drivers/net/ionic/ionic_rxtx.c         | 916 +++++++++----------------
 drivers/net/ionic/ionic_rxtx.h         |  56 +-
 drivers/net/ionic/ionic_rxtx_sg.c      | 544 +++++++++++++++
 drivers/net/ionic/ionic_rxtx_simple.c  | 465 +++++++++++++
 drivers/net/ionic/meson.build          |   7 +-
 26 files changed, 2154 insertions(+), 990 deletions(-)
 create mode 100644 drivers/net/ionic/ionic_dev_pci.c
 create mode 100644 drivers/net/ionic/ionic_rxtx_sg.c
 create mode 100644 drivers/net/ionic/ionic_rxtx_simple.c
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/35 net/ionic: fix up endianness for Rx and Tx handling

These fields all need to be LE when talking to the FW.

Fixes a27d901331da ("net/ionic: add Rx and Tx handling")
---
 drivers/net/ionic/ionic_rxtx.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/net/ionic/ionic_rxtx.c +15 -12
index 9f602de6a9..af2d89f9fa 100644
@@ -300,18 +300,20 @@ ionic_tx_tso_post(struct ionic_queue *q, struct ionic_txq_desc *desc,
 		bool start, bool done)
 {
 	void **info;
+	uint64_t cmd;
 	uint8_t flags = 0;
 	flags |= has_vlan ? IONIC_TXQ_DESC_FLAG_VLAN : 0;
 	flags |= encap ? IONIC_TXQ_DESC_FLAG_ENCAP : 0;
 	flags |= start ? IONIC_TXQ_DESC_FLAG_TSO_SOT : 0;
 	flags |= done ? IONIC_TXQ_DESC_FLAG_TSO_EOT : 0;
 
-	desc->cmd = encode_txq_desc_cmd(IONIC_TXQ_DESC_OPCODE_TSO,
+	cmd = encode_txq_desc_cmd(IONIC_TXQ_DESC_OPCODE_TSO,
 		flags, nsge, addr);
-	desc->len = len;
-	desc->vlan_tci = vlan_tci;
-	desc->hdr_len = hdrlen;
-	desc->mss = mss;
+	desc->cmd = rte_cpu_to_le_64(cmd);
+	desc->len = rte_cpu_to_le_16(len);
+	desc->vlan_tci = rte_cpu_to_le_16(vlan_tci);
+	desc->hdr_len = rte_cpu_to_le_16(hdrlen);
+	desc->mss = rte_cpu_to_le_16(mss);
 
 	if (done) {
 		info = IONIC_INFO_PTR(q, q->head_idx);
@@ -423,7 +425,7 @@ ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm)
 				len = RTE_MIN(frag_left, left);
 				frag_left -= len;
 				elem->addr = next_addr;
-				elem->len = len;
+				elem->len = rte_cpu_to_le_16(len);
 				elem++;
 				desc_nsge++;
 			} else {
@@ -470,7 +472,7 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm)
 	bool encap;
 	bool has_vlan;
 	uint64_t ol_flags = txm->ol_flags;
-	uint64_t addr;
+	uint64_t addr, cmd;
 	uint8_t opcode = IONIC_TXQ_DESC_OPCODE_CSUM_NONE;
 	uint8_t flags = 0;
 
@@ -505,9 +507,10 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm)
 
 	addr = rte_cpu_to_le_64(rte_mbuf_data_iova(txm));
 
-	desc->cmd = encode_txq_desc_cmd(opcode, flags, txm->nb_segs - 1, addr);
-	desc->len = txm->data_len;
-	desc->vlan_tci = txm->vlan_tci;
+	cmd = encode_txq_desc_cmd(opcode, flags, txm->nb_segs - 1, addr);
+	desc->cmd = rte_cpu_to_le_64(cmd);
+	desc->len = rte_cpu_to_le_16(txm->data_len);
+	desc->vlan_tci = rte_cpu_to_le_16(txm->vlan_tci);
 
 	info[0] = txm;
 
@@ -515,7 +518,7 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm)
 
 	txm_seg = txm->next;
 	while (txm_seg != NULL) {
-		elem->len = txm_seg->data_len;
+		elem->len = rte_cpu_to_le_16(txm_seg->data_len);
 		elem->addr = rte_cpu_to_le_64(rte_mbuf_data_iova(txm_seg));
 		elem++;
 		txm_seg = txm_seg->next;
@@ -845,7 +848,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 	/* Vlan Strip */
 	if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_VLAN) {
 		pkt_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED;
-		rxm->vlan_tci = cq_desc->vlan_tci;
+		rxm->vlan_tci = rte_le_to_cpu_16(cq_desc->vlan_tci);
 	}
 
 	/* Checksum */
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/35 net/ionic: fix up endianness for Rx and Tx handling

In reply to Andrew Boyer

These fields all need to be LE when talking to the FW.

Fixes a27d901331da ("net/ionic: add Rx and Tx handling")
---
 drivers/net/ionic/ionic_rxtx.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/net/ionic/ionic_rxtx.c +15 -12
index 9f602de6a9..af2d89f9fa 100644
@@ -300,18 +300,20 @@ ionic_tx_tso_post(struct ionic_queue *q, struct ionic_txq_desc *desc,
 		bool start, bool done)
 {
 	void **info;
+	uint64_t cmd;
 	uint8_t flags = 0;
 	flags |= has_vlan ? IONIC_TXQ_DESC_FLAG_VLAN : 0;
 	flags |= encap ? IONIC_TXQ_DESC_FLAG_ENCAP : 0;
 	flags |= start ? IONIC_TXQ_DESC_FLAG_TSO_SOT : 0;
 	flags |= done ? IONIC_TXQ_DESC_FLAG_TSO_EOT : 0;
 
-	desc->cmd = encode_txq_desc_cmd(IONIC_TXQ_DESC_OPCODE_TSO,
+	cmd = encode_txq_desc_cmd(IONIC_TXQ_DESC_OPCODE_TSO,
 		flags, nsge, addr);
-	desc->len = len;
-	desc->vlan_tci = vlan_tci;
-	desc->hdr_len = hdrlen;
-	desc->mss = mss;
+	desc->cmd = rte_cpu_to_le_64(cmd);
+	desc->len = rte_cpu_to_le_16(len);
+	desc->vlan_tci = rte_cpu_to_le_16(vlan_tci);
+	desc->hdr_len = rte_cpu_to_le_16(hdrlen);
+	desc->mss = rte_cpu_to_le_16(mss);
 
 	if (done) {
 		info = IONIC_INFO_PTR(q, q->head_idx);
@@ -423,7 +425,7 @@ ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm)
 				len = RTE_MIN(frag_left, left);
 				frag_left -= len;
 				elem->addr = next_addr;
-				elem->len = len;
+				elem->len = rte_cpu_to_le_16(len);
 				elem++;
 				desc_nsge++;
 			} else {
@@ -470,7 +472,7 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm)
 	bool encap;
 	bool has_vlan;
 	uint64_t ol_flags = txm->ol_flags;
-	uint64_t addr;
+	uint64_t addr, cmd;
 	uint8_t opcode = IONIC_TXQ_DESC_OPCODE_CSUM_NONE;
 	uint8_t flags = 0;
 
@@ -505,9 +507,10 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm)
 
 	addr = rte_cpu_to_le_64(rte_mbuf_data_iova(txm));
 
-	desc->cmd = encode_txq_desc_cmd(opcode, flags, txm->nb_segs - 1, addr);
-	desc->len = txm->data_len;
-	desc->vlan_tci = txm->vlan_tci;
+	cmd = encode_txq_desc_cmd(opcode, flags, txm->nb_segs - 1, addr);
+	desc->cmd = rte_cpu_to_le_64(cmd);
+	desc->len = rte_cpu_to_le_16(txm->data_len);
+	desc->vlan_tci = rte_cpu_to_le_16(txm->vlan_tci);
 
 	info[0] = txm;
 
@@ -515,7 +518,7 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm)
 
 	txm_seg = txm->next;
 	while (txm_seg != NULL) {
-		elem->len = txm_seg->data_len;
+		elem->len = rte_cpu_to_le_16(txm_seg->data_len);
 		elem->addr = rte_cpu_to_le_64(rte_mbuf_data_iova(txm_seg));
 		elem++;
 		txm_seg = txm_seg->next;
@@ -845,7 +848,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 	/* Vlan Strip */
 	if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_VLAN) {
 		pkt_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED;
-		rxm->vlan_tci = cq_desc->vlan_tci;
+		rxm->vlan_tci = rte_le_to_cpu_16(cq_desc->vlan_tci);
 	}
 
 	/* Checksum */
Signature · 1 line
2.17.1
#3 lore raw

PATCH 2/35 net/ionic: fix up endianness for RSS

In reply to Andrew Boyer

This field needs to be LE when talking to the FW.

Fixes 22e7171bc63b ("net/ionic: support RSS")
---
 drivers/net/ionic/ionic_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ionic/ionic_rxtx.c +1 -1
index af2d89f9fa..665d085823 100644
@@ -843,7 +843,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 
 	/* RSS */
 	pkt_flags |= RTE_MBUF_F_RX_RSS_HASH;
-	rxm->hash.rss = cq_desc->rss_hash;
+	rxm->hash.rss = rte_le_to_cpu_32(cq_desc->rss_hash);
 
 	/* Vlan Strip */
 	if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_VLAN) {
Signature · 1 line
2.17.1
#4 lore raw

PATCH 2/35 net/ionic: fix up endianness for RSS

In reply to Andrew Boyer

This field needs to be LE when talking to the FW.

Fixes 22e7171bc63b ("net/ionic: support RSS")
---
 drivers/net/ionic/ionic_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ionic/ionic_rxtx.c +1 -1
index af2d89f9fa..665d085823 100644
@@ -843,7 +843,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 
 	/* RSS */
 	pkt_flags |= RTE_MBUF_F_RX_RSS_HASH;
-	rxm->hash.rss = cq_desc->rss_hash;
+	rxm->hash.rss = rte_le_to_cpu_32(cq_desc->rss_hash);
 
 	/* Vlan Strip */
 	if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_VLAN) {
Signature · 1 line
2.17.1
#5 lore raw

PATCH 3/35 net/ionic: fix to set the adapter name for logging

In reply to Andrew Boyer

Otherwise the log messages will be garbled.

Fixes 4ae96cb88fa0 ("net/ionic: do minor logging fixups")
---
 drivers/net/ionic/ionic_dev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ionic/ionic_dev.c +4 -1
index 43e9ca3de3..5439b99b2d 100644
@@ -55,7 +55,10 @@ ionic_dev_setup(struct ionic_adapter *adapter)
 			ioread8(&idev->dev_info->fw_version[i]);
 	adapter->fw_version[IONIC_DEVINFO_FWVERS_BUFLEN - 1] = '\0';
 
-	IONIC_PRINT(DEBUG, "Firmware version: %s", adapter->fw_version);
+	adapter->name = adapter->pci_dev->device.name;
+
+	IONIC_PRINT(DEBUG, "%s firmware version: %s",
+		adapter->name, adapter->fw_version);
 
 	/* BAR1: doorbells */
 	bar++;
Signature · 1 line
2.17.1
#6 lore raw

PATCH 3/35 net/ionic: fix to set the adapter name for logging

In reply to Andrew Boyer

Otherwise the log messages will be garbled.

Fixes 4ae96cb88fa0 ("net/ionic: do minor logging fixups")
---
 drivers/net/ionic/ionic_dev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ionic/ionic_dev.c +4 -1
index 43e9ca3de3..5439b99b2d 100644
@@ -55,7 +55,10 @@ ionic_dev_setup(struct ionic_adapter *adapter)
 			ioread8(&idev->dev_info->fw_version[i]);
 	adapter->fw_version[IONIC_DEVINFO_FWVERS_BUFLEN - 1] = '\0';
 
-	IONIC_PRINT(DEBUG, "Firmware version: %s", adapter->fw_version);
+	adapter->name = adapter->pci_dev->device.name;
+
+	IONIC_PRINT(DEBUG, "%s firmware version: %s",
+		adapter->name, adapter->fw_version);
 
 	/* BAR1: doorbells */
 	bar++;
Signature · 1 line
2.17.1
#7 lore raw

PATCH 4/35 net/ionic: fix up the Rx filter save API

In reply to Andrew Boyer

Check the match variable after copying cmd info, or else there can be unexpected results.

Fixes a27e0e96ab77 ("net/ionic: observe endianness in Rx filter")
---
 drivers/net/ionic/ionic_rx_filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ionic/ionic_rx_filter.c +1 -1
index bf57a9fa52..4b2e907f9f 100644
@@ -63,8 +63,8 @@ ionic_rx_filter_save(struct ionic_lif *lif, uint32_t flow_id,
 	f->flow_id = flow_id;
 	f->filter_id = rte_le_to_cpu_32(ctx->comp.rx_filter_add.filter_id);
 	f->rxq_index = rxq_index;
-	f->match = rte_le_to_cpu_16(f->cmd.match);
 	memcpy(&f->cmd, &ctx->cmd, sizeof(f->cmd));
+	f->match = rte_le_to_cpu_16(f->cmd.match);
 
 	switch (f->match) {
 	case IONIC_RX_FILTER_MATCH_VLAN:
Signature · 1 line
2.17.1
#8 lore raw

PATCH 4/35 net/ionic: fix up the Rx filter save API

In reply to Andrew Boyer

Check the match variable after copying cmd info, or else there can be unexpected results.

Fixes a27e0e96ab77 ("net/ionic: observe endianness in Rx filter")
---
 drivers/net/ionic/ionic_rx_filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ionic/ionic_rx_filter.c +1 -1
index bf57a9fa52..4b2e907f9f 100644
@@ -63,8 +63,8 @@ ionic_rx_filter_save(struct ionic_lif *lif, uint32_t flow_id,
 	f->flow_id = flow_id;
 	f->filter_id = rte_le_to_cpu_32(ctx->comp.rx_filter_add.filter_id);
 	f->rxq_index = rxq_index;
-	f->match = rte_le_to_cpu_16(f->cmd.match);
 	memcpy(&f->cmd, &ctx->cmd, sizeof(f->cmd));
+	f->match = rte_le_to_cpu_16(f->cmd.match);
 
 	switch (f->match) {
 	case IONIC_RX_FILTER_MATCH_VLAN:
Signature · 1 line
2.17.1
#9 lore raw

PATCH 5/35 net/ionic: fix up reported error stats

In reply to Andrew Boyer

Report descriptor errors in ierrors instead of imissed. Don't report rx_queue_empty or rx_queue_disabled in imissed, since those packet errors are already included in the rx_*_drop_packets counters.
This makes the reported stats correct.

Fixes 3cdfd90579e7 ("net/ionic: add stats")
---
 drivers/net/ionic/ionic_lif.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ionic/ionic_lif.c +2 -4
index 5e8fdf3893..799530f7f5 100644
@@ -132,7 +132,7 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats
 
 	for (i = 0; i < lif->nrxqcqs; i++) {
 		struct ionic_rx_stats *rx_stats = &lif->rxqcqs[i]->stats;
-		stats->imissed +=
+		stats->ierrors +=
 			rx_stats->no_cb_arg +
 			rx_stats->bad_cq_status +
 			rx_stats->no_room +
@@ -144,10 +144,8 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats
 		ls->rx_mcast_drop_packets +
 		ls->rx_bcast_drop_packets;
 
-	stats->imissed +=
-		ls->rx_queue_empty +
+	stats->ierrors +=
 		ls->rx_dma_error +
-		ls->rx_queue_disabled +
 		ls->rx_desc_fetch_error +
 		ls->rx_desc_data_error;
 
Signature · 1 line
2.17.1
#10 lore raw

PATCH 5/35 net/ionic: fix up reported error stats

In reply to Andrew Boyer

Report descriptor errors in ierrors instead of imissed. Don't report rx_queue_empty or rx_queue_disabled in imissed, since those packet errors are already included in the rx_*_drop_packets counters.
This makes the reported stats correct.

Fixes 3cdfd90579e7 ("net/ionic: add stats")
---
 drivers/net/ionic/ionic_lif.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ionic/ionic_lif.c +2 -4
index 5e8fdf3893..799530f7f5 100644
@@ -132,7 +132,7 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats
 
 	for (i = 0; i < lif->nrxqcqs; i++) {
 		struct ionic_rx_stats *rx_stats = &lif->rxqcqs[i]->stats;
-		stats->imissed +=
+		stats->ierrors +=
 			rx_stats->no_cb_arg +
 			rx_stats->bad_cq_status +
 			rx_stats->no_room +
@@ -144,10 +144,8 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats
 		ls->rx_mcast_drop_packets +
 		ls->rx_bcast_drop_packets;
 
-	stats->imissed +=
-		ls->rx_queue_empty +
+	stats->ierrors +=
 		ls->rx_dma_error +
-		ls->rx_queue_disabled +
 		ls->rx_desc_fetch_error +
 		ls->rx_desc_data_error;
 
Signature · 1 line
2.17.1
#11 lore raw

PATCH 6/35 net/ionic: update documentation and copyrights

In reply to Andrew Boyer

Pensando Systems has been acquired by AMD.
Update all copyright strings and email addresses.

---
 MAINTAINERS                            |  4 ++--
 doc/guides/nics/ionic.rst              | 16 ++++++++--------
 doc/guides/rel_notes/release_22_11.rst |  5 +++++
 drivers/net/ionic/ionic.h              |  6 +++---
 drivers/net/ionic/ionic_dev.c          |  2 +-
 drivers/net/ionic/ionic_dev.h          |  2 +-
 drivers/net/ionic/ionic_ethdev.c       |  2 +-
 drivers/net/ionic/ionic_ethdev.h       |  2 +-
 drivers/net/ionic/ionic_if.h           |  2 +-
 drivers/net/ionic/ionic_lif.c          |  2 +-
 drivers/net/ionic/ionic_lif.h          |  2 +-
 drivers/net/ionic/ionic_logs.h         |  2 +-
 drivers/net/ionic/ionic_mac_api.c      |  2 +-
 drivers/net/ionic/ionic_mac_api.h      |  2 +-
 drivers/net/ionic/ionic_main.c         |  2 +-
 drivers/net/ionic/ionic_osdep.h        |  2 +-
 drivers/net/ionic/ionic_regs.h         |  2 +-
 drivers/net/ionic/ionic_rx_filter.c    |  2 +-
 drivers/net/ionic/ionic_rx_filter.h    |  2 +-
 drivers/net/ionic/ionic_rxtx.c         |  2 +-
 drivers/net/ionic/ionic_rxtx.h         |  2 +-
 drivers/net/ionic/meson.build          |  2 +-
 22 files changed, 36 insertions(+), 31 deletions(-)
MAINTAINERS +2 -2
index 08e575faac..f2f7f33d1f 100644
@@ -895,8 +895,8 @@ F: doc/guides/nics/pfe.rst
 F: drivers/net/pfe/
 F: doc/guides/nics/features/pfe.ini
 
-Pensando ionic
-M: Andrew Boyer <[email protected]>
+AMD Pensando ionic
+M: Andrew Boyer <[email protected]>
 F: drivers/net/ionic/
 F: doc/guides/nics/ionic.rst
 F: doc/guides/nics/features/ionic.ini
doc/guides/nics/ionic.rst +8 -8
index 673700d6ce..24b57fc0f5 100644
@@ -1,22 +1,22 @@
 ..  SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
-    Copyright(c) 2018-2020 Pensando Systems, Inc. All rights reserved.
+    Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
 
 IONIC Driver
 ============
 
-The ionic driver provides support for Pensando server adapters.
+The ionic driver provides support for AMD Pensando server adapters.
 It currently supports the below models:
 
-- DSC-25 dual-port 25G Distributed Services Card `(pdf) <https://pensando.io/wp-content/uploads/2020/03/Pensando-DSC-25-Product-Brief.pdf>`__
-- DSC-100 dual-port 100G Distributed Services Card `(pdf) <https://pensando.io/wp-content/uploads/2020/03/Pensando-DSC-100-Product-Brief.pdf>`__
+- DSC-25 dual-port 25G Distributed Services Card
+- DSC-100 dual-port 100G Distributed Services Card
+- DSC-200 dual-port 200G Distributed Services Card `(pdf) <https://www.amd.com/system/files/documents/pensando-dsc-200-product-brief.pdf>`__
 
-Please visit the Pensando web site at https://pensando.io for more information.
-The `Documents <https://pensando.io/documents/>`_ page contains Product Briefs and other product information.
+Please visit the AMD Pensando web site at https://www.amd.com/en/accelerators/pensando for more information.
 
 Identifying the Adapter
 -----------------------
 
-To determine if one or more Pensando DSC Ethernet devices are installed
+To determine if one or more AMD Pensando DSC Ethernet devices are installed
 on the host, check for the PCI devices:
 
    .. code-block:: console
@@ -30,7 +30,7 @@ Firmware Support
 
 The ionic PMD requires firmware which supports 16 segment transmit SGLs.
 This support was added prior to version 1.0. For help upgrading older versions,
-please contact Pensando support.
+please contact AMD Pensando support.
 
 Building DPDK
 -------------
doc/guides/rel_notes/release_22_11.rst +5 -0
index 980c91d5d8..552cc5b62c 100644
@@ -78,6 +78,11 @@ New Features
 
   * Added support to set device link down/up.
 
+* **Updated AMD Pensando ionic driver.**
+
+  Updated the ionic PMD with new features and improvements, including:
+
+  * Updated to reflect that Pensando has been acquired by AMD.
 
 Removed Items
 -------------
drivers/net/ionic/ionic.h +3 -3
index a55202b178..31837f050d 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_H_
@@ -15,8 +15,8 @@
 #include "ionic_osdep.h"
 
 #define IONIC_DRV_NAME			"ionic"
-#define IONIC_DRV_DESCRIPTION		"Pensando Ethernet NIC Driver"
-#define IONIC_DRV_VERSION		"0.11.0-49"
+#define IONIC_DRV_DESCRIPTION		"AMD Pensando Ethernet NIC Driver"
+#define IONIC_DRV_VERSION		"1.17.0-65"
 
 /* Vendor ID */
 #define IONIC_PENSANDO_VENDOR_ID	0x1dd8
drivers/net/ionic/ionic_dev.c +1 -1
index 5439b99b2d..a266ea7ddf 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #include <stdbool.h>
drivers/net/ionic/ionic_dev.h +1 -1
index 38c078efdf..42d192026b 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_DEV_H_
drivers/net/ionic/ionic_ethdev.c +1 -1
index d72033c32c..c696311a18 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #include <rte_pci.h>
drivers/net/ionic/ionic_ethdev.h +1 -1
index 9304e170de..afe4a67743 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_ETHDEV_H_
drivers/net/ionic/ionic_if.h +1 -1
index 45bad9b040..696ca9806e 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB OR BSD-3-Clause */
-/* Copyright (c) 2017-2020 Pensando Systems, Inc.  All rights reserved. */
+/* Copyright 2017-2022 Advanced Micro Devices, Inc. All Rights Reserved. */
 
 #ifndef _IONIC_IF_H_
 #define _IONIC_IF_H_
drivers/net/ionic/ionic_lif.c +1 -1
index 799530f7f5..f0c774c1cb 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #include <rte_malloc.h>
drivers/net/ionic/ionic_lif.h +1 -1
index 9f00ba2973..bb65184f96 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_LIF_H_
drivers/net/ionic/ionic_logs.h +1 -1
index bc10ad1744..9c96112b9d 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_LOGS_H_
drivers/net/ionic/ionic_mac_api.c +1 -1
index 411d84b578..6b48a311ec 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #include <stdbool.h>
drivers/net/ionic/ionic_mac_api.h +1 -1
index ed9e059a63..7db788fd01 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_API_H_
drivers/net/ionic/ionic_main.c +1 -1
index 7301f53342..3f85a155e0 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #include <stdbool.h>
drivers/net/ionic/ionic_osdep.h +1 -1
index 89ed106d11..9ea90b8edd 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_OSDEP_
drivers/net/ionic/ionic_regs.h +1 -1
index 3bdec34242..da7b1614a1 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_REGS_H_
drivers/net/ionic/ionic_rx_filter.c +1 -1
index 4b2e907f9f..6d3b0362c8 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #include <errno.h>
drivers/net/ionic/ionic_rx_filter.h +1 -1
index 773042fcb2..cd176c9f52 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_RX_FILTER_H_
drivers/net/ionic/ionic_rxtx.c +1 -1
index 665d085823..82e333ea13 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #include <sys/queue.h>
drivers/net/ionic/ionic_rxtx.h +1 -1
index befbe61cef..ff49d52fff 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_RXTX_H_
drivers/net/ionic/meson.build +1 -1
index 487fef1882..c338515e27 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
-# Copyright(c) 2019 Pensando
+# Copyright 2019-2022 Advanced Micro Devices, Inc. All Rights Reserved.
 
 if is_windows
     build = false
Signature · 1 line
2.17.1
#12 lore raw

Re: [PATCH 06/35] net/ionic: update documentation and copyrights

Quoted 34 lines · Andrew Boyer

Pensando Systems has been acquired by AMD.
Update all copyright strings and email addresses.

---
  MAINTAINERS                            |  4 ++--
  doc/guides/nics/ionic.rst              | 16 ++++++++--------
  doc/guides/rel_notes/release_22_11.rst |  5 +++++
  drivers/net/ionic/ionic.h              |  6 +++---
  drivers/net/ionic/ionic_dev.c          |  2 +-
  drivers/net/ionic/ionic_dev.h          |  2 +-
  drivers/net/ionic/ionic_ethdev.c       |  2 +-
  drivers/net/ionic/ionic_ethdev.h       |  2 +-
  drivers/net/ionic/ionic_if.h           |  2 +-
  drivers/net/ionic/ionic_lif.c          |  2 +-
  drivers/net/ionic/ionic_lif.h          |  2 +-
  drivers/net/ionic/ionic_logs.h         |  2 +-
  drivers/net/ionic/ionic_mac_api.c      |  2 +-
  drivers/net/ionic/ionic_mac_api.h      |  2 +-
  drivers/net/ionic/ionic_main.c         |  2 +-
  drivers/net/ionic/ionic_osdep.h        |  2 +-
  drivers/net/ionic/ionic_regs.h         |  2 +-
  drivers/net/ionic/ionic_rx_filter.c    |  2 +-
  drivers/net/ionic/ionic_rx_filter.h    |  2 +-
  drivers/net/ionic/ionic_rxtx.c         |  2 +-
  drivers/net/ionic/ionic_rxtx.h         |  2 +-
  drivers/net/ionic/meson.build          |  2 +-
  22 files changed, 36 insertions(+), 31 deletions(-)
MAINTAINERS +0 -0
index 08e575faac..f2f7f33d1f 100644

MAINTAINERS F: doc/guides/nics/pfe.rst · line 902

Quoted 10 lines
MAINTAINERS +2 -2
@@ -895,8 +895,8 @@ F: doc/guides/nics/pfe.rst
  F: drivers/net/pfe/
  F: doc/guides/nics/features/pfe.ini
 
-Pensando ionic
-M: Andrew Boyer <[email protected]>
+AMD Pensando ionic
+M: Andrew Boyer <[email protected]>
  F: drivers/net/ionic/
  F: doc/guides/nics/ionic.rst
  F: doc/guides/nics/features/ionic.ini

Need to move the block up after other AMD driver, since it is sorted alphabetically.

Quoted 11 lines
doc/guides/nics/ionic.rst +1 -1
index 673700d6ce..24b57fc0f5 100644
@@ -1,22 +1,22 @@
  ..  SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
-    Copyright(c) 2018-2020 Pensando Systems, Inc. All rights reserved.
+    Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
 
  IONIC Driver
  ============

doc/guides/nics/ionic.rst line 12

Quoted 10 lines
doc/guides/nics/ionic.rst +4 -3
 
-The ionic driver provides support for Pensando server adapters.
+The ionic driver provides support for AMD Pensando server adapters.
  It currently supports the below models:
 
-- DSC-25 dual-port 25G Distributed Services Card `(pdf) <https://pensando.io/wp-content/uploads/2020/03/Pensando-DSC-25-Product-Brief.pdf>`__
-- DSC-100 dual-port 100G Distributed Services Card `(pdf) <https://pensando.io/wp-content/uploads/2020/03/Pensando-DSC-100-Product-Brief.pdf>`__
+- DSC-25 dual-port 25G Distributed Services Card
+- DSC-100 dual-port 100G Distributed Services Card
+- DSC-200 dual-port 200G Distributed Services Card `(pdf) <https://www.amd.com/system/files/documents/pensando-dsc-200-product-brief.pdf>`__

This 'DSC-200' support seems an addition, can you please separate it from this patch.

Quoted 27 lines
doc/guides/nics/ionic.rst +3 -4
-Please visit the Pensando web site at https://pensando.io for more information.
-The `Documents <https://pensando.io/documents/>`_ page contains Product Briefs and other product information.
+Please visit the AMD Pensando web site at https://www.amd.com/en/accelerators/pensando for more information.
 
  Identifying the Adapter
  -----------------------
 
-To determine if one or more Pensando DSC Ethernet devices are installed
+To determine if one or more AMD Pensando DSC Ethernet devices are installed
  on the host, check for the PCI devices:
 
     .. code-block:: console
@@ -30,7 +30,7 @@ Firmware Support
 
  The ionic PMD requires firmware which supports 16 segment transmit SGLs.
  This support was added prior to version 1.0. For help upgrading older versions,
-please contact Pensando support.
+please contact AMD Pensando support.
 
  Building DPDK
  -------------
doc/guides/rel_notes/release_22_11.rst +0 -0
index 980c91d5d8..552cc5b62c 100644

doc/guides/rel_notes/release_22_11.rst New Features · line 86

Quoted 9 lines
doc/guides/rel_notes/release_22_11.rst +5 -0
@@ -78,6 +78,11 @@ New Features
 
    * Added support to set device link down/up.
 
+* **Updated AMD Pensando ionic driver.**
+
+  Updated the ionic PMD with new features and improvements, including:
+
+  * Updated to reflect that Pensando has been acquired by AMD.
 

Need to move this block, to sort it alphabetically in the network drivers group.

Quoted 14 lines
doc/guides/rel_notes/release_22_11.rst +0 -0
  Removed Items
  -------------
drivers/net/ionic/ionic.h +1 -1
index a55202b178..31837f050d 100644
@@ -1,5 +1,5 @@
  /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
   */
 
  #ifndef _IONIC_H_

drivers/net/ionic/ionic.h line 19

Quoted 7 lines
drivers/net/ionic/ionic.h +2 -2
@@ -15,8 +15,8 @@
  #include "ionic_osdep.h"
 
  #define IONIC_DRV_NAME			"ionic"
-#define IONIC_DRV_DESCRIPTION		"Pensando Ethernet NIC Driver"
-#define IONIC_DRV_VERSION		"0.11.0-49"
+#define IONIC_DRV_DESCRIPTION		"AMD Pensando Ethernet NIC Driver"
+#define IONIC_DRV_VERSION		"1.17.0-65"

If there is a driver version change, can you please make it in different patch that clarifies the change of the version, unless this version change is purely because of company change but I doubt that is the case.

drivers/net/ionic/ionic_dev.c line 2

Quoted 11 lines
drivers/net/ionic/ionic.h +0 -0
  /* Vendor ID */
  #define IONIC_PENSANDO_VENDOR_ID	0x1dd8
drivers/net/ionic/ionic_dev.c +1 -1
index 5439b99b2d..a266ea7ddf 100644
@@ -1,5 +1,5 @@
  /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.

I am not sure what is the additional benefit of the "All Rights Reserved." note when there is copyright and license in place, but it is common to have that note in separate line after Coypright line. Making it consistent can be helpful in the future if we have scripts to parse the copyright lines etc..
If not blocked by the legal, can you please move the "All Rights Reserved." to the next line below copyright?

And if possible, can you please question if "All Rights Reserved." line is required at all?

#13 lore raw

PATCH 6/35 net/ionic: update documentation and copyrights

In reply to Andrew Boyer

Pensando Systems has been acquired by AMD.
Update all copyright strings and email addresses.

---
 MAINTAINERS                            |  4 ++--
 doc/guides/nics/ionic.rst              | 16 ++++++++--------
 doc/guides/rel_notes/release_22_11.rst |  7 ++++++-
 drivers/net/ionic/ionic.h              |  6 +++---
 drivers/net/ionic/ionic_dev.c          |  2 +-
 drivers/net/ionic/ionic_dev.h          |  2 +-
 drivers/net/ionic/ionic_ethdev.c       |  2 +-
 drivers/net/ionic/ionic_ethdev.h       |  2 +-
 drivers/net/ionic/ionic_if.h           |  2 +-
 drivers/net/ionic/ionic_lif.c          |  2 +-
 drivers/net/ionic/ionic_lif.h          |  2 +-
 drivers/net/ionic/ionic_logs.h         |  2 +-
 drivers/net/ionic/ionic_mac_api.c      |  2 +-
 drivers/net/ionic/ionic_mac_api.h      |  2 +-
 drivers/net/ionic/ionic_main.c         |  2 +-
 drivers/net/ionic/ionic_osdep.h        |  2 +-
 drivers/net/ionic/ionic_regs.h         |  2 +-
 drivers/net/ionic/ionic_rx_filter.c    |  2 +-
 drivers/net/ionic/ionic_rx_filter.h    |  2 +-
 drivers/net/ionic/ionic_rxtx.c         |  2 +-
 drivers/net/ionic/ionic_rxtx.h         |  2 +-
 drivers/net/ionic/meson.build          |  2 +-
 22 files changed, 37 insertions(+), 32 deletions(-)
MAINTAINERS +2 -2
index 3757ccc3b3..a03bacdb77 100644
@@ -904,8 +904,8 @@ F: doc/guides/nics/pfe.rst
 F: drivers/net/pfe/
 F: doc/guides/nics/features/pfe.ini
 
-Pensando ionic
-M: Andrew Boyer <[email protected]>
+AMD Pensando ionic
+M: Andrew Boyer <[email protected]>
 F: drivers/net/ionic/
 F: doc/guides/nics/ionic.rst
 F: doc/guides/nics/features/ionic.ini
doc/guides/nics/ionic.rst +8 -8
index 673700d6ce..be13955a82 100644
@@ -1,22 +1,22 @@
 ..  SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
-    Copyright(c) 2018-2020 Pensando Systems, Inc. All rights reserved.
+    Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
 
 IONIC Driver
 ============
 
-The ionic driver provides support for Pensando server adapters.
+The ionic driver provides support for AMD Pensando server adapters.
 It currently supports the below models:
 
-- DSC-25 dual-port 25G Distributed Services Card `(pdf) <https://pensando.io/wp-content/uploads/2020/03/Pensando-DSC-25-Product-Brief.pdf>`__
-- DSC-100 dual-port 100G Distributed Services Card `(pdf) <https://pensando.io/wp-content/uploads/2020/03/Pensando-DSC-100-Product-Brief.pdf>`__
+- DSC-25 dual-port 25G Distributed Services Card `(pdf) <https://pensandoio.secure.force.com/DownloadFile?id=a0L4T000004IKurUAG>`__
+- DSC-100 dual-port 100G Distributed Services Card `(pdf) <https://pensandoio.secure.force.com/DownloadFile?id=a0L4T000004IKuwUAG>`__
+- DSC-200 dual-port 200G Distributed Services Card `(pdf) <https://www.amd.com/system/files/documents/pensando-dsc-200-product-brief.pdf>`__
 
-Please visit the Pensando web site at https://pensando.io for more information.
-The `Documents <https://pensando.io/documents/>`_ page contains Product Briefs and other product information.
+Please visit the AMD Pensando web site at https://www.amd.com/en/accelerators/pensando for more information.
 
 Identifying the Adapter
 -----------------------
 
-To determine if one or more Pensando DSC Ethernet devices are installed
+To determine if one or more AMD Pensando DSC Ethernet devices are installed
 on the host, check for the PCI devices:
 
    .. code-block:: console
@@ -30,7 +30,7 @@ Firmware Support
 
 The ionic PMD requires firmware which supports 16 segment transmit SGLs.
 This support was added prior to version 1.0. For help upgrading older versions,
-please contact Pensando support.
+please contact AMD Pensando support.
 
 Building DPDK
 -------------
doc/guides/rel_notes/release_22_11.rst +6 -1
index fbb575255f..4135021283 100644
@@ -159,6 +159,12 @@ New Features
 
   * Added support to set device link down/up.
 
+* **Updated AMD Pensando ionic driver.**
+
+  Updated the ionic PMD with new features and improvements, including:
+
+  * Updated to reflect that Pensando has been acquired by AMD.
+
 * **Added support for MACsec in rte_security.**
 
   Added MACsec transform for rte_security session and added new API
@@ -200,7 +206,6 @@ New Features
   into single event containing ``rte_event_vector``
   whose event type is ``RTE_EVENT_TYPE_CRYPTODEV_VECTOR``.
 
-
 Removed Items
 -------------
 
drivers/net/ionic/ionic.h +3 -3
index a55202b178..31837f050d 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_H_
@@ -15,8 +15,8 @@
 #include "ionic_osdep.h"
 
 #define IONIC_DRV_NAME			"ionic"
-#define IONIC_DRV_DESCRIPTION		"Pensando Ethernet NIC Driver"
-#define IONIC_DRV_VERSION		"0.11.0-49"
+#define IONIC_DRV_DESCRIPTION		"AMD Pensando Ethernet NIC Driver"
+#define IONIC_DRV_VERSION		"1.17.0-65"
 
 /* Vendor ID */
 #define IONIC_PENSANDO_VENDOR_ID	0x1dd8
drivers/net/ionic/ionic_dev.c +1 -1
index 5439b99b2d..a266ea7ddf 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #include <stdbool.h>
drivers/net/ionic/ionic_dev.h +1 -1
index 38c078efdf..42d192026b 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_DEV_H_
drivers/net/ionic/ionic_ethdev.c +1 -1
index d72033c32c..c696311a18 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #include <rte_pci.h>
drivers/net/ionic/ionic_ethdev.h +1 -1
index 9304e170de..afe4a67743 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_ETHDEV_H_
drivers/net/ionic/ionic_if.h +1 -1
index 45bad9b040..696ca9806e 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB OR BSD-3-Clause */
-/* Copyright (c) 2017-2020 Pensando Systems, Inc.  All rights reserved. */
+/* Copyright 2017-2022 Advanced Micro Devices, Inc. All Rights Reserved. */
 
 #ifndef _IONIC_IF_H_
 #define _IONIC_IF_H_
drivers/net/ionic/ionic_lif.c +1 -1
index 799530f7f5..f0c774c1cb 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #include <rte_malloc.h>
drivers/net/ionic/ionic_lif.h +1 -1
index 9f00ba2973..bb65184f96 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_LIF_H_
drivers/net/ionic/ionic_logs.h +1 -1
index bc10ad1744..9c96112b9d 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_LOGS_H_
drivers/net/ionic/ionic_mac_api.c +1 -1
index 411d84b578..6b48a311ec 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #include <stdbool.h>
drivers/net/ionic/ionic_mac_api.h +1 -1
index ed9e059a63..7db788fd01 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_API_H_
drivers/net/ionic/ionic_main.c +1 -1
index 7301f53342..3f85a155e0 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #include <stdbool.h>
drivers/net/ionic/ionic_osdep.h +1 -1
index 89ed106d11..9ea90b8edd 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_OSDEP_
drivers/net/ionic/ionic_regs.h +1 -1
index 3bdec34242..da7b1614a1 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_REGS_H_
drivers/net/ionic/ionic_rx_filter.c +1 -1
index 4b2e907f9f..6d3b0362c8 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #include <errno.h>
drivers/net/ionic/ionic_rx_filter.h +1 -1
index 773042fcb2..cd176c9f52 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_RX_FILTER_H_
drivers/net/ionic/ionic_rxtx.c +1 -1
index 665d085823..82e333ea13 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #include <sys/queue.h>
drivers/net/ionic/ionic_rxtx.h +1 -1
index befbe61cef..ff49d52fff 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
 #ifndef _IONIC_RXTX_H_
drivers/net/ionic/meson.build +1 -1
index 487fef1882..c338515e27 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
-# Copyright(c) 2019 Pensando
+# Copyright 2019-2022 Advanced Micro Devices, Inc. All Rights Reserved.
 
 if is_windows
     build = false
Signature · 1 line
2.17.1
#14 lore raw

PATCH 7/35 net/ionic: update license terms to remove GPL

In reply to Andrew Boyer

Remove GPL2 and leave only BSD-3-Clause. This is more in line with the norms of the DPDK community.

---
 drivers/net/ionic/ionic.h           | 2 +-
 drivers/net/ionic/ionic_dev.c       | 2 +-
 drivers/net/ionic/ionic_dev.h       | 2 +-
 drivers/net/ionic/ionic_ethdev.c    | 2 +-
 drivers/net/ionic/ionic_ethdev.h    | 2 +-
 drivers/net/ionic/ionic_if.h        | 5 +++--
 drivers/net/ionic/ionic_lif.c       | 2 +-
 drivers/net/ionic/ionic_lif.h       | 2 +-
 drivers/net/ionic/ionic_logs.h      | 2 +-
 drivers/net/ionic/ionic_mac_api.c   | 2 +-
 drivers/net/ionic/ionic_mac_api.h   | 2 +-
 drivers/net/ionic/ionic_main.c      | 2 +-
 drivers/net/ionic/ionic_osdep.h     | 2 +-
 drivers/net/ionic/ionic_regs.h      | 2 +-
 drivers/net/ionic/ionic_rx_filter.c | 2 +-
 drivers/net/ionic/ionic_rx_filter.h | 2 +-
 drivers/net/ionic/ionic_rxtx.c      | 2 +-
 drivers/net/ionic/ionic_rxtx.h      | 2 +-
 drivers/net/ionic/meson.build       | 2 +-
 19 files changed, 21 insertions(+), 20 deletions(-)
drivers/net/ionic/ionic.h +1 -1
index 31837f050d..7578cd31bf 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_dev.c +1 -1
index a266ea7ddf..a631523e59 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_dev.h +1 -1
index 42d192026b..3b902554b8 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_ethdev.c +1 -1
index c696311a18..387042c080 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_ethdev.h +1 -1
index afe4a67743..d1ed293604 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_if.h +3 -2
index 696ca9806e..761d366c71 100644
@@ -1,5 +1,6 @@
-/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB OR BSD-3-Clause */
-/* Copyright 2017-2022 Advanced Micro Devices, Inc. All Rights Reserved. */
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2017-2022 Advanced Micro Devices, Inc. All Rights Reserved.
+ */
 
 #ifndef _IONIC_IF_H_
 #define _IONIC_IF_H_
drivers/net/ionic/ionic_lif.c +1 -1
index f0c774c1cb..dc21387cd8 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_lif.h +1 -1
index bb65184f96..4aebfe20d0 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_logs.h +1 -1
index 9c96112b9d..9b17303e42 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_mac_api.c +1 -1
index 6b48a311ec..0464a7b13c 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_mac_api.h +1 -1
index 7db788fd01..766c7733c8 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_main.c +1 -1
index 3f85a155e0..b42430713c 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_osdep.h +1 -1
index 9ea90b8edd..c6d77c0fae 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_regs.h +1 -1
index da7b1614a1..dbf5388268 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_rx_filter.c +1 -1
index 6d3b0362c8..fdedb9e288 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_rx_filter.h +1 -1
index cd176c9f52..e6cd06f002 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_rxtx.c +1 -1
index 82e333ea13..acdfda9312 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_rxtx.h +1 -1
index ff49d52fff..91a9073803 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/meson.build +1 -1
index c338515e27..e251e7cbe0 100644
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+# SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2019-2022 Advanced Micro Devices, Inc. All Rights Reserved.
 
 if is_windows
Signature · 1 line
2.17.1
#15 lore raw

Re: [PATCH 07/35] net/ionic: update license terms to remove GPL

Quoted 4 lines · Andrew Boyer

Remove GPL2 and leave only BSD-3-Clause. This is more in line with the norms of the DPDK community.

ack.

Thanks for the cleanup.

#16 lore raw

PATCH 7/35 net/ionic: update license terms to remove GPL

In reply to Andrew Boyer

Remove GPL2 and leave only BSD-3-Clause. This is more in line with the norms of the DPDK community.

---
 drivers/net/ionic/ionic.h           | 2 +-
 drivers/net/ionic/ionic_dev.c       | 2 +-
 drivers/net/ionic/ionic_dev.h       | 2 +-
 drivers/net/ionic/ionic_ethdev.c    | 2 +-
 drivers/net/ionic/ionic_ethdev.h    | 2 +-
 drivers/net/ionic/ionic_if.h        | 5 +++--
 drivers/net/ionic/ionic_lif.c       | 2 +-
 drivers/net/ionic/ionic_lif.h       | 2 +-
 drivers/net/ionic/ionic_logs.h      | 2 +-
 drivers/net/ionic/ionic_mac_api.c   | 2 +-
 drivers/net/ionic/ionic_mac_api.h   | 2 +-
 drivers/net/ionic/ionic_main.c      | 2 +-
 drivers/net/ionic/ionic_osdep.h     | 2 +-
 drivers/net/ionic/ionic_regs.h      | 2 +-
 drivers/net/ionic/ionic_rx_filter.c | 2 +-
 drivers/net/ionic/ionic_rx_filter.h | 2 +-
 drivers/net/ionic/ionic_rxtx.c      | 2 +-
 drivers/net/ionic/ionic_rxtx.h      | 2 +-
 drivers/net/ionic/meson.build       | 2 +-
 19 files changed, 21 insertions(+), 20 deletions(-)
drivers/net/ionic/ionic.h +1 -1
index 31837f050d..7578cd31bf 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_dev.c +1 -1
index a266ea7ddf..a631523e59 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_dev.h +1 -1
index 42d192026b..3b902554b8 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_ethdev.c +1 -1
index c696311a18..387042c080 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_ethdev.h +1 -1
index afe4a67743..d1ed293604 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_if.h +3 -2
index 696ca9806e..761d366c71 100644
@@ -1,5 +1,6 @@
-/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB OR BSD-3-Clause */
-/* Copyright 2017-2022 Advanced Micro Devices, Inc. All Rights Reserved. */
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2017-2022 Advanced Micro Devices, Inc. All Rights Reserved.
+ */
 
 #ifndef _IONIC_IF_H_
 #define _IONIC_IF_H_
drivers/net/ionic/ionic_lif.c +1 -1
index f0c774c1cb..dc21387cd8 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_lif.h +1 -1
index bb65184f96..4aebfe20d0 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_logs.h +1 -1
index 9c96112b9d..9b17303e42 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_mac_api.c +1 -1
index 6b48a311ec..0464a7b13c 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_mac_api.h +1 -1
index 7db788fd01..766c7733c8 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_main.c +1 -1
index 3f85a155e0..b42430713c 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_osdep.h +1 -1
index 9ea90b8edd..c6d77c0fae 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_regs.h +1 -1
index da7b1614a1..dbf5388268 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_rx_filter.c +1 -1
index 6d3b0362c8..fdedb9e288 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_rx_filter.h +1 -1
index cd176c9f52..e6cd06f002 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_rxtx.c +1 -1
index 82e333ea13..acdfda9312 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/ionic_rxtx.h +1 -1
index ff49d52fff..91a9073803 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc. All Rights Reserved.
  */
 
drivers/net/ionic/meson.build +1 -1
index c338515e27..e251e7cbe0 100644
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+# SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2019-2022 Advanced Micro Devices, Inc. All Rights Reserved.
 
 if is_windows
Signature · 1 line
2.17.1
#17 lore raw

PATCH 8/35 net/ionic: update MTU calculations

In reply to Andrew Boyer

Test min and max MTU against values read from firmware, for correctness. Update the firmware field name, for clarity.
The device must be stopped before changing MTU, for correctness. Store the calculated frame size in the queue, for performance.

---
 drivers/net/ionic/ionic_dev.h    |  5 +++-
 drivers/net/ionic/ionic_ethdev.c | 40 +++++++++++++++++++++-----------
 drivers/net/ionic/ionic_if.h     |  8 +++----
 drivers/net/ionic/ionic_lif.c    | 10 +++-----
 drivers/net/ionic/ionic_lif.h    |  4 +++-
 drivers/net/ionic/ionic_rxtx.c   | 26 +++++++++------------
 6 files changed, 51 insertions(+), 42 deletions(-)
drivers/net/ionic/ionic_dev.h +4 -1
index 3b902554b8..42ba9ef5aa 100644
@@ -11,8 +11,11 @@
 #include "ionic_if.h"
 #include "ionic_regs.h"
 
+#define VLAN_TAG_SIZE			4
+
 #define IONIC_MIN_MTU			RTE_ETHER_MIN_MTU
-#define IONIC_MAX_MTU			9194
+#define IONIC_MAX_MTU			9378
+#define IONIC_ETH_OVERHEAD		(RTE_ETHER_HDR_LEN + VLAN_TAG_SIZE)
 
 #define IONIC_MAX_RING_DESC		32768
 #define IONIC_MIN_RING_DESC		16
drivers/net/ionic/ionic_ethdev.c +26 -14
index 387042c080..815b7e3c9e 100644
@@ -343,18 +343,17 @@ static int
 ionic_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 {
 	struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
-	int err;
 
-	IONIC_PRINT_CALL();
+	if (lif->state & IONIC_LIF_F_UP) {
+		IONIC_PRINT(ERR, "Stop %s before setting mtu", lif->name);
+		return -EBUSY;
+	}
 
-	/*
-	 * Note: mtu check against IONIC_MIN_MTU, IONIC_MAX_MTU
-	 * is done by the API.
-	 */
+	/* Note: mtu check against min/max is done by the API */
+	IONIC_PRINT(INFO, "Setting mtu %u", mtu);
 
-	err = ionic_lif_change_mtu(lif, mtu);
-	if (err)
-		return err;
+	/* Update the frame size used by the Rx path */
+	lif->frame_size = mtu + IONIC_ETH_OVERHEAD;
 
 	return 0;
 }
@@ -376,12 +375,16 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 		rte_le_to_cpu_32(cfg->queue_count[IONIC_QTYPE_TXQ]);
 
 	/* Also add ETHER_CRC_LEN if the adapter is able to keep CRC */
-	dev_info->min_rx_bufsize = IONIC_MIN_MTU + RTE_ETHER_HDR_LEN;
-	dev_info->max_rx_pktlen = IONIC_MAX_MTU + RTE_ETHER_HDR_LEN;
-	dev_info->max_mac_addrs = adapter->max_mac_addrs;
-	dev_info->min_mtu = IONIC_MIN_MTU;
-	dev_info->max_mtu = IONIC_MAX_MTU;
+	dev_info->min_mtu = RTE_MAX((uint32_t)IONIC_MIN_MTU,
+			rte_le_to_cpu_32(ident->lif.eth.min_mtu));
+	dev_info->max_mtu = RTE_MIN((uint32_t)IONIC_MAX_MTU,
+			rte_le_to_cpu_32(ident->lif.eth.max_mtu));
+	dev_info->min_rx_bufsize = dev_info->min_mtu + IONIC_ETH_OVERHEAD;
+	dev_info->max_rx_pktlen = dev_info->max_mtu + IONIC_ETH_OVERHEAD;
+	dev_info->max_lro_pkt_size =
+		eth_dev->data->dev_conf.rxmode.max_lro_pkt_size;
 
+	dev_info->max_mac_addrs = adapter->max_mac_addrs;
 	dev_info->hash_key_size = IONIC_RSS_HASH_KEY_SIZE;
 	dev_info->reta_size = rte_le_to_cpu_16(ident->lif.eth.rss_ind_tbl_sz);
 	dev_info->flow_type_rss_offloads = IONIC_ETH_RSS_OFFLOAD_ALL;
@@ -889,6 +892,15 @@ ionic_dev_start(struct rte_eth_dev *eth_dev)
 	if (dev_conf->lpbk_mode)
 		IONIC_PRINT(WARNING, "Loopback mode not supported");
 
+	lif->frame_size = eth_dev->data->mtu + IONIC_ETH_OVERHEAD;
+
+	err = ionic_lif_change_mtu(lif, eth_dev->data->mtu);
+	if (err) {
+		IONIC_PRINT(ERR, "Cannot set LIF frame size %u: %d",
+			lif->frame_size, err);
+		return err;
+	}
+
 	err = ionic_lif_start(lif);
 	if (err) {
 		IONIC_PRINT(ERR, "Cannot start LIF: %d", err);
drivers/net/ionic/ionic_if.h +4 -4
index 761d366c71..05ab620167 100644
@@ -401,8 +401,8 @@ union ionic_lif_config {
  *     @version:            Ethernet identify structure version
  *     @max_ucast_filters:  Number of perfect unicast addresses supported
  *     @max_mcast_filters:  Number of perfect multicast addresses supported
- *     @min_frame_size:     Minimum size of frames to be sent
- *     @max_frame_size:     Maximum size of frames to be sent
+ *     @min_mtu:            Minimum MTU of frames to be sent
+ *     @max_mtu:            Maximum MTU of frames to be sent
  *     @config:             LIF config struct with features, mtu, mac, q counts
  *
  * @rdma:                RDMA identify structure
@@ -434,8 +434,8 @@ union ionic_lif_identity {
 			__le32 max_ucast_filters;
 			__le32 max_mcast_filters;
 			__le16 rss_ind_tbl_sz;
-			__le32 min_frame_size;
-			__le32 max_frame_size;
+			__le32 min_mtu;
+			__le32 max_mtu;
 			u8 rsvd2[106];
 			union ionic_lif_config config;
 		} __rte_packed eth;
drivers/net/ionic/ionic_lif.c +3 -7
index dc21387cd8..2c6f7f7f4e 100644
@@ -536,7 +536,7 @@ ionic_dev_allmulticast_disable(struct rte_eth_dev *eth_dev)
 }
 
 int
-ionic_lif_change_mtu(struct ionic_lif *lif, int new_mtu)
+ionic_lif_change_mtu(struct ionic_lif *lif, uint32_t new_mtu)
 {
 	struct ionic_admin_ctx ctx = {
 		.pending_work = true,
@@ -546,13 +546,8 @@ ionic_lif_change_mtu(struct ionic_lif *lif, int new_mtu)
 			.mtu = rte_cpu_to_le_32(new_mtu),
 		},
 	};
-	int err;
-
-	err = ionic_adminq_post_wait(lif, &ctx);
-	if (err)
-		return err;
 
-	return 0;
+	return ionic_adminq_post_wait(lif, &ctx);
 }
 
 int
@@ -730,6 +725,7 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 	int err;
 
 	flags = IONIC_QCQ_F_SG;
+
 	err = ionic_qcq_alloc(lif,
 		IONIC_QTYPE_RXQ,
 		sizeof(struct ionic_rx_qcq),
drivers/net/ionic/ionic_lif.h +3 -1
index 4aebfe20d0..c3ae96d25b 100644
@@ -81,6 +81,7 @@ struct ionic_rx_qcq {
 
 	/* cacheline2 */
 	struct rte_mempool *mb_pool;
+	uint16_t frame_size;	/* Based on configured MTU */
 	uint16_t flags;
 
 	/* cacheline3 (inside stats) */
@@ -123,6 +124,7 @@ struct ionic_lif {
 	struct ionic_adapter *adapter;
 	struct rte_eth_dev *eth_dev;
 	uint16_t port_id;  /**< Device port identifier */
+	uint16_t frame_size;
 	uint32_t hw_index;
 	uint32_t state;
 	uint32_t ntxqcqs;
@@ -181,7 +183,7 @@ int ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr);
 int ionic_qcq_service(struct ionic_qcq *qcq, int budget, ionic_cq_cb cb,
 	void *cb_arg);
 
-int ionic_lif_change_mtu(struct ionic_lif *lif, int new_mtu);
+int ionic_lif_change_mtu(struct ionic_lif *lif, uint32_t new_mtu);
 
 int ionic_dev_add_mac(struct rte_eth_dev *eth_dev,
 	struct rte_ether_addr *mac_addr,
drivers/net/ionic/ionic_rxtx.c +11 -15
index acdfda9312..d77f06c022 100644
@@ -772,8 +772,6 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 	struct ionic_rxq_comp *cq_desc_base = cq->base;
 	struct ionic_rxq_comp *cq_desc = &cq_desc_base[cq_desc_index];
 	struct rte_mbuf *rxm, *rxm_seg;
-	uint32_t max_frame_size =
-		rxq->qcq.lif->eth_dev->data->mtu + RTE_ETHER_HDR_LEN;
 	uint64_t pkt_flags = 0;
 	uint32_t pkt_type;
 	struct ionic_rx_stats *stats = &rxq->stats;
@@ -814,8 +812,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 		return;
 	}
 
-	if (cq_desc->len > max_frame_size ||
-			cq_desc->len == 0) {
+	if (cq_desc->len > rxq->frame_size || cq_desc->len == 0) {
 		stats->bad_len++;
 		ionic_rx_recycle(q, q_desc_index, rxm);
 		return;
@@ -936,7 +933,7 @@ ionic_rx_recycle(struct ionic_queue *q, uint32_t q_desc_index,
 }
 
 static __rte_always_inline int
-ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len)
+ionic_rx_fill(struct ionic_rx_qcq *rxq)
 {
 	struct ionic_queue *q = &rxq->qcq.q;
 	struct ionic_rxq_desc *desc, *desc_base = q->base;
@@ -961,7 +958,7 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len)
 
 		info = IONIC_INFO_PTR(q, q->head_idx);
 
-		nsegs = (len + buf_size - 1) / buf_size;
+		nsegs = (rxq->frame_size + buf_size - 1) / buf_size;
 
 		desc = &desc_base[q->head_idx];
 		dma_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(rxm));
@@ -996,9 +993,9 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len)
 			prev_rxm_seg = rxm_seg;
 		}
 
-		if (size < len)
+		if (size < rxq->frame_size)
 			IONIC_PRINT(ERR, "Rx SG size is not sufficient (%d < %d)",
-				size, len);
+				size, rxq->frame_size);
 
 		info[0] = rxm;
 
@@ -1016,7 +1013,6 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len)
 int __rte_cold
 ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 {
-	uint32_t frame_size = eth_dev->data->mtu + RTE_ETHER_HDR_LEN;
 	uint8_t *rx_queue_state = eth_dev->data->rx_queue_state;
 	struct ionic_rx_qcq *rxq;
 	int err;
@@ -1029,8 +1025,10 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 
 	rxq = eth_dev->data->rx_queues[rx_queue_id];
 
-	IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs (size: %u)",
-		rx_queue_id, rxq->qcq.q.num_descs, frame_size);
+	rxq->frame_size = rxq->qcq.lif->frame_size - RTE_ETHER_CRC_LEN;
+
+	IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs, size %u",
+		rx_queue_id, rxq->qcq.q.num_descs, rxq->frame_size);
 
 	if (!(rxq->flags & IONIC_QCQ_F_INITED)) {
 		err = ionic_lif_rxq_init(rxq);
@@ -1041,7 +1039,7 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 	}
 
 	/* Allocate buffers for descriptor rings */
-	if (ionic_rx_fill(rxq, frame_size) != 0) {
+	if (ionic_rx_fill(rxq) != 0) {
 		IONIC_PRINT(ERR, "Could not alloc mbuf for queue:%d",
 			rx_queue_id);
 		return -1;
@@ -1129,8 +1127,6 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts)
 {
 	struct ionic_rx_qcq *rxq = rx_queue;
-	uint32_t frame_size =
-		rxq->qcq.lif->eth_dev->data->mtu + RTE_ETHER_HDR_LEN;
 	struct ionic_rx_service service_cb_arg;
 
 	service_cb_arg.rx_pkts = rx_pkts;
@@ -1139,7 +1135,7 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 	ionic_rxq_service(rxq, nb_pkts, &service_cb_arg);
 
-	ionic_rx_fill(rxq, frame_size);
+	ionic_rx_fill(rxq);
 
 	return service_cb_arg.nb_rx;
 }
Signature · 1 line
2.17.1
#18 lore raw

PATCH 8/35 net/ionic: update MTU calculations

In reply to Andrew Boyer

Test min and max MTU against values read from firmware, for correctness. Update the firmware field name, for clarity.
The device must be stopped before changing MTU, for correctness. Store the calculated frame size in the queue, for performance.

---
 drivers/net/ionic/ionic_dev.h    |  5 +++-
 drivers/net/ionic/ionic_ethdev.c | 40 +++++++++++++++++++++-----------
 drivers/net/ionic/ionic_if.h     |  8 +++----
 drivers/net/ionic/ionic_lif.c    | 10 +++-----
 drivers/net/ionic/ionic_lif.h    |  4 +++-
 drivers/net/ionic/ionic_rxtx.c   | 26 +++++++++------------
 6 files changed, 51 insertions(+), 42 deletions(-)
drivers/net/ionic/ionic_dev.h +4 -1
index 3b902554b8..42ba9ef5aa 100644
@@ -11,8 +11,11 @@
 #include "ionic_if.h"
 #include "ionic_regs.h"
 
+#define VLAN_TAG_SIZE			4
+
 #define IONIC_MIN_MTU			RTE_ETHER_MIN_MTU
-#define IONIC_MAX_MTU			9194
+#define IONIC_MAX_MTU			9378
+#define IONIC_ETH_OVERHEAD		(RTE_ETHER_HDR_LEN + VLAN_TAG_SIZE)
 
 #define IONIC_MAX_RING_DESC		32768
 #define IONIC_MIN_RING_DESC		16
drivers/net/ionic/ionic_ethdev.c +26 -14
index 387042c080..815b7e3c9e 100644
@@ -343,18 +343,17 @@ static int
 ionic_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 {
 	struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
-	int err;
 
-	IONIC_PRINT_CALL();
+	if (lif->state & IONIC_LIF_F_UP) {
+		IONIC_PRINT(ERR, "Stop %s before setting mtu", lif->name);
+		return -EBUSY;
+	}
 
-	/*
-	 * Note: mtu check against IONIC_MIN_MTU, IONIC_MAX_MTU
-	 * is done by the API.
-	 */
+	/* Note: mtu check against min/max is done by the API */
+	IONIC_PRINT(INFO, "Setting mtu %u", mtu);
 
-	err = ionic_lif_change_mtu(lif, mtu);
-	if (err)
-		return err;
+	/* Update the frame size used by the Rx path */
+	lif->frame_size = mtu + IONIC_ETH_OVERHEAD;
 
 	return 0;
 }
@@ -376,12 +375,16 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 		rte_le_to_cpu_32(cfg->queue_count[IONIC_QTYPE_TXQ]);
 
 	/* Also add ETHER_CRC_LEN if the adapter is able to keep CRC */
-	dev_info->min_rx_bufsize = IONIC_MIN_MTU + RTE_ETHER_HDR_LEN;
-	dev_info->max_rx_pktlen = IONIC_MAX_MTU + RTE_ETHER_HDR_LEN;
-	dev_info->max_mac_addrs = adapter->max_mac_addrs;
-	dev_info->min_mtu = IONIC_MIN_MTU;
-	dev_info->max_mtu = IONIC_MAX_MTU;
+	dev_info->min_mtu = RTE_MAX((uint32_t)IONIC_MIN_MTU,
+			rte_le_to_cpu_32(ident->lif.eth.min_mtu));
+	dev_info->max_mtu = RTE_MIN((uint32_t)IONIC_MAX_MTU,
+			rte_le_to_cpu_32(ident->lif.eth.max_mtu));
+	dev_info->min_rx_bufsize = dev_info->min_mtu + IONIC_ETH_OVERHEAD;
+	dev_info->max_rx_pktlen = dev_info->max_mtu + IONIC_ETH_OVERHEAD;
+	dev_info->max_lro_pkt_size =
+		eth_dev->data->dev_conf.rxmode.max_lro_pkt_size;
 
+	dev_info->max_mac_addrs = adapter->max_mac_addrs;
 	dev_info->hash_key_size = IONIC_RSS_HASH_KEY_SIZE;
 	dev_info->reta_size = rte_le_to_cpu_16(ident->lif.eth.rss_ind_tbl_sz);
 	dev_info->flow_type_rss_offloads = IONIC_ETH_RSS_OFFLOAD_ALL;
@@ -889,6 +892,15 @@ ionic_dev_start(struct rte_eth_dev *eth_dev)
 	if (dev_conf->lpbk_mode)
 		IONIC_PRINT(WARNING, "Loopback mode not supported");
 
+	lif->frame_size = eth_dev->data->mtu + IONIC_ETH_OVERHEAD;
+
+	err = ionic_lif_change_mtu(lif, eth_dev->data->mtu);
+	if (err) {
+		IONIC_PRINT(ERR, "Cannot set LIF frame size %u: %d",
+			lif->frame_size, err);
+		return err;
+	}
+
 	err = ionic_lif_start(lif);
 	if (err) {
 		IONIC_PRINT(ERR, "Cannot start LIF: %d", err);
drivers/net/ionic/ionic_if.h +4 -4
index 761d366c71..05ab620167 100644
@@ -401,8 +401,8 @@ union ionic_lif_config {
  *     @version:            Ethernet identify structure version
  *     @max_ucast_filters:  Number of perfect unicast addresses supported
  *     @max_mcast_filters:  Number of perfect multicast addresses supported
- *     @min_frame_size:     Minimum size of frames to be sent
- *     @max_frame_size:     Maximum size of frames to be sent
+ *     @min_mtu:            Minimum MTU of frames to be sent
+ *     @max_mtu:            Maximum MTU of frames to be sent
  *     @config:             LIF config struct with features, mtu, mac, q counts
  *
  * @rdma:                RDMA identify structure
@@ -434,8 +434,8 @@ union ionic_lif_identity {
 			__le32 max_ucast_filters;
 			__le32 max_mcast_filters;
 			__le16 rss_ind_tbl_sz;
-			__le32 min_frame_size;
-			__le32 max_frame_size;
+			__le32 min_mtu;
+			__le32 max_mtu;
 			u8 rsvd2[106];
 			union ionic_lif_config config;
 		} __rte_packed eth;
drivers/net/ionic/ionic_lif.c +3 -7
index dc21387cd8..2c6f7f7f4e 100644
@@ -536,7 +536,7 @@ ionic_dev_allmulticast_disable(struct rte_eth_dev *eth_dev)
 }
 
 int
-ionic_lif_change_mtu(struct ionic_lif *lif, int new_mtu)
+ionic_lif_change_mtu(struct ionic_lif *lif, uint32_t new_mtu)
 {
 	struct ionic_admin_ctx ctx = {
 		.pending_work = true,
@@ -546,13 +546,8 @@ ionic_lif_change_mtu(struct ionic_lif *lif, int new_mtu)
 			.mtu = rte_cpu_to_le_32(new_mtu),
 		},
 	};
-	int err;
-
-	err = ionic_adminq_post_wait(lif, &ctx);
-	if (err)
-		return err;
 
-	return 0;
+	return ionic_adminq_post_wait(lif, &ctx);
 }
 
 int
@@ -730,6 +725,7 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 	int err;
 
 	flags = IONIC_QCQ_F_SG;
+
 	err = ionic_qcq_alloc(lif,
 		IONIC_QTYPE_RXQ,
 		sizeof(struct ionic_rx_qcq),
drivers/net/ionic/ionic_lif.h +3 -1
index 4aebfe20d0..c3ae96d25b 100644
@@ -81,6 +81,7 @@ struct ionic_rx_qcq {
 
 	/* cacheline2 */
 	struct rte_mempool *mb_pool;
+	uint16_t frame_size;	/* Based on configured MTU */
 	uint16_t flags;
 
 	/* cacheline3 (inside stats) */
@@ -123,6 +124,7 @@ struct ionic_lif {
 	struct ionic_adapter *adapter;
 	struct rte_eth_dev *eth_dev;
 	uint16_t port_id;  /**< Device port identifier */
+	uint16_t frame_size;
 	uint32_t hw_index;
 	uint32_t state;
 	uint32_t ntxqcqs;
@@ -181,7 +183,7 @@ int ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr);
 int ionic_qcq_service(struct ionic_qcq *qcq, int budget, ionic_cq_cb cb,
 	void *cb_arg);
 
-int ionic_lif_change_mtu(struct ionic_lif *lif, int new_mtu);
+int ionic_lif_change_mtu(struct ionic_lif *lif, uint32_t new_mtu);
 
 int ionic_dev_add_mac(struct rte_eth_dev *eth_dev,
 	struct rte_ether_addr *mac_addr,
drivers/net/ionic/ionic_rxtx.c +11 -15
index acdfda9312..d77f06c022 100644
@@ -772,8 +772,6 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 	struct ionic_rxq_comp *cq_desc_base = cq->base;
 	struct ionic_rxq_comp *cq_desc = &cq_desc_base[cq_desc_index];
 	struct rte_mbuf *rxm, *rxm_seg;
-	uint32_t max_frame_size =
-		rxq->qcq.lif->eth_dev->data->mtu + RTE_ETHER_HDR_LEN;
 	uint64_t pkt_flags = 0;
 	uint32_t pkt_type;
 	struct ionic_rx_stats *stats = &rxq->stats;
@@ -814,8 +812,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 		return;
 	}
 
-	if (cq_desc->len > max_frame_size ||
-			cq_desc->len == 0) {
+	if (cq_desc->len > rxq->frame_size || cq_desc->len == 0) {
 		stats->bad_len++;
 		ionic_rx_recycle(q, q_desc_index, rxm);
 		return;
@@ -936,7 +933,7 @@ ionic_rx_recycle(struct ionic_queue *q, uint32_t q_desc_index,
 }
 
 static __rte_always_inline int
-ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len)
+ionic_rx_fill(struct ionic_rx_qcq *rxq)
 {
 	struct ionic_queue *q = &rxq->qcq.q;
 	struct ionic_rxq_desc *desc, *desc_base = q->base;
@@ -961,7 +958,7 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len)
 
 		info = IONIC_INFO_PTR(q, q->head_idx);
 
-		nsegs = (len + buf_size - 1) / buf_size;
+		nsegs = (rxq->frame_size + buf_size - 1) / buf_size;
 
 		desc = &desc_base[q->head_idx];
 		dma_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(rxm));
@@ -996,9 +993,9 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len)
 			prev_rxm_seg = rxm_seg;
 		}
 
-		if (size < len)
+		if (size < rxq->frame_size)
 			IONIC_PRINT(ERR, "Rx SG size is not sufficient (%d < %d)",
-				size, len);
+				size, rxq->frame_size);
 
 		info[0] = rxm;
 
@@ -1016,7 +1013,6 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len)
 int __rte_cold
 ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 {
-	uint32_t frame_size = eth_dev->data->mtu + RTE_ETHER_HDR_LEN;
 	uint8_t *rx_queue_state = eth_dev->data->rx_queue_state;
 	struct ionic_rx_qcq *rxq;
 	int err;
@@ -1029,8 +1025,10 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 
 	rxq = eth_dev->data->rx_queues[rx_queue_id];
 
-	IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs (size: %u)",
-		rx_queue_id, rxq->qcq.q.num_descs, frame_size);
+	rxq->frame_size = rxq->qcq.lif->frame_size - RTE_ETHER_CRC_LEN;
+
+	IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs, size %u",
+		rx_queue_id, rxq->qcq.q.num_descs, rxq->frame_size);
 
 	if (!(rxq->flags & IONIC_QCQ_F_INITED)) {
 		err = ionic_lif_rxq_init(rxq);
@@ -1041,7 +1039,7 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 	}
 
 	/* Allocate buffers for descriptor rings */
-	if (ionic_rx_fill(rxq, frame_size) != 0) {
+	if (ionic_rx_fill(rxq) != 0) {
 		IONIC_PRINT(ERR, "Could not alloc mbuf for queue:%d",
 			rx_queue_id);
 		return -1;
@@ -1129,8 +1127,6 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts)
 {
 	struct ionic_rx_qcq *rxq = rx_queue;
-	uint32_t frame_size =
-		rxq->qcq.lif->eth_dev->data->mtu + RTE_ETHER_HDR_LEN;
 	struct ionic_rx_service service_cb_arg;
 
 	service_cb_arg.rx_pkts = rx_pkts;
@@ -1139,7 +1135,7 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 	ionic_rxq_service(rxq, nb_pkts, &service_cb_arg);
 
-	ionic_rx_fill(rxq, frame_size);
+	ionic_rx_fill(rxq);
 
 	return service_cb_arg.nb_rx;
 }
Signature · 1 line
2.17.1
#19 lore raw

PATCH 9/35 net/ionic: simplify code by removing doorbell map helper

In reply to Andrew Boyer

There is only one doorbell page in DPDK configurations, so no helper function is needed.

---
 drivers/net/ionic/ionic_lif.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/net/ionic/ionic_lif.c +1 -12
index 2c6f7f7f4e..4cc44a6a2f 100644
@@ -846,17 +846,6 @@ ionic_notify_qcq_alloc(struct ionic_lif *lif)
 	return 0;
 }
 
-static void *
-ionic_bus_map_dbpage(struct ionic_adapter *adapter, int page_num)
-{
-	char *vaddr = adapter->bars[IONIC_PCI_BAR_DBELL].vaddr;
-
-	if (adapter->num_bars <= IONIC_PCI_BAR_DBELL)
-		return NULL;
-
-	return (void *)&vaddr[page_num << PAGE_SHIFT];
-}
-
 static void
 ionic_lif_queue_identify(struct ionic_lif *lif)
 {
@@ -959,7 +948,7 @@ ionic_lif_alloc(struct ionic_lif *lif)
 	rte_spinlock_init(&lif->adminq_lock);
 	rte_spinlock_init(&lif->adminq_service_lock);
 
-	lif->kern_dbpage = ionic_bus_map_dbpage(adapter, 0);
+	lif->kern_dbpage = adapter->idev.db_pages;
 	if (!lif->kern_dbpage) {
 		IONIC_PRINT(ERR, "Cannot map dbpage, aborting");
 		return -ENOMEM;
Signature · 1 line
2.17.1
#20 lore raw

PATCH 9/35 net/ionic: simplify code by removing doorbell map helper

In reply to Andrew Boyer

There is only one doorbell page in DPDK configurations, so no helper function is needed.

---
 drivers/net/ionic/ionic_lif.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/net/ionic/ionic_lif.c +1 -12
index 2c6f7f7f4e..4cc44a6a2f 100644
@@ -846,17 +846,6 @@ ionic_notify_qcq_alloc(struct ionic_lif *lif)
 	return 0;
 }
 
-static void *
-ionic_bus_map_dbpage(struct ionic_adapter *adapter, int page_num)
-{
-	char *vaddr = adapter->bars[IONIC_PCI_BAR_DBELL].vaddr;
-
-	if (adapter->num_bars <= IONIC_PCI_BAR_DBELL)
-		return NULL;
-
-	return (void *)&vaddr[page_num << PAGE_SHIFT];
-}
-
 static void
 ionic_lif_queue_identify(struct ionic_lif *lif)
 {
@@ -959,7 +948,7 @@ ionic_lif_alloc(struct ionic_lif *lif)
 	rte_spinlock_init(&lif->adminq_lock);
 	rte_spinlock_init(&lif->adminq_service_lock);
 
-	lif->kern_dbpage = ionic_bus_map_dbpage(adapter, 0);
+	lif->kern_dbpage = adapter->idev.db_pages;
 	if (!lif->kern_dbpage) {
 		IONIC_PRINT(ERR, "Cannot map dbpage, aborting");
 		return -ENOMEM;
Signature · 1 line
2.17.1
#21 lore raw

PATCH 10/35 net/ionic: remove unused identifiers

In reply to Andrew Boyer

These bits are not used. Remove them to simplify the code. Fix the spacing on the IONIC_ALIGN #define.

---
 drivers/net/ionic/ionic.h        | 1 -
 drivers/net/ionic/ionic_dev.h    | 4 +---
 drivers/net/ionic/ionic_ethdev.h | 2 --
 3 files changed, 1 insertion(+), 6 deletions(-)
drivers/net/ionic/ionic.h +0 -1
index 7578cd31bf..ebe23ad4e6 100644
@@ -62,7 +62,6 @@ struct ionic_adapter {
 	bool link_up;
 	char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN];
 	struct rte_pci_device *pci_dev;
-	LIST_ENTRY(ionic_adapter) pci_adapters;
 };
 
 /** ionic_admin_ctx - Admin command context.
drivers/net/ionic/ionic_dev.h +1 -3
index 42ba9ef5aa..600d8f4abd 100644
@@ -21,12 +21,10 @@
 #define IONIC_MIN_RING_DESC		16
 #define IONIC_DEF_TXRX_DESC		4096
 
-#define IONIC_LIFS_MAX			1024
-
 #define IONIC_DEVCMD_TIMEOUT		5	/* devcmd_timeout */
 #define IONIC_DEVCMD_CHECK_PERIOD_US	10	/* devcmd status chk period */
 
-#define	IONIC_ALIGN             4096
+#define IONIC_ALIGN			4096
 
 struct ionic_adapter;
 
drivers/net/ionic/ionic_ethdev.h +0 -2
index d1ed293604..f4a4276d33 100644
@@ -17,8 +17,6 @@
 
 #define IONIC_ETH_DEV_TO_LIF(eth_dev) ((struct ionic_lif *) \
 	(eth_dev)->data->dev_private)
-#define IONIC_ETH_DEV_TO_ADAPTER(eth_dev) \
-	(IONIC_ETH_DEV_TO_LIF(eth_dev)->adapter)
 
 int ionic_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
 
Signature · 1 line
2.17.1
#22 lore raw

PATCH 10/35 net/ionic: remove unused identifiers

In reply to Andrew Boyer

These bits are not used. Remove them to simplify the code. Fix the spacing on the IONIC_ALIGN #define.

---
 drivers/net/ionic/ionic.h        | 1 -
 drivers/net/ionic/ionic_dev.h    | 4 +---
 drivers/net/ionic/ionic_ethdev.h | 2 --
 3 files changed, 1 insertion(+), 6 deletions(-)
drivers/net/ionic/ionic.h +0 -1
index 7578cd31bf..ebe23ad4e6 100644
@@ -62,7 +62,6 @@ struct ionic_adapter {
 	bool link_up;
 	char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN];
 	struct rte_pci_device *pci_dev;
-	LIST_ENTRY(ionic_adapter) pci_adapters;
 };
 
 /** ionic_admin_ctx - Admin command context.
drivers/net/ionic/ionic_dev.h +1 -3
index 42ba9ef5aa..600d8f4abd 100644
@@ -21,12 +21,10 @@
 #define IONIC_MIN_RING_DESC		16
 #define IONIC_DEF_TXRX_DESC		4096
 
-#define IONIC_LIFS_MAX			1024
-
 #define IONIC_DEVCMD_TIMEOUT		5	/* devcmd_timeout */
 #define IONIC_DEVCMD_CHECK_PERIOD_US	10	/* devcmd status chk period */
 
-#define	IONIC_ALIGN             4096
+#define IONIC_ALIGN			4096
 
 struct ionic_adapter;
 
drivers/net/ionic/ionic_ethdev.h +0 -2
index d1ed293604..f4a4276d33 100644
@@ -17,8 +17,6 @@
 
 #define IONIC_ETH_DEV_TO_LIF(eth_dev) ((struct ionic_lif *) \
 	(eth_dev)->data->dev_private)
-#define IONIC_ETH_DEV_TO_ADAPTER(eth_dev) \
-	(IONIC_ETH_DEV_TO_LIF(eth_dev)->adapter)
 
 int ionic_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
 
Signature · 1 line
2.17.1
#23 lore raw

PATCH 11/35 net/ionic: only allocate interrupts if required

In reply to Andrew Boyer

There is no need to allocate the interrupt vector list if datapath packet interrupts are not enabled.
This conserves resources.

---
 drivers/net/ionic/ionic_ethdev.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/ionic/ionic_ethdev.c +7 -5
index 815b7e3c9e..efea691b8f 100644
@@ -1082,14 +1082,16 @@ ionic_configure_intr(struct ionic_adapter *adapter)
 		return -1;
 	}
 
-	if (rte_intr_dp_is_en(intr_handle))
+	if (rte_intr_dp_is_en(intr_handle)) {
 		IONIC_PRINT(DEBUG,
 			"Packet I/O interrupt on datapath is enabled");
 
-	if (rte_intr_vec_list_alloc(intr_handle, "intr_vec", adapter->nintrs)) {
-		IONIC_PRINT(ERR, "Failed to allocate %u vectors",
-			    adapter->nintrs);
-		return -ENOMEM;
+		if (rte_intr_vec_list_alloc(intr_handle, "intr_vec",
+						adapter->nintrs)) {
+			IONIC_PRINT(ERR, "Failed to allocate %u vectors",
+				adapter->nintrs);
+			return -ENOMEM;
+		}
 	}
 
 	err = rte_intr_callback_register(intr_handle,
Signature · 1 line
2.17.1
#24 lore raw

PATCH 11/35 net/ionic: only allocate interrupts if required

In reply to Andrew Boyer

There is no need to allocate the interrupt vector list if datapath packet interrupts are not enabled.
This conserves resources.

---
 drivers/net/ionic/ionic_ethdev.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/ionic/ionic_ethdev.c +7 -5
index 815b7e3c9e..efea691b8f 100644
@@ -1082,14 +1082,16 @@ ionic_configure_intr(struct ionic_adapter *adapter)
 		return -1;
 	}
 
-	if (rte_intr_dp_is_en(intr_handle))
+	if (rte_intr_dp_is_en(intr_handle)) {
 		IONIC_PRINT(DEBUG,
 			"Packet I/O interrupt on datapath is enabled");
 
-	if (rte_intr_vec_list_alloc(intr_handle, "intr_vec", adapter->nintrs)) {
-		IONIC_PRINT(ERR, "Failed to allocate %u vectors",
-			    adapter->nintrs);
-		return -ENOMEM;
+		if (rte_intr_vec_list_alloc(intr_handle, "intr_vec",
+						adapter->nintrs)) {
+			IONIC_PRINT(ERR, "Failed to allocate %u vectors",
+				adapter->nintrs);
+			return -ENOMEM;
+		}
 	}
 
 	err = rte_intr_callback_register(intr_handle,
Signature · 1 line
2.17.1
#25 lore raw

PATCH 12/35 net/ionic: move PCI-specific code to a separate file

In reply to Andrew Boyer

For future support of virtual devices, move the PCI code to its own file. Create a new device interface, struct ionic_dev_intf, to plug in to common code.

---
 drivers/net/ionic/ionic.h         |  13 +-
 drivers/net/ionic/ionic_dev.c     |  62 ---------
 drivers/net/ionic/ionic_dev.h     |  13 +-
 drivers/net/ionic/ionic_dev_pci.c | 216 ++++++++++++++++++++++++++++++
 drivers/net/ionic/ionic_ethdev.c  | 161 ++++++----------------
 drivers/net/ionic/ionic_ethdev.h  |   9 ++
 drivers/net/ionic/ionic_main.c    |   2 +-
 drivers/net/ionic/meson.build     |   1 +
 8 files changed, 286 insertions(+), 191 deletions(-)
 create mode 100644 drivers/net/ionic/ionic_dev_pci.c
drivers/net/ionic/ionic.h +8 -5
index ebe23ad4e6..6bfab623f7 100644
@@ -8,8 +8,6 @@
 #include <stdint.h>
 #include <inttypes.h>
 
-#include <bus_pci_driver.h>
-
 #include "ionic_dev.h"
 #include "ionic_if.h"
 #include "ionic_osdep.h"
@@ -42,6 +40,11 @@ struct ionic_hw {
 	uint16_t vendor_id;
 };
 
+struct ionic_bars {
+	struct ionic_dev_bar bar[IONIC_BARS_MAX];
+	uint32_t num_bars;
+};
+
 /*
  * Structure to store private data for each driver instance (for each adapter).
  */
@@ -49,10 +52,10 @@ struct ionic_adapter {
 	struct ionic_hw hw;
 	struct ionic_dev idev;
 	const char *name;
-	struct ionic_dev_bar bars[IONIC_BARS_MAX];
+	struct ionic_bars bars;
+	const struct ionic_dev_intf *intf;
 	struct ionic_identity	ident;
 	struct ionic_lif *lif;
-	uint32_t num_bars;
 	uint32_t max_ntxqs_per_lif;
 	uint32_t max_nrxqs_per_lif;
 	uint32_t max_mac_addrs;
@@ -61,7 +64,7 @@ struct ionic_adapter {
 	bool intrs[IONIC_INTR_CTRL_REGS_MAX];
 	bool link_up;
 	char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN];
-	struct rte_pci_device *pci_dev;
+	void *bus_dev;
 };
 
 /** ionic_admin_ctx - Admin command context.
drivers/net/ionic/ionic_dev.c +0 -62

68 lines not on this page · raw message

drivers/net/ionic/ionic_dev.h +11 -2
index 600d8f4abd..3b8e9fc3c2 100644
@@ -173,14 +173,23 @@ struct ionic_cq {
 struct ionic_lif;
 struct ionic_adapter;
 struct ionic_qcq;
+struct rte_mempool;
+struct rte_eth_dev;
+
+struct ionic_dev_intf {
+	int  (*setup)(struct ionic_adapter *adapter);
+	void (*copy_bus_info)(struct ionic_adapter *adapter,
+			struct rte_eth_dev *eth_dev);
+	int  (*configure_intr)(struct ionic_adapter *adapter);
+	void (*unconfigure_intr)(struct ionic_adapter *adapter);
+	void (*unmap_bars)(struct ionic_adapter *adapter);
+};
 
 void ionic_intr_init(struct ionic_dev *idev, struct ionic_intr_info *intr,
 	unsigned long index);
 
 const char *ionic_opcode_to_str(enum ionic_cmd_opcode opcode);
 
-int ionic_dev_setup(struct ionic_adapter *adapter);
-
 void ionic_dev_cmd_go(struct ionic_dev *idev, union ionic_dev_cmd *cmd);
 uint8_t ionic_dev_cmd_status(struct ionic_dev *idev);
 bool ionic_dev_cmd_done(struct ionic_dev *idev);
drivers/net/ionic/ionic_dev_pci.c new file +216 -0

216 lines not on this page · raw message

drivers/net/ionic/ionic_ethdev.c +40 -121

274 lines not on this page · raw message

drivers/net/ionic/ionic_ethdev.h +9 -0
index f4a4276d33..c5726408de 100644
@@ -18,6 +18,15 @@
 #define IONIC_ETH_DEV_TO_LIF(eth_dev) ((struct ionic_lif *) \
 	(eth_dev)->data->dev_private)
 
+struct ionic_bars;
+struct ionic_dev_intf;
+
+int eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev,
+	struct ionic_bars *bars, const struct ionic_dev_intf *intf,
+	uint16_t device_id, uint16_t vendor_id);
+int eth_ionic_dev_remove(struct rte_device *rte_dev);
+
+void ionic_dev_interrupt_handler(void *param);
 int ionic_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
 
 #endif /* _IONIC_ETHDEV_H_ */
drivers/net/ionic/ionic_main.c +1 -1
index b42430713c..996af0a51f 100644
@@ -336,7 +336,7 @@ ionic_dev_cmd_wait_check(struct ionic_dev *idev, unsigned long max_wait)
 int
 ionic_setup(struct ionic_adapter *adapter)
 {
-	return ionic_dev_setup(adapter);
+	return (*adapter->intf->setup)(adapter);
 }
 
 int
drivers/net/ionic/meson.build +1 -0
index e251e7cbe0..2869e0027c 100644
@@ -9,6 +9,7 @@ endif
 
 sources = files(
         'ionic_dev.c',
+        'ionic_dev_pci.c',
         'ionic_ethdev.c',
         'ionic_lif.c',
         'ionic_mac_api.c',
Signature · 1 line
2.17.1
#26 lore raw

PATCH 12/35 net/ionic: move PCI-specific code to a separate file

In reply to Andrew Boyer

For future support of virtual devices, move the PCI code to its own file. Create a new device interface, struct ionic_dev_intf, to plug in to common code.

---
 drivers/net/ionic/ionic.h         |  13 +-
 drivers/net/ionic/ionic_dev.c     |  62 ---------
 drivers/net/ionic/ionic_dev.h     |  13 +-
 drivers/net/ionic/ionic_dev_pci.c | 216 ++++++++++++++++++++++++++++++
 drivers/net/ionic/ionic_ethdev.c  | 161 ++++++----------------
 drivers/net/ionic/ionic_ethdev.h  |   9 ++
 drivers/net/ionic/ionic_main.c    |   2 +-
 drivers/net/ionic/meson.build     |   1 +
 8 files changed, 286 insertions(+), 191 deletions(-)
 create mode 100644 drivers/net/ionic/ionic_dev_pci.c
drivers/net/ionic/ionic.h +8 -5
index ebe23ad4e6..6bfab623f7 100644
@@ -8,8 +8,6 @@
 #include <stdint.h>
 #include <inttypes.h>
 
-#include <bus_pci_driver.h>
-
 #include "ionic_dev.h"
 #include "ionic_if.h"
 #include "ionic_osdep.h"
@@ -42,6 +40,11 @@ struct ionic_hw {
 	uint16_t vendor_id;
 };
 
+struct ionic_bars {
+	struct ionic_dev_bar bar[IONIC_BARS_MAX];
+	uint32_t num_bars;
+};
+
 /*
  * Structure to store private data for each driver instance (for each adapter).
  */
@@ -49,10 +52,10 @@ struct ionic_adapter {
 	struct ionic_hw hw;
 	struct ionic_dev idev;
 	const char *name;
-	struct ionic_dev_bar bars[IONIC_BARS_MAX];
+	struct ionic_bars bars;
+	const struct ionic_dev_intf *intf;
 	struct ionic_identity	ident;
 	struct ionic_lif *lif;
-	uint32_t num_bars;
 	uint32_t max_ntxqs_per_lif;
 	uint32_t max_nrxqs_per_lif;
 	uint32_t max_mac_addrs;
@@ -61,7 +64,7 @@ struct ionic_adapter {
 	bool intrs[IONIC_INTR_CTRL_REGS_MAX];
 	bool link_up;
 	char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN];
-	struct rte_pci_device *pci_dev;
+	void *bus_dev;
 };
 
 /** ionic_admin_ctx - Admin command context.
drivers/net/ionic/ionic_dev.c +0 -62

68 lines not on this page · raw message

drivers/net/ionic/ionic_dev.h +11 -2
index 600d8f4abd..3b8e9fc3c2 100644
@@ -173,14 +173,23 @@ struct ionic_cq {
 struct ionic_lif;
 struct ionic_adapter;
 struct ionic_qcq;
+struct rte_mempool;
+struct rte_eth_dev;
+
+struct ionic_dev_intf {
+	int  (*setup)(struct ionic_adapter *adapter);
+	void (*copy_bus_info)(struct ionic_adapter *adapter,
+			struct rte_eth_dev *eth_dev);
+	int  (*configure_intr)(struct ionic_adapter *adapter);
+	void (*unconfigure_intr)(struct ionic_adapter *adapter);
+	void (*unmap_bars)(struct ionic_adapter *adapter);
+};
 
 void ionic_intr_init(struct ionic_dev *idev, struct ionic_intr_info *intr,
 	unsigned long index);
 
 const char *ionic_opcode_to_str(enum ionic_cmd_opcode opcode);
 
-int ionic_dev_setup(struct ionic_adapter *adapter);
-
 void ionic_dev_cmd_go(struct ionic_dev *idev, union ionic_dev_cmd *cmd);
 uint8_t ionic_dev_cmd_status(struct ionic_dev *idev);
 bool ionic_dev_cmd_done(struct ionic_dev *idev);
drivers/net/ionic/ionic_dev_pci.c new file +216 -0

216 lines not on this page · raw message

drivers/net/ionic/ionic_ethdev.c +40 -121

274 lines not on this page · raw message

drivers/net/ionic/ionic_ethdev.h +9 -0
index f4a4276d33..c5726408de 100644
@@ -18,6 +18,15 @@
 #define IONIC_ETH_DEV_TO_LIF(eth_dev) ((struct ionic_lif *) \
 	(eth_dev)->data->dev_private)
 
+struct ionic_bars;
+struct ionic_dev_intf;
+
+int eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev,
+	struct ionic_bars *bars, const struct ionic_dev_intf *intf,
+	uint16_t device_id, uint16_t vendor_id);
+int eth_ionic_dev_remove(struct rte_device *rte_dev);
+
+void ionic_dev_interrupt_handler(void *param);
 int ionic_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
 
 #endif /* _IONIC_ETHDEV_H_ */
drivers/net/ionic/ionic_main.c +1 -1
index b42430713c..996af0a51f 100644
@@ -336,7 +336,7 @@ ionic_dev_cmd_wait_check(struct ionic_dev *idev, unsigned long max_wait)
 int
 ionic_setup(struct ionic_adapter *adapter)
 {
-	return ionic_dev_setup(adapter);
+	return (*adapter->intf->setup)(adapter);
 }
 
 int
drivers/net/ionic/meson.build +1 -0
index e251e7cbe0..2869e0027c 100644
@@ -9,6 +9,7 @@ endif
 
 sources = files(
         'ionic_dev.c',
+        'ionic_dev_pci.c',
         'ionic_ethdev.c',
         'ionic_lif.c',
         'ionic_mac_api.c',
Signature · 1 line
2.17.1
#27 lore raw

PATCH 13/35 net/ionic: only request notifyq interrupt if supported

In reply to Andrew Boyer

Enable the interrupt if the platform & device support it. This prevents spurious interrupts on virtual platforms.

---
 drivers/net/ionic/ionic_lif.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/ionic/ionic_lif.c +9 -3
index 4cc44a6a2f..220a4fdacb 100644
@@ -1350,6 +1350,7 @@ ionic_lif_notifyq_init(struct ionic_lif *lif)
 	struct ionic_dev *idev = &lif->adapter->idev;
 	struct ionic_notify_qcq *nqcq = lif->notifyqcq;
 	struct ionic_queue *q = &nqcq->qcq.q;
+	uint16_t flags = IONIC_QINIT_F_ENA;
 	int err;
 
 	struct ionic_admin_ctx ctx = {
@@ -1359,14 +1360,19 @@ ionic_lif_notifyq_init(struct ionic_lif *lif)
 			.type = q->type,
 			.ver = lif->qtype_info[q->type].version,
 			.index = rte_cpu_to_le_32(q->index),
-			.intr_index = rte_cpu_to_le_16(nqcq->intr.index),
-			.flags = rte_cpu_to_le_16(IONIC_QINIT_F_IRQ |
-						IONIC_QINIT_F_ENA),
+			.intr_index = rte_cpu_to_le_16(IONIC_INTR_NONE),
 			.ring_size = rte_log2_u32(q->num_descs),
 			.ring_base = rte_cpu_to_le_64(q->base_pa),
 		}
 	};
 
+	/* Only enable an interrupt if the device supports them */
+	if (lif->adapter->intf->configure_intr != NULL) {
+		flags |= IONIC_QINIT_F_IRQ;
+		ctx.cmd.q_init.intr_index = rte_cpu_to_le_16(nqcq->intr.index);
+	}
+	ctx.cmd.q_init.flags = rte_cpu_to_le_16(flags);
+
 	IONIC_PRINT(DEBUG, "notifyq_init.index %d", q->index);
 	IONIC_PRINT(DEBUG, "notifyq_init.ring_base 0x%" PRIx64 "", q->base_pa);
 	IONIC_PRINT(DEBUG, "notifyq_init.ring_size %d",
Signature · 1 line
2.17.1
#28 lore raw

PATCH 13/35 net/ionic: only request notifyq interrupt if supported

In reply to Andrew Boyer

Enable the interrupt if the platform & device support it. This prevents spurious interrupts on virtual platforms.

---
 drivers/net/ionic/ionic_lif.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/ionic/ionic_lif.c +9 -3
index 4cc44a6a2f..220a4fdacb 100644
@@ -1350,6 +1350,7 @@ ionic_lif_notifyq_init(struct ionic_lif *lif)
 	struct ionic_dev *idev = &lif->adapter->idev;
 	struct ionic_notify_qcq *nqcq = lif->notifyqcq;
 	struct ionic_queue *q = &nqcq->qcq.q;
+	uint16_t flags = IONIC_QINIT_F_ENA;
 	int err;
 
 	struct ionic_admin_ctx ctx = {
@@ -1359,14 +1360,19 @@ ionic_lif_notifyq_init(struct ionic_lif *lif)
 			.type = q->type,
 			.ver = lif->qtype_info[q->type].version,
 			.index = rte_cpu_to_le_32(q->index),
-			.intr_index = rte_cpu_to_le_16(nqcq->intr.index),
-			.flags = rte_cpu_to_le_16(IONIC_QINIT_F_IRQ |
-						IONIC_QINIT_F_ENA),
+			.intr_index = rte_cpu_to_le_16(IONIC_INTR_NONE),
 			.ring_size = rte_log2_u32(q->num_descs),
 			.ring_base = rte_cpu_to_le_64(q->base_pa),
 		}
 	};
 
+	/* Only enable an interrupt if the device supports them */
+	if (lif->adapter->intf->configure_intr != NULL) {
+		flags |= IONIC_QINIT_F_IRQ;
+		ctx.cmd.q_init.intr_index = rte_cpu_to_le_16(nqcq->intr.index);
+	}
+	ctx.cmd.q_init.flags = rte_cpu_to_le_16(flags);
+
 	IONIC_PRINT(DEBUG, "notifyq_init.index %d", q->index);
 	IONIC_PRINT(DEBUG, "notifyq_init.ring_base 0x%" PRIx64 "", q->base_pa);
 	IONIC_PRINT(DEBUG, "notifyq_init.ring_size %d",
Signature · 1 line
2.17.1
#29 lore raw

PATCH 14/35 net/ionic: replace void pointer with actual type

In reply to Andrew Boyer

This makes the code safer by helping the compiler catch errors. Rename the variables, too; they're not callbacks anymore.

---
 drivers/net/ionic/ionic_rxtx.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)
drivers/net/ionic/ionic_rxtx.c +13 -15
index d77f06c022..440e655e63 100644
@@ -765,7 +765,7 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 static __rte_always_inline void
 ionic_rx_clean(struct ionic_rx_qcq *rxq,
 		uint32_t q_desc_index, uint32_t cq_desc_index,
-		void *service_cb_arg)
+		struct ionic_rx_service *rx_svc)
 {
 	struct ionic_queue *q = &rxq->qcq.q;
 	struct ionic_cq *cq = &rxq->qcq.cq;
@@ -775,8 +775,6 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 	uint64_t pkt_flags = 0;
 	uint32_t pkt_type;
 	struct ionic_rx_stats *stats = &rxq->stats;
-	struct ionic_rx_service *recv_args = (struct ionic_rx_service *)
-		service_cb_arg;
 	uint32_t buf_size = (uint16_t)
 		(rte_pktmbuf_data_room_size(rxq->mb_pool) -
 		RTE_PKTMBUF_HEADROOM);
@@ -789,7 +787,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 
 	rxm = info[0];
 
-	if (!recv_args) {
+	if (!rx_svc) {
 		stats->no_cb_arg++;
 		/* Flush */
 		rte_pktmbuf_free(rxm);
@@ -806,7 +804,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 		return;
 	}
 
-	if (recv_args->nb_rx >= recv_args->nb_pkts) {
+	if (rx_svc->nb_rx >= rx_svc->nb_pkts) {
 		stats->no_room++;
 		ionic_rx_recycle(q, q_desc_index, rxm);
 		return;
@@ -907,8 +905,8 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 
 	rxm->packet_type = pkt_type;
 
-	recv_args->rx_pkts[recv_args->nb_rx] = rxm;
-	recv_args->nb_rx++;
+	rx_svc->rx_pkts[rx_svc->nb_rx] = rxm;
+	rx_svc->nb_rx++;
 
 	stats->packets++;
 	stats->bytes += rxm->pkt_len;
@@ -1052,7 +1050,7 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 
 static __rte_always_inline void
 ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,
-		void *service_cb_arg)
+		struct ionic_rx_service *rx_svc)
 {
 	struct ionic_cq *cq = &rxq->qcq.cq;
 	struct ionic_queue *q = &rxq->qcq.q;
@@ -1088,7 +1086,7 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,
 				rte_prefetch0(&q->info[q->tail_idx]);
 
 			ionic_rx_clean(rxq, curr_q_tail_idx, curr_cq_tail_idx,
-				service_cb_arg);
+				rx_svc);
 
 		} while (more);
 
@@ -1127,15 +1125,15 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts)
 {
 	struct ionic_rx_qcq *rxq = rx_queue;
-	struct ionic_rx_service service_cb_arg;
+	struct ionic_rx_service rx_svc;
 
-	service_cb_arg.rx_pkts = rx_pkts;
-	service_cb_arg.nb_pkts = nb_pkts;
-	service_cb_arg.nb_rx = 0;
+	rx_svc.rx_pkts = rx_pkts;
+	rx_svc.nb_pkts = nb_pkts;
+	rx_svc.nb_rx = 0;
 
-	ionic_rxq_service(rxq, nb_pkts, &service_cb_arg);
+	ionic_rxq_service(rxq, nb_pkts, &rx_svc);
 
 	ionic_rx_fill(rxq);
 
-	return service_cb_arg.nb_rx;
+	return rx_svc.nb_rx;
 }
Signature · 1 line
2.17.1
#30 lore raw

PATCH 14/35 net/ionic: replace void pointer with actual type

In reply to Andrew Boyer

This makes the code safer by helping the compiler catch errors. Rename the variables, too; they're not callbacks anymore.

---
 drivers/net/ionic/ionic_rxtx.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)
drivers/net/ionic/ionic_rxtx.c +13 -15
index d77f06c022..440e655e63 100644
@@ -765,7 +765,7 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 static __rte_always_inline void
 ionic_rx_clean(struct ionic_rx_qcq *rxq,
 		uint32_t q_desc_index, uint32_t cq_desc_index,
-		void *service_cb_arg)
+		struct ionic_rx_service *rx_svc)
 {
 	struct ionic_queue *q = &rxq->qcq.q;
 	struct ionic_cq *cq = &rxq->qcq.cq;
@@ -775,8 +775,6 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 	uint64_t pkt_flags = 0;
 	uint32_t pkt_type;
 	struct ionic_rx_stats *stats = &rxq->stats;
-	struct ionic_rx_service *recv_args = (struct ionic_rx_service *)
-		service_cb_arg;
 	uint32_t buf_size = (uint16_t)
 		(rte_pktmbuf_data_room_size(rxq->mb_pool) -
 		RTE_PKTMBUF_HEADROOM);
@@ -789,7 +787,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 
 	rxm = info[0];
 
-	if (!recv_args) {
+	if (!rx_svc) {
 		stats->no_cb_arg++;
 		/* Flush */
 		rte_pktmbuf_free(rxm);
@@ -806,7 +804,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 		return;
 	}
 
-	if (recv_args->nb_rx >= recv_args->nb_pkts) {
+	if (rx_svc->nb_rx >= rx_svc->nb_pkts) {
 		stats->no_room++;
 		ionic_rx_recycle(q, q_desc_index, rxm);
 		return;
@@ -907,8 +905,8 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 
 	rxm->packet_type = pkt_type;
 
-	recv_args->rx_pkts[recv_args->nb_rx] = rxm;
-	recv_args->nb_rx++;
+	rx_svc->rx_pkts[rx_svc->nb_rx] = rxm;
+	rx_svc->nb_rx++;
 
 	stats->packets++;
 	stats->bytes += rxm->pkt_len;
@@ -1052,7 +1050,7 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 
 static __rte_always_inline void
 ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,
-		void *service_cb_arg)
+		struct ionic_rx_service *rx_svc)
 {
 	struct ionic_cq *cq = &rxq->qcq.cq;
 	struct ionic_queue *q = &rxq->qcq.q;
@@ -1088,7 +1086,7 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,
 				rte_prefetch0(&q->info[q->tail_idx]);
 
 			ionic_rx_clean(rxq, curr_q_tail_idx, curr_cq_tail_idx,
-				service_cb_arg);
+				rx_svc);
 
 		} while (more);
 
@@ -1127,15 +1125,15 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts)
 {
 	struct ionic_rx_qcq *rxq = rx_queue;
-	struct ionic_rx_service service_cb_arg;
+	struct ionic_rx_service rx_svc;
 
-	service_cb_arg.rx_pkts = rx_pkts;
-	service_cb_arg.nb_pkts = nb_pkts;
-	service_cb_arg.nb_rx = 0;
+	rx_svc.rx_pkts = rx_pkts;
+	rx_svc.nb_pkts = nb_pkts;
+	rx_svc.nb_rx = 0;
 
-	ionic_rxq_service(rxq, nb_pkts, &service_cb_arg);
+	ionic_rxq_service(rxq, nb_pkts, &rx_svc);
 
 	ionic_rx_fill(rxq);
 
-	return service_cb_arg.nb_rx;
+	return rx_svc.nb_rx;
 }
Signature · 1 line
2.17.1
#31 lore raw

PATCH 15/35 net/ionic: free all buffers during Rx queue stop

In reply to Andrew Boyer

Free all of the mbufs in the receive queue when the queue is stopped. This will allow them to be resized when the MTU is changed.

---
 drivers/net/ionic/ionic_dev.c  |  16 +++++
 drivers/net/ionic/ionic_dev.h  |   2 +
 drivers/net/ionic/ionic_lif.c  |  32 ++++-----
 drivers/net/ionic/ionic_lif.h  |   4 --
 drivers/net/ionic/ionic_rxtx.c | 116 +++++++++++++++------------------
 5 files changed, 81 insertions(+), 89 deletions(-)
drivers/net/ionic/ionic_dev.c +16 -0
index d0d2ab1b17..e31ce4b2ef 100644
@@ -317,6 +317,15 @@ ionic_cq_init(struct ionic_cq *cq, uint16_t num_descs)
 	return 0;
 }
 
+void
+ionic_cq_reset(struct ionic_cq *cq)
+{
+	cq->tail_idx = 0;
+	cq->done_color = 1;
+
+	memset(cq->base, 0, sizeof(struct ionic_nop_comp) * cq->num_descs);
+}
+
 void
 ionic_cq_map(struct ionic_cq *cq, void *base, rte_iova_t base_pa)
 {
@@ -379,3 +388,10 @@ ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa)
 	q->sg_base = base;
 	q->sg_base_pa = base_pa;
 }
+
+void
+ionic_q_reset(struct ionic_queue *q)
+{
+	q->head_idx = 0;
+	q->tail_idx = 0;
+}
drivers/net/ionic/ionic_dev.h +2 -0
index 3b8e9fc3c2..f72c05342c 100644
@@ -225,6 +225,7 @@ struct ionic_doorbell __iomem *ionic_db_map(struct ionic_lif *lif,
 	struct ionic_queue *q);
 
 int ionic_cq_init(struct ionic_cq *cq, uint16_t num_descs);
+void ionic_cq_reset(struct ionic_cq *cq);
 void ionic_cq_map(struct ionic_cq *cq, void *base, rte_iova_t base_pa);
 typedef bool (*ionic_cq_cb)(struct ionic_cq *cq, uint16_t cq_desc_index,
 		void *cb_arg);
@@ -232,6 +233,7 @@ uint32_t ionic_cq_service(struct ionic_cq *cq, uint32_t work_to_do,
 	ionic_cq_cb cb, void *cb_arg);
 
 int ionic_q_init(struct ionic_queue *q, uint32_t index, uint16_t num_descs);
+void ionic_q_reset(struct ionic_queue *q);
 void ionic_q_map(struct ionic_queue *q, void *base, rte_iova_t base_pa);
 void ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa);
 
drivers/net/ionic/ionic_lif.c +11 -21
index 220a4fdacb..578e36e60c 100644
@@ -30,25 +30,7 @@ static const uint8_t ionic_qtype_vers[IONIC_QTYPE_MAX] = {
 static int ionic_lif_addr_add(struct ionic_lif *lif, const uint8_t *addr);
 static int ionic_lif_addr_del(struct ionic_lif *lif, const uint8_t *addr);
 
-int
-ionic_qcq_enable(struct ionic_qcq *qcq)
-{
-	struct ionic_queue *q = &qcq->q;
-	struct ionic_lif *lif = qcq->lif;
-	struct ionic_admin_ctx ctx = {
-		.pending_work = true,
-		.cmd.q_control = {
-			.opcode = IONIC_CMD_Q_CONTROL,
-			.type = q->type,
-			.index = rte_cpu_to_le_32(q->index),
-			.oper = IONIC_Q_ENABLE,
-		},
-	};
-
-	return ionic_adminq_post_wait(lif, &ctx);
-}
-
-int
+static int
 ionic_qcq_disable(struct ionic_qcq *qcq)
 {
 	struct ionic_queue *q = &qcq->q;
@@ -133,7 +115,6 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats
 	for (i = 0; i < lif->nrxqcqs; i++) {
 		struct ionic_rx_stats *rx_stats = &lif->rxqcqs[i]->stats;
 		stats->ierrors +=
-			rx_stats->no_cb_arg +
 			rx_stats->bad_cq_status +
 			rx_stats->no_room +
 			rx_stats->bad_len;
@@ -154,7 +135,6 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats
 		stats->q_ipackets[i] = rx_stats->packets;
 		stats->q_ibytes[i] = rx_stats->bytes;
 		stats->q_errors[i] =
-			rx_stats->no_cb_arg +
 			rx_stats->bad_cq_status +
 			rx_stats->no_room +
 			rx_stats->bad_len;
@@ -1146,12 +1126,16 @@ ionic_lif_rss_teardown(struct ionic_lif *lif)
 void
 ionic_lif_txq_deinit(struct ionic_tx_qcq *txq)
 {
+	ionic_qcq_disable(&txq->qcq);
+
 	txq->flags &= ~IONIC_QCQ_F_INITED;
 }
 
 void
 ionic_lif_rxq_deinit(struct ionic_rx_qcq *rxq)
 {
+	ionic_qcq_disable(&rxq->qcq);
+
 	rxq->flags &= ~IONIC_QCQ_F_INITED;
 }
 
@@ -1488,6 +1472,9 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq)
 		ctx.cmd.q_init.ring_size);
 	IONIC_PRINT(DEBUG, "txq_init.ver %u", ctx.cmd.q_init.ver);
 
+	ionic_q_reset(q);
+	ionic_cq_reset(cq);
+
 	err = ionic_adminq_post_wait(lif, &ctx);
 	if (err)
 		return err;
@@ -1536,6 +1523,9 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq)
 		ctx.cmd.q_init.ring_size);
 	IONIC_PRINT(DEBUG, "rxq_init.ver %u", ctx.cmd.q_init.ver);
 
+	ionic_q_reset(q);
+	ionic_cq_reset(cq);
+
 	err = ionic_adminq_post_wait(lif, &ctx);
 	if (err)
 		return err;
drivers/net/ionic/ionic_lif.h +0 -4
index c3ae96d25b..b3f0ce720b 100644
@@ -39,7 +39,6 @@ struct ionic_tx_stats {
 struct ionic_rx_stats {
 	uint64_t packets;
 	uint64_t bytes;
-	uint64_t no_cb_arg;
 	uint64_t bad_cq_status;
 	uint64_t no_room;
 	uint64_t bad_len;
@@ -207,9 +206,6 @@ int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id,
 	struct ionic_tx_qcq **qcq_out);
 void ionic_qcq_free(struct ionic_qcq *qcq);
 
-int ionic_qcq_enable(struct ionic_qcq *qcq);
-int ionic_qcq_disable(struct ionic_qcq *qcq);
-
 int ionic_lif_rxq_init(struct ionic_rx_qcq *rxq);
 void ionic_lif_rxq_deinit(struct ionic_rx_qcq *rxq);
 
drivers/net/ionic/ionic_rxtx.c +52 -64

192 lines not on this page · raw message

Signature · 1 line
2.17.1
#32 lore raw

PATCH 15/35 net/ionic: free all buffers during Rx queue stop

In reply to Andrew Boyer

Free all of the mbufs in the receive queue when the queue is stopped. This will allow them to be resized when the MTU is changed.

---
 drivers/net/ionic/ionic_dev.c  |  16 +++++
 drivers/net/ionic/ionic_dev.h  |   2 +
 drivers/net/ionic/ionic_lif.c  |  32 ++++-----
 drivers/net/ionic/ionic_lif.h  |   4 --
 drivers/net/ionic/ionic_rxtx.c | 116 +++++++++++++++------------------
 5 files changed, 81 insertions(+), 89 deletions(-)
drivers/net/ionic/ionic_dev.c +16 -0
index d0d2ab1b17..e31ce4b2ef 100644
@@ -317,6 +317,15 @@ ionic_cq_init(struct ionic_cq *cq, uint16_t num_descs)
 	return 0;
 }
 
+void
+ionic_cq_reset(struct ionic_cq *cq)
+{
+	cq->tail_idx = 0;
+	cq->done_color = 1;
+
+	memset(cq->base, 0, sizeof(struct ionic_nop_comp) * cq->num_descs);
+}
+
 void
 ionic_cq_map(struct ionic_cq *cq, void *base, rte_iova_t base_pa)
 {
@@ -379,3 +388,10 @@ ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa)
 	q->sg_base = base;
 	q->sg_base_pa = base_pa;
 }
+
+void
+ionic_q_reset(struct ionic_queue *q)
+{
+	q->head_idx = 0;
+	q->tail_idx = 0;
+}
drivers/net/ionic/ionic_dev.h +2 -0
index 3b8e9fc3c2..f72c05342c 100644
@@ -225,6 +225,7 @@ struct ionic_doorbell __iomem *ionic_db_map(struct ionic_lif *lif,
 	struct ionic_queue *q);
 
 int ionic_cq_init(struct ionic_cq *cq, uint16_t num_descs);
+void ionic_cq_reset(struct ionic_cq *cq);
 void ionic_cq_map(struct ionic_cq *cq, void *base, rte_iova_t base_pa);
 typedef bool (*ionic_cq_cb)(struct ionic_cq *cq, uint16_t cq_desc_index,
 		void *cb_arg);
@@ -232,6 +233,7 @@ uint32_t ionic_cq_service(struct ionic_cq *cq, uint32_t work_to_do,
 	ionic_cq_cb cb, void *cb_arg);
 
 int ionic_q_init(struct ionic_queue *q, uint32_t index, uint16_t num_descs);
+void ionic_q_reset(struct ionic_queue *q);
 void ionic_q_map(struct ionic_queue *q, void *base, rte_iova_t base_pa);
 void ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa);
 
drivers/net/ionic/ionic_lif.c +11 -21
index 220a4fdacb..578e36e60c 100644
@@ -30,25 +30,7 @@ static const uint8_t ionic_qtype_vers[IONIC_QTYPE_MAX] = {
 static int ionic_lif_addr_add(struct ionic_lif *lif, const uint8_t *addr);
 static int ionic_lif_addr_del(struct ionic_lif *lif, const uint8_t *addr);
 
-int
-ionic_qcq_enable(struct ionic_qcq *qcq)
-{
-	struct ionic_queue *q = &qcq->q;
-	struct ionic_lif *lif = qcq->lif;
-	struct ionic_admin_ctx ctx = {
-		.pending_work = true,
-		.cmd.q_control = {
-			.opcode = IONIC_CMD_Q_CONTROL,
-			.type = q->type,
-			.index = rte_cpu_to_le_32(q->index),
-			.oper = IONIC_Q_ENABLE,
-		},
-	};
-
-	return ionic_adminq_post_wait(lif, &ctx);
-}
-
-int
+static int
 ionic_qcq_disable(struct ionic_qcq *qcq)
 {
 	struct ionic_queue *q = &qcq->q;
@@ -133,7 +115,6 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats
 	for (i = 0; i < lif->nrxqcqs; i++) {
 		struct ionic_rx_stats *rx_stats = &lif->rxqcqs[i]->stats;
 		stats->ierrors +=
-			rx_stats->no_cb_arg +
 			rx_stats->bad_cq_status +
 			rx_stats->no_room +
 			rx_stats->bad_len;
@@ -154,7 +135,6 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats
 		stats->q_ipackets[i] = rx_stats->packets;
 		stats->q_ibytes[i] = rx_stats->bytes;
 		stats->q_errors[i] =
-			rx_stats->no_cb_arg +
 			rx_stats->bad_cq_status +
 			rx_stats->no_room +
 			rx_stats->bad_len;
@@ -1146,12 +1126,16 @@ ionic_lif_rss_teardown(struct ionic_lif *lif)
 void
 ionic_lif_txq_deinit(struct ionic_tx_qcq *txq)
 {
+	ionic_qcq_disable(&txq->qcq);
+
 	txq->flags &= ~IONIC_QCQ_F_INITED;
 }
 
 void
 ionic_lif_rxq_deinit(struct ionic_rx_qcq *rxq)
 {
+	ionic_qcq_disable(&rxq->qcq);
+
 	rxq->flags &= ~IONIC_QCQ_F_INITED;
 }
 
@@ -1488,6 +1472,9 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq)
 		ctx.cmd.q_init.ring_size);
 	IONIC_PRINT(DEBUG, "txq_init.ver %u", ctx.cmd.q_init.ver);
 
+	ionic_q_reset(q);
+	ionic_cq_reset(cq);
+
 	err = ionic_adminq_post_wait(lif, &ctx);
 	if (err)
 		return err;
@@ -1536,6 +1523,9 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq)
 		ctx.cmd.q_init.ring_size);
 	IONIC_PRINT(DEBUG, "rxq_init.ver %u", ctx.cmd.q_init.ver);
 
+	ionic_q_reset(q);
+	ionic_cq_reset(cq);
+
 	err = ionic_adminq_post_wait(lif, &ctx);
 	if (err)
 		return err;
drivers/net/ionic/ionic_lif.h +0 -4
index c3ae96d25b..b3f0ce720b 100644
@@ -39,7 +39,6 @@ struct ionic_tx_stats {
 struct ionic_rx_stats {
 	uint64_t packets;
 	uint64_t bytes;
-	uint64_t no_cb_arg;
 	uint64_t bad_cq_status;
 	uint64_t no_room;
 	uint64_t bad_len;
@@ -207,9 +206,6 @@ int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id,
 	struct ionic_tx_qcq **qcq_out);
 void ionic_qcq_free(struct ionic_qcq *qcq);
 
-int ionic_qcq_enable(struct ionic_qcq *qcq);
-int ionic_qcq_disable(struct ionic_qcq *qcq);
-
 int ionic_lif_rxq_init(struct ionic_rx_qcq *rxq);
 void ionic_lif_rxq_deinit(struct ionic_rx_qcq *rxq);
 
drivers/net/ionic/ionic_rxtx.c +52 -64

192 lines not on this page · raw message

Signature · 1 line
2.17.1
#33 lore raw

PATCH 16/35 net/ionic: precalculate segment lengths on receive side

In reply to Andrew Boyer

The first (header) segment includes the standard headroom. Subsequent segments do not.

Store the fragment counts in the queue structure.

Precalculating improves performance by reducing
how much work must be done in the hot path.

---
 drivers/net/ionic/ionic_dev.h  |  1 +
 drivers/net/ionic/ionic_lif.c  | 36 ++++++++++++++++++++++++--
 drivers/net/ionic/ionic_lif.h  |  4 ++-
 drivers/net/ionic/ionic_rxtx.c | 46 ++++++++++++++--------------------
 4 files changed, 57 insertions(+), 30 deletions(-)
drivers/net/ionic/ionic_dev.h +1 -0
index f72c05342c..55a9485bff 100644
@@ -137,6 +137,7 @@ struct ionic_dev {
 
 struct ionic_queue {
 	uint16_t num_descs;
+	uint16_t num_segs;
 	uint16_t head_idx;
 	uint16_t tail_idx;
 	uint16_t size_mask;
drivers/net/ionic/ionic_lif.c +34 -2
index 578e36e60c..cc64aedaa1 100644
@@ -566,6 +566,7 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 		const char *type_name,
 		uint16_t flags,
 		uint16_t num_descs,
+		uint16_t num_segs,
 		uint16_t desc_size,
 		uint16_t cq_desc_size,
 		uint16_t sg_desc_size,
@@ -616,6 +617,7 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 		goto err_out_free_qcq;
 	}
 
+	new->q.num_segs = num_segs;
 	new->q.type = type;
 
 	err = ionic_q_init(&new->q, index, num_descs);
@@ -698,14 +700,38 @@ ionic_qcq_free(struct ionic_qcq *qcq)
 
 int
 ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
-		uint16_t nrxq_descs, struct ionic_rx_qcq **rxq_out)
+		uint16_t nrxq_descs, struct rte_mempool *mb_pool,
+		struct ionic_rx_qcq **rxq_out)
 {
 	struct ionic_rx_qcq *rxq;
-	uint16_t flags;
+	uint16_t flags, seg_size, hdr_seg_size, max_segs, max_segs_fw;
+	uint32_t max_mtu;
 	int err;
 
 	flags = IONIC_QCQ_F_SG;
 
+	seg_size = rte_pktmbuf_data_room_size(mb_pool);
+
+	/* The first mbuf needs to leave headroom */
+	hdr_seg_size = seg_size - RTE_PKTMBUF_HEADROOM;
+
+	max_mtu = rte_le_to_cpu_32(lif->adapter->ident.lif.eth.max_mtu);
+
+	max_segs_fw = IONIC_RX_MAX_SG_ELEMS + 1;
+
+	/*
+	 * Calculate how many fragment pointers might be stored in queue.
+	 */
+	max_segs = 1 + (max_mtu + RTE_PKTMBUF_HEADROOM - 1) / seg_size;
+
+	IONIC_PRINT(DEBUG, "rxq %u frame_size %u seg_size %u max_segs %u",
+		index, lif->frame_size, seg_size, max_segs);
+	if (max_segs > max_segs_fw) {
+		IONIC_PRINT(ERR, "Rx mbuf size insufficient (%d > %d avail)",
+			max_segs, max_segs_fw);
+		return -EINVAL;
+	}
+
 	err = ionic_qcq_alloc(lif,
 		IONIC_QTYPE_RXQ,
 		sizeof(struct ionic_rx_qcq),
@@ -714,6 +740,7 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 		"rx",
 		flags,
 		nrxq_descs,
+		max_segs,
 		sizeof(struct ionic_rxq_desc),
 		sizeof(struct ionic_rxq_comp),
 		sizeof(struct ionic_rxq_sg_desc),
@@ -722,6 +749,8 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 		return err;
 
 	rxq->flags = flags;
+	rxq->seg_size = seg_size;
+	rxq->hdr_seg_size = hdr_seg_size;
 
 	lif->rxqcqs[index] = rxq;
 	*rxq_out = rxq;
@@ -749,6 +778,7 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 		"tx",
 		flags,
 		ntxq_descs,
+		1,
 		sizeof(struct ionic_txq_desc),
 		sizeof(struct ionic_txq_comp),
 		sizeof(struct ionic_txq_sg_desc_v1),
@@ -779,6 +809,7 @@ ionic_admin_qcq_alloc(struct ionic_lif *lif)
 		"admin",
 		flags,
 		IONIC_ADMINQ_LENGTH,
+		1,
 		sizeof(struct ionic_admin_cmd),
 		sizeof(struct ionic_admin_comp),
 		0,
@@ -805,6 +836,7 @@ ionic_notify_qcq_alloc(struct ionic_lif *lif)
 		"notify",
 		flags,
 		IONIC_NOTIFYQ_LENGTH,
+		1,
 		sizeof(struct ionic_notifyq_cmd),
 		sizeof(union ionic_notifyq_comp),
 		0,
drivers/net/ionic/ionic_lif.h +3 -1
index b3f0ce720b..237fd0a2ef 100644
@@ -81,6 +81,8 @@ struct ionic_rx_qcq {
 	/* cacheline2 */
 	struct rte_mempool *mb_pool;
 	uint16_t frame_size;	/* Based on configured MTU */
+	uint16_t hdr_seg_size;	/* Length of first segment of RX chain */
+	uint16_t seg_size;	/* Length of all subsequent segments */
 	uint16_t flags;
 
 	/* cacheline3 (inside stats) */
@@ -199,7 +201,7 @@ int ionic_dev_allmulticast_enable(struct rte_eth_dev *dev);
 int ionic_dev_allmulticast_disable(struct rte_eth_dev *dev);
 
 int ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id,
-	uint32_t index, uint16_t nrxq_descs,
+	uint32_t index, uint16_t nrxq_descs, struct rte_mempool *mp,
 	struct ionic_rx_qcq **qcq_out);
 int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id,
 	uint32_t index, uint16_t ntxq_descs,
drivers/net/ionic/ionic_rxtx.c +19 -27

118 lines not on this page · raw message

Signature · 1 line
2.17.1
#34 lore raw

PATCH 16/35 net/ionic: precalculate segment lengths on receive side

In reply to Andrew Boyer

The first (header) segment includes the standard headroom. Subsequent segments do not.

Store the fragment counts in the queue structure.

Precalculating improves performance by reducing
how much work must be done in the hot path.

---
 drivers/net/ionic/ionic_dev.h  |  1 +
 drivers/net/ionic/ionic_lif.c  | 36 ++++++++++++++++++++++++--
 drivers/net/ionic/ionic_lif.h  |  4 ++-
 drivers/net/ionic/ionic_rxtx.c | 46 ++++++++++++++--------------------
 4 files changed, 57 insertions(+), 30 deletions(-)
drivers/net/ionic/ionic_dev.h +1 -0
index f72c05342c..55a9485bff 100644
@@ -137,6 +137,7 @@ struct ionic_dev {
 
 struct ionic_queue {
 	uint16_t num_descs;
+	uint16_t num_segs;
 	uint16_t head_idx;
 	uint16_t tail_idx;
 	uint16_t size_mask;
drivers/net/ionic/ionic_lif.c +34 -2
index 578e36e60c..cc64aedaa1 100644
@@ -566,6 +566,7 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 		const char *type_name,
 		uint16_t flags,
 		uint16_t num_descs,
+		uint16_t num_segs,
 		uint16_t desc_size,
 		uint16_t cq_desc_size,
 		uint16_t sg_desc_size,
@@ -616,6 +617,7 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 		goto err_out_free_qcq;
 	}
 
+	new->q.num_segs = num_segs;
 	new->q.type = type;
 
 	err = ionic_q_init(&new->q, index, num_descs);
@@ -698,14 +700,38 @@ ionic_qcq_free(struct ionic_qcq *qcq)
 
 int
 ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
-		uint16_t nrxq_descs, struct ionic_rx_qcq **rxq_out)
+		uint16_t nrxq_descs, struct rte_mempool *mb_pool,
+		struct ionic_rx_qcq **rxq_out)
 {
 	struct ionic_rx_qcq *rxq;
-	uint16_t flags;
+	uint16_t flags, seg_size, hdr_seg_size, max_segs, max_segs_fw;
+	uint32_t max_mtu;
 	int err;
 
 	flags = IONIC_QCQ_F_SG;
 
+	seg_size = rte_pktmbuf_data_room_size(mb_pool);
+
+	/* The first mbuf needs to leave headroom */
+	hdr_seg_size = seg_size - RTE_PKTMBUF_HEADROOM;
+
+	max_mtu = rte_le_to_cpu_32(lif->adapter->ident.lif.eth.max_mtu);
+
+	max_segs_fw = IONIC_RX_MAX_SG_ELEMS + 1;
+
+	/*
+	 * Calculate how many fragment pointers might be stored in queue.
+	 */
+	max_segs = 1 + (max_mtu + RTE_PKTMBUF_HEADROOM - 1) / seg_size;
+
+	IONIC_PRINT(DEBUG, "rxq %u frame_size %u seg_size %u max_segs %u",
+		index, lif->frame_size, seg_size, max_segs);
+	if (max_segs > max_segs_fw) {
+		IONIC_PRINT(ERR, "Rx mbuf size insufficient (%d > %d avail)",
+			max_segs, max_segs_fw);
+		return -EINVAL;
+	}
+
 	err = ionic_qcq_alloc(lif,
 		IONIC_QTYPE_RXQ,
 		sizeof(struct ionic_rx_qcq),
@@ -714,6 +740,7 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 		"rx",
 		flags,
 		nrxq_descs,
+		max_segs,
 		sizeof(struct ionic_rxq_desc),
 		sizeof(struct ionic_rxq_comp),
 		sizeof(struct ionic_rxq_sg_desc),
@@ -722,6 +749,8 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 		return err;
 
 	rxq->flags = flags;
+	rxq->seg_size = seg_size;
+	rxq->hdr_seg_size = hdr_seg_size;
 
 	lif->rxqcqs[index] = rxq;
 	*rxq_out = rxq;
@@ -749,6 +778,7 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 		"tx",
 		flags,
 		ntxq_descs,
+		1,
 		sizeof(struct ionic_txq_desc),
 		sizeof(struct ionic_txq_comp),
 		sizeof(struct ionic_txq_sg_desc_v1),
@@ -779,6 +809,7 @@ ionic_admin_qcq_alloc(struct ionic_lif *lif)
 		"admin",
 		flags,
 		IONIC_ADMINQ_LENGTH,
+		1,
 		sizeof(struct ionic_admin_cmd),
 		sizeof(struct ionic_admin_comp),
 		0,
@@ -805,6 +836,7 @@ ionic_notify_qcq_alloc(struct ionic_lif *lif)
 		"notify",
 		flags,
 		IONIC_NOTIFYQ_LENGTH,
+		1,
 		sizeof(struct ionic_notifyq_cmd),
 		sizeof(union ionic_notifyq_comp),
 		0,
drivers/net/ionic/ionic_lif.h +3 -1
index b3f0ce720b..237fd0a2ef 100644
@@ -81,6 +81,8 @@ struct ionic_rx_qcq {
 	/* cacheline2 */
 	struct rte_mempool *mb_pool;
 	uint16_t frame_size;	/* Based on configured MTU */
+	uint16_t hdr_seg_size;	/* Length of first segment of RX chain */
+	uint16_t seg_size;	/* Length of all subsequent segments */
 	uint16_t flags;
 
 	/* cacheline3 (inside stats) */
@@ -199,7 +201,7 @@ int ionic_dev_allmulticast_enable(struct rte_eth_dev *dev);
 int ionic_dev_allmulticast_disable(struct rte_eth_dev *dev);
 
 int ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id,
-	uint32_t index, uint16_t nrxq_descs,
+	uint32_t index, uint16_t nrxq_descs, struct rte_mempool *mp,
 	struct ionic_rx_qcq **qcq_out);
 int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id,
 	uint32_t index, uint16_t ntxq_descs,
drivers/net/ionic/ionic_rxtx.c +19 -27

118 lines not on this page · raw message

Signature · 1 line
2.17.1
#35 lore raw

PATCH 17/35 net/ionic: use a helper variable in packet Tx function

In reply to Andrew Boyer

This improves readability.

---
 drivers/net/ionic/ionic_rxtx.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ionic/ionic_rxtx.c +7 -4
index 0f251eca13..0c1cc842cf 100644
@@ -560,6 +560,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	struct ionic_tx_qcq *txq = tx_queue;
 	struct ionic_queue *q = &txq->qcq.q;
 	struct ionic_tx_stats *stats = &txq->stats;
+	struct rte_mbuf *mbuf;
 	uint32_t next_q_head_idx;
 	uint32_t bytes_tx = 0;
 	uint16_t nb_avail, nb_tx = 0;
@@ -582,16 +583,18 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			rte_prefetch0(&q->info[next_q_head_idx]);
 		}
 
-		if (tx_pkts[nb_tx]->ol_flags & RTE_MBUF_F_TX_TCP_SEG)
-			err = ionic_tx_tso(txq, tx_pkts[nb_tx]);
+		mbuf = tx_pkts[nb_tx];
+
+		if (mbuf->ol_flags & RTE_MBUF_F_TX_TCP_SEG)
+			err = ionic_tx_tso(txq, mbuf);
 		else
-			err = ionic_tx(txq, tx_pkts[nb_tx]);
+			err = ionic_tx(txq, mbuf);
 		if (err) {
 			stats->drop += nb_pkts - nb_tx;
 			break;
 		}
 
-		bytes_tx += tx_pkts[nb_tx]->pkt_len;
+		bytes_tx += mbuf->pkt_len;
 		nb_tx++;
 	}
 
Signature · 1 line
2.17.1
#36 lore raw

PATCH 17/35 net/ionic: use a helper variable in packet Tx function

In reply to Andrew Boyer

This improves readability.

---
 drivers/net/ionic/ionic_rxtx.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ionic/ionic_rxtx.c +7 -4
index 0f251eca13..0c1cc842cf 100644
@@ -560,6 +560,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	struct ionic_tx_qcq *txq = tx_queue;
 	struct ionic_queue *q = &txq->qcq.q;
 	struct ionic_tx_stats *stats = &txq->stats;
+	struct rte_mbuf *mbuf;
 	uint32_t next_q_head_idx;
 	uint32_t bytes_tx = 0;
 	uint16_t nb_avail, nb_tx = 0;
@@ -582,16 +583,18 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			rte_prefetch0(&q->info[next_q_head_idx]);
 		}
 
-		if (tx_pkts[nb_tx]->ol_flags & RTE_MBUF_F_TX_TCP_SEG)
-			err = ionic_tx_tso(txq, tx_pkts[nb_tx]);
+		mbuf = tx_pkts[nb_tx];
+
+		if (mbuf->ol_flags & RTE_MBUF_F_TX_TCP_SEG)
+			err = ionic_tx_tso(txq, mbuf);
 		else
-			err = ionic_tx(txq, tx_pkts[nb_tx]);
+			err = ionic_tx(txq, mbuf);
 		if (err) {
 			stats->drop += nb_pkts - nb_tx;
 			break;
 		}
 
-		bytes_tx += tx_pkts[nb_tx]->pkt_len;
+		bytes_tx += mbuf->pkt_len;
 		nb_tx++;
 	}
 
Signature · 1 line
2.17.1
#37 lore raw

PATCH 18/35 net/ionic: do one-time init of receive descriptors

In reply to Andrew Boyer

These fields don't need to be set in the hot path. This improves performance.

---
 drivers/net/ionic/ionic_rxtx.c | 38 ++++++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 4 deletions(-)
drivers/net/ionic/ionic_rxtx.c +34 -4
index 0c1cc842cf..2a34465e46 100644
@@ -941,9 +941,6 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq)
 		desc = &desc_base[q->head_idx];
 		dma_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(rxm));
 		desc->addr = dma_addr;
-		desc->len = rxq->hdr_seg_size;
-		desc->opcode = (q->num_segs > 1) ? IONIC_RXQ_DESC_OPCODE_SG :
-			IONIC_RXQ_DESC_OPCODE_SIMPLE;
 		rxm->next = NULL;
 
 		prev_rxm_seg = rxm;
@@ -963,7 +960,6 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq)
 			data_iova = rte_mbuf_data_iova(rxm_seg);
 			dma_addr = rte_cpu_to_le_64(data_iova);
 			elem->addr = dma_addr;
-			elem->len = rxq->seg_size;
 			elem++;
 
 			rxm_seg->next = NULL;
@@ -981,6 +977,38 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq)
 	return 0;
 }
 
+/*
+ * Perform one-time initialization of descriptor fields
+ * which will not change for the life of the queue.
+ */
+static void __rte_cold
+ionic_rx_init_descriptors(struct ionic_rx_qcq *rxq)
+{
+	struct ionic_queue *q = &rxq->qcq.q;
+	struct ionic_rxq_desc *desc, *desc_base = q->base;
+	struct ionic_rxq_sg_desc *sg_desc, *sg_desc_base = q->sg_base;
+	uint32_t i, j;
+	uint8_t opcode;
+
+	opcode = (q->num_segs > 1) ?
+		IONIC_RXQ_DESC_OPCODE_SG : IONIC_RXQ_DESC_OPCODE_SIMPLE;
+
+	/*
+	 * NB: Only the first segment needs to leave headroom (hdr_seg_size).
+	 *     Later segments (seg_size) do not.
+	 */
+	for (i = 0; i < q->num_descs; i++) {
+		desc = &desc_base[i];
+		desc->len = rte_cpu_to_le_16(rxq->hdr_seg_size);
+		desc->opcode = opcode;
+
+		sg_desc = &sg_desc_base[i];
+		for (j = 0; j < q->num_segs - 1u; j++)
+			sg_desc->elems[j].len =
+				rte_cpu_to_le_16(rxq->seg_size);
+	}
+}
+
 /*
  * Start Receive Units for specified queue.
  */
@@ -1010,6 +1038,8 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 	IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs, size %u segs %u",
 		rx_queue_id, q->num_descs, rxq->frame_size, q->num_segs);
 
+	ionic_rx_init_descriptors(rxq);
+
 	err = ionic_lif_rxq_init(rxq);
 	if (err)
 		return err;
Signature · 1 line
2.17.1
#38 lore raw

cover net/ionic: updates for 22.11 release

In reply to Andrew Boyer

This patch series provides features and performance improvements relevant for the upstream release of DPDK 22.11.

There are some bits (like struct ionic_dev_intf) only useful for drivers and device types which have not yet been upstreamed. All of the changes are confined to the ionic PMD.

---
v1:
* Rebased to avoid conflicts in release notes
* Added missing links to product briefs in patch 6

Andrew Boyer (35):
net/ionic: fix up endianness for Rx and Tx handling net/ionic: fix up endianness for RSS
net/ionic: fix to set the adapter name for logging net/ionic: fix up the Rx filter save API net/ionic: fix up reported error stats net/ionic: update documentation and copyrights net/ionic: update license terms to remove GPL net/ionic: update MTU calculations
net/ionic: simplify code by removing doorbell map helper net/ionic: remove unused identifiers
net/ionic: only allocate interrupts if required net/ionic: move PCI-specific code to a separate file net/ionic: only request notifyq interrupt if supported net/ionic: replace void pointer with actual type net/ionic: free all buffers during Rx queue stop net/ionic: precalculate segment lengths on receive side net/ionic: use a helper variable in packet Tx function net/ionic: do one-time init of receive descriptors net/ionic: overhaul receive side for performance net/ionic: overhaul transmit side for performance net/ionic: add support for mbuf fast free net/ionic: do bulk allocations of receive mbufs net/ionic: add a lookup table for packet type net/ionic: add a lookup table for checksum flags net/ionic: advertise supported packet types net/ionic: add Rx descriptor status functions net/ionic: add Tx descriptor status function net/ionic: add Q-in-CMB option controlled by devarg net/ionic: update array allocations to use calloc net/ionic: add alignment and socket info in allocations net/ionic: allow client to specify Tx free threshold net/ionic: add optimized handlers for non-scattered Rx/Tx net/ionic: use a helper variable for page size net/ionic: retry init commands up to five times net/ionic: add watchdogs to protect each queue type

 MAINTAINERS                            |   4 +-
 doc/guides/nics/features/ionic.ini     |   3 +
 doc/guides/nics/ionic.rst              |  28 +-
 doc/guides/rel_notes/release_22_11.rst |  13 +-
 drivers/net/ionic/ionic.h              |  27 +-
 drivers/net/ionic/ionic_dev.c          |  79 +--
 drivers/net/ionic/ionic_dev.h          |  40 +-
 drivers/net/ionic/ionic_dev_pci.c      | 274 ++++++++
 drivers/net/ionic/ionic_ethdev.c       | 254 +++----
 drivers/net/ionic/ionic_ethdev.h       |  15 +-
 drivers/net/ionic/ionic_if.h           |  13 +-
 drivers/net/ionic/ionic_lif.c          | 310 ++++++---
 drivers/net/ionic/ionic_lif.h          |  33 +-
 drivers/net/ionic/ionic_logs.h         |   4 +-
 drivers/net/ionic/ionic_mac_api.c      |   4 +-
 drivers/net/ionic/ionic_mac_api.h      |   4 +-
 drivers/net/ionic/ionic_main.c         |  32 +-
 drivers/net/ionic/ionic_osdep.h        |   4 +-
 drivers/net/ionic/ionic_regs.h         |   4 +-
 drivers/net/ionic/ionic_rx_filter.c    |   9 +-
 drivers/net/ionic/ionic_rx_filter.h    |   4 +-
 drivers/net/ionic/ionic_rxtx.c         | 916 +++++++++----------------
 drivers/net/ionic/ionic_rxtx.h         |  56 +-
 drivers/net/ionic/ionic_rxtx_sg.c      | 544 +++++++++++++++
 drivers/net/ionic/ionic_rxtx_simple.c  | 465 +++++++++++++
 drivers/net/ionic/meson.build          |   7 +-
 26 files changed, 2155 insertions(+), 991 deletions(-)
 create mode 100644 drivers/net/ionic/ionic_dev_pci.c
 create mode 100644 drivers/net/ionic/ionic_rxtx_sg.c
 create mode 100644 drivers/net/ionic/ionic_rxtx_simple.c
Signature · 1 line
2.17.1
#39 lore raw
Quoted 45 lines · Andrew Boyer

This patch series provides features and performance improvements relevant for the upstream release of DPDK 22.11.

There are some bits (like struct ionic_dev_intf) only useful for drivers and device types which have not yet been upstreamed. All of the changes are confined to the ionic PMD.

---
v1:
* Rebased to avoid conflicts in release notes
* Added missing links to product briefs in patch 6

Andrew Boyer (35):
net/ionic: fix up endianness for Rx and Tx handling net/ionic: fix up endianness for RSS
net/ionic: fix to set the adapter name for logging net/ionic: fix up the Rx filter save API net/ionic: fix up reported error stats net/ionic: update documentation and copyrights net/ionic: update license terms to remove GPL net/ionic: update MTU calculations
net/ionic: simplify code by removing doorbell map helper net/ionic: remove unused identifiers
net/ionic: only allocate interrupts if required net/ionic: move PCI-specific code to a separate file net/ionic: only request notifyq interrupt if supported net/ionic: replace void pointer with actual type net/ionic: free all buffers during Rx queue stop net/ionic: precalculate segment lengths on receive side net/ionic: use a helper variable in packet Tx function net/ionic: do one-time init of receive descriptors net/ionic: overhaul receive side for performance net/ionic: overhaul transmit side for performance net/ionic: add support for mbuf fast free net/ionic: do bulk allocations of receive mbufs net/ionic: add a lookup table for packet type net/ionic: add a lookup table for checksum flags net/ionic: advertise supported packet types net/ionic: add Rx descriptor status functions net/ionic: add Tx descriptor status function

Quoted 9 lines

net/ionic: add Q-in-CMB option controlled by devarg net/ionic: update array allocations to use calloc net/ionic: add alignment and socket info in allocations net/ionic: allow client to specify Tx free threshold net/ionic: add optimized handlers for non-scattered Rx/Tx net/ionic: use a helper variable for page size net/ionic: retry init commands up to five times net/ionic: add watchdogs to protect each queue type

Hi Andrew,

I put some minor comments related to the copyright changes, rest looks good to me.

And in this version each patch looks like a new series in patchwork, not sure what caused it, but can you please be sure all patches in series sent by single 'git send-email' command, if it didn't done this way already. And please use '--in-reply-to' for next version:
https://doc.dpdk.org/guides/contributing/patches.html#sending-patches

Thanks,
ferruh

#40 lore raw

v2 cover net/ionic: updates for 22.11 release

In reply to Andrew Boyer

This patch series provides features and performance improvements relevant for the upstream release of DPDK 22.11.

There are some bits (like struct ionic_dev_intf) only useful for drivers and device types which have not yet been upstreamed. All of the changes are confined to the ionic PMD.

---
v1:
* Rebased to avoid conflicts in release notes
* Added missing links to product briefs in patch 6
v2:
* Split DSC-200 addition into its own patch
* Reverted driver ID string change
* Removed "All Rights Reserved" text
* Updated license on ionic.rst file
* Sorted our entry in maintainers file
* Sorted our entry in release notes

Andrew Boyer (36):
net/ionic: fix up endianness for Rx and Tx handling net/ionic: fix up endianness for RSS
net/ionic: fix to set the adapter name for logging net/ionic: fix up the Rx filter save API net/ionic: fix up reported error stats net/ionic: update documentation and copyrights net/ionic: update supported devices list net/ionic: update license terms to remove GPL net/ionic: update MTU calculations
net/ionic: simplify code by removing doorbell map helper net/ionic: remove unused identifiers
net/ionic: only allocate interrupts if required net/ionic: move PCI-specific code to a separate file net/ionic: only request notifyq interrupt if supported net/ionic: replace void pointer with actual type net/ionic: free all buffers during Rx queue stop net/ionic: precalculate segment lengths on receive side net/ionic: use a helper variable in packet Tx function net/ionic: do one-time init of receive descriptors net/ionic: overhaul receive side for performance net/ionic: overhaul transmit side for performance net/ionic: add support for mbuf fast free net/ionic: do bulk allocations of receive mbufs net/ionic: add a lookup table for packet type net/ionic: add a lookup table for checksum flags net/ionic: advertise supported packet types net/ionic: add Rx descriptor status functions net/ionic: add Tx descriptor status function net/ionic: add Q-in-CMB option controlled by devarg net/ionic: update array allocations to use calloc net/ionic: add alignment and socket info in allocations net/ionic: allow client to specify Tx free threshold net/ionic: add optimized handlers for non-scattered Rx/Tx net/ionic: use a helper variable for page size net/ionic: retry init commands up to five times net/ionic: add watchdogs to protect each queue type

 MAINTAINERS                            |  12 +-
 doc/guides/nics/features/ionic.ini     |   3 +
 doc/guides/nics/ionic.rst              |  30 +-
 doc/guides/rel_notes/release_22_11.rst |  12 +
 drivers/net/ionic/ionic.h              |  25 +-
 drivers/net/ionic/ionic_dev.c          |  79 +--
 drivers/net/ionic/ionic_dev.h          |  40 +-
 drivers/net/ionic/ionic_dev_pci.c      | 274 ++++++++
 drivers/net/ionic/ionic_ethdev.c       | 254 +++----
 drivers/net/ionic/ionic_ethdev.h       |  15 +-
 drivers/net/ionic/ionic_if.h           |  13 +-
 drivers/net/ionic/ionic_lif.c          | 310 ++++++---
 drivers/net/ionic/ionic_lif.h          |  33 +-
 drivers/net/ionic/ionic_logs.h         |   4 +-
 drivers/net/ionic/ionic_mac_api.c      |   4 +-
 drivers/net/ionic/ionic_mac_api.h      |   4 +-
 drivers/net/ionic/ionic_main.c         |  32 +-
 drivers/net/ionic/ionic_osdep.h        |   4 +-
 drivers/net/ionic/ionic_regs.h         |   4 +-
 drivers/net/ionic/ionic_rx_filter.c    |   9 +-
 drivers/net/ionic/ionic_rx_filter.h    |   4 +-
 drivers/net/ionic/ionic_rxtx.c         | 916 +++++++++----------------
 drivers/net/ionic/ionic_rxtx.h         |  56 +-
 drivers/net/ionic/ionic_rxtx_sg.c      | 544 +++++++++++++++
 drivers/net/ionic/ionic_rxtx_simple.c  | 465 +++++++++++++
 drivers/net/ionic/meson.build          |   7 +-
 26 files changed, 2159 insertions(+), 994 deletions(-)
 create mode 100644 drivers/net/ionic/ionic_dev_pci.c
 create mode 100644 drivers/net/ionic/ionic_rxtx_sg.c
 create mode 100644 drivers/net/ionic/ionic_rxtx_simple.c
Signature · 1 line
2.17.1
#41 lore raw
Quoted 53 lines · Andrew Boyer

This patch series provides features and performance improvements relevant for the upstream release of DPDK 22.11.

There are some bits (like struct ionic_dev_intf) only useful for drivers and device types which have not yet been upstreamed. All of the changes are confined to the ionic PMD.

---
v1:
* Rebased to avoid conflicts in release notes
* Added missing links to product briefs in patch 6
v2:
* Split DSC-200 addition into its own patch
* Reverted driver ID string change
* Removed "All Rights Reserved" text
* Updated license on ionic.rst file
* Sorted our entry in maintainers file
* Sorted our entry in release notes

Andrew Boyer (36):
net/ionic: fix up endianness for Rx and Tx handling net/ionic: fix up endianness for RSS
net/ionic: fix to set the adapter name for logging net/ionic: fix up the Rx filter save API net/ionic: fix up reported error stats net/ionic: update documentation and copyrights net/ionic: update supported devices list net/ionic: update license terms to remove GPL net/ionic: update MTU calculations
net/ionic: simplify code by removing doorbell map helper net/ionic: remove unused identifiers
net/ionic: only allocate interrupts if required net/ionic: move PCI-specific code to a separate file net/ionic: only request notifyq interrupt if supported net/ionic: replace void pointer with actual type net/ionic: free all buffers during Rx queue stop net/ionic: precalculate segment lengths on receive side net/ionic: use a helper variable in packet Tx function net/ionic: do one-time init of receive descriptors net/ionic: overhaul receive side for performance net/ionic: overhaul transmit side for performance net/ionic: add support for mbuf fast free net/ionic: do bulk allocations of receive mbufs net/ionic: add a lookup table for packet type net/ionic: add a lookup table for checksum flags net/ionic: advertise supported packet types net/ionic: add Rx descriptor status functions net/ionic: add Tx descriptor status function

Quoted 9 lines

net/ionic: add Q-in-CMB option controlled by devarg net/ionic: update array allocations to use calloc net/ionic: add alignment and socket info in allocations net/ionic: allow client to specify Tx free threshold net/ionic: add optimized handlers for non-scattered Rx/Tx net/ionic: use a helper variable for page size net/ionic: retry init commands up to five times net/ionic: add watchdogs to protect each queue type

Series applied to dpdk-next-net/main, thanks.

#42 lore raw

PATCH v2 1/36 net/ionic: fix up endianness for Rx and Tx handling

In reply to Andrew Boyer

These fields all need to be LE when talking to the FW.

Fixes a27d901331da ("net/ionic: add Rx and Tx handling")
---
 drivers/net/ionic/ionic_rxtx.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/net/ionic/ionic_rxtx.c +15 -12
index 9f602de6a9..af2d89f9fa 100644
@@ -300,18 +300,20 @@ ionic_tx_tso_post(struct ionic_queue *q, struct ionic_txq_desc *desc,
 		bool start, bool done)
 {
 	void **info;
+	uint64_t cmd;
 	uint8_t flags = 0;
 	flags |= has_vlan ? IONIC_TXQ_DESC_FLAG_VLAN : 0;
 	flags |= encap ? IONIC_TXQ_DESC_FLAG_ENCAP : 0;
 	flags |= start ? IONIC_TXQ_DESC_FLAG_TSO_SOT : 0;
 	flags |= done ? IONIC_TXQ_DESC_FLAG_TSO_EOT : 0;
 
-	desc->cmd = encode_txq_desc_cmd(IONIC_TXQ_DESC_OPCODE_TSO,
+	cmd = encode_txq_desc_cmd(IONIC_TXQ_DESC_OPCODE_TSO,
 		flags, nsge, addr);
-	desc->len = len;
-	desc->vlan_tci = vlan_tci;
-	desc->hdr_len = hdrlen;
-	desc->mss = mss;
+	desc->cmd = rte_cpu_to_le_64(cmd);
+	desc->len = rte_cpu_to_le_16(len);
+	desc->vlan_tci = rte_cpu_to_le_16(vlan_tci);
+	desc->hdr_len = rte_cpu_to_le_16(hdrlen);
+	desc->mss = rte_cpu_to_le_16(mss);
 
 	if (done) {
 		info = IONIC_INFO_PTR(q, q->head_idx);
@@ -423,7 +425,7 @@ ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm)
 				len = RTE_MIN(frag_left, left);
 				frag_left -= len;
 				elem->addr = next_addr;
-				elem->len = len;
+				elem->len = rte_cpu_to_le_16(len);
 				elem++;
 				desc_nsge++;
 			} else {
@@ -470,7 +472,7 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm)
 	bool encap;
 	bool has_vlan;
 	uint64_t ol_flags = txm->ol_flags;
-	uint64_t addr;
+	uint64_t addr, cmd;
 	uint8_t opcode = IONIC_TXQ_DESC_OPCODE_CSUM_NONE;
 	uint8_t flags = 0;
 
@@ -505,9 +507,10 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm)
 
 	addr = rte_cpu_to_le_64(rte_mbuf_data_iova(txm));
 
-	desc->cmd = encode_txq_desc_cmd(opcode, flags, txm->nb_segs - 1, addr);
-	desc->len = txm->data_len;
-	desc->vlan_tci = txm->vlan_tci;
+	cmd = encode_txq_desc_cmd(opcode, flags, txm->nb_segs - 1, addr);
+	desc->cmd = rte_cpu_to_le_64(cmd);
+	desc->len = rte_cpu_to_le_16(txm->data_len);
+	desc->vlan_tci = rte_cpu_to_le_16(txm->vlan_tci);
 
 	info[0] = txm;
 
@@ -515,7 +518,7 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm)
 
 	txm_seg = txm->next;
 	while (txm_seg != NULL) {
-		elem->len = txm_seg->data_len;
+		elem->len = rte_cpu_to_le_16(txm_seg->data_len);
 		elem->addr = rte_cpu_to_le_64(rte_mbuf_data_iova(txm_seg));
 		elem++;
 		txm_seg = txm_seg->next;
@@ -845,7 +848,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 	/* Vlan Strip */
 	if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_VLAN) {
 		pkt_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED;
-		rxm->vlan_tci = cq_desc->vlan_tci;
+		rxm->vlan_tci = rte_le_to_cpu_16(cq_desc->vlan_tci);
 	}
 
 	/* Checksum */
Signature · 1 line
2.17.1
#43 lore raw

PATCH v2 2/36 net/ionic: fix up endianness for RSS

In reply to Andrew Boyer

This field needs to be LE when talking to the FW.

Fixes 22e7171bc63b ("net/ionic: support RSS")
---
 drivers/net/ionic/ionic_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ionic/ionic_rxtx.c +1 -1
index af2d89f9fa..665d085823 100644
@@ -843,7 +843,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 
 	/* RSS */
 	pkt_flags |= RTE_MBUF_F_RX_RSS_HASH;
-	rxm->hash.rss = cq_desc->rss_hash;
+	rxm->hash.rss = rte_le_to_cpu_32(cq_desc->rss_hash);
 
 	/* Vlan Strip */
 	if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_VLAN) {
Signature · 1 line
2.17.1
#44 lore raw

PATCH v2 3/36 net/ionic: fix to set the adapter name for logging

In reply to Andrew Boyer

Otherwise the log messages will be garbled.

Fixes 4ae96cb88fa0 ("net/ionic: do minor logging fixups")
---
 drivers/net/ionic/ionic_dev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ionic/ionic_dev.c +4 -1
index 43e9ca3de3..5439b99b2d 100644
@@ -55,7 +55,10 @@ ionic_dev_setup(struct ionic_adapter *adapter)
 			ioread8(&idev->dev_info->fw_version[i]);
 	adapter->fw_version[IONIC_DEVINFO_FWVERS_BUFLEN - 1] = '\0';
 
-	IONIC_PRINT(DEBUG, "Firmware version: %s", adapter->fw_version);
+	adapter->name = adapter->pci_dev->device.name;
+
+	IONIC_PRINT(DEBUG, "%s firmware version: %s",
+		adapter->name, adapter->fw_version);
 
 	/* BAR1: doorbells */
 	bar++;
Signature · 1 line
2.17.1
#45 lore raw

PATCH v2 4/36 net/ionic: fix up the Rx filter save API

In reply to Andrew Boyer

Check the match variable after copying cmd info, or else there can be unexpected results.

Fixes a27e0e96ab77 ("net/ionic: observe endianness in Rx filter")
---
 drivers/net/ionic/ionic_rx_filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ionic/ionic_rx_filter.c +1 -1
index bf57a9fa52..4b2e907f9f 100644
@@ -63,8 +63,8 @@ ionic_rx_filter_save(struct ionic_lif *lif, uint32_t flow_id,
 	f->flow_id = flow_id;
 	f->filter_id = rte_le_to_cpu_32(ctx->comp.rx_filter_add.filter_id);
 	f->rxq_index = rxq_index;
-	f->match = rte_le_to_cpu_16(f->cmd.match);
 	memcpy(&f->cmd, &ctx->cmd, sizeof(f->cmd));
+	f->match = rte_le_to_cpu_16(f->cmd.match);
 
 	switch (f->match) {
 	case IONIC_RX_FILTER_MATCH_VLAN:
Signature · 1 line
2.17.1
#46 lore raw

PATCH v2 5/36 net/ionic: fix up reported error stats

In reply to Andrew Boyer

Report descriptor errors in ierrors instead of imissed. Don't report rx_queue_empty or rx_queue_disabled in imissed, since those packet errors are already included in the rx_*_drop_packets counters.
This makes the reported stats correct.

Fixes 3cdfd90579e7 ("net/ionic: add stats")
---
 drivers/net/ionic/ionic_lif.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ionic/ionic_lif.c +2 -4
index 5e8fdf3893..799530f7f5 100644
@@ -132,7 +132,7 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats
 
 	for (i = 0; i < lif->nrxqcqs; i++) {
 		struct ionic_rx_stats *rx_stats = &lif->rxqcqs[i]->stats;
-		stats->imissed +=
+		stats->ierrors +=
 			rx_stats->no_cb_arg +
 			rx_stats->bad_cq_status +
 			rx_stats->no_room +
@@ -144,10 +144,8 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats
 		ls->rx_mcast_drop_packets +
 		ls->rx_bcast_drop_packets;
 
-	stats->imissed +=
-		ls->rx_queue_empty +
+	stats->ierrors +=
 		ls->rx_dma_error +
-		ls->rx_queue_disabled +
 		ls->rx_desc_fetch_error +
 		ls->rx_desc_data_error;
 
Signature · 1 line
2.17.1
#47 lore raw

PATCH v2 6/36 net/ionic: update documentation and copyrights

In reply to Andrew Boyer

Pensando Systems has been acquired by AMD.
Update all copyright strings and email addresses.

---
 MAINTAINERS                            | 12 ++++++------
 doc/guides/nics/ionic.rst              | 15 +++++++--------
 doc/guides/rel_notes/release_22_11.rst |  6 ++++++
 drivers/net/ionic/ionic.h              |  4 ++--
 drivers/net/ionic/ionic_dev.c          |  2 +-
 drivers/net/ionic/ionic_dev.h          |  2 +-
 drivers/net/ionic/ionic_ethdev.c       |  2 +-
 drivers/net/ionic/ionic_ethdev.h       |  2 +-
 drivers/net/ionic/ionic_if.h           |  2 +-
 drivers/net/ionic/ionic_lif.c          |  2 +-
 drivers/net/ionic/ionic_lif.h          |  2 +-
 drivers/net/ionic/ionic_logs.h         |  2 +-
 drivers/net/ionic/ionic_mac_api.c      |  2 +-
 drivers/net/ionic/ionic_mac_api.h      |  2 +-
 drivers/net/ionic/ionic_main.c         |  2 +-
 drivers/net/ionic/ionic_osdep.h        |  2 +-
 drivers/net/ionic/ionic_regs.h         |  2 +-
 drivers/net/ionic/ionic_rx_filter.c    |  2 +-
 drivers/net/ionic/ionic_rx_filter.h    |  2 +-
 drivers/net/ionic/ionic_rxtx.c         |  2 +-
 drivers/net/ionic/ionic_rxtx.h         |  2 +-
 drivers/net/ionic/meson.build          |  2 +-
 22 files changed, 39 insertions(+), 34 deletions(-)
MAINTAINERS +6 -6
index 2bd4a55f1b..92b381bc30 100644
@@ -630,6 +630,12 @@ F: drivers/net/axgbe/
 F: doc/guides/nics/axgbe.rst
 F: doc/guides/nics/features/axgbe.ini
 
+AMD Pensando ionic
+M: Andrew Boyer <[email protected]>
+F: drivers/net/ionic/
+F: doc/guides/nics/ionic.rst
+F: doc/guides/nics/features/ionic.ini
+
 Marvell/Aquantia atlantic
 M: Igor Russkikh <[email protected]>
 T: git://dpdk.org/next/dpdk-next-net-mrvl
@@ -895,12 +901,6 @@ F: doc/guides/nics/pfe.rst
 F: drivers/net/pfe/
 F: doc/guides/nics/features/pfe.ini
 
-Pensando ionic
-M: Andrew Boyer <[email protected]>
-F: drivers/net/ionic/
-F: doc/guides/nics/ionic.rst
-F: doc/guides/nics/features/ionic.ini
-
 Marvell QLogic bnx2x
 M: Rasesh Mody <[email protected]>
 M: Shahed Shaikh <[email protected]>
doc/guides/nics/ionic.rst +7 -8
index 673700d6ce..82fb0eff9f 100644
@@ -1,22 +1,21 @@
 ..  SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
-    Copyright(c) 2018-2020 Pensando Systems, Inc. All rights reserved.
+    Copyright 2018-2022 Advanced Micro Devices, Inc.
 
 IONIC Driver
 ============
 
-The ionic driver provides support for Pensando server adapters.
+The ionic driver provides support for AMD Pensando server adapters.
 It currently supports the below models:
 
-- DSC-25 dual-port 25G Distributed Services Card `(pdf) <https://pensando.io/wp-content/uploads/2020/03/Pensando-DSC-25-Product-Brief.pdf>`__
-- DSC-100 dual-port 100G Distributed Services Card `(pdf) <https://pensando.io/wp-content/uploads/2020/03/Pensando-DSC-100-Product-Brief.pdf>`__
+- DSC-25 dual-port 25G Distributed Services Card `(pdf) <https://pensandoio.secure.force.com/DownloadFile?id=a0L4T000004IKurUAG>`__
+- DSC-100 dual-port 100G Distributed Services Card `(pdf) <https://pensandoio.secure.force.com/DownloadFile?id=a0L4T000004IKuwUAG>`__
 
-Please visit the Pensando web site at https://pensando.io for more information.
-The `Documents <https://pensando.io/documents/>`_ page contains Product Briefs and other product information.
+Please visit the AMD Pensando web site at https://www.amd.com/en/accelerators/pensando for more information.
 
 Identifying the Adapter
 -----------------------
 
-To determine if one or more Pensando DSC Ethernet devices are installed
+To determine if one or more AMD Pensando DSC Ethernet devices are installed
 on the host, check for the PCI devices:
 
    .. code-block:: console
@@ -30,7 +29,7 @@ Firmware Support
 
 The ionic PMD requires firmware which supports 16 segment transmit SGLs.
 This support was added prior to version 1.0. For help upgrading older versions,
-please contact Pensando support.
+please contact AMD Pensando support.
 
 Building DPDK
 -------------
doc/guides/rel_notes/release_22_11.rst +6 -0
index a3700bbb34..4656607aae 100644
@@ -140,6 +140,12 @@ New Features
 
   * Made compatible with libbpf v0.8.0 (when used with libxdp).
 
+* **Updated AMD Pensando ionic driver.**
+
+  Updated the ionic PMD with new features and improvements, including:
+
+  * Updated to reflect that Pensando has been acquired by AMD.
+
 * **Updated Intel iavf driver.**
 
   * Added flow subscription support.
drivers/net/ionic/ionic.h +2 -2
index a55202b178..986408ad31 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #ifndef _IONIC_H_
@@ -15,7 +15,7 @@
 #include "ionic_osdep.h"
 
 #define IONIC_DRV_NAME			"ionic"
-#define IONIC_DRV_DESCRIPTION		"Pensando Ethernet NIC Driver"
+#define IONIC_DRV_DESCRIPTION		"AMD Pensando Ethernet NIC Driver"
 #define IONIC_DRV_VERSION		"0.11.0-49"
 
 /* Vendor ID */
drivers/net/ionic/ionic_dev.c +1 -1
index 5439b99b2d..c891a51e03 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #include <stdbool.h>
drivers/net/ionic/ionic_dev.h +1 -1
index 38c078efdf..c814301451 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #ifndef _IONIC_DEV_H_
drivers/net/ionic/ionic_ethdev.c +1 -1
index d72033c32c..d85162ee3f 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #include <rte_pci.h>
drivers/net/ionic/ionic_ethdev.h +1 -1
index 9304e170de..b5b1212bfa 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #ifndef _IONIC_ETHDEV_H_
drivers/net/ionic/ionic_if.h +1 -1
index 45bad9b040..0e99df8cc2 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB OR BSD-3-Clause */
-/* Copyright (c) 2017-2020 Pensando Systems, Inc.  All rights reserved. */
+/* Copyright 2017-2022 Advanced Micro Devices, Inc. */
 
 #ifndef _IONIC_IF_H_
 #define _IONIC_IF_H_
drivers/net/ionic/ionic_lif.c +1 -1
index 799530f7f5..27002b8142 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #include <rte_malloc.h>
drivers/net/ionic/ionic_lif.h +1 -1
index 9f00ba2973..c11c1f35da 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #ifndef _IONIC_LIF_H_
drivers/net/ionic/ionic_logs.h +1 -1
index bc10ad1744..a4ebac346c 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #ifndef _IONIC_LOGS_H_
drivers/net/ionic/ionic_mac_api.c +1 -1
index 411d84b578..71775dcf95 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #include <stdbool.h>
drivers/net/ionic/ionic_mac_api.h +1 -1
index ed9e059a63..4ab8555c24 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #ifndef _IONIC_API_H_
drivers/net/ionic/ionic_main.c +1 -1
index 7301f53342..066cd98617 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #include <stdbool.h>
drivers/net/ionic/ionic_osdep.h +1 -1
index 89ed106d11..5776a2944f 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #ifndef _IONIC_OSDEP_
drivers/net/ionic/ionic_regs.h +1 -1
index 3bdec34242..1b17540690 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #ifndef _IONIC_REGS_H_
drivers/net/ionic/ionic_rx_filter.c +1 -1
index 4b2e907f9f..448afefddd 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #include <errno.h>
drivers/net/ionic/ionic_rx_filter.h +1 -1
index 773042fcb2..a3401c6e53 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #ifndef _IONIC_RX_FILTER_H_
drivers/net/ionic/ionic_rxtx.c +1 -1
index 665d085823..96896aec2b 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #include <sys/queue.h>
drivers/net/ionic/ionic_rxtx.h +1 -1
index befbe61cef..1a8b9c0117 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
 #ifndef _IONIC_RXTX_H_
drivers/net/ionic/meson.build +1 -1
index 487fef1882..76389f9213 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
-# Copyright(c) 2019 Pensando
+# Copyright 2019-2022 Advanced Micro Devices, Inc.
 
 if is_windows
     build = false
Signature · 1 line
2.17.1
#48 lore raw

PATCH v2 7/36 net/ionic: update supported devices list

In reply to Andrew Boyer

Add listed support for the DSC-200.

---
 doc/guides/nics/ionic.rst | 1 +
 1 file changed, 1 insertion(+)
doc/guides/nics/ionic.rst +1 -0
index 82fb0eff9f..f2cdd2b571 100644
@@ -9,6 +9,7 @@ It currently supports the below models:
 
 - DSC-25 dual-port 25G Distributed Services Card `(pdf) <https://pensandoio.secure.force.com/DownloadFile?id=a0L4T000004IKurUAG>`__
 - DSC-100 dual-port 100G Distributed Services Card `(pdf) <https://pensandoio.secure.force.com/DownloadFile?id=a0L4T000004IKuwUAG>`__
+- DSC-200 dual-port 200G Distributed Services Card `(pdf) <https://www.amd.com/system/files/documents/pensando-dsc-200-product-brief.pdf>`__
 
 Please visit the AMD Pensando web site at https://www.amd.com/en/accelerators/pensando for more information.
 
Signature · 1 line
2.17.1
#49 lore raw

PATCH v2 8/36 net/ionic: update license terms to remove GPL

In reply to Andrew Boyer

Remove GPL2 and leave only BSD-3-Clause. This is more in line with the norms of the DPDK community.

---
 doc/guides/nics/ionic.rst           | 2 +-
 drivers/net/ionic/ionic.h           | 2 +-
 drivers/net/ionic/ionic_dev.c       | 2 +-
 drivers/net/ionic/ionic_dev.h       | 2 +-
 drivers/net/ionic/ionic_ethdev.c    | 2 +-
 drivers/net/ionic/ionic_ethdev.h    | 2 +-
 drivers/net/ionic/ionic_if.h        | 5 +++--
 drivers/net/ionic/ionic_lif.c       | 2 +-
 drivers/net/ionic/ionic_lif.h       | 2 +-
 drivers/net/ionic/ionic_logs.h      | 2 +-
 drivers/net/ionic/ionic_mac_api.c   | 2 +-
 drivers/net/ionic/ionic_mac_api.h   | 2 +-
 drivers/net/ionic/ionic_main.c      | 2 +-
 drivers/net/ionic/ionic_osdep.h     | 2 +-
 drivers/net/ionic/ionic_regs.h      | 2 +-
 drivers/net/ionic/ionic_rx_filter.c | 2 +-
 drivers/net/ionic/ionic_rx_filter.h | 2 +-
 drivers/net/ionic/ionic_rxtx.c      | 2 +-
 drivers/net/ionic/ionic_rxtx.h      | 2 +-
 drivers/net/ionic/meson.build       | 2 +-
 20 files changed, 22 insertions(+), 21 deletions(-)
doc/guides/nics/ionic.rst +1 -1
index f2cdd2b571..216f820736 100644
@@ -1,4 +1,4 @@
-..  SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+..  SPDX-License-Identifier: BSD-3-Clause
     Copyright 2018-2022 Advanced Micro Devices, Inc.
 
 IONIC Driver
drivers/net/ionic/ionic.h +1 -1
index 986408ad31..a05bf4ee71 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/ionic_dev.c +1 -1
index c891a51e03..27abc29da4 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/ionic_dev.h +1 -1
index c814301451..fabc21834a 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/ionic_ethdev.c +1 -1
index d85162ee3f..2b7c05a9f2 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/ionic_ethdev.h +1 -1
index b5b1212bfa..4762ba7a9d 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/ionic_if.h +3 -2
index 0e99df8cc2..c9c4a9dee4 100644
@@ -1,5 +1,6 @@
-/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB OR BSD-3-Clause */
-/* Copyright 2017-2022 Advanced Micro Devices, Inc. */
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2017-2022 Advanced Micro Devices, Inc.
+ */
 
 #ifndef _IONIC_IF_H_
 #define _IONIC_IF_H_
drivers/net/ionic/ionic_lif.c +1 -1
index 27002b8142..0d167f677f 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/ionic_lif.h +1 -1
index c11c1f35da..b37841b69f 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/ionic_logs.h +1 -1
index a4ebac346c..c10b06c051 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/ionic_mac_api.c +1 -1
index 71775dcf95..baf6047921 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/ionic_mac_api.h +1 -1
index 4ab8555c24..78202d44c6 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/ionic_main.c +1 -1
index 066cd98617..11b8a8a44b 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/ionic_osdep.h +1 -1
index 5776a2944f..68f767b920 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/ionic_regs.h +1 -1
index 1b17540690..b4c665a58d 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/ionic_rx_filter.c +1 -1
index 448afefddd..bbfc217826 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/ionic_rx_filter.h +1 -1
index a3401c6e53..5500c7d70b 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/ionic_rxtx.c +1 -1
index 96896aec2b..ffca26dd3e 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/ionic_rxtx.h +1 -1
index 1a8b9c0117..e55e86c8b3 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+/* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018-2022 Advanced Micro Devices, Inc.
  */
 
drivers/net/ionic/meson.build +1 -1
index 76389f9213..d122686b5a 100644
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+# SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2019-2022 Advanced Micro Devices, Inc.
 
 if is_windows
Signature · 1 line
2.17.1
#50 lore raw

PATCH v2 9/36 net/ionic: update MTU calculations

In reply to Andrew Boyer

Test min and max MTU against values read from firmware, for correctness. Update the firmware field name, for clarity.
The device must be stopped before changing MTU, for correctness. Store the calculated frame size in the queue, for performance.

---
 drivers/net/ionic/ionic_dev.h    |  5 +++-
 drivers/net/ionic/ionic_ethdev.c | 40 +++++++++++++++++++++-----------
 drivers/net/ionic/ionic_if.h     |  8 +++----
 drivers/net/ionic/ionic_lif.c    | 10 +++-----
 drivers/net/ionic/ionic_lif.h    |  4 +++-
 drivers/net/ionic/ionic_rxtx.c   | 26 +++++++++------------
 6 files changed, 51 insertions(+), 42 deletions(-)
drivers/net/ionic/ionic_dev.h +4 -1
index fabc21834a..7aea9c9907 100644
@@ -11,8 +11,11 @@
 #include "ionic_if.h"
 #include "ionic_regs.h"
 
+#define VLAN_TAG_SIZE			4
+
 #define IONIC_MIN_MTU			RTE_ETHER_MIN_MTU
-#define IONIC_MAX_MTU			9194
+#define IONIC_MAX_MTU			9378
+#define IONIC_ETH_OVERHEAD		(RTE_ETHER_HDR_LEN + VLAN_TAG_SIZE)
 
 #define IONIC_MAX_RING_DESC		32768
 #define IONIC_MIN_RING_DESC		16
drivers/net/ionic/ionic_ethdev.c +26 -14
index 2b7c05a9f2..637553716d 100644
@@ -343,18 +343,17 @@ static int
 ionic_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 {
 	struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
-	int err;
 
-	IONIC_PRINT_CALL();
+	if (lif->state & IONIC_LIF_F_UP) {
+		IONIC_PRINT(ERR, "Stop %s before setting mtu", lif->name);
+		return -EBUSY;
+	}
 
-	/*
-	 * Note: mtu check against IONIC_MIN_MTU, IONIC_MAX_MTU
-	 * is done by the API.
-	 */
+	/* Note: mtu check against min/max is done by the API */
+	IONIC_PRINT(INFO, "Setting mtu %u", mtu);
 
-	err = ionic_lif_change_mtu(lif, mtu);
-	if (err)
-		return err;
+	/* Update the frame size used by the Rx path */
+	lif->frame_size = mtu + IONIC_ETH_OVERHEAD;
 
 	return 0;
 }
@@ -376,12 +375,16 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 		rte_le_to_cpu_32(cfg->queue_count[IONIC_QTYPE_TXQ]);
 
 	/* Also add ETHER_CRC_LEN if the adapter is able to keep CRC */
-	dev_info->min_rx_bufsize = IONIC_MIN_MTU + RTE_ETHER_HDR_LEN;
-	dev_info->max_rx_pktlen = IONIC_MAX_MTU + RTE_ETHER_HDR_LEN;
-	dev_info->max_mac_addrs = adapter->max_mac_addrs;
-	dev_info->min_mtu = IONIC_MIN_MTU;
-	dev_info->max_mtu = IONIC_MAX_MTU;
+	dev_info->min_mtu = RTE_MAX((uint32_t)IONIC_MIN_MTU,
+			rte_le_to_cpu_32(ident->lif.eth.min_mtu));
+	dev_info->max_mtu = RTE_MIN((uint32_t)IONIC_MAX_MTU,
+			rte_le_to_cpu_32(ident->lif.eth.max_mtu));
+	dev_info->min_rx_bufsize = dev_info->min_mtu + IONIC_ETH_OVERHEAD;
+	dev_info->max_rx_pktlen = dev_info->max_mtu + IONIC_ETH_OVERHEAD;
+	dev_info->max_lro_pkt_size =
+		eth_dev->data->dev_conf.rxmode.max_lro_pkt_size;
 
+	dev_info->max_mac_addrs = adapter->max_mac_addrs;
 	dev_info->hash_key_size = IONIC_RSS_HASH_KEY_SIZE;
 	dev_info->reta_size = rte_le_to_cpu_16(ident->lif.eth.rss_ind_tbl_sz);
 	dev_info->flow_type_rss_offloads = IONIC_ETH_RSS_OFFLOAD_ALL;
@@ -889,6 +892,15 @@ ionic_dev_start(struct rte_eth_dev *eth_dev)
 	if (dev_conf->lpbk_mode)
 		IONIC_PRINT(WARNING, "Loopback mode not supported");
 
+	lif->frame_size = eth_dev->data->mtu + IONIC_ETH_OVERHEAD;
+
+	err = ionic_lif_change_mtu(lif, eth_dev->data->mtu);
+	if (err) {
+		IONIC_PRINT(ERR, "Cannot set LIF frame size %u: %d",
+			lif->frame_size, err);
+		return err;
+	}
+
 	err = ionic_lif_start(lif);
 	if (err) {
 		IONIC_PRINT(ERR, "Cannot start LIF: %d", err);
drivers/net/ionic/ionic_if.h +4 -4
index c9c4a9dee4..79aa196345 100644
@@ -401,8 +401,8 @@ union ionic_lif_config {
  *     @version:            Ethernet identify structure version
  *     @max_ucast_filters:  Number of perfect unicast addresses supported
  *     @max_mcast_filters:  Number of perfect multicast addresses supported
- *     @min_frame_size:     Minimum size of frames to be sent
- *     @max_frame_size:     Maximum size of frames to be sent
+ *     @min_mtu:            Minimum MTU of frames to be sent
+ *     @max_mtu:            Maximum MTU of frames to be sent
  *     @config:             LIF config struct with features, mtu, mac, q counts
  *
  * @rdma:                RDMA identify structure
@@ -434,8 +434,8 @@ union ionic_lif_identity {
 			__le32 max_ucast_filters;
 			__le32 max_mcast_filters;
 			__le16 rss_ind_tbl_sz;
-			__le32 min_frame_size;
-			__le32 max_frame_size;
+			__le32 min_mtu;
+			__le32 max_mtu;
 			u8 rsvd2[106];
 			union ionic_lif_config config;
 		} __rte_packed eth;
drivers/net/ionic/ionic_lif.c +3 -7
index 0d167f677f..13c763407c 100644
@@ -536,7 +536,7 @@ ionic_dev_allmulticast_disable(struct rte_eth_dev *eth_dev)
 }
 
 int
-ionic_lif_change_mtu(struct ionic_lif *lif, int new_mtu)
+ionic_lif_change_mtu(struct ionic_lif *lif, uint32_t new_mtu)
 {
 	struct ionic_admin_ctx ctx = {
 		.pending_work = true,
@@ -546,13 +546,8 @@ ionic_lif_change_mtu(struct ionic_lif *lif, int new_mtu)
 			.mtu = rte_cpu_to_le_32(new_mtu),
 		},
 	};
-	int err;
-
-	err = ionic_adminq_post_wait(lif, &ctx);
-	if (err)
-		return err;
 
-	return 0;
+	return ionic_adminq_post_wait(lif, &ctx);
 }
 
 int
@@ -730,6 +725,7 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 	int err;
 
 	flags = IONIC_QCQ_F_SG;
+
 	err = ionic_qcq_alloc(lif,
 		IONIC_QTYPE_RXQ,
 		sizeof(struct ionic_rx_qcq),
drivers/net/ionic/ionic_lif.h +3 -1
index b37841b69f..c87f981803 100644
@@ -81,6 +81,7 @@ struct ionic_rx_qcq {
 
 	/* cacheline2 */
 	struct rte_mempool *mb_pool;
+	uint16_t frame_size;	/* Based on configured MTU */
 	uint16_t flags;
 
 	/* cacheline3 (inside stats) */
@@ -123,6 +124,7 @@ struct ionic_lif {
 	struct ionic_adapter *adapter;
 	struct rte_eth_dev *eth_dev;
 	uint16_t port_id;  /**< Device port identifier */
+	uint16_t frame_size;
 	uint32_t hw_index;
 	uint32_t state;
 	uint32_t ntxqcqs;
@@ -181,7 +183,7 @@ int ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr);
 int ionic_qcq_service(struct ionic_qcq *qcq, int budget, ionic_cq_cb cb,
 	void *cb_arg);
 
-int ionic_lif_change_mtu(struct ionic_lif *lif, int new_mtu);
+int ionic_lif_change_mtu(struct ionic_lif *lif, uint32_t new_mtu);
 
 int ionic_dev_add_mac(struct rte_eth_dev *eth_dev,
 	struct rte_ether_addr *mac_addr,
drivers/net/ionic/ionic_rxtx.c +11 -15
index ffca26dd3e..ce1bdbc2c3 100644
@@ -772,8 +772,6 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 	struct ionic_rxq_comp *cq_desc_base = cq->base;
 	struct ionic_rxq_comp *cq_desc = &cq_desc_base[cq_desc_index];
 	struct rte_mbuf *rxm, *rxm_seg;
-	uint32_t max_frame_size =
-		rxq->qcq.lif->eth_dev->data->mtu + RTE_ETHER_HDR_LEN;
 	uint64_t pkt_flags = 0;
 	uint32_t pkt_type;
 	struct ionic_rx_stats *stats = &rxq->stats;
@@ -814,8 +812,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 		return;
 	}
 
-	if (cq_desc->len > max_frame_size ||
-			cq_desc->len == 0) {
+	if (cq_desc->len > rxq->frame_size || cq_desc->len == 0) {
 		stats->bad_len++;
 		ionic_rx_recycle(q, q_desc_index, rxm);
 		return;
@@ -936,7 +933,7 @@ ionic_rx_recycle(struct ionic_queue *q, uint32_t q_desc_index,
 }
 
 static __rte_always_inline int
-ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len)
+ionic_rx_fill(struct ionic_rx_qcq *rxq)
 {
 	struct ionic_queue *q = &rxq->qcq.q;
 	struct ionic_rxq_desc *desc, *desc_base = q->base;
@@ -961,7 +958,7 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len)
 
 		info = IONIC_INFO_PTR(q, q->head_idx);
 
-		nsegs = (len + buf_size - 1) / buf_size;
+		nsegs = (rxq->frame_size + buf_size - 1) / buf_size;
 
 		desc = &desc_base[q->head_idx];
 		dma_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(rxm));
@@ -996,9 +993,9 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len)
 			prev_rxm_seg = rxm_seg;
 		}
 
-		if (size < len)
+		if (size < rxq->frame_size)
 			IONIC_PRINT(ERR, "Rx SG size is not sufficient (%d < %d)",
-				size, len);
+				size, rxq->frame_size);
 
 		info[0] = rxm;
 
@@ -1016,7 +1013,6 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len)
 int __rte_cold
 ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 {
-	uint32_t frame_size = eth_dev->data->mtu + RTE_ETHER_HDR_LEN;
 	uint8_t *rx_queue_state = eth_dev->data->rx_queue_state;
 	struct ionic_rx_qcq *rxq;
 	int err;
@@ -1029,8 +1025,10 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 
 	rxq = eth_dev->data->rx_queues[rx_queue_id];
 
-	IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs (size: %u)",
-		rx_queue_id, rxq->qcq.q.num_descs, frame_size);
+	rxq->frame_size = rxq->qcq.lif->frame_size - RTE_ETHER_CRC_LEN;
+
+	IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs, size %u",
+		rx_queue_id, rxq->qcq.q.num_descs, rxq->frame_size);
 
 	if (!(rxq->flags & IONIC_QCQ_F_INITED)) {
 		err = ionic_lif_rxq_init(rxq);
@@ -1041,7 +1039,7 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 	}
 
 	/* Allocate buffers for descriptor rings */
-	if (ionic_rx_fill(rxq, frame_size) != 0) {
+	if (ionic_rx_fill(rxq) != 0) {
 		IONIC_PRINT(ERR, "Could not alloc mbuf for queue:%d",
 			rx_queue_id);
 		return -1;
@@ -1129,8 +1127,6 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts)
 {
 	struct ionic_rx_qcq *rxq = rx_queue;
-	uint32_t frame_size =
-		rxq->qcq.lif->eth_dev->data->mtu + RTE_ETHER_HDR_LEN;
 	struct ionic_rx_service service_cb_arg;
 
 	service_cb_arg.rx_pkts = rx_pkts;
@@ -1139,7 +1135,7 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 	ionic_rxq_service(rxq, nb_pkts, &service_cb_arg);
 
-	ionic_rx_fill(rxq, frame_size);
+	ionic_rx_fill(rxq);
 
 	return service_cb_arg.nb_rx;
 }
Signature · 1 line
2.17.1
#51 lore raw

PATCH v2 10/36 net/ionic: simplify code by removing doorbell map helper

In reply to Andrew Boyer

There is only one doorbell page in DPDK configurations, so no helper function is needed.

---
 drivers/net/ionic/ionic_lif.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/net/ionic/ionic_lif.c +1 -12
index 13c763407c..637473cca5 100644
@@ -846,17 +846,6 @@ ionic_notify_qcq_alloc(struct ionic_lif *lif)
 	return 0;
 }
 
-static void *
-ionic_bus_map_dbpage(struct ionic_adapter *adapter, int page_num)
-{
-	char *vaddr = adapter->bars[IONIC_PCI_BAR_DBELL].vaddr;
-
-	if (adapter->num_bars <= IONIC_PCI_BAR_DBELL)
-		return NULL;
-
-	return (void *)&vaddr[page_num << PAGE_SHIFT];
-}
-
 static void
 ionic_lif_queue_identify(struct ionic_lif *lif)
 {
@@ -959,7 +948,7 @@ ionic_lif_alloc(struct ionic_lif *lif)
 	rte_spinlock_init(&lif->adminq_lock);
 	rte_spinlock_init(&lif->adminq_service_lock);
 
-	lif->kern_dbpage = ionic_bus_map_dbpage(adapter, 0);
+	lif->kern_dbpage = adapter->idev.db_pages;
 	if (!lif->kern_dbpage) {
 		IONIC_PRINT(ERR, "Cannot map dbpage, aborting");
 		return -ENOMEM;
Signature · 1 line
2.17.1
#52 lore raw

PATCH v2 11/36 net/ionic: remove unused identifiers

In reply to Andrew Boyer

These bits are not used. Remove them to simplify the code. Fix the spacing on the IONIC_ALIGN #define.

---
 drivers/net/ionic/ionic.h        | 1 -
 drivers/net/ionic/ionic_dev.h    | 4 +---
 drivers/net/ionic/ionic_ethdev.h | 2 --
 3 files changed, 1 insertion(+), 6 deletions(-)
drivers/net/ionic/ionic.h +0 -1
index a05bf4ee71..7c8710b637 100644
@@ -62,7 +62,6 @@ struct ionic_adapter {
 	bool link_up;
 	char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN];
 	struct rte_pci_device *pci_dev;
-	LIST_ENTRY(ionic_adapter) pci_adapters;
 };
 
 /** ionic_admin_ctx - Admin command context.
drivers/net/ionic/ionic_dev.h +1 -3
index 7aea9c9907..b284a36044 100644
@@ -21,12 +21,10 @@
 #define IONIC_MIN_RING_DESC		16
 #define IONIC_DEF_TXRX_DESC		4096
 
-#define IONIC_LIFS_MAX			1024
-
 #define IONIC_DEVCMD_TIMEOUT		5	/* devcmd_timeout */
 #define IONIC_DEVCMD_CHECK_PERIOD_US	10	/* devcmd status chk period */
 
-#define	IONIC_ALIGN             4096
+#define IONIC_ALIGN			4096
 
 struct ionic_adapter;
 
drivers/net/ionic/ionic_ethdev.h +0 -2
index 4762ba7a9d..16077e2786 100644
@@ -17,8 +17,6 @@
 
 #define IONIC_ETH_DEV_TO_LIF(eth_dev) ((struct ionic_lif *) \
 	(eth_dev)->data->dev_private)
-#define IONIC_ETH_DEV_TO_ADAPTER(eth_dev) \
-	(IONIC_ETH_DEV_TO_LIF(eth_dev)->adapter)
 
 int ionic_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
 
Signature · 1 line
2.17.1
#53 lore raw

PATCH v2 12/36 net/ionic: only allocate interrupts if required

In reply to Andrew Boyer

There is no need to allocate the interrupt vector list if datapath packet interrupts are not enabled.
This conserves resources.

---
 drivers/net/ionic/ionic_ethdev.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/ionic/ionic_ethdev.c +7 -5
index 637553716d..cabdfa1f21 100644
@@ -1082,14 +1082,16 @@ ionic_configure_intr(struct ionic_adapter *adapter)
 		return -1;
 	}
 
-	if (rte_intr_dp_is_en(intr_handle))
+	if (rte_intr_dp_is_en(intr_handle)) {
 		IONIC_PRINT(DEBUG,
 			"Packet I/O interrupt on datapath is enabled");
 
-	if (rte_intr_vec_list_alloc(intr_handle, "intr_vec", adapter->nintrs)) {
-		IONIC_PRINT(ERR, "Failed to allocate %u vectors",
-			    adapter->nintrs);
-		return -ENOMEM;
+		if (rte_intr_vec_list_alloc(intr_handle, "intr_vec",
+						adapter->nintrs)) {
+			IONIC_PRINT(ERR, "Failed to allocate %u vectors",
+				adapter->nintrs);
+			return -ENOMEM;
+		}
 	}
 
 	err = rte_intr_callback_register(intr_handle,
Signature · 1 line
2.17.1
#54 lore raw

PATCH v2 13/36 net/ionic: move PCI-specific code to a separate file

In reply to Andrew Boyer

For future support of virtual devices, move the PCI code to its own file. Create a new device interface, struct ionic_dev_intf, to plug in to common code.

---
 drivers/net/ionic/ionic.h         |  13 +-
 drivers/net/ionic/ionic_dev.c     |  62 ---------
 drivers/net/ionic/ionic_dev.h     |  13 +-
 drivers/net/ionic/ionic_dev_pci.c | 216 ++++++++++++++++++++++++++++++
 drivers/net/ionic/ionic_ethdev.c  | 161 ++++++----------------
 drivers/net/ionic/ionic_ethdev.h  |   9 ++
 drivers/net/ionic/ionic_main.c    |   2 +-
 drivers/net/ionic/meson.build     |   1 +
 8 files changed, 286 insertions(+), 191 deletions(-)
 create mode 100644 drivers/net/ionic/ionic_dev_pci.c
drivers/net/ionic/ionic.h +8 -5
index 7c8710b637..8b0e85ea26 100644
@@ -8,8 +8,6 @@
 #include <stdint.h>
 #include <inttypes.h>
 
-#include <bus_pci_driver.h>
-
 #include "ionic_dev.h"
 #include "ionic_if.h"
 #include "ionic_osdep.h"
@@ -42,6 +40,11 @@ struct ionic_hw {
 	uint16_t vendor_id;
 };
 
+struct ionic_bars {
+	struct ionic_dev_bar bar[IONIC_BARS_MAX];
+	uint32_t num_bars;
+};
+
 /*
  * Structure to store private data for each driver instance (for each adapter).
  */
@@ -49,10 +52,10 @@ struct ionic_adapter {
 	struct ionic_hw hw;
 	struct ionic_dev idev;
 	const char *name;
-	struct ionic_dev_bar bars[IONIC_BARS_MAX];
+	struct ionic_bars bars;
+	const struct ionic_dev_intf *intf;
 	struct ionic_identity	ident;
 	struct ionic_lif *lif;
-	uint32_t num_bars;
 	uint32_t max_ntxqs_per_lif;
 	uint32_t max_nrxqs_per_lif;
 	uint32_t max_mac_addrs;
@@ -61,7 +64,7 @@ struct ionic_adapter {
 	bool intrs[IONIC_INTR_CTRL_REGS_MAX];
 	bool link_up;
 	char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN];
-	struct rte_pci_device *pci_dev;
+	void *bus_dev;
 };
 
 /** ionic_admin_ctx - Admin command context.
drivers/net/ionic/ionic_dev.c +0 -62

68 lines not on this page · raw message

drivers/net/ionic/ionic_dev.h +11 -2
index b284a36044..6dab7e5bbd 100644
@@ -173,14 +173,23 @@ struct ionic_cq {
 struct ionic_lif;
 struct ionic_adapter;
 struct ionic_qcq;
+struct rte_mempool;
+struct rte_eth_dev;
+
+struct ionic_dev_intf {
+	int  (*setup)(struct ionic_adapter *adapter);
+	void (*copy_bus_info)(struct ionic_adapter *adapter,
+			struct rte_eth_dev *eth_dev);
+	int  (*configure_intr)(struct ionic_adapter *adapter);
+	void (*unconfigure_intr)(struct ionic_adapter *adapter);
+	void (*unmap_bars)(struct ionic_adapter *adapter);
+};
 
 void ionic_intr_init(struct ionic_dev *idev, struct ionic_intr_info *intr,
 	unsigned long index);
 
 const char *ionic_opcode_to_str(enum ionic_cmd_opcode opcode);
 
-int ionic_dev_setup(struct ionic_adapter *adapter);
-
 void ionic_dev_cmd_go(struct ionic_dev *idev, union ionic_dev_cmd *cmd);
 uint8_t ionic_dev_cmd_status(struct ionic_dev *idev);
 bool ionic_dev_cmd_done(struct ionic_dev *idev);
drivers/net/ionic/ionic_dev_pci.c new file +216 -0

216 lines not on this page · raw message

drivers/net/ionic/ionic_ethdev.c +40 -121

274 lines not on this page · raw message

drivers/net/ionic/ionic_ethdev.h +9 -0
index 16077e2786..8dddef80d5 100644
@@ -18,6 +18,15 @@
 #define IONIC_ETH_DEV_TO_LIF(eth_dev) ((struct ionic_lif *) \
 	(eth_dev)->data->dev_private)
 
+struct ionic_bars;
+struct ionic_dev_intf;
+
+int eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev,
+	struct ionic_bars *bars, const struct ionic_dev_intf *intf,
+	uint16_t device_id, uint16_t vendor_id);
+int eth_ionic_dev_remove(struct rte_device *rte_dev);
+
+void ionic_dev_interrupt_handler(void *param);
 int ionic_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
 
 #endif /* _IONIC_ETHDEV_H_ */
drivers/net/ionic/ionic_main.c +1 -1
index 11b8a8a44b..05f1e90e30 100644
@@ -336,7 +336,7 @@ ionic_dev_cmd_wait_check(struct ionic_dev *idev, unsigned long max_wait)
 int
 ionic_setup(struct ionic_adapter *adapter)
 {
-	return ionic_dev_setup(adapter);
+	return (*adapter->intf->setup)(adapter);
 }
 
 int
drivers/net/ionic/meson.build +1 -0
index d122686b5a..00865c2139 100644
@@ -9,6 +9,7 @@ endif
 
 sources = files(
         'ionic_dev.c',
+        'ionic_dev_pci.c',
         'ionic_ethdev.c',
         'ionic_lif.c',
         'ionic_mac_api.c',
Signature · 1 line
2.17.1
#55 lore raw

PATCH v2 14/36 net/ionic: only request notifyq interrupt if supported

In reply to Andrew Boyer

Enable the interrupt if the platform & device support it. This prevents spurious interrupts on virtual platforms.

---
 drivers/net/ionic/ionic_lif.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/ionic/ionic_lif.c +9 -3
index 637473cca5..ccd7ea68bb 100644
@@ -1350,6 +1350,7 @@ ionic_lif_notifyq_init(struct ionic_lif *lif)
 	struct ionic_dev *idev = &lif->adapter->idev;
 	struct ionic_notify_qcq *nqcq = lif->notifyqcq;
 	struct ionic_queue *q = &nqcq->qcq.q;
+	uint16_t flags = IONIC_QINIT_F_ENA;
 	int err;
 
 	struct ionic_admin_ctx ctx = {
@@ -1359,14 +1360,19 @@ ionic_lif_notifyq_init(struct ionic_lif *lif)
 			.type = q->type,
 			.ver = lif->qtype_info[q->type].version,
 			.index = rte_cpu_to_le_32(q->index),
-			.intr_index = rte_cpu_to_le_16(nqcq->intr.index),
-			.flags = rte_cpu_to_le_16(IONIC_QINIT_F_IRQ |
-						IONIC_QINIT_F_ENA),
+			.intr_index = rte_cpu_to_le_16(IONIC_INTR_NONE),
 			.ring_size = rte_log2_u32(q->num_descs),
 			.ring_base = rte_cpu_to_le_64(q->base_pa),
 		}
 	};
 
+	/* Only enable an interrupt if the device supports them */
+	if (lif->adapter->intf->configure_intr != NULL) {
+		flags |= IONIC_QINIT_F_IRQ;
+		ctx.cmd.q_init.intr_index = rte_cpu_to_le_16(nqcq->intr.index);
+	}
+	ctx.cmd.q_init.flags = rte_cpu_to_le_16(flags);
+
 	IONIC_PRINT(DEBUG, "notifyq_init.index %d", q->index);
 	IONIC_PRINT(DEBUG, "notifyq_init.ring_base 0x%" PRIx64 "", q->base_pa);
 	IONIC_PRINT(DEBUG, "notifyq_init.ring_size %d",
Signature · 1 line
2.17.1
#56 lore raw

PATCH v2 15/36 net/ionic: replace void pointer with actual type

In reply to Andrew Boyer

This makes the code safer by helping the compiler catch errors. Rename the variables, too; they're not callbacks anymore.

---
 drivers/net/ionic/ionic_rxtx.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)
drivers/net/ionic/ionic_rxtx.c +13 -15
index ce1bdbc2c3..c90d3d62f3 100644
@@ -765,7 +765,7 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 static __rte_always_inline void
 ionic_rx_clean(struct ionic_rx_qcq *rxq,
 		uint32_t q_desc_index, uint32_t cq_desc_index,
-		void *service_cb_arg)
+		struct ionic_rx_service *rx_svc)
 {
 	struct ionic_queue *q = &rxq->qcq.q;
 	struct ionic_cq *cq = &rxq->qcq.cq;
@@ -775,8 +775,6 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 	uint64_t pkt_flags = 0;
 	uint32_t pkt_type;
 	struct ionic_rx_stats *stats = &rxq->stats;
-	struct ionic_rx_service *recv_args = (struct ionic_rx_service *)
-		service_cb_arg;
 	uint32_t buf_size = (uint16_t)
 		(rte_pktmbuf_data_room_size(rxq->mb_pool) -
 		RTE_PKTMBUF_HEADROOM);
@@ -789,7 +787,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 
 	rxm = info[0];
 
-	if (!recv_args) {
+	if (!rx_svc) {
 		stats->no_cb_arg++;
 		/* Flush */
 		rte_pktmbuf_free(rxm);
@@ -806,7 +804,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 		return;
 	}
 
-	if (recv_args->nb_rx >= recv_args->nb_pkts) {
+	if (rx_svc->nb_rx >= rx_svc->nb_pkts) {
 		stats->no_room++;
 		ionic_rx_recycle(q, q_desc_index, rxm);
 		return;
@@ -907,8 +905,8 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq,
 
 	rxm->packet_type = pkt_type;
 
-	recv_args->rx_pkts[recv_args->nb_rx] = rxm;
-	recv_args->nb_rx++;
+	rx_svc->rx_pkts[rx_svc->nb_rx] = rxm;
+	rx_svc->nb_rx++;
 
 	stats->packets++;
 	stats->bytes += rxm->pkt_len;
@@ -1052,7 +1050,7 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 
 static __rte_always_inline void
 ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,
-		void *service_cb_arg)
+		struct ionic_rx_service *rx_svc)
 {
 	struct ionic_cq *cq = &rxq->qcq.cq;
 	struct ionic_queue *q = &rxq->qcq.q;
@@ -1088,7 +1086,7 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,
 				rte_prefetch0(&q->info[q->tail_idx]);
 
 			ionic_rx_clean(rxq, curr_q_tail_idx, curr_cq_tail_idx,
-				service_cb_arg);
+				rx_svc);
 
 		} while (more);
 
@@ -1127,15 +1125,15 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts)
 {
 	struct ionic_rx_qcq *rxq = rx_queue;
-	struct ionic_rx_service service_cb_arg;
+	struct ionic_rx_service rx_svc;
 
-	service_cb_arg.rx_pkts = rx_pkts;
-	service_cb_arg.nb_pkts = nb_pkts;
-	service_cb_arg.nb_rx = 0;
+	rx_svc.rx_pkts = rx_pkts;
+	rx_svc.nb_pkts = nb_pkts;
+	rx_svc.nb_rx = 0;
 
-	ionic_rxq_service(rxq, nb_pkts, &service_cb_arg);
+	ionic_rxq_service(rxq, nb_pkts, &rx_svc);
 
 	ionic_rx_fill(rxq);
 
-	return service_cb_arg.nb_rx;
+	return rx_svc.nb_rx;
 }
Signature · 1 line
2.17.1
#57 lore raw

PATCH v2 16/36 net/ionic: free all buffers during Rx queue stop

In reply to Andrew Boyer

Free all of the mbufs in the receive queue when the queue is stopped. This will allow them to be resized when the MTU is changed.

---
 drivers/net/ionic/ionic_dev.c  |  16 +++++
 drivers/net/ionic/ionic_dev.h  |   2 +
 drivers/net/ionic/ionic_lif.c  |  32 ++++-----
 drivers/net/ionic/ionic_lif.h  |   4 --
 drivers/net/ionic/ionic_rxtx.c | 116 +++++++++++++++------------------
 5 files changed, 81 insertions(+), 89 deletions(-)
drivers/net/ionic/ionic_dev.c +16 -0
index 1082a007d3..70c14882ed 100644
@@ -317,6 +317,15 @@ ionic_cq_init(struct ionic_cq *cq, uint16_t num_descs)
 	return 0;
 }
 
+void
+ionic_cq_reset(struct ionic_cq *cq)
+{
+	cq->tail_idx = 0;
+	cq->done_color = 1;
+
+	memset(cq->base, 0, sizeof(struct ionic_nop_comp) * cq->num_descs);
+}
+
 void
 ionic_cq_map(struct ionic_cq *cq, void *base, rte_iova_t base_pa)
 {
@@ -379,3 +388,10 @@ ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa)
 	q->sg_base = base;
 	q->sg_base_pa = base_pa;
 }
+
+void
+ionic_q_reset(struct ionic_queue *q)
+{
+	q->head_idx = 0;
+	q->tail_idx = 0;
+}
drivers/net/ionic/ionic_dev.h +2 -0
index 6dab7e5bbd..b77de30de1 100644
@@ -225,6 +225,7 @@ struct ionic_doorbell __iomem *ionic_db_map(struct ionic_lif *lif,
 	struct ionic_queue *q);
 
 int ionic_cq_init(struct ionic_cq *cq, uint16_t num_descs);
+void ionic_cq_reset(struct ionic_cq *cq);
 void ionic_cq_map(struct ionic_cq *cq, void *base, rte_iova_t base_pa);
 typedef bool (*ionic_cq_cb)(struct ionic_cq *cq, uint16_t cq_desc_index,
 		void *cb_arg);
@@ -232,6 +233,7 @@ uint32_t ionic_cq_service(struct ionic_cq *cq, uint32_t work_to_do,
 	ionic_cq_cb cb, void *cb_arg);
 
 int ionic_q_init(struct ionic_queue *q, uint32_t index, uint16_t num_descs);
+void ionic_q_reset(struct ionic_queue *q);
 void ionic_q_map(struct ionic_queue *q, void *base, rte_iova_t base_pa);
 void ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa);
 
drivers/net/ionic/ionic_lif.c +11 -21
index ccd7ea68bb..e7cb9e2ea3 100644
@@ -30,25 +30,7 @@ static const uint8_t ionic_qtype_vers[IONIC_QTYPE_MAX] = {
 static int ionic_lif_addr_add(struct ionic_lif *lif, const uint8_t *addr);
 static int ionic_lif_addr_del(struct ionic_lif *lif, const uint8_t *addr);
 
-int
-ionic_qcq_enable(struct ionic_qcq *qcq)
-{
-	struct ionic_queue *q = &qcq->q;
-	struct ionic_lif *lif = qcq->lif;
-	struct ionic_admin_ctx ctx = {
-		.pending_work = true,
-		.cmd.q_control = {
-			.opcode = IONIC_CMD_Q_CONTROL,
-			.type = q->type,
-			.index = rte_cpu_to_le_32(q->index),
-			.oper = IONIC_Q_ENABLE,
-		},
-	};
-
-	return ionic_adminq_post_wait(lif, &ctx);
-}
-
-int
+static int
 ionic_qcq_disable(struct ionic_qcq *qcq)
 {
 	struct ionic_queue *q = &qcq->q;
@@ -133,7 +115,6 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats
 	for (i = 0; i < lif->nrxqcqs; i++) {
 		struct ionic_rx_stats *rx_stats = &lif->rxqcqs[i]->stats;
 		stats->ierrors +=
-			rx_stats->no_cb_arg +
 			rx_stats->bad_cq_status +
 			rx_stats->no_room +
 			rx_stats->bad_len;
@@ -154,7 +135,6 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats
 		stats->q_ipackets[i] = rx_stats->packets;
 		stats->q_ibytes[i] = rx_stats->bytes;
 		stats->q_errors[i] =
-			rx_stats->no_cb_arg +
 			rx_stats->bad_cq_status +
 			rx_stats->no_room +
 			rx_stats->bad_len;
@@ -1146,12 +1126,16 @@ ionic_lif_rss_teardown(struct ionic_lif *lif)
 void
 ionic_lif_txq_deinit(struct ionic_tx_qcq *txq)
 {
+	ionic_qcq_disable(&txq->qcq);
+
 	txq->flags &= ~IONIC_QCQ_F_INITED;
 }
 
 void
 ionic_lif_rxq_deinit(struct ionic_rx_qcq *rxq)
 {
+	ionic_qcq_disable(&rxq->qcq);
+
 	rxq->flags &= ~IONIC_QCQ_F_INITED;
 }
 
@@ -1488,6 +1472,9 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq)
 		ctx.cmd.q_init.ring_size);
 	IONIC_PRINT(DEBUG, "txq_init.ver %u", ctx.cmd.q_init.ver);
 
+	ionic_q_reset(q);
+	ionic_cq_reset(cq);
+
 	err = ionic_adminq_post_wait(lif, &ctx);
 	if (err)
 		return err;
@@ -1536,6 +1523,9 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq)
 		ctx.cmd.q_init.ring_size);
 	IONIC_PRINT(DEBUG, "rxq_init.ver %u", ctx.cmd.q_init.ver);
 
+	ionic_q_reset(q);
+	ionic_cq_reset(cq);
+
 	err = ionic_adminq_post_wait(lif, &ctx);
 	if (err)
 		return err;
drivers/net/ionic/ionic_lif.h +0 -4
index c87f981803..a8f7458327 100644
@@ -39,7 +39,6 @@ struct ionic_tx_stats {
 struct ionic_rx_stats {
 	uint64_t packets;
 	uint64_t bytes;
-	uint64_t no_cb_arg;
 	uint64_t bad_cq_status;
 	uint64_t no_room;
 	uint64_t bad_len;
@@ -207,9 +206,6 @@ int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id,
 	struct ionic_tx_qcq **qcq_out);
 void ionic_qcq_free(struct ionic_qcq *qcq);
 
-int ionic_qcq_enable(struct ionic_qcq *qcq);
-int ionic_qcq_disable(struct ionic_qcq *qcq);
-
 int ionic_lif_rxq_init(struct ionic_rx_qcq *rxq);
 void ionic_lif_rxq_deinit(struct ionic_rx_qcq *rxq);
 
drivers/net/ionic/ionic_rxtx.c +52 -64

192 lines not on this page · raw message

Signature · 1 line
2.17.1
#58 lore raw

PATCH v2 17/36 net/ionic: precalculate segment lengths on receive side

In reply to Andrew Boyer

The first (header) segment includes the standard headroom. Subsequent segments do not.

Store the fragment counts in the queue structure.

Precalculating improves performance by reducing
how much work must be done in the hot path.

---
 drivers/net/ionic/ionic_dev.h  |  1 +
 drivers/net/ionic/ionic_lif.c  | 36 ++++++++++++++++++++++++--
 drivers/net/ionic/ionic_lif.h  |  4 ++-
 drivers/net/ionic/ionic_rxtx.c | 46 ++++++++++++++--------------------
 4 files changed, 57 insertions(+), 30 deletions(-)
drivers/net/ionic/ionic_dev.h +1 -0
index b77de30de1..aff49ae34d 100644
@@ -137,6 +137,7 @@ struct ionic_dev {
 
 struct ionic_queue {
 	uint16_t num_descs;
+	uint16_t num_segs;
 	uint16_t head_idx;
 	uint16_t tail_idx;
 	uint16_t size_mask;
drivers/net/ionic/ionic_lif.c +34 -2
index e7cb9e2ea3..2bc2362453 100644
@@ -566,6 +566,7 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 		const char *type_name,
 		uint16_t flags,
 		uint16_t num_descs,
+		uint16_t num_segs,
 		uint16_t desc_size,
 		uint16_t cq_desc_size,
 		uint16_t sg_desc_size,
@@ -616,6 +617,7 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 		goto err_out_free_qcq;
 	}
 
+	new->q.num_segs = num_segs;
 	new->q.type = type;
 
 	err = ionic_q_init(&new->q, index, num_descs);
@@ -698,14 +700,38 @@ ionic_qcq_free(struct ionic_qcq *qcq)
 
 int
 ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
-		uint16_t nrxq_descs, struct ionic_rx_qcq **rxq_out)
+		uint16_t nrxq_descs, struct rte_mempool *mb_pool,
+		struct ionic_rx_qcq **rxq_out)
 {
 	struct ionic_rx_qcq *rxq;
-	uint16_t flags;
+	uint16_t flags, seg_size, hdr_seg_size, max_segs, max_segs_fw;
+	uint32_t max_mtu;
 	int err;
 
 	flags = IONIC_QCQ_F_SG;
 
+	seg_size = rte_pktmbuf_data_room_size(mb_pool);
+
+	/* The first mbuf needs to leave headroom */
+	hdr_seg_size = seg_size - RTE_PKTMBUF_HEADROOM;
+
+	max_mtu = rte_le_to_cpu_32(lif->adapter->ident.lif.eth.max_mtu);
+
+	max_segs_fw = IONIC_RX_MAX_SG_ELEMS + 1;
+
+	/*
+	 * Calculate how many fragment pointers might be stored in queue.
+	 */
+	max_segs = 1 + (max_mtu + RTE_PKTMBUF_HEADROOM - 1) / seg_size;
+
+	IONIC_PRINT(DEBUG, "rxq %u frame_size %u seg_size %u max_segs %u",
+		index, lif->frame_size, seg_size, max_segs);
+	if (max_segs > max_segs_fw) {
+		IONIC_PRINT(ERR, "Rx mbuf size insufficient (%d > %d avail)",
+			max_segs, max_segs_fw);
+		return -EINVAL;
+	}
+
 	err = ionic_qcq_alloc(lif,
 		IONIC_QTYPE_RXQ,
 		sizeof(struct ionic_rx_qcq),
@@ -714,6 +740,7 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 		"rx",
 		flags,
 		nrxq_descs,
+		max_segs,
 		sizeof(struct ionic_rxq_desc),
 		sizeof(struct ionic_rxq_comp),
 		sizeof(struct ionic_rxq_sg_desc),
@@ -722,6 +749,8 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 		return err;
 
 	rxq->flags = flags;
+	rxq->seg_size = seg_size;
+	rxq->hdr_seg_size = hdr_seg_size;
 
 	lif->rxqcqs[index] = rxq;
 	*rxq_out = rxq;
@@ -749,6 +778,7 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 		"tx",
 		flags,
 		ntxq_descs,
+		1,
 		sizeof(struct ionic_txq_desc),
 		sizeof(struct ionic_txq_comp),
 		sizeof(struct ionic_txq_sg_desc_v1),
@@ -779,6 +809,7 @@ ionic_admin_qcq_alloc(struct ionic_lif *lif)
 		"admin",
 		flags,
 		IONIC_ADMINQ_LENGTH,
+		1,
 		sizeof(struct ionic_admin_cmd),
 		sizeof(struct ionic_admin_comp),
 		0,
@@ -805,6 +836,7 @@ ionic_notify_qcq_alloc(struct ionic_lif *lif)
 		"notify",
 		flags,
 		IONIC_NOTIFYQ_LENGTH,
+		1,
 		sizeof(struct ionic_notifyq_cmd),
 		sizeof(union ionic_notifyq_comp),
 		0,
drivers/net/ionic/ionic_lif.h +3 -1
index a8f7458327..8650200ec7 100644
@@ -81,6 +81,8 @@ struct ionic_rx_qcq {
 	/* cacheline2 */
 	struct rte_mempool *mb_pool;
 	uint16_t frame_size;	/* Based on configured MTU */
+	uint16_t hdr_seg_size;	/* Length of first segment of RX chain */
+	uint16_t seg_size;	/* Length of all subsequent segments */
 	uint16_t flags;
 
 	/* cacheline3 (inside stats) */
@@ -199,7 +201,7 @@ int ionic_dev_allmulticast_enable(struct rte_eth_dev *dev);
 int ionic_dev_allmulticast_disable(struct rte_eth_dev *dev);
 
 int ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id,
-	uint32_t index, uint16_t nrxq_descs,
+	uint32_t index, uint16_t nrxq_descs, struct rte_mempool *mp,
 	struct ionic_rx_qcq **qcq_out);
 int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id,
 	uint32_t index, uint16_t ntxq_descs,
drivers/net/ionic/ionic_rxtx.c +19 -27

118 lines not on this page · raw message

Signature · 1 line
2.17.1
#59 lore raw

PATCH v2 18/36 net/ionic: use a helper variable in packet Tx function

In reply to Andrew Boyer

This improves readability.

---
 drivers/net/ionic/ionic_rxtx.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ionic/ionic_rxtx.c +7 -4
index 27678ccb6e..93a29a0326 100644
@@ -560,6 +560,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	struct ionic_tx_qcq *txq = tx_queue;
 	struct ionic_queue *q = &txq->qcq.q;
 	struct ionic_tx_stats *stats = &txq->stats;
+	struct rte_mbuf *mbuf;
 	uint32_t next_q_head_idx;
 	uint32_t bytes_tx = 0;
 	uint16_t nb_avail, nb_tx = 0;
@@ -582,16 +583,18 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			rte_prefetch0(&q->info[next_q_head_idx]);
 		}
 
-		if (tx_pkts[nb_tx]->ol_flags & RTE_MBUF_F_TX_TCP_SEG)
-			err = ionic_tx_tso(txq, tx_pkts[nb_tx]);
+		mbuf = tx_pkts[nb_tx];
+
+		if (mbuf->ol_flags & RTE_MBUF_F_TX_TCP_SEG)
+			err = ionic_tx_tso(txq, mbuf);
 		else
-			err = ionic_tx(txq, tx_pkts[nb_tx]);
+			err = ionic_tx(txq, mbuf);
 		if (err) {
 			stats->drop += nb_pkts - nb_tx;
 			break;
 		}
 
-		bytes_tx += tx_pkts[nb_tx]->pkt_len;
+		bytes_tx += mbuf->pkt_len;
 		nb_tx++;
 	}
 
Signature · 1 line
2.17.1
#60 lore raw

PATCH v2 19/36 net/ionic: do one-time init of receive descriptors

In reply to Andrew Boyer

These fields don't need to be set in the hot path. This improves performance.

---
 drivers/net/ionic/ionic_rxtx.c | 38 ++++++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 4 deletions(-)
drivers/net/ionic/ionic_rxtx.c +34 -4
index 93a29a0326..9812604c3f 100644
@@ -941,9 +941,6 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq)
 		desc = &desc_base[q->head_idx];
 		dma_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(rxm));
 		desc->addr = dma_addr;
-		desc->len = rxq->hdr_seg_size;
-		desc->opcode = (q->num_segs > 1) ? IONIC_RXQ_DESC_OPCODE_SG :
-			IONIC_RXQ_DESC_OPCODE_SIMPLE;
 		rxm->next = NULL;
 
 		prev_rxm_seg = rxm;
@@ -963,7 +960,6 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq)
 			data_iova = rte_mbuf_data_iova(rxm_seg);
 			dma_addr = rte_cpu_to_le_64(data_iova);
 			elem->addr = dma_addr;
-			elem->len = rxq->seg_size;
 			elem++;
 
 			rxm_seg->next = NULL;
@@ -981,6 +977,38 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq)
 	return 0;
 }
 
+/*
+ * Perform one-time initialization of descriptor fields
+ * which will not change for the life of the queue.
+ */
+static void __rte_cold
+ionic_rx_init_descriptors(struct ionic_rx_qcq *rxq)
+{
+	struct ionic_queue *q = &rxq->qcq.q;
+	struct ionic_rxq_desc *desc, *desc_base = q->base;
+	struct ionic_rxq_sg_desc *sg_desc, *sg_desc_base = q->sg_base;
+	uint32_t i, j;
+	uint8_t opcode;
+
+	opcode = (q->num_segs > 1) ?
+		IONIC_RXQ_DESC_OPCODE_SG : IONIC_RXQ_DESC_OPCODE_SIMPLE;
+
+	/*
+	 * NB: Only the first segment needs to leave headroom (hdr_seg_size).
+	 *     Later segments (seg_size) do not.
+	 */
+	for (i = 0; i < q->num_descs; i++) {
+		desc = &desc_base[i];
+		desc->len = rte_cpu_to_le_16(rxq->hdr_seg_size);
+		desc->opcode = opcode;
+
+		sg_desc = &sg_desc_base[i];
+		for (j = 0; j < q->num_segs - 1u; j++)
+			sg_desc->elems[j].len =
+				rte_cpu_to_le_16(rxq->seg_size);
+	}
+}
+
 /*
  * Start Receive Units for specified queue.
  */
@@ -1010,6 +1038,8 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 	IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs, size %u segs %u",
 		rx_queue_id, q->num_descs, rxq->frame_size, q->num_segs);
 
+	ionic_rx_init_descriptors(rxq);
+
 	err = ionic_lif_rxq_init(rxq);
 	if (err)
 		return err;
Signature · 1 line
2.17.1
#61 lore raw

PATCH v2 20/36 net/ionic: overhaul receive side for performance

In reply to Andrew Boyer

Linearize RX mbuf chains in the expanded info array.
Clean one and fill one per CQE (completions are not coalesced). Touch the mbufs as little as possible in the fill stage. When touching the mbuf in the clean stage, use the rearm_data unions. Ring the doorbell once at the end of the bulk clean/fill.

---
 doc/guides/rel_notes/release_22_11.rst |   1 +
 drivers/net/ionic/ionic_dev.h          |   2 +-
 drivers/net/ionic/ionic_lif.c          |  49 +++++-
 drivers/net/ionic/ionic_lif.h          |   3 +-
 drivers/net/ionic/ionic_rxtx.c         | 225 ++++++++++++-------------
 drivers/net/ionic/ionic_rxtx.h         |   1 -
 6 files changed, 159 insertions(+), 122 deletions(-)
doc/guides/rel_notes/release_22_11.rst +1 -0
index 4656607aae..72ddb43f51 100644
@@ -145,6 +145,7 @@ New Features
   Updated the ionic PMD with new features and improvements, including:
 
   * Updated to reflect that Pensando has been acquired by AMD.
+  * Enhanced data path to provide substantial performance improvements.
 
 * **Updated Intel iavf driver.**
 
drivers/net/ionic/ionic_dev.h +1 -1
index aff49ae34d..312f195e58 100644
@@ -132,7 +132,7 @@ struct ionic_dev {
 #define Q_NEXT_TO_POST(_q, _n)	(((_q)->head_idx + (_n)) & ((_q)->size_mask))
 #define Q_NEXT_TO_SRVC(_q, _n)	(((_q)->tail_idx + (_n)) & ((_q)->size_mask))
 
-#define IONIC_INFO_IDX(_q, _i)	(_i)
+#define IONIC_INFO_IDX(_q, _i)	((_i) * (_q)->num_segs)
 #define IONIC_INFO_PTR(_q, _i)	(&(_q)->info[IONIC_INFO_IDX((_q), _i)])
 
 struct ionic_queue {
drivers/net/ionic/ionic_lif.c +44 -5

89 lines not on this page · raw message

drivers/net/ionic/ionic_lif.h +2 -1
index 8650200ec7..ce31b66a1e 100644
@@ -40,7 +40,6 @@ struct ionic_rx_stats {
 	uint64_t packets;
 	uint64_t bytes;
 	uint64_t bad_cq_status;
-	uint64_t no_room;
 	uint64_t bad_len;
 	uint64_t mtods;
 };
@@ -80,6 +79,8 @@ struct ionic_rx_qcq {
 
 	/* cacheline2 */
 	struct rte_mempool *mb_pool;
+	uint64_t rearm_data;
+	uint64_t rearm_seg_data;
 	uint16_t frame_size;	/* Based on configured MTU */
 	uint16_t hdr_seg_size;	/* Length of first segment of RX chain */
 	uint16_t seg_size;	/* Length of all subsequent segments */
drivers/net/ionic/ionic_rxtx.c +111 -114

333 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx.h +0 -1
index e55e86c8b3..6f9f3f92c6 100644
@@ -10,7 +10,6 @@
 struct ionic_rx_service {
 	/* cb in */
 	struct rte_mbuf **rx_pkts;
-	uint16_t nb_pkts;
 	/* cb out */
 	uint16_t nb_rx;
 };
Signature · 1 line
2.17.1
#62 lore raw

PATCH v2 21/36 net/ionic: overhaul transmit side for performance

In reply to Andrew Boyer

Linearize Tx mbuf chains in the info array.
This avoids walking the mbuf chain during flush.
Move a few branches out of the hot path.

---
 drivers/net/ionic/ionic_lif.c  |   2 +-
 drivers/net/ionic/ionic_rxtx.c | 143 ++++++++++++++++++++-------------
 2 files changed, 87 insertions(+), 58 deletions(-)
drivers/net/ionic/ionic_lif.c +1 -1
index ede368d8ca..4305587fe0 100644
@@ -817,7 +817,7 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 		"tx",
 		flags,
 		ntxq_descs,
-		1,
+		num_segs_fw,
 		sizeof(struct ionic_txq_desc),
 		sizeof(struct ionic_txq_comp),
 		sizeof(struct ionic_txq_sg_desc_v1),
drivers/net/ionic/ionic_rxtx.c +86 -57

231 lines not on this page · raw message

Signature · 1 line
2.17.1
#63 lore raw

PATCH v2 22/36 net/ionic: add support for mbuf fast free

In reply to Andrew Boyer

Use a put() rather than a free() in the optimized case.

---
 doc/guides/nics/features/ionic.ini     | 1 +
 doc/guides/rel_notes/release_22_11.rst | 1 +
 drivers/net/ionic/ionic_ethdev.c       | 2 +-
 drivers/net/ionic/ionic_lif.h          | 1 +
 drivers/net/ionic/ionic_rxtx.c         | 9 ++++++++-
 5 files changed, 12 insertions(+), 2 deletions(-)
doc/guides/nics/features/ionic.ini +1 -0
index 5bd18e39e9..77947bfd22 100644
@@ -7,6 +7,7 @@
 Speed capabilities   = Y
 Link status          = Y
 Link status event    = Y
+Fast mbuf free       = Y
 Queue start/stop     = Y
 MTU update           = Y
 Scattered Rx         = Y
doc/guides/rel_notes/release_22_11.rst +1 -0
index 72ddb43f51..4ad525375f 100644
@@ -146,6 +146,7 @@ New Features
 
   * Updated to reflect that Pensando has been acquired by AMD.
   * Enhanced data path to provide substantial performance improvements.
+  * Added support for mbuf fast free.
 
 * **Updated Intel iavf driver.**
 
drivers/net/ionic/ionic_ethdev.c +1 -1
index 7d95e52346..7d21bc0a9b 100644
@@ -396,7 +396,7 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 	 */
 
 	dev_info->rx_queue_offload_capa = 0;
-	dev_info->tx_queue_offload_capa = 0;
+	dev_info->tx_queue_offload_capa = RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
 
 	/*
 	 * Per-port capabilities
drivers/net/ionic/ionic_lif.h +1 -0
index ce31b66a1e..547d4873be 100644
@@ -50,6 +50,7 @@ struct ionic_rx_stats {
 #define IONIC_QCQ_F_CSUM_L3	BIT(7)
 #define IONIC_QCQ_F_CSUM_UDP	BIT(8)
 #define IONIC_QCQ_F_CSUM_TCP	BIT(9)
+#define IONIC_QCQ_F_FAST_FREE	BIT(10)
 
 /* Queue / Completion Queue */
 struct ionic_qcq {
drivers/net/ionic/ionic_rxtx.c +8 -1
index 56701e90d4..64766f2652 100644
@@ -94,6 +94,8 @@ ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 
 	qinfo->nb_desc = q->num_descs;
 	qinfo->conf.offloads = dev->data->dev_conf.txmode.offloads;
+	if (txq->flags & IONIC_QCQ_F_FAST_FREE)
+		qinfo->conf.offloads |= RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
 	qinfo->conf.tx_deferred_start = txq->flags & IONIC_QCQ_F_DEFERRED;
 }
 
@@ -136,7 +138,10 @@ ionic_tx_flush(struct ionic_tx_qcq *txq)
 				if (!txm)
 					break;
 
-				rte_pktmbuf_free_seg(txm);
+				if (txq->flags & IONIC_QCQ_F_FAST_FREE)
+					rte_mempool_put(txm->pool, txm);
+				else
+					rte_pktmbuf_free_seg(txm);
 
 				info[i] = NULL;
 			}
@@ -240,6 +245,8 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id,
 		txq->flags |= IONIC_QCQ_F_CSUM_TCP;
 	if (offloads & RTE_ETH_TX_OFFLOAD_UDP_CKSUM)
 		txq->flags |= IONIC_QCQ_F_CSUM_UDP;
+	if (offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
+		txq->flags |= IONIC_QCQ_F_FAST_FREE;
 
 	eth_dev->data->tx_queues[tx_queue_id] = txq;
 
Signature · 1 line
2.17.1
#64 lore raw

PATCH v2 23/36 net/ionic: do bulk allocations of receive mbufs

In reply to Andrew Boyer

Do bulk allocations to improve performance.

---
 drivers/net/ionic/ionic_lif.h  |  6 ++++++
 drivers/net/ionic/ionic_rxtx.c | 35 ++++++++++++++++++++++++++--------
 2 files changed, 33 insertions(+), 8 deletions(-)
drivers/net/ionic/ionic_lif.h +6 -0
index 547d4873be..f1cc0f60fc 100644
@@ -17,6 +17,8 @@
 #define IONIC_ADMINQ_LENGTH	16	/* must be a power of two */
 #define IONIC_NOTIFYQ_LENGTH	64	/* must be a power of two */
 
+#define IONIC_MBUF_BULK_ALLOC	64	/* Multiple of 4 */
+
 #define IONIC_RSS_OFFLOAD_ALL ( \
 	IONIC_RSS_TYPE_IPV4 | \
 	IONIC_RSS_TYPE_IPV4_TCP | \
@@ -86,9 +88,13 @@ struct ionic_rx_qcq {
 	uint16_t hdr_seg_size;	/* Length of first segment of RX chain */
 	uint16_t seg_size;	/* Length of all subsequent segments */
 	uint16_t flags;
+	uint16_t mb_idx;
 
 	/* cacheline3 (inside stats) */
 	struct ionic_rx_stats stats;
+
+	/* cacheline4+ */
+	struct rte_mbuf *mbs[IONIC_MBUF_BULK_ALLOC] __rte_cache_aligned;
 };
 
 struct ionic_tx_qcq {
drivers/net/ionic/ionic_rxtx.c +27 -8
index 64766f2652..cb5ae7671d 100644
@@ -77,6 +77,10 @@ ionic_rx_empty(struct ionic_rx_qcq *rxq)
 	 * fragments that were left dangling for later reuse
 	 */
 	ionic_empty_array(q->info, q->num_descs * q->num_segs, 0);
+
+	ionic_empty_array((void **)rxq->mbs,
+			IONIC_MBUF_BULK_ALLOC, rxq->mb_idx);
+	rxq->mb_idx = 0;
 }
 
 /*********************************************************************
@@ -950,6 +954,7 @@ ionic_rx_fill_one(struct ionic_rx_qcq *rxq)
 	rte_iova_t data_iova;
 	uint32_t i;
 	void **info;
+	int ret;
 
 	info = IONIC_INFO_PTR(q, q->head_idx);
 	desc = &desc_base[q->head_idx];
@@ -959,12 +964,19 @@ ionic_rx_fill_one(struct ionic_rx_qcq *rxq)
 	if (unlikely(info[0]))
 		return 0;
 
-	rxm = rte_mbuf_raw_alloc(rxq->mb_pool);
-	if (unlikely(rxm == NULL)) {
-		assert(0);
-		return -ENOMEM;
+	if (rxq->mb_idx == 0) {
+		ret = rte_mempool_get_bulk(rxq->mb_pool,
+					(void **)rxq->mbs,
+					IONIC_MBUF_BULK_ALLOC);
+		if (ret) {
+			assert(0);
+			return -ENOMEM;
+		}
+
+		rxq->mb_idx = IONIC_MBUF_BULK_ALLOC;
 	}
 
+	rxm = rxq->mbs[--rxq->mb_idx];
 	info[0] = rxm;
 
 	data_iova = rte_mbuf_data_iova_default(rxm);
@@ -975,12 +987,19 @@ ionic_rx_fill_one(struct ionic_rx_qcq *rxq)
 		if (info[i])
 			return 0;
 
-		rxm_seg = rte_mbuf_raw_alloc(rxq->mb_pool);
-		if (rxm_seg == NULL) {
-			assert(0);
-			return -ENOMEM;
+		if (rxq->mb_idx == 0) {
+			ret = rte_mempool_get_bulk(rxq->mb_pool,
+					(void **)rxq->mbs,
+					IONIC_MBUF_BULK_ALLOC);
+			if (ret) {
+				assert(0);
+				return -ENOMEM;
+			}
+
+			rxq->mb_idx = IONIC_MBUF_BULK_ALLOC;
 		}
 
+		rxm_seg = rxq->mbs[--rxq->mb_idx];
 		info[i] = rxm_seg;
 
 		/* The data_off does not get set to 0 until later */
Signature · 1 line
2.17.1
#65 lore raw

PATCH v2 24/36 net/ionic: add a lookup table for packet type

In reply to Andrew Boyer

This improves performance by reducing branching.

---
 drivers/net/ionic/ionic_rxtx.c | 63 ++++++++++++++++------------------
 1 file changed, 29 insertions(+), 34 deletions(-)
drivers/net/ionic/ionic_rxtx.c +29 -34
index cb5ae7671d..8a544c03d3 100644
@@ -804,6 +804,22 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	return 0;
 }
 
+/* RTE_PTYPE_UNKNOWN is 0x0 */
+static const uint32_t ionic_ptype_table[IONIC_RXQ_COMP_PKT_TYPE_MASK]
+		__rte_cache_aligned = {
+	[IONIC_PKT_TYPE_NON_IP]   = RTE_PTYPE_UNKNOWN,
+	[IONIC_PKT_TYPE_IPV4]     = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4,
+	[IONIC_PKT_TYPE_IPV4_TCP] =
+		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_TCP,
+	[IONIC_PKT_TYPE_IPV4_UDP] =
+		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_UDP,
+	[IONIC_PKT_TYPE_IPV6]     = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6,
+	[IONIC_PKT_TYPE_IPV6_TCP] =
+		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_TCP,
+	[IONIC_PKT_TYPE_IPV6_UDP] =
+		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_UDP,
+};
+
 /*
  * Cleans one descriptor. Connects the filled mbufs into a chain.
  * Does not advance the tail index.
@@ -820,6 +836,7 @@ ionic_rx_clean_one(struct ionic_rx_qcq *rxq,
 	uint32_t pkt_type;
 	uint32_t left, i;
 	uint16_t cq_desc_len;
+	uint8_t ptype;
 	void **info;
 
 	cq_desc_len = rte_le_to_cpu_16(cq_desc->len);
@@ -895,41 +912,19 @@ ionic_rx_clean_one(struct ionic_rx_qcq *rxq,
 	rxm->ol_flags = pkt_flags;
 
 	/* Packet Type */
-	switch (cq_desc->pkt_type_color & IONIC_RXQ_COMP_PKT_TYPE_MASK) {
-	case IONIC_PKT_TYPE_IPV4:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4;
-		break;
-	case IONIC_PKT_TYPE_IPV6:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6;
-		break;
-	case IONIC_PKT_TYPE_IPV4_TCP:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 |
-			RTE_PTYPE_L4_TCP;
-		break;
-	case IONIC_PKT_TYPE_IPV6_TCP:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 |
-			RTE_PTYPE_L4_TCP;
-		break;
-	case IONIC_PKT_TYPE_IPV4_UDP:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 |
-			RTE_PTYPE_L4_UDP;
-		break;
-	case IONIC_PKT_TYPE_IPV6_UDP:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 |
-			RTE_PTYPE_L4_UDP;
-		break;
-	default:
-		{
-			struct rte_ether_hdr *eth_h = rte_pktmbuf_mtod(rxm,
+	ptype = cq_desc->pkt_type_color & IONIC_RXQ_COMP_PKT_TYPE_MASK;
+	pkt_type = ionic_ptype_table[ptype];
+	if (pkt_type == RTE_PTYPE_UNKNOWN) {
+		struct rte_ether_hdr *eth_h = rte_pktmbuf_mtod(rxm,
 				struct rte_ether_hdr *);
-			uint16_t ether_type = eth_h->ether_type;
-			if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP))
-				pkt_type = RTE_PTYPE_L2_ETHER_ARP;
-			else
-				pkt_type = RTE_PTYPE_UNKNOWN;
-			stats->mtods++;
-			break;
-		}
+		uint16_t ether_type = eth_h->ether_type;
+		if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP))
+			pkt_type = RTE_PTYPE_L2_ETHER_ARP;
+		else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_LLDP))
+			pkt_type = RTE_PTYPE_L2_ETHER_LLDP;
+		else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_1588))
+			pkt_type = RTE_PTYPE_L2_ETHER_TIMESYNC;
+		stats->mtods++;
 	}
 
 	rxm->packet_type = pkt_type;
Signature · 1 line
2.17.1
#66 lore raw

PATCH v2 25/36 net/ionic: add a lookup table for checksum flags

In reply to Andrew Boyer

This improves performance by reducing branching.

---
 drivers/net/ionic/ionic_rxtx.c | 47 ++++++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 14 deletions(-)
drivers/net/ionic/ionic_rxtx.c +33 -14
index 8a544c03d3..697e6dcc15 100644
@@ -804,6 +804,36 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	return 0;
 }
 
+#define IONIC_CSUM_FLAG_MASK (IONIC_RXQ_COMP_CSUM_F_VLAN - 1)
+static const uint64_t ionic_csum_flags[IONIC_CSUM_FLAG_MASK]
+		__rte_cache_aligned = {
+	/* IP_BAD set */
+	[IONIC_RXQ_COMP_CSUM_F_IP_BAD] = RTE_MBUF_F_RX_IP_CKSUM_BAD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_BAD | IONIC_RXQ_COMP_CSUM_F_TCP_OK] =
+			RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_BAD | IONIC_RXQ_COMP_CSUM_F_TCP_BAD] =
+			RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_BAD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_BAD | IONIC_RXQ_COMP_CSUM_F_UDP_OK] =
+			RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_BAD | IONIC_RXQ_COMP_CSUM_F_UDP_BAD] =
+			RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_BAD,
+	/* IP_OK set */
+	[IONIC_RXQ_COMP_CSUM_F_IP_OK] = RTE_MBUF_F_RX_IP_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_OK | IONIC_RXQ_COMP_CSUM_F_TCP_OK] =
+			RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_OK | IONIC_RXQ_COMP_CSUM_F_TCP_BAD] =
+			RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_BAD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_OK | IONIC_RXQ_COMP_CSUM_F_UDP_OK] =
+			RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_OK | IONIC_RXQ_COMP_CSUM_F_UDP_BAD] =
+			RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_BAD,
+	/* No IP flag set */
+	[IONIC_RXQ_COMP_CSUM_F_TCP_OK] = RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_TCP_BAD] = RTE_MBUF_F_RX_L4_CKSUM_BAD,
+	[IONIC_RXQ_COMP_CSUM_F_UDP_OK] = RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_UDP_BAD] = RTE_MBUF_F_RX_L4_CKSUM_BAD,
+};
+
 /* RTE_PTYPE_UNKNOWN is 0x0 */
 static const uint32_t ionic_ptype_table[IONIC_RXQ_COMP_PKT_TYPE_MASK]
 		__rte_cache_aligned = {
@@ -836,7 +866,7 @@ ionic_rx_clean_one(struct ionic_rx_qcq *rxq,
 	uint32_t pkt_type;
 	uint32_t left, i;
 	uint16_t cq_desc_len;
-	uint8_t ptype;
+	uint8_t ptype, cflags;
 	void **info;
 
 	cq_desc_len = rte_le_to_cpu_16(cq_desc->len);
@@ -894,19 +924,8 @@ ionic_rx_clean_one(struct ionic_rx_qcq *rxq,
 
 	/* Checksum */
 	if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_CALC) {
-		if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_IP_OK)
-			pkt_flags |= RTE_MBUF_F_RX_IP_CKSUM_GOOD;
-		else if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_IP_BAD)
-			pkt_flags |= RTE_MBUF_F_RX_IP_CKSUM_BAD;
-
-		if ((cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_TCP_OK) ||
-			(cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_UDP_OK))
-			pkt_flags |= RTE_MBUF_F_RX_L4_CKSUM_GOOD;
-		else if ((cq_desc->csum_flags &
-				IONIC_RXQ_COMP_CSUM_F_TCP_BAD) ||
-				(cq_desc->csum_flags &
-				IONIC_RXQ_COMP_CSUM_F_UDP_BAD))
-			pkt_flags |= RTE_MBUF_F_RX_L4_CKSUM_BAD;
+		cflags = cq_desc->csum_flags & IONIC_CSUM_FLAG_MASK;
+		pkt_flags |= ionic_csum_flags[cflags];
 	}
 
 	rxm->ol_flags = pkt_flags;
Signature · 1 line
2.17.1
#67 lore raw

PATCH v2 26/36 net/ionic: advertise supported packet types

In reply to Andrew Boyer

This improves performance, since clients may be able to skip SW packet classification.

---
 doc/guides/rel_notes/release_22_11.rst |  1 +
 drivers/net/ionic/ionic_ethdev.c       |  1 +
 drivers/net/ionic/ionic_rxtx.c         | 19 +++++++++++++++++++
 drivers/net/ionic/ionic_rxtx.h         |  2 ++
 4 files changed, 23 insertions(+)
doc/guides/rel_notes/release_22_11.rst +1 -0
index 4ad525375f..0db516157c 100644
@@ -147,6 +147,7 @@ New Features
   * Updated to reflect that Pensando has been acquired by AMD.
   * Enhanced data path to provide substantial performance improvements.
   * Added support for mbuf fast free.
+  * Added support for advertising packet types.
 
 * **Updated Intel iavf driver.**
 
drivers/net/ionic/ionic_ethdev.c +1 -0
index 7d21bc0a9b..2560a30fe4 100644
@@ -70,6 +70,7 @@ static const struct rte_eth_desc_lim tx_desc_lim_v1 = {
 
 static const struct eth_dev_ops ionic_eth_dev_ops = {
 	.dev_infos_get          = ionic_dev_info_get,
+	.dev_supported_ptypes_get = ionic_dev_supported_ptypes_get,
 	.dev_configure          = ionic_dev_configure,
 	.mtu_set                = ionic_dev_mtu_set,
 	.dev_start              = ionic_dev_start,
drivers/net/ionic/ionic_rxtx.c +19 -0
index 697e6dcc15..f92cf3fb46 100644
@@ -850,6 +850,25 @@ static const uint32_t ionic_ptype_table[IONIC_RXQ_COMP_PKT_TYPE_MASK]
 		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_UDP,
 };
 
+const uint32_t *
+ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
+{
+	/* See ionic_ptype_table[] */
+	static const uint32_t ptypes[] = {
+		RTE_PTYPE_L2_ETHER,
+		RTE_PTYPE_L2_ETHER_TIMESYNC,
+		RTE_PTYPE_L2_ETHER_LLDP,
+		RTE_PTYPE_L2_ETHER_ARP,
+		RTE_PTYPE_L3_IPV4,
+		RTE_PTYPE_L3_IPV6,
+		RTE_PTYPE_L4_TCP,
+		RTE_PTYPE_L4_UDP,
+		RTE_PTYPE_UNKNOWN
+	};
+
+	return ptypes;
+}
+
 /*
  * Cleans one descriptor. Connects the filled mbufs into a chain.
  * Does not advance the tail index.
drivers/net/ionic/ionic_rxtx.h +2 -0
index 6f9f3f92c6..e4c56d734d 100644
@@ -40,4 +40,6 @@ void ionic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 void ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	struct rte_eth_txq_info *qinfo);
 
+const uint32_t *ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev);
+
 #endif /* _IONIC_RXTX_H_ */
Signature · 1 line
2.17.1
#68 lore raw

PATCH v2 27/36 net/ionic: add Rx descriptor status functions

In reply to Andrew Boyer

These may be useful for clients.

---
 doc/guides/nics/features/ionic.ini     |  1 +
 doc/guides/rel_notes/release_22_11.rst |  1 +
 drivers/net/ionic/ionic_ethdev.c       |  2 ++
 drivers/net/ionic/ionic_rxtx.c         | 39 ++++++++++++++++++++++++++
 drivers/net/ionic/ionic_rxtx.h         |  2 ++
 5 files changed, 45 insertions(+)
doc/guides/nics/features/ionic.ini +1 -0
index 77947bfd22..e01ba87135 100644
@@ -27,6 +27,7 @@ CRC offload          = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 Packet type parsing  = Y
+Rx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/rel_notes/release_22_11.rst +1 -0
index 0db516157c..fcbb3228a4 100644
@@ -148,6 +148,7 @@ New Features
   * Enhanced data path to provide substantial performance improvements.
   * Added support for mbuf fast free.
   * Added support for advertising packet types.
+  * Added support for descriptor status functions.
 
 * **Updated Intel iavf driver.**
 
drivers/net/ionic/ionic_ethdev.c +2 -0
index 2560a30fe4..f9b05e4a90 100644
@@ -984,6 +984,8 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 	eth_dev->tx_pkt_burst = &ionic_xmit_pkts;
 	eth_dev->tx_pkt_prepare = &ionic_prep_pkts;
 
+	eth_dev->rx_descriptor_status = ionic_dev_rx_descriptor_status;
+
 	/* Multi-process not supported, primary does initialization anyway */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
drivers/net/ionic/ionic_rxtx.c +39 -0
index f92cf3fb46..2c46a64dd2 100644
@@ -1235,3 +1235,42 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 	return rx_svc.nb_rx;
 }
+
+int
+ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset)
+{
+	struct ionic_rx_qcq *rxq = rx_queue;
+	struct ionic_qcq *qcq = &rxq->qcq;
+	struct ionic_rxq_comp *cq_desc;
+	uint16_t mask, head, tail, pos;
+	bool done_color;
+
+	mask = qcq->q.size_mask;
+
+	/* offset must be within the size of the ring */
+	if (offset > mask)
+		return -EINVAL;
+
+	head = qcq->q.head_idx;
+	tail = qcq->q.tail_idx;
+
+	/* offset is beyond what is posted */
+	if (offset >= ((head - tail) & mask))
+		return RTE_ETH_RX_DESC_UNAVAIL;
+
+	/* interested in this absolute position in the rxq */
+	pos = (tail + offset) & mask;
+
+	/* rx cq position == rx q position */
+	cq_desc = qcq->cq.base;
+	cq_desc = &cq_desc[pos];
+
+	/* expected done color at this position */
+	done_color = qcq->cq.done_color != (pos < tail);
+
+	/* has the hw indicated the done color at this position? */
+	if (color_match(cq_desc->pkt_type_color, done_color))
+		return RTE_ETH_RX_DESC_DONE;
+
+	return RTE_ETH_RX_DESC_AVAIL;
+}
drivers/net/ionic/ionic_rxtx.h +2 -0
index e4c56d734d..09d8c9b152 100644
@@ -40,6 +40,8 @@ void ionic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 void ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	struct rte_eth_txq_info *qinfo);
 
+int ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+
 const uint32_t *ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 
 #endif /* _IONIC_RXTX_H_ */
Signature · 1 line
2.17.1
#69 lore raw

PATCH v2 28/36 net/ionic: add Tx descriptor status function

In reply to Andrew Boyer

This may be useful for clients.

---
 doc/guides/nics/features/ionic.ini |  1 +
 drivers/net/ionic/ionic_ethdev.c   |  1 +
 drivers/net/ionic/ionic_rxtx.c     | 51 ++++++++++++++++++++++++++++++
 drivers/net/ionic/ionic_rxtx.h     |  1 +
 4 files changed, 54 insertions(+)
doc/guides/nics/features/ionic.ini +1 -0
index e01ba87135..af0fc5462a 100644
@@ -28,6 +28,7 @@ L3 checksum offload  = Y
 L4 checksum offload  = Y
 Packet type parsing  = Y
 Rx descriptor status = Y
+Tx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
drivers/net/ionic/ionic_ethdev.c +1 -0
index f9b05e4a90..393d36d946 100644
@@ -985,6 +985,7 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 	eth_dev->tx_pkt_prepare = &ionic_prep_pkts;
 
 	eth_dev->rx_descriptor_status = ionic_dev_rx_descriptor_status;
+	eth_dev->tx_descriptor_status = ionic_dev_tx_descriptor_status;
 
 	/* Multi-process not supported, primary does initialization anyway */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
drivers/net/ionic/ionic_rxtx.c +51 -0

54 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx.h +1 -0
index 09d8c9b152..5b9d9eac80 100644
@@ -41,6 +41,7 @@ void ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	struct rte_eth_txq_info *qinfo);
 
 int ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+int ionic_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
 
 const uint32_t *ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 
Signature · 1 line
2.17.1
#70 lore raw

PATCH v2 29/36 net/ionic: add Q-in-CMB option controlled by devarg

In reply to Andrew Boyer

When 'ionic_cmb' is set to '1', queue memory will be allocated from the device's onboard memory (Controller Memory Buffer). In some configurations, this will dramatically reduce packet latency and increase PPS.

Add the WC_ACTIVATE flag to the PCI driver flags. Write combining must be enabled to achieve the maximum PPS.

When the queue is in the CMB, descriptors cannot be prefetched.

---
 doc/guides/nics/ionic.rst              | 12 ++++++
 doc/guides/rel_notes/release_22_11.rst |  1 +
 drivers/net/ionic/ionic.h              |  5 +++
 drivers/net/ionic/ionic_dev.h          |  3 ++
 drivers/net/ionic/ionic_dev_pci.c      | 60 +++++++++++++++++++++++++-
 drivers/net/ionic/ionic_ethdev.c       |  9 ++++
 drivers/net/ionic/ionic_lif.c          | 38 ++++++++++++++++
 drivers/net/ionic/ionic_lif.h          |  2 +
 drivers/net/ionic/ionic_rxtx.c         |  9 ++--
 9 files changed, 135 insertions(+), 4 deletions(-)
doc/guides/nics/ionic.rst +12 -0
index 216f820736..e0eb1b5c9a 100644
@@ -32,6 +32,18 @@ The ionic PMD requires firmware which supports 16 segment transmit SGLs.
 This support was added prior to version 1.0. For help upgrading older versions,
 please contact AMD Pensando support.
 
+Runtime Configuration
+---------------------
+
+- ``Queue in CMB support`` (default ``0``)
+
+  Queue memory can be allocated from the Controller Memory Buffer (CMB) using
+  the ``ionic_cmb`` ``devargs`` parameter.
+
+  For example::
+
+    -a 0000:b5:00.0,ionic_cmb=1
+
 Building DPDK
 -------------
 
doc/guides/rel_notes/release_22_11.rst +1 -0
index fcbb3228a4..c98c64d24d 100644
@@ -149,6 +149,7 @@ New Features
   * Added support for mbuf fast free.
   * Added support for advertising packet types.
   * Added support for descriptor status functions.
+  * Added Q-in-CMB feature controlled by devarg ionic_cmb.
 
 * **Updated Intel iavf driver.**
 
drivers/net/ionic/ionic.h +5 -0
index 8b0e85ea26..c479eaba74 100644
@@ -24,6 +24,9 @@
 #define IONIC_DEV_ID_ETH_VF		0x1003
 #define IONIC_DEV_ID_ETH_MGMT		0x1004
 
+/* Devargs */
+#define PMD_IONIC_CMB_KVARG		"ionic_cmb"
+
 enum ionic_mac_type {
 	IONIC_MAC_UNKNOWN = 0,
 	IONIC_MAC_CAPRI,
@@ -62,9 +65,11 @@ struct ionic_adapter {
 	uint32_t link_speed;
 	uint32_t nintrs;
 	bool intrs[IONIC_INTR_CTRL_REGS_MAX];
+	bool q_in_cmb;
 	bool link_up;
 	char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN];
 	void *bus_dev;
+	uint64_t cmb_offset;
 };
 
 /** ionic_admin_ctx - Admin command context.
drivers/net/ionic/ionic_dev.h +3 -0
index 312f195e58..7ac86396be 100644
@@ -176,9 +176,12 @@ struct ionic_adapter;
 struct ionic_qcq;
 struct rte_mempool;
 struct rte_eth_dev;
+struct rte_devargs;
 
 struct ionic_dev_intf {
 	int  (*setup)(struct ionic_adapter *adapter);
+	int  (*devargs)(struct ionic_adapter *adapter,
+			struct rte_devargs *devargs);
 	void (*copy_bus_info)(struct ionic_adapter *adapter,
 			struct rte_eth_dev *eth_dev);
 	int  (*configure_intr)(struct ionic_adapter *adapter);
drivers/net/ionic/ionic_dev_pci.c +59 -1

87 lines not on this page · raw message

drivers/net/ionic/ionic_ethdev.c +9 -0
index 393d36d946..0184ffb02e 100644
@@ -1118,6 +1118,15 @@ eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev,
 
 	adapter->intf = intf;
 
+	/* Parse device arguments */
+	if (adapter->intf->devargs) {
+		err = (*adapter->intf->devargs)(adapter, rte_dev->devargs);
+		if (err) {
+			IONIC_PRINT(ERR, "Cannot parse device arguments");
+			goto err_free_adapter;
+		}
+	}
+
 	/* Discover ionic dev resources */
 	err = ionic_setup(adapter);
 	if (err) {
drivers/net/ionic/ionic_lif.c +38 -0
index 4305587fe0..db0893acb8 100644
@@ -660,6 +660,21 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 		ionic_q_sg_map(&new->q, sg_base, sg_base_pa);
 	}
 
+	if (flags & IONIC_QCQ_F_CMB) {
+		/* alloc descriptor ring from nic memory */
+		if (lif->adapter->cmb_offset + q_size >
+				lif->adapter->bars.bar[2].len) {
+			IONIC_PRINT(ERR, "Cannot reserve queue from NIC mem");
+			return -ENOMEM;
+		}
+		q_base = (void *)
+			((uintptr_t)lif->adapter->bars.bar[2].vaddr +
+			 (uintptr_t)lif->adapter->cmb_offset);
+		/* CMB PA is a relative address */
+		q_base_pa = lif->adapter->cmb_offset;
+		lif->adapter->cmb_offset += q_size;
+	}
+
 	IONIC_PRINT(DEBUG, "Q-Base-PA = %#jx CQ-Base-PA = %#jx "
 		"SG-base-PA = %#jx",
 		q_base_pa, cq_base_pa, sg_base_pa);
@@ -744,6 +759,8 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 	int err;
 
 	flags = IONIC_QCQ_F_SG;
+	if (lif->state & IONIC_LIF_F_Q_IN_CMB)
+		flags |= IONIC_QCQ_F_CMB;
 
 	seg_size = rte_pktmbuf_data_room_size(mb_pool);
 
@@ -806,6 +823,8 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 	int err;
 
 	flags = IONIC_QCQ_F_SG;
+	if (lif->state & IONIC_LIF_F_Q_IN_CMB)
+		flags |= IONIC_QCQ_F_CMB;
 
 	num_segs_fw = IONIC_TX_MAX_SG_ELEMS_V1 + 1;
 
@@ -994,6 +1013,19 @@ ionic_lif_alloc(struct ionic_lif *lif)
 		return -ENXIO;
 	}
 
+	if (adapter->q_in_cmb) {
+		if (adapter->bars.num_bars >= 3 &&
+		    lif->qtype_info[IONIC_QTYPE_RXQ].version >= 2 &&
+		    lif->qtype_info[IONIC_QTYPE_TXQ].version >= 3) {
+			IONIC_PRINT(INFO, "%s enabled on %s",
+				PMD_IONIC_CMB_KVARG, lif->name);
+			lif->state |= IONIC_LIF_F_Q_IN_CMB;
+		} else {
+			IONIC_PRINT(ERR, "%s not supported on %s, disabled",
+				PMD_IONIC_CMB_KVARG, lif->name);
+		}
+	}
+
 	IONIC_PRINT(DEBUG, "Allocating Lif Info");
 
 	rte_spinlock_init(&lif->adminq_lock);
@@ -1537,6 +1569,9 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq)
 	};
 	int err;
 
+	if (txq->flags & IONIC_QCQ_F_CMB)
+		ctx.cmd.q_init.flags |= rte_cpu_to_le_16(IONIC_QINIT_F_CMB);
+
 	IONIC_PRINT(DEBUG, "txq_init.index %d", q->index);
 	IONIC_PRINT(DEBUG, "txq_init.ring_base 0x%" PRIx64 "", q->base_pa);
 	IONIC_PRINT(DEBUG, "txq_init.ring_size %d",
@@ -1588,6 +1623,9 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq)
 	};
 	int err;
 
+	if (rxq->flags & IONIC_QCQ_F_CMB)
+		ctx.cmd.q_init.flags |= rte_cpu_to_le_16(IONIC_QINIT_F_CMB);
+
 	IONIC_PRINT(DEBUG, "rxq_init.index %d", q->index);
 	IONIC_PRINT(DEBUG, "rxq_init.ring_base 0x%" PRIx64 "", q->base_pa);
 	IONIC_PRINT(DEBUG, "rxq_init.ring_size %d",
drivers/net/ionic/ionic_lif.h +2 -0
index f1cc0f60fc..b9d2e879fb 100644
@@ -49,6 +49,7 @@ 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_CMB		BIT(5)
 #define IONIC_QCQ_F_CSUM_L3	BIT(7)
 #define IONIC_QCQ_F_CSUM_UDP	BIT(8)
 #define IONIC_QCQ_F_CSUM_TCP	BIT(9)
@@ -126,6 +127,7 @@ struct ionic_qtype_info {
 #define IONIC_LIF_F_LINK_CHECK_NEEDED	BIT(1)
 #define IONIC_LIF_F_UP			BIT(2)
 #define IONIC_LIF_F_FW_RESET		BIT(3)
+#define IONIC_LIF_F_Q_IN_CMB		BIT(4)
 
 #define IONIC_LIF_NAME_MAX_SZ		(32)
 
drivers/net/ionic/ionic_rxtx.c +6 -3
index 24f498d910..1885c5961e 100644
@@ -600,7 +600,8 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	int err;
 
 	struct ionic_txq_desc *desc_base = q->base;
-	rte_prefetch0(&desc_base[q->head_idx]);
+	if (!(txq->flags & IONIC_QCQ_F_CMB))
+		rte_prefetch0(&desc_base[q->head_idx]);
 	rte_prefetch0(IONIC_INFO_PTR(q, q->head_idx));
 
 	if (tx_pkts) {
@@ -619,7 +620,8 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	while (nb_tx < nb_pkts) {
 		uint16_t next_idx = Q_NEXT_TO_POST(q, 1);
-		rte_prefetch0(&desc_base[next_idx]);
+		if (!(txq->flags & IONIC_QCQ_F_CMB))
+			rte_prefetch0(&desc_base[next_idx]);
 		rte_prefetch0(IONIC_INFO_PTR(q, next_idx));
 
 		if (nb_tx + 1 < nb_pkts) {
@@ -1172,7 +1174,8 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,
 		/* Prefetch 4 x 16B comp */
 		rte_prefetch0(&cq_desc_base[Q_NEXT_TO_SRVC(cq, 4)]);
 		/* Prefetch 4 x 16B descriptors */
-		rte_prefetch0(&q_desc_base[Q_NEXT_TO_POST(q, 4)]);
+		if (!(rxq->flags & IONIC_QCQ_F_CMB))
+			rte_prefetch0(&q_desc_base[Q_NEXT_TO_POST(q, 4)]);
 
 		ionic_rx_clean_one(rxq, cq_desc, rx_svc);
 
Signature · 1 line
2.17.1
#71 lore raw

PATCH v2 30/36 net/ionic: update array allocations to use calloc

In reply to Andrew Boyer

Use rte_calloc() where appropriate.
This makes the code clearer.

---
 drivers/net/ionic/ionic_ethdev.c |  6 +++---
 drivers/net/ionic/ionic_lif.c    | 12 ++++++------
 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/ionic/ionic_ethdev.c +3 -3
index 0184ffb02e..b1d8663329 100644
@@ -1003,9 +1003,9 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 		adapter->max_mac_addrs);
 
 	/* Allocate memory for storing MAC addresses */
-	eth_dev->data->mac_addrs = rte_zmalloc("ionic",
-		RTE_ETHER_ADDR_LEN * adapter->max_mac_addrs, 0);
-
+	eth_dev->data->mac_addrs = rte_calloc("ionic",
+					adapter->max_mac_addrs,
+					RTE_ETHER_ADDR_LEN, 0);
 	if (eth_dev->data->mac_addrs == NULL) {
 		IONIC_PRINT(ERR, "Failed to allocate %u bytes needed to "
 			"store MAC addresses",
drivers/net/ionic/ionic_lif.c +6 -6
index db0893acb8..8b10b26266 100644
@@ -1037,17 +1037,17 @@ ionic_lif_alloc(struct ionic_lif *lif)
 		return -ENOMEM;
 	}
 
-	lif->txqcqs = rte_zmalloc("ionic", sizeof(*lif->txqcqs) *
-		adapter->max_ntxqs_per_lif, 0);
-
+	lif->txqcqs = rte_calloc("ionic",
+				adapter->max_ntxqs_per_lif,
+				sizeof(*lif->txqcqs), 0);
 	if (!lif->txqcqs) {
 		IONIC_PRINT(ERR, "Cannot allocate tx queues array");
 		return -ENOMEM;
 	}
 
-	lif->rxqcqs = rte_zmalloc("ionic", sizeof(*lif->rxqcqs) *
-		adapter->max_nrxqs_per_lif, 0);
-
+	lif->rxqcqs = rte_calloc("ionic",
+				adapter->max_nrxqs_per_lif,
+				sizeof(*lif->rxqcqs), 0);
 	if (!lif->rxqcqs) {
 		IONIC_PRINT(ERR, "Cannot allocate rx queues array");
 		return -ENOMEM;
Signature · 1 line
2.17.1
#72 lore raw

PATCH v2 31/36 net/ionic: add alignment and socket info in allocations

In reply to Andrew Boyer

This will avoid memory access penalties on NUMA systems.

---
 drivers/net/ionic/ionic_ethdev.c    |  5 +++--
 drivers/net/ionic/ionic_lif.c       | 13 ++++++++-----
 drivers/net/ionic/ionic_rx_filter.c |  3 +--
 3 files changed, 12 insertions(+), 9 deletions(-)
drivers/net/ionic/ionic_ethdev.c +3 -2
index b1d8663329..2f720315c3 100644
@@ -1005,7 +1005,8 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 	/* Allocate memory for storing MAC addresses */
 	eth_dev->data->mac_addrs = rte_calloc("ionic",
 					adapter->max_mac_addrs,
-					RTE_ETHER_ADDR_LEN, 0);
+					RTE_ETHER_ADDR_LEN,
+					RTE_CACHE_LINE_SIZE);
 	if (eth_dev->data->mac_addrs == NULL) {
 		IONIC_PRINT(ERR, "Failed to allocate %u bytes needed to "
 			"store MAC addresses",
@@ -1083,7 +1084,7 @@ eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev,
 		goto err;
 	}
 
-	adapter = rte_zmalloc("ionic", sizeof(*adapter), 0);
+	adapter = rte_zmalloc("ionic", sizeof(*adapter), RTE_CACHE_LINE_SIZE);
 	if (!adapter) {
 		IONIC_PRINT(ERR, "OOM");
 		err = -ENOMEM;
drivers/net/ionic/ionic_lif.c +8 -5
index 8b10b26266..eeec4860ba 100644
@@ -598,7 +598,8 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 		total_size += rte_mem_page_size();
 	}
 
-	new = rte_zmalloc("ionic", struct_size, 0);
+	new = rte_zmalloc_socket("ionic", struct_size,
+				RTE_CACHE_LINE_SIZE, socket_id);
 	if (!new) {
 		IONIC_PRINT(ERR, "Cannot allocate queue structure");
 		return -ENOMEM;
@@ -1037,17 +1038,19 @@ ionic_lif_alloc(struct ionic_lif *lif)
 		return -ENOMEM;
 	}
 
-	lif->txqcqs = rte_calloc("ionic",
+	lif->txqcqs = rte_calloc_socket("ionic",
 				adapter->max_ntxqs_per_lif,
-				sizeof(*lif->txqcqs), 0);
+				sizeof(*lif->txqcqs),
+				RTE_CACHE_LINE_SIZE, socket_id);
 	if (!lif->txqcqs) {
 		IONIC_PRINT(ERR, "Cannot allocate tx queues array");
 		return -ENOMEM;
 	}
 
-	lif->rxqcqs = rte_calloc("ionic",
+	lif->rxqcqs = rte_calloc_socket("ionic",
 				adapter->max_nrxqs_per_lif,
-				sizeof(*lif->rxqcqs), 0);
+				sizeof(*lif->rxqcqs),
+				RTE_CACHE_LINE_SIZE, socket_id);
 	if (!lif->rxqcqs) {
 		IONIC_PRINT(ERR, "Cannot allocate rx queues array");
 		return -ENOMEM;
drivers/net/ionic/ionic_rx_filter.c +1 -2
index bbfc217826..cfcfd2a1ea 100644
@@ -55,8 +55,7 @@ ionic_rx_filter_save(struct ionic_lif *lif, uint32_t flow_id,
 	struct ionic_rx_filter *f;
 	uint32_t key;
 
-	f = rte_zmalloc("ionic", sizeof(*f), 0);
-
+	f = rte_zmalloc("ionic", sizeof(*f), RTE_CACHE_LINE_SIZE);
 	if (!f)
 		return -ENOMEM;
 
Signature · 1 line
2.17.1
#73 lore raw

PATCH v2 32/36 net/ionic: allow client to specify Tx free threshold

In reply to Andrew Boyer

Some clients have opinions about how often to flush the transmit ring.

The default value is the number of Tx descriptors minus the default Tx burst size.

---
 drivers/net/ionic/ionic_dev.h    |  1 +
 drivers/net/ionic/ionic_ethdev.c |  4 ++--
 drivers/net/ionic/ionic_lif.h    |  1 +
 drivers/net/ionic/ionic_rxtx.c   | 17 +++++++++++++++--
 4 files changed, 19 insertions(+), 4 deletions(-)
drivers/net/ionic/ionic_dev.h +1 -0
index 7ac86396be..46434f81a4 100644
@@ -20,6 +20,7 @@
 #define IONIC_MAX_RING_DESC		32768
 #define IONIC_MIN_RING_DESC		16
 #define IONIC_DEF_TXRX_DESC		4096
+#define IONIC_DEF_TXRX_BURST		32
 
 #define IONIC_DEVCMD_TIMEOUT		5	/* devcmd_timeout */
 #define IONIC_DEVCMD_CHECK_PERIOD_US	10	/* devcmd status chk period */
drivers/net/ionic/ionic_ethdev.c +2 -2
index 2f720315c3..1092c7a921 100644
@@ -429,8 +429,8 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 	dev_info->tx_desc_lim = tx_desc_lim_v1;
 
 	/* Driver-preferred Rx/Tx parameters */
-	dev_info->default_rxportconf.burst_size = 32;
-	dev_info->default_txportconf.burst_size = 32;
+	dev_info->default_rxportconf.burst_size = IONIC_DEF_TXRX_BURST;
+	dev_info->default_txportconf.burst_size = IONIC_DEF_TXRX_BURST;
 	dev_info->default_rxportconf.nb_queues = 1;
 	dev_info->default_txportconf.nb_queues = 1;
 	dev_info->default_rxportconf.ring_size = IONIC_DEF_TXRX_DESC;
drivers/net/ionic/ionic_lif.h +1 -0
index b9d2e879fb..09ebca7e89 100644
@@ -104,6 +104,7 @@ struct ionic_tx_qcq {
 
 	/* cacheline2 */
 	uint16_t num_segs_fw;	/* # segs supported by current FW */
+	uint16_t free_thresh;
 	uint16_t flags;
 
 	struct ionic_tx_stats stats;
drivers/net/ionic/ionic_rxtx.c +15 -2
index 1885c5961e..f43f9c1149 100644
@@ -223,6 +223,13 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id,
 	if (!rte_is_power_of_2(nb_desc) || nb_desc < IONIC_MIN_RING_DESC)
 		return -EINVAL; /* or use IONIC_DEFAULT_RING_DESC */
 
+	if (tx_conf->tx_free_thresh > nb_desc) {
+		IONIC_PRINT(ERR,
+			"tx_free_thresh must be less than nb_desc (%u)",
+			nb_desc);
+		return -EINVAL;
+	}
+
 	/* Free memory prior to re-allocation if needed... */
 	if (eth_dev->data->tx_queues[tx_queue_id] != NULL) {
 		ionic_dev_tx_queue_release(eth_dev, tx_queue_id);
@@ -252,6 +259,10 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id,
 	if (offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
 		txq->flags |= IONIC_QCQ_F_FAST_FREE;
 
+	txq->free_thresh =
+		tx_conf->tx_free_thresh ? tx_conf->tx_free_thresh :
+		nb_desc - IONIC_DEF_TXRX_BURST;
+
 	eth_dev->data->tx_queues[tx_queue_id] = txq;
 
 	return 0;
@@ -609,8 +620,10 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		rte_mbuf_prefetch_part2(tx_pkts[0]);
 	}
 
-	/* Cleaning old buffers */
-	ionic_tx_flush(txq);
+	if (unlikely(ionic_q_space_avail(q) < txq->free_thresh)) {
+		/* Cleaning old buffers */
+		ionic_tx_flush(txq);
+	}
 
 	nb_avail = ionic_q_space_avail(q);
 	if (unlikely(nb_avail < nb_pkts)) {
Signature · 1 line
2.17.1
#74 lore raw

PATCH v2 33/36 net/ionic: add optimized handlers for non-scattered Rx/Tx

In reply to Andrew Boyer

The code is very similar, but the simple case can skip a few branches in the hot path. This improves PPS when 10KB mbufs are used.

S/G is enabled on the Rx side by offload DEV_RX_OFFLOAD_SCATTER. S/G is enabled on the Tx side by offload DEV_TX_OFFLOAD_MULTI_SEGS.

S/G is automatically enabled on the Rx side if the provided mbufs are too small to hold the maximum possible frame.

To enable S/G in testpmd, add these args:
--rx-offloads=0x2000 --tx-offloads=0x8000

---
 doc/guides/rel_notes/release_22_11.rst |   1 +
 drivers/net/ionic/ionic_ethdev.c       |  25 +-
 drivers/net/ionic/ionic_lif.c          |  61 ++-
 drivers/net/ionic/ionic_lif.h          |   1 +
 drivers/net/ionic/ionic_rxtx.c         | 576 ++-----------------------
 drivers/net/ionic/ionic_rxtx.h         |  46 +-
 drivers/net/ionic/ionic_rxtx_sg.c      | 496 +++++++++++++++++++++
 drivers/net/ionic/ionic_rxtx_simple.c  | 417 ++++++++++++++++++
 drivers/net/ionic/meson.build          |   2 +
 9 files changed, 1054 insertions(+), 571 deletions(-)
 create mode 100644 drivers/net/ionic/ionic_rxtx_sg.c
 create mode 100644 drivers/net/ionic/ionic_rxtx_simple.c
doc/guides/rel_notes/release_22_11.rst +1 -0
index c98c64d24d..1c3daf141d 100644
@@ -150,6 +150,7 @@ New Features
   * Added support for advertising packet types.
   * Added support for descriptor status functions.
   * Added Q-in-CMB feature controlled by devarg ionic_cmb.
+  * Added optimized handlers for non-scattered Rx and Tx.
 
 * **Updated Intel iavf driver.**
 
drivers/net/ionic/ionic_ethdev.c +19 -6
index 1092c7a921..340fd0cd59 100644
@@ -828,8 +828,6 @@ ionic_dev_configure(struct rte_eth_dev *eth_dev)
 
 	ionic_lif_configure(lif);
 
-	ionic_lif_set_features(lif);
-
 	return 0;
 }
 
@@ -883,6 +881,13 @@ ionic_dev_start(struct rte_eth_dev *eth_dev)
 	if (dev_conf->lpbk_mode)
 		IONIC_PRINT(WARNING, "Loopback mode not supported");
 
+	/* Re-set features in case SG flag was added in rx_queue_setup() */
+	err = ionic_lif_set_features(lif);
+	if (err) {
+		IONIC_PRINT(ERR, "Cannot set LIF features: %d", err);
+		return err;
+	}
+
 	lif->frame_size = eth_dev->data->mtu + IONIC_ETH_OVERHEAD;
 
 	err = ionic_lif_change_mtu(lif, eth_dev->data->mtu);
@@ -917,6 +922,18 @@ ionic_dev_start(struct rte_eth_dev *eth_dev)
 				speed);
 	}
 
+	if (lif->hw_features & IONIC_ETH_HW_RX_SG)
+		eth_dev->rx_pkt_burst = &ionic_recv_pkts_sg;
+	else
+		eth_dev->rx_pkt_burst = &ionic_recv_pkts;
+
+	if (lif->hw_features & IONIC_ETH_HW_TX_SG)
+		eth_dev->tx_pkt_burst = &ionic_xmit_pkts_sg;
+	else
+		eth_dev->tx_pkt_burst = &ionic_xmit_pkts;
+
+	eth_dev->tx_pkt_prepare = &ionic_prep_pkts;
+
 	ionic_dev_link_update(eth_dev, 0);
 
 	return 0;
@@ -980,10 +997,6 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 	IONIC_PRINT_CALL();
 
 	eth_dev->dev_ops = &ionic_eth_dev_ops;
-	eth_dev->rx_pkt_burst = &ionic_recv_pkts;
-	eth_dev->tx_pkt_burst = &ionic_xmit_pkts;
-	eth_dev->tx_pkt_prepare = &ionic_prep_pkts;
-
 	eth_dev->rx_descriptor_status = ionic_dev_rx_descriptor_status;
 	eth_dev->tx_descriptor_status = ionic_dev_tx_descriptor_status;
 
drivers/net/ionic/ionic_lif.c +44 -17

123 lines not on this page · raw message

drivers/net/ionic/ionic_lif.h +1 -0
index 09ebca7e89..00c8add95c 100644
@@ -188,6 +188,7 @@ void ionic_lif_stop(struct ionic_lif *lif);
 
 void ionic_lif_configure(struct ionic_lif *lif);
 void ionic_lif_configure_vlan_offload(struct ionic_lif *lif, int mask);
+void ionic_lif_configure_rx_sg_offload(struct ionic_lif *lif);
 void ionic_lif_reset(struct ionic_lif *lif);
 
 int ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr);
drivers/net/ionic/ionic_rxtx.c +35 -541

695 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx.h +39 -7

63 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx_sg.c new file +496 -0

496 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx_simple.c new file +417 -0

417 lines not on this page · raw message

drivers/net/ionic/meson.build +2 -0
index 00865c2139..71c7f2311a 100644
@@ -16,4 +16,6 @@ sources = files(
         'ionic_main.c',
         'ionic_rx_filter.c',
         'ionic_rxtx.c',
+        'ionic_rxtx_simple.c',
+        'ionic_rxtx_sg.c',
 )
Signature · 1 line
2.17.1
#75 lore raw

PATCH v2 34/36 net/ionic: use a helper variable for page size

In reply to Andrew Boyer

This improves readability.

---
 drivers/net/ionic/ionic_lif.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)
drivers/net/ionic/ionic_lif.c +12 -14
index 383fff9ffd..1b5932db12 100644
@@ -576,6 +576,7 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 	rte_iova_t q_base_pa = 0;
 	rte_iova_t cq_base_pa = 0;
 	rte_iova_t sg_base_pa = 0;
+	size_t page_size = rte_mem_page_size();
 	int err;
 
 	*qcq = NULL;
@@ -584,18 +585,18 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 	cq_size = num_descs * cq_desc_size;
 	sg_size = num_descs * sg_desc_size;
 
-	total_size = RTE_ALIGN(q_size, rte_mem_page_size()) +
-			RTE_ALIGN(cq_size, rte_mem_page_size());
+	total_size = RTE_ALIGN(q_size, page_size) +
+			RTE_ALIGN(cq_size, page_size);
 	/*
 	 * Note: aligning q_size/cq_size is not enough due to cq_base address
 	 * aligning as q_base could be not aligned to the page.
-	 * Adding rte_mem_page_size().
+	 * Adding page_size.
 	 */
-	total_size += rte_mem_page_size();
+	total_size += page_size;
 
 	if (flags & IONIC_QCQ_F_SG) {
-		total_size += RTE_ALIGN(sg_size, rte_mem_page_size());
-		total_size += rte_mem_page_size();
+		total_size += RTE_ALIGN(sg_size, page_size);
+		total_size += page_size;
 	}
 
 	new = rte_zmalloc_socket("ionic", struct_size,
@@ -610,7 +611,7 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 	/* Most queue types will store 1 ptr per descriptor */
 	new->q.info = rte_calloc_socket("ionic",
 				num_descs * num_segs, sizeof(void *),
-				rte_mem_page_size(), socket_id);
+				page_size, socket_id);
 	if (!new->q.info) {
 		IONIC_PRINT(ERR, "Cannot allocate queue info");
 		err = -ENOMEM;
@@ -648,16 +649,13 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 	q_base = new->base;
 	q_base_pa = new->base_pa;
 
-	cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size,
-			rte_mem_page_size());
-	cq_base_pa = RTE_ALIGN(q_base_pa + q_size,
-			rte_mem_page_size());
+	cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size, page_size);
+	cq_base_pa = RTE_ALIGN(q_base_pa + q_size, page_size);
 
 	if (flags & IONIC_QCQ_F_SG) {
 		sg_base = (void *)RTE_ALIGN((uintptr_t)cq_base + cq_size,
-				rte_mem_page_size());
-		sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size,
-				rte_mem_page_size());
+				page_size);
+		sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size, page_size);
 		ionic_q_sg_map(&new->q, sg_base, sg_base_pa);
 	}
 
Signature · 1 line
2.17.1
#76 lore raw

PATCH v2 35/36 net/ionic: retry init commands up to five times

In reply to Andrew Boyer

In some configurations, the FW may return EAGAIN if it is not able to respond to commands immediately. Retry the init commands in this case to prevent errors from reaching the client.

Fix up some return-code stuff while here, for clarity.

---
 drivers/net/ionic/ionic_dev.h  |  1 +
 drivers/net/ionic/ionic_lif.c  | 14 ++++++++++++++
 drivers/net/ionic/ionic_main.c |  4 ++--
 3 files changed, 17 insertions(+), 2 deletions(-)
drivers/net/ionic/ionic_dev.h +1 -0
index 46434f81a4..5e238e8ab7 100644
@@ -24,6 +24,7 @@
 
 #define IONIC_DEVCMD_TIMEOUT		5	/* devcmd_timeout */
 #define IONIC_DEVCMD_CHECK_PERIOD_US	10	/* devcmd status chk period */
+#define IONIC_DEVCMD_RETRY_WAIT_US	20000
 
 #define IONIC_ALIGN			4096
 
drivers/net/ionic/ionic_lif.c +14 -0
index 1b5932db12..63635a4b19 100644
@@ -1423,10 +1423,17 @@ ionic_lif_adminq_init(struct ionic_lif *lif)
 	struct ionic_admin_qcq *aqcq = lif->adminqcq;
 	struct ionic_queue *q = &aqcq->qcq.q;
 	struct ionic_q_init_comp comp;
+	uint32_t retries = 5;
 	int err;
 
+retry_adminq_init:
 	ionic_dev_cmd_adminq_init(idev, &aqcq->qcq);
 	err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
+	if (err == -EAGAIN && retries > 0) {
+		retries--;
+		rte_delay_us_block(IONIC_DEVCMD_RETRY_WAIT_US);
+		goto retry_adminq_init;
+	}
 	if (err)
 		return err;
 
@@ -1713,12 +1720,19 @@ ionic_lif_init(struct ionic_lif *lif)
 {
 	struct ionic_dev *idev = &lif->adapter->idev;
 	struct ionic_lif_init_comp comp;
+	uint32_t retries = 5;
 	int err;
 
 	memset(&lif->stats_base, 0, sizeof(lif->stats_base));
 
+retry_lif_init:
 	ionic_dev_cmd_lif_init(idev, lif->info_pa);
 	err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
+	if (err == -EAGAIN && retries > 0) {
+		retries--;
+		rte_delay_us_block(IONIC_DEVCMD_RETRY_WAIT_US);
+		goto retry_lif_init;
+	}
 	if (err)
 		return err;
 
drivers/net/ionic/ionic_main.c +2 -2
index 05f1e90e30..26e08d06c9 100644
@@ -313,10 +313,10 @@ ionic_dev_cmd_check_error(struct ionic_dev *idev)
 	uint8_t status;
 
 	status = ionic_dev_cmd_status(idev);
-	if (status == 0)
+	if (status == IONIC_RC_SUCCESS)
 		return 0;
 
-	return -EIO;
+	return (status == IONIC_RC_EAGAIN) ? -EAGAIN : -EIO;
 }
 
 int
Signature · 1 line
2.17.1
#77 lore raw

PATCH v2 36/36 net/ionic: add watchdogs to protect each queue type

In reply to Andrew Boyer

Ring the doorbell again for the following scenarios:
* No receives posted but Rx queue not empty after deadline
* No transmits posted but Tx work still pending after deadline
* Admin queue work still pending after deadline

This will help the queues recover in the extremely rare case that a doorbell is missed by the FW.

---
 drivers/net/ionic/ionic_dev.h         |  4 +++
 drivers/net/ionic/ionic_lif.h         |  3 ++
 drivers/net/ionic/ionic_main.c        | 22 ++++++++++++
 drivers/net/ionic/ionic_rxtx.c        |  1 +
 drivers/net/ionic/ionic_rxtx_sg.c     | 50 ++++++++++++++++++++++++++-
 drivers/net/ionic/ionic_rxtx_simple.c | 50 ++++++++++++++++++++++++++-
 6 files changed, 128 insertions(+), 2 deletions(-)
drivers/net/ionic/ionic_dev.h +4 -0
index 5e238e8ab7..b1e74fbd89 100644
@@ -26,6 +26,10 @@
 #define IONIC_DEVCMD_CHECK_PERIOD_US	10	/* devcmd status chk period */
 #define IONIC_DEVCMD_RETRY_WAIT_US	20000
 
+#define IONIC_Q_WDOG_MS			10	/* 10ms */
+#define IONIC_Q_WDOG_MAX_MS		5000	/* 5s */
+#define IONIC_ADMINQ_WDOG_MS		500	/* 500ms */
+
 #define IONIC_ALIGN			4096
 
 struct ionic_adapter;
drivers/net/ionic/ionic_lif.h +3 -0
index 00c8add95c..36b3bcc5a9 100644
@@ -85,6 +85,8 @@ struct ionic_rx_qcq {
 	struct rte_mempool *mb_pool;
 	uint64_t rearm_data;
 	uint64_t rearm_seg_data;
+	uint64_t last_wdog_cycles;
+	uint64_t wdog_ms;
 	uint16_t frame_size;	/* Based on configured MTU */
 	uint16_t hdr_seg_size;	/* Length of first segment of RX chain */
 	uint16_t seg_size;	/* Length of all subsequent segments */
@@ -103,6 +105,7 @@ struct ionic_tx_qcq {
 	struct ionic_qcq qcq;
 
 	/* cacheline2 */
+	uint64_t last_wdog_cycles;
 	uint16_t num_segs_fw;	/* # segs supported by current FW */
 	uint16_t free_thresh;
 	uint16_t flags;
drivers/net/ionic/ionic_main.c +22 -0
index 26e08d06c9..c957d55bf9 100644
@@ -230,10 +230,16 @@ static int
 ionic_adminq_wait_for_completion(struct ionic_lif *lif,
 		struct ionic_admin_ctx *ctx, unsigned long max_wait)
 {
+	struct ionic_queue *q = &lif->adminqcq->qcq.q;
 	unsigned long step_usec = IONIC_DEVCMD_CHECK_PERIOD_US;
+	unsigned long step_deadline;
 	unsigned long max_wait_usec = max_wait * 1000000L;
 	unsigned long elapsed_usec = 0;
 	int budget = 8;
+	uint16_t idx;
+	void **info;
+
+	step_deadline = IONIC_ADMINQ_WDOG_MS * 1000 / step_usec;
 
 	while (ctx->pending_work && elapsed_usec < max_wait_usec) {
 		/*
@@ -245,10 +251,26 @@ ionic_adminq_wait_for_completion(struct ionic_lif *lif,
 		ionic_qcq_service(&lif->adminqcq->qcq, budget,
 				ionic_adminq_service, NULL);
 
+		/*
+		 * Ring the doorbell again if work is pending after deadline.
+		 */
+		if (ctx->pending_work && !step_deadline) {
+			step_deadline = IONIC_ADMINQ_WDOG_MS *
+				1000 / step_usec;
+
+			rte_spinlock_lock(&lif->adminq_lock);
+			idx = Q_NEXT_TO_POST(q, -1);
+			info = IONIC_INFO_PTR(q, idx);
+			if (info[0] == ctx)
+				ionic_q_flush(q);
+			rte_spinlock_unlock(&lif->adminq_lock);
+		}
+
 		rte_spinlock_unlock(&lif->adminq_service_lock);
 
 		rte_delay_us_block(step_usec);
 		elapsed_usec += step_usec;
+		step_deadline--;
 	}
 
 	return (!ctx->pending_work);
drivers/net/ionic/ionic_rxtx.c +1 -0
index d216980450..b9e73b4871 100644
@@ -551,6 +551,7 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	}
 
 	rxq->mb_pool = mp;
+	rxq->wdog_ms = IONIC_Q_WDOG_MS;
 
 	/*
 	 * Note: the interface does not currently support
drivers/net/ionic/ionic_rxtx_sg.c +49 -1

77 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx_simple.c +49 -1

77 lines not on this page · raw message

Signature · 1 line
2.17.1
#78 lore raw

PATCH 18/35 net/ionic: do one-time init of receive descriptors

In reply to Andrew Boyer

These fields don't need to be set in the hot path. This improves performance.

---
 drivers/net/ionic/ionic_rxtx.c | 38 ++++++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 4 deletions(-)
drivers/net/ionic/ionic_rxtx.c +34 -4
index 0c1cc842cf..2a34465e46 100644
@@ -941,9 +941,6 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq)
 		desc = &desc_base[q->head_idx];
 		dma_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(rxm));
 		desc->addr = dma_addr;
-		desc->len = rxq->hdr_seg_size;
-		desc->opcode = (q->num_segs > 1) ? IONIC_RXQ_DESC_OPCODE_SG :
-			IONIC_RXQ_DESC_OPCODE_SIMPLE;
 		rxm->next = NULL;
 
 		prev_rxm_seg = rxm;
@@ -963,7 +960,6 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq)
 			data_iova = rte_mbuf_data_iova(rxm_seg);
 			dma_addr = rte_cpu_to_le_64(data_iova);
 			elem->addr = dma_addr;
-			elem->len = rxq->seg_size;
 			elem++;
 
 			rxm_seg->next = NULL;
@@ -981,6 +977,38 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq)
 	return 0;
 }
 
+/*
+ * Perform one-time initialization of descriptor fields
+ * which will not change for the life of the queue.
+ */
+static void __rte_cold
+ionic_rx_init_descriptors(struct ionic_rx_qcq *rxq)
+{
+	struct ionic_queue *q = &rxq->qcq.q;
+	struct ionic_rxq_desc *desc, *desc_base = q->base;
+	struct ionic_rxq_sg_desc *sg_desc, *sg_desc_base = q->sg_base;
+	uint32_t i, j;
+	uint8_t opcode;
+
+	opcode = (q->num_segs > 1) ?
+		IONIC_RXQ_DESC_OPCODE_SG : IONIC_RXQ_DESC_OPCODE_SIMPLE;
+
+	/*
+	 * NB: Only the first segment needs to leave headroom (hdr_seg_size).
+	 *     Later segments (seg_size) do not.
+	 */
+	for (i = 0; i < q->num_descs; i++) {
+		desc = &desc_base[i];
+		desc->len = rte_cpu_to_le_16(rxq->hdr_seg_size);
+		desc->opcode = opcode;
+
+		sg_desc = &sg_desc_base[i];
+		for (j = 0; j < q->num_segs - 1u; j++)
+			sg_desc->elems[j].len =
+				rte_cpu_to_le_16(rxq->seg_size);
+	}
+}
+
 /*
  * Start Receive Units for specified queue.
  */
@@ -1010,6 +1038,8 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 	IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs, size %u segs %u",
 		rx_queue_id, q->num_descs, rxq->frame_size, q->num_segs);
 
+	ionic_rx_init_descriptors(rxq);
+
 	err = ionic_lif_rxq_init(rxq);
 	if (err)
 		return err;
Signature · 1 line
2.17.1
#79 lore raw

PATCH 19/35 net/ionic: overhaul receive side for performance

In reply to Andrew Boyer

Linearize RX mbuf chains in the expanded info array.
Clean one and fill one per CQE (completions are not coalesced). Touch the mbufs as little as possible in the fill stage. When touching the mbuf in the clean stage, use the rearm_data unions. Ring the doorbell once at the end of the bulk clean/fill.

---
 doc/guides/rel_notes/release_22_11.rst |   1 +
 drivers/net/ionic/ionic_dev.h          |   2 +-
 drivers/net/ionic/ionic_lif.c          |  49 +++++-
 drivers/net/ionic/ionic_lif.h          |   3 +-
 drivers/net/ionic/ionic_rxtx.c         | 225 ++++++++++++-------------
 drivers/net/ionic/ionic_rxtx.h         |   1 -
 6 files changed, 159 insertions(+), 122 deletions(-)
doc/guides/rel_notes/release_22_11.rst +1 -0
index 552cc5b62c..d7eced510e 100644
@@ -83,6 +83,7 @@ New Features
   Updated the ionic PMD with new features and improvements, including:
 
   * Updated to reflect that Pensando has been acquired by AMD.
+  * Enhanced data path to provide substantial performance improvements.
 
 Removed Items
 -------------
drivers/net/ionic/ionic_dev.h +1 -1
index 55a9485bff..6a80ebc71b 100644
@@ -132,7 +132,7 @@ struct ionic_dev {
 #define Q_NEXT_TO_POST(_q, _n)	(((_q)->head_idx + (_n)) & ((_q)->size_mask))
 #define Q_NEXT_TO_SRVC(_q, _n)	(((_q)->tail_idx + (_n)) & ((_q)->size_mask))
 
-#define IONIC_INFO_IDX(_q, _i)	(_i)
+#define IONIC_INFO_IDX(_q, _i)	((_i) * (_q)->num_segs)
 #define IONIC_INFO_PTR(_q, _i)	(&(_q)->info[IONIC_INFO_IDX((_q), _i)])
 
 struct ionic_queue {
drivers/net/ionic/ionic_lif.c +44 -5

89 lines not on this page · raw message

drivers/net/ionic/ionic_lif.h +2 -1
index 237fd0a2ef..b0bd721b06 100644
@@ -40,7 +40,6 @@ struct ionic_rx_stats {
 	uint64_t packets;
 	uint64_t bytes;
 	uint64_t bad_cq_status;
-	uint64_t no_room;
 	uint64_t bad_len;
 	uint64_t mtods;
 };
@@ -80,6 +79,8 @@ struct ionic_rx_qcq {
 
 	/* cacheline2 */
 	struct rte_mempool *mb_pool;
+	uint64_t rearm_data;
+	uint64_t rearm_seg_data;
 	uint16_t frame_size;	/* Based on configured MTU */
 	uint16_t hdr_seg_size;	/* Length of first segment of RX chain */
 	uint16_t seg_size;	/* Length of all subsequent segments */
drivers/net/ionic/ionic_rxtx.c +111 -114

333 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx.h +0 -1
index 91a9073803..79ec1112de 100644
@@ -10,7 +10,6 @@
 struct ionic_rx_service {
 	/* cb in */
 	struct rte_mbuf **rx_pkts;
-	uint16_t nb_pkts;
 	/* cb out */
 	uint16_t nb_rx;
 };
Signature · 1 line
2.17.1
#80 lore raw

PATCH 19/35 net/ionic: overhaul receive side for performance

In reply to Andrew Boyer

Linearize RX mbuf chains in the expanded info array.
Clean one and fill one per CQE (completions are not coalesced). Touch the mbufs as little as possible in the fill stage. When touching the mbuf in the clean stage, use the rearm_data unions. Ring the doorbell once at the end of the bulk clean/fill.

---
 doc/guides/rel_notes/release_22_11.rst |   1 +
 drivers/net/ionic/ionic_dev.h          |   2 +-
 drivers/net/ionic/ionic_lif.c          |  49 +++++-
 drivers/net/ionic/ionic_lif.h          |   3 +-
 drivers/net/ionic/ionic_rxtx.c         | 225 ++++++++++++-------------
 drivers/net/ionic/ionic_rxtx.h         |   1 -
 6 files changed, 159 insertions(+), 122 deletions(-)
doc/guides/rel_notes/release_22_11.rst +1 -0
index 4135021283..6c8a8d5bdb 100644
@@ -164,6 +164,7 @@ New Features
   Updated the ionic PMD with new features and improvements, including:
 
   * Updated to reflect that Pensando has been acquired by AMD.
+  * Enhanced data path to provide substantial performance improvements.
 
 * **Added support for MACsec in rte_security.**
 
drivers/net/ionic/ionic_dev.h +1 -1
index 55a9485bff..6a80ebc71b 100644
@@ -132,7 +132,7 @@ struct ionic_dev {
 #define Q_NEXT_TO_POST(_q, _n)	(((_q)->head_idx + (_n)) & ((_q)->size_mask))
 #define Q_NEXT_TO_SRVC(_q, _n)	(((_q)->tail_idx + (_n)) & ((_q)->size_mask))
 
-#define IONIC_INFO_IDX(_q, _i)	(_i)
+#define IONIC_INFO_IDX(_q, _i)	((_i) * (_q)->num_segs)
 #define IONIC_INFO_PTR(_q, _i)	(&(_q)->info[IONIC_INFO_IDX((_q), _i)])
 
 struct ionic_queue {
drivers/net/ionic/ionic_lif.c +44 -5

89 lines not on this page · raw message

drivers/net/ionic/ionic_lif.h +2 -1
index 237fd0a2ef..b0bd721b06 100644
@@ -40,7 +40,6 @@ struct ionic_rx_stats {
 	uint64_t packets;
 	uint64_t bytes;
 	uint64_t bad_cq_status;
-	uint64_t no_room;
 	uint64_t bad_len;
 	uint64_t mtods;
 };
@@ -80,6 +79,8 @@ struct ionic_rx_qcq {
 
 	/* cacheline2 */
 	struct rte_mempool *mb_pool;
+	uint64_t rearm_data;
+	uint64_t rearm_seg_data;
 	uint16_t frame_size;	/* Based on configured MTU */
 	uint16_t hdr_seg_size;	/* Length of first segment of RX chain */
 	uint16_t seg_size;	/* Length of all subsequent segments */
drivers/net/ionic/ionic_rxtx.c +111 -114

333 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx.h +0 -1
index 91a9073803..79ec1112de 100644
@@ -10,7 +10,6 @@
 struct ionic_rx_service {
 	/* cb in */
 	struct rte_mbuf **rx_pkts;
-	uint16_t nb_pkts;
 	/* cb out */
 	uint16_t nb_rx;
 };
Signature · 1 line
2.17.1
#81 lore raw

PATCH 20/35 net/ionic: overhaul transmit side for performance

In reply to Andrew Boyer

Linearize Tx mbuf chains in the info array.
This avoids walking the mbuf chain during flush.
Move a few branches out of the hot path.

---
 drivers/net/ionic/ionic_lif.c  |   2 +-
 drivers/net/ionic/ionic_rxtx.c | 143 ++++++++++++++++++++-------------
 2 files changed, 87 insertions(+), 58 deletions(-)
drivers/net/ionic/ionic_lif.c +1 -1
index db5d42dda6..ac9b69fc70 100644
@@ -817,7 +817,7 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 		"tx",
 		flags,
 		ntxq_descs,
-		1,
+		num_segs_fw,
 		sizeof(struct ionic_txq_desc),
 		sizeof(struct ionic_txq_comp),
 		sizeof(struct ionic_txq_sg_desc_v1),
drivers/net/ionic/ionic_rxtx.c +86 -57

231 lines not on this page · raw message

Signature · 1 line
2.17.1
#82 lore raw

PATCH 20/35 net/ionic: overhaul transmit side for performance

In reply to Andrew Boyer

Linearize Tx mbuf chains in the info array.
This avoids walking the mbuf chain during flush.
Move a few branches out of the hot path.

---
 drivers/net/ionic/ionic_lif.c  |   2 +-
 drivers/net/ionic/ionic_rxtx.c | 143 ++++++++++++++++++++-------------
 2 files changed, 87 insertions(+), 58 deletions(-)
drivers/net/ionic/ionic_lif.c +1 -1
index db5d42dda6..ac9b69fc70 100644
@@ -817,7 +817,7 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 		"tx",
 		flags,
 		ntxq_descs,
-		1,
+		num_segs_fw,
 		sizeof(struct ionic_txq_desc),
 		sizeof(struct ionic_txq_comp),
 		sizeof(struct ionic_txq_sg_desc_v1),
drivers/net/ionic/ionic_rxtx.c +86 -57

231 lines not on this page · raw message

Signature · 1 line
2.17.1
#83 lore raw

PATCH 21/35 net/ionic: add support for mbuf fast free

In reply to Andrew Boyer

Use a put() rather than a free() in the optimized case.

---
 doc/guides/nics/features/ionic.ini     | 1 +
 doc/guides/rel_notes/release_22_11.rst | 1 +
 drivers/net/ionic/ionic_ethdev.c       | 2 +-
 drivers/net/ionic/ionic_lif.h          | 1 +
 drivers/net/ionic/ionic_rxtx.c         | 9 ++++++++-
 5 files changed, 12 insertions(+), 2 deletions(-)
doc/guides/nics/features/ionic.ini +1 -0
index 5bd18e39e9..77947bfd22 100644
@@ -7,6 +7,7 @@
 Speed capabilities   = Y
 Link status          = Y
 Link status event    = Y
+Fast mbuf free       = Y
 Queue start/stop     = Y
 MTU update           = Y
 Scattered Rx         = Y
doc/guides/rel_notes/release_22_11.rst +1 -0
index d7eced510e..0c962f9637 100644
@@ -84,6 +84,7 @@ New Features
 
   * Updated to reflect that Pensando has been acquired by AMD.
   * Enhanced data path to provide substantial performance improvements.
+  * Added support for mbuf fast free.
 
 Removed Items
 -------------
drivers/net/ionic/ionic_ethdev.c +1 -1
index 186cde8330..38241d41ec 100644
@@ -396,7 +396,7 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 	 */
 
 	dev_info->rx_queue_offload_capa = 0;
-	dev_info->tx_queue_offload_capa = 0;
+	dev_info->tx_queue_offload_capa = RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
 
 	/*
 	 * Per-port capabilities
drivers/net/ionic/ionic_lif.h +1 -0
index b0bd721b06..4fb1f213ff 100644
@@ -50,6 +50,7 @@ struct ionic_rx_stats {
 #define IONIC_QCQ_F_CSUM_L3	BIT(7)
 #define IONIC_QCQ_F_CSUM_UDP	BIT(8)
 #define IONIC_QCQ_F_CSUM_TCP	BIT(9)
+#define IONIC_QCQ_F_FAST_FREE	BIT(10)
 
 /* Queue / Completion Queue */
 struct ionic_qcq {
drivers/net/ionic/ionic_rxtx.c +8 -1
index 53b0add228..30f7ce9fc6 100644
@@ -94,6 +94,8 @@ ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 
 	qinfo->nb_desc = q->num_descs;
 	qinfo->conf.offloads = dev->data->dev_conf.txmode.offloads;
+	if (txq->flags & IONIC_QCQ_F_FAST_FREE)
+		qinfo->conf.offloads |= RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
 	qinfo->conf.tx_deferred_start = txq->flags & IONIC_QCQ_F_DEFERRED;
 }
 
@@ -136,7 +138,10 @@ ionic_tx_flush(struct ionic_tx_qcq *txq)
 				if (!txm)
 					break;
 
-				rte_pktmbuf_free_seg(txm);
+				if (txq->flags & IONIC_QCQ_F_FAST_FREE)
+					rte_mempool_put(txm->pool, txm);
+				else
+					rte_pktmbuf_free_seg(txm);
 
 				info[i] = NULL;
 			}
@@ -240,6 +245,8 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id,
 		txq->flags |= IONIC_QCQ_F_CSUM_TCP;
 	if (offloads & RTE_ETH_TX_OFFLOAD_UDP_CKSUM)
 		txq->flags |= IONIC_QCQ_F_CSUM_UDP;
+	if (offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
+		txq->flags |= IONIC_QCQ_F_FAST_FREE;
 
 	eth_dev->data->tx_queues[tx_queue_id] = txq;
 
Signature · 1 line
2.17.1
#84 lore raw

PATCH 21/35 net/ionic: add support for mbuf fast free

In reply to Andrew Boyer

Use a put() rather than a free() in the optimized case.

---
 doc/guides/nics/features/ionic.ini     | 1 +
 doc/guides/rel_notes/release_22_11.rst | 1 +
 drivers/net/ionic/ionic_ethdev.c       | 2 +-
 drivers/net/ionic/ionic_lif.h          | 1 +
 drivers/net/ionic/ionic_rxtx.c         | 9 ++++++++-
 5 files changed, 12 insertions(+), 2 deletions(-)
doc/guides/nics/features/ionic.ini +1 -0
index 5bd18e39e9..77947bfd22 100644
@@ -7,6 +7,7 @@
 Speed capabilities   = Y
 Link status          = Y
 Link status event    = Y
+Fast mbuf free       = Y
 Queue start/stop     = Y
 MTU update           = Y
 Scattered Rx         = Y
doc/guides/rel_notes/release_22_11.rst +1 -0
index 6c8a8d5bdb..2fdc82b673 100644
@@ -165,6 +165,7 @@ New Features
 
   * Updated to reflect that Pensando has been acquired by AMD.
   * Enhanced data path to provide substantial performance improvements.
+  * Added support for mbuf fast free.
 
 * **Added support for MACsec in rte_security.**
 
drivers/net/ionic/ionic_ethdev.c +1 -1
index 186cde8330..38241d41ec 100644
@@ -396,7 +396,7 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 	 */
 
 	dev_info->rx_queue_offload_capa = 0;
-	dev_info->tx_queue_offload_capa = 0;
+	dev_info->tx_queue_offload_capa = RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
 
 	/*
 	 * Per-port capabilities
drivers/net/ionic/ionic_lif.h +1 -0
index b0bd721b06..4fb1f213ff 100644
@@ -50,6 +50,7 @@ struct ionic_rx_stats {
 #define IONIC_QCQ_F_CSUM_L3	BIT(7)
 #define IONIC_QCQ_F_CSUM_UDP	BIT(8)
 #define IONIC_QCQ_F_CSUM_TCP	BIT(9)
+#define IONIC_QCQ_F_FAST_FREE	BIT(10)
 
 /* Queue / Completion Queue */
 struct ionic_qcq {
drivers/net/ionic/ionic_rxtx.c +8 -1
index 53b0add228..30f7ce9fc6 100644
@@ -94,6 +94,8 @@ ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 
 	qinfo->nb_desc = q->num_descs;
 	qinfo->conf.offloads = dev->data->dev_conf.txmode.offloads;
+	if (txq->flags & IONIC_QCQ_F_FAST_FREE)
+		qinfo->conf.offloads |= RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
 	qinfo->conf.tx_deferred_start = txq->flags & IONIC_QCQ_F_DEFERRED;
 }
 
@@ -136,7 +138,10 @@ ionic_tx_flush(struct ionic_tx_qcq *txq)
 				if (!txm)
 					break;
 
-				rte_pktmbuf_free_seg(txm);
+				if (txq->flags & IONIC_QCQ_F_FAST_FREE)
+					rte_mempool_put(txm->pool, txm);
+				else
+					rte_pktmbuf_free_seg(txm);
 
 				info[i] = NULL;
 			}
@@ -240,6 +245,8 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id,
 		txq->flags |= IONIC_QCQ_F_CSUM_TCP;
 	if (offloads & RTE_ETH_TX_OFFLOAD_UDP_CKSUM)
 		txq->flags |= IONIC_QCQ_F_CSUM_UDP;
+	if (offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
+		txq->flags |= IONIC_QCQ_F_FAST_FREE;
 
 	eth_dev->data->tx_queues[tx_queue_id] = txq;
 
Signature · 1 line
2.17.1
#85 lore raw

PATCH 22/35 net/ionic: do bulk allocations of receive mbufs

In reply to Andrew Boyer

Do bulk allocations to improve performance.

---
 drivers/net/ionic/ionic_lif.h  |  6 ++++++
 drivers/net/ionic/ionic_rxtx.c | 35 ++++++++++++++++++++++++++--------
 2 files changed, 33 insertions(+), 8 deletions(-)
drivers/net/ionic/ionic_lif.h +6 -0
index 4fb1f213ff..5231909213 100644
@@ -17,6 +17,8 @@
 #define IONIC_ADMINQ_LENGTH	16	/* must be a power of two */
 #define IONIC_NOTIFYQ_LENGTH	64	/* must be a power of two */
 
+#define IONIC_MBUF_BULK_ALLOC	64	/* Multiple of 4 */
+
 #define IONIC_RSS_OFFLOAD_ALL ( \
 	IONIC_RSS_TYPE_IPV4 | \
 	IONIC_RSS_TYPE_IPV4_TCP | \
@@ -86,9 +88,13 @@ struct ionic_rx_qcq {
 	uint16_t hdr_seg_size;	/* Length of first segment of RX chain */
 	uint16_t seg_size;	/* Length of all subsequent segments */
 	uint16_t flags;
+	uint16_t mb_idx;
 
 	/* cacheline3 (inside stats) */
 	struct ionic_rx_stats stats;
+
+	/* cacheline4+ */
+	struct rte_mbuf *mbs[IONIC_MBUF_BULK_ALLOC] __rte_cache_aligned;
 };
 
 struct ionic_tx_qcq {
drivers/net/ionic/ionic_rxtx.c +27 -8
index 30f7ce9fc6..5ee6573a50 100644
@@ -77,6 +77,10 @@ ionic_rx_empty(struct ionic_rx_qcq *rxq)
 	 * fragments that were left dangling for later reuse
 	 */
 	ionic_empty_array(q->info, q->num_descs * q->num_segs, 0);
+
+	ionic_empty_array((void **)rxq->mbs,
+			IONIC_MBUF_BULK_ALLOC, rxq->mb_idx);
+	rxq->mb_idx = 0;
 }
 
 /*********************************************************************
@@ -950,6 +954,7 @@ ionic_rx_fill_one(struct ionic_rx_qcq *rxq)
 	rte_iova_t data_iova;
 	uint32_t i;
 	void **info;
+	int ret;
 
 	info = IONIC_INFO_PTR(q, q->head_idx);
 	desc = &desc_base[q->head_idx];
@@ -959,12 +964,19 @@ ionic_rx_fill_one(struct ionic_rx_qcq *rxq)
 	if (unlikely(info[0]))
 		return 0;
 
-	rxm = rte_mbuf_raw_alloc(rxq->mb_pool);
-	if (unlikely(rxm == NULL)) {
-		assert(0);
-		return -ENOMEM;
+	if (rxq->mb_idx == 0) {
+		ret = rte_mempool_get_bulk(rxq->mb_pool,
+					(void **)rxq->mbs,
+					IONIC_MBUF_BULK_ALLOC);
+		if (ret) {
+			assert(0);
+			return -ENOMEM;
+		}
+
+		rxq->mb_idx = IONIC_MBUF_BULK_ALLOC;
 	}
 
+	rxm = rxq->mbs[--rxq->mb_idx];
 	info[0] = rxm;
 
 	data_iova = rte_mbuf_data_iova_default(rxm);
@@ -975,12 +987,19 @@ ionic_rx_fill_one(struct ionic_rx_qcq *rxq)
 		if (info[i])
 			return 0;
 
-		rxm_seg = rte_mbuf_raw_alloc(rxq->mb_pool);
-		if (rxm_seg == NULL) {
-			assert(0);
-			return -ENOMEM;
+		if (rxq->mb_idx == 0) {
+			ret = rte_mempool_get_bulk(rxq->mb_pool,
+					(void **)rxq->mbs,
+					IONIC_MBUF_BULK_ALLOC);
+			if (ret) {
+				assert(0);
+				return -ENOMEM;
+			}
+
+			rxq->mb_idx = IONIC_MBUF_BULK_ALLOC;
 		}
 
+		rxm_seg = rxq->mbs[--rxq->mb_idx];
 		info[i] = rxm_seg;
 
 		/* The data_off does not get set to 0 until later */
Signature · 1 line
2.17.1
#86 lore raw

PATCH 22/35 net/ionic: do bulk allocations of receive mbufs

In reply to Andrew Boyer

Do bulk allocations to improve performance.

---
 drivers/net/ionic/ionic_lif.h  |  6 ++++++
 drivers/net/ionic/ionic_rxtx.c | 35 ++++++++++++++++++++++++++--------
 2 files changed, 33 insertions(+), 8 deletions(-)
drivers/net/ionic/ionic_lif.h +6 -0
index 4fb1f213ff..5231909213 100644
@@ -17,6 +17,8 @@
 #define IONIC_ADMINQ_LENGTH	16	/* must be a power of two */
 #define IONIC_NOTIFYQ_LENGTH	64	/* must be a power of two */
 
+#define IONIC_MBUF_BULK_ALLOC	64	/* Multiple of 4 */
+
 #define IONIC_RSS_OFFLOAD_ALL ( \
 	IONIC_RSS_TYPE_IPV4 | \
 	IONIC_RSS_TYPE_IPV4_TCP | \
@@ -86,9 +88,13 @@ struct ionic_rx_qcq {
 	uint16_t hdr_seg_size;	/* Length of first segment of RX chain */
 	uint16_t seg_size;	/* Length of all subsequent segments */
 	uint16_t flags;
+	uint16_t mb_idx;
 
 	/* cacheline3 (inside stats) */
 	struct ionic_rx_stats stats;
+
+	/* cacheline4+ */
+	struct rte_mbuf *mbs[IONIC_MBUF_BULK_ALLOC] __rte_cache_aligned;
 };
 
 struct ionic_tx_qcq {
drivers/net/ionic/ionic_rxtx.c +27 -8
index 30f7ce9fc6..5ee6573a50 100644
@@ -77,6 +77,10 @@ ionic_rx_empty(struct ionic_rx_qcq *rxq)
 	 * fragments that were left dangling for later reuse
 	 */
 	ionic_empty_array(q->info, q->num_descs * q->num_segs, 0);
+
+	ionic_empty_array((void **)rxq->mbs,
+			IONIC_MBUF_BULK_ALLOC, rxq->mb_idx);
+	rxq->mb_idx = 0;
 }
 
 /*********************************************************************
@@ -950,6 +954,7 @@ ionic_rx_fill_one(struct ionic_rx_qcq *rxq)
 	rte_iova_t data_iova;
 	uint32_t i;
 	void **info;
+	int ret;
 
 	info = IONIC_INFO_PTR(q, q->head_idx);
 	desc = &desc_base[q->head_idx];
@@ -959,12 +964,19 @@ ionic_rx_fill_one(struct ionic_rx_qcq *rxq)
 	if (unlikely(info[0]))
 		return 0;
 
-	rxm = rte_mbuf_raw_alloc(rxq->mb_pool);
-	if (unlikely(rxm == NULL)) {
-		assert(0);
-		return -ENOMEM;
+	if (rxq->mb_idx == 0) {
+		ret = rte_mempool_get_bulk(rxq->mb_pool,
+					(void **)rxq->mbs,
+					IONIC_MBUF_BULK_ALLOC);
+		if (ret) {
+			assert(0);
+			return -ENOMEM;
+		}
+
+		rxq->mb_idx = IONIC_MBUF_BULK_ALLOC;
 	}
 
+	rxm = rxq->mbs[--rxq->mb_idx];
 	info[0] = rxm;
 
 	data_iova = rte_mbuf_data_iova_default(rxm);
@@ -975,12 +987,19 @@ ionic_rx_fill_one(struct ionic_rx_qcq *rxq)
 		if (info[i])
 			return 0;
 
-		rxm_seg = rte_mbuf_raw_alloc(rxq->mb_pool);
-		if (rxm_seg == NULL) {
-			assert(0);
-			return -ENOMEM;
+		if (rxq->mb_idx == 0) {
+			ret = rte_mempool_get_bulk(rxq->mb_pool,
+					(void **)rxq->mbs,
+					IONIC_MBUF_BULK_ALLOC);
+			if (ret) {
+				assert(0);
+				return -ENOMEM;
+			}
+
+			rxq->mb_idx = IONIC_MBUF_BULK_ALLOC;
 		}
 
+		rxm_seg = rxq->mbs[--rxq->mb_idx];
 		info[i] = rxm_seg;
 
 		/* The data_off does not get set to 0 until later */
Signature · 1 line
2.17.1
#87 lore raw

PATCH 23/35 net/ionic: add a lookup table for packet type

In reply to Andrew Boyer

This improves performance by reducing branching.

---
 drivers/net/ionic/ionic_rxtx.c | 63 ++++++++++++++++------------------
 1 file changed, 29 insertions(+), 34 deletions(-)
drivers/net/ionic/ionic_rxtx.c +29 -34
index 5ee6573a50..bb09c4eb1f 100644
@@ -804,6 +804,22 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	return 0;
 }
 
+/* RTE_PTYPE_UNKNOWN is 0x0 */
+static const uint32_t ionic_ptype_table[IONIC_RXQ_COMP_PKT_TYPE_MASK]
+		__rte_cache_aligned = {
+	[IONIC_PKT_TYPE_NON_IP]   = RTE_PTYPE_UNKNOWN,
+	[IONIC_PKT_TYPE_IPV4]     = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4,
+	[IONIC_PKT_TYPE_IPV4_TCP] =
+		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_TCP,
+	[IONIC_PKT_TYPE_IPV4_UDP] =
+		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_UDP,
+	[IONIC_PKT_TYPE_IPV6]     = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6,
+	[IONIC_PKT_TYPE_IPV6_TCP] =
+		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_TCP,
+	[IONIC_PKT_TYPE_IPV6_UDP] =
+		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_UDP,
+};
+
 /*
  * Cleans one descriptor. Connects the filled mbufs into a chain.
  * Does not advance the tail index.
@@ -820,6 +836,7 @@ ionic_rx_clean_one(struct ionic_rx_qcq *rxq,
 	uint32_t pkt_type;
 	uint32_t left, i;
 	uint16_t cq_desc_len;
+	uint8_t ptype;
 	void **info;
 
 	cq_desc_len = rte_le_to_cpu_16(cq_desc->len);
@@ -895,41 +912,19 @@ ionic_rx_clean_one(struct ionic_rx_qcq *rxq,
 	rxm->ol_flags = pkt_flags;
 
 	/* Packet Type */
-	switch (cq_desc->pkt_type_color & IONIC_RXQ_COMP_PKT_TYPE_MASK) {
-	case IONIC_PKT_TYPE_IPV4:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4;
-		break;
-	case IONIC_PKT_TYPE_IPV6:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6;
-		break;
-	case IONIC_PKT_TYPE_IPV4_TCP:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 |
-			RTE_PTYPE_L4_TCP;
-		break;
-	case IONIC_PKT_TYPE_IPV6_TCP:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 |
-			RTE_PTYPE_L4_TCP;
-		break;
-	case IONIC_PKT_TYPE_IPV4_UDP:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 |
-			RTE_PTYPE_L4_UDP;
-		break;
-	case IONIC_PKT_TYPE_IPV6_UDP:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 |
-			RTE_PTYPE_L4_UDP;
-		break;
-	default:
-		{
-			struct rte_ether_hdr *eth_h = rte_pktmbuf_mtod(rxm,
+	ptype = cq_desc->pkt_type_color & IONIC_RXQ_COMP_PKT_TYPE_MASK;
+	pkt_type = ionic_ptype_table[ptype];
+	if (pkt_type == RTE_PTYPE_UNKNOWN) {
+		struct rte_ether_hdr *eth_h = rte_pktmbuf_mtod(rxm,
 				struct rte_ether_hdr *);
-			uint16_t ether_type = eth_h->ether_type;
-			if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP))
-				pkt_type = RTE_PTYPE_L2_ETHER_ARP;
-			else
-				pkt_type = RTE_PTYPE_UNKNOWN;
-			stats->mtods++;
-			break;
-		}
+		uint16_t ether_type = eth_h->ether_type;
+		if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP))
+			pkt_type = RTE_PTYPE_L2_ETHER_ARP;
+		else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_LLDP))
+			pkt_type = RTE_PTYPE_L2_ETHER_LLDP;
+		else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_1588))
+			pkt_type = RTE_PTYPE_L2_ETHER_TIMESYNC;
+		stats->mtods++;
 	}
 
 	rxm->packet_type = pkt_type;
Signature · 1 line
2.17.1
#88 lore raw

PATCH 23/35 net/ionic: add a lookup table for packet type

In reply to Andrew Boyer

This improves performance by reducing branching.

---
 drivers/net/ionic/ionic_rxtx.c | 63 ++++++++++++++++------------------
 1 file changed, 29 insertions(+), 34 deletions(-)
drivers/net/ionic/ionic_rxtx.c +29 -34
index 5ee6573a50..bb09c4eb1f 100644
@@ -804,6 +804,22 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	return 0;
 }
 
+/* RTE_PTYPE_UNKNOWN is 0x0 */
+static const uint32_t ionic_ptype_table[IONIC_RXQ_COMP_PKT_TYPE_MASK]
+		__rte_cache_aligned = {
+	[IONIC_PKT_TYPE_NON_IP]   = RTE_PTYPE_UNKNOWN,
+	[IONIC_PKT_TYPE_IPV4]     = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4,
+	[IONIC_PKT_TYPE_IPV4_TCP] =
+		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_TCP,
+	[IONIC_PKT_TYPE_IPV4_UDP] =
+		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_UDP,
+	[IONIC_PKT_TYPE_IPV6]     = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6,
+	[IONIC_PKT_TYPE_IPV6_TCP] =
+		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_TCP,
+	[IONIC_PKT_TYPE_IPV6_UDP] =
+		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_UDP,
+};
+
 /*
  * Cleans one descriptor. Connects the filled mbufs into a chain.
  * Does not advance the tail index.
@@ -820,6 +836,7 @@ ionic_rx_clean_one(struct ionic_rx_qcq *rxq,
 	uint32_t pkt_type;
 	uint32_t left, i;
 	uint16_t cq_desc_len;
+	uint8_t ptype;
 	void **info;
 
 	cq_desc_len = rte_le_to_cpu_16(cq_desc->len);
@@ -895,41 +912,19 @@ ionic_rx_clean_one(struct ionic_rx_qcq *rxq,
 	rxm->ol_flags = pkt_flags;
 
 	/* Packet Type */
-	switch (cq_desc->pkt_type_color & IONIC_RXQ_COMP_PKT_TYPE_MASK) {
-	case IONIC_PKT_TYPE_IPV4:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4;
-		break;
-	case IONIC_PKT_TYPE_IPV6:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6;
-		break;
-	case IONIC_PKT_TYPE_IPV4_TCP:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 |
-			RTE_PTYPE_L4_TCP;
-		break;
-	case IONIC_PKT_TYPE_IPV6_TCP:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 |
-			RTE_PTYPE_L4_TCP;
-		break;
-	case IONIC_PKT_TYPE_IPV4_UDP:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 |
-			RTE_PTYPE_L4_UDP;
-		break;
-	case IONIC_PKT_TYPE_IPV6_UDP:
-		pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 |
-			RTE_PTYPE_L4_UDP;
-		break;
-	default:
-		{
-			struct rte_ether_hdr *eth_h = rte_pktmbuf_mtod(rxm,
+	ptype = cq_desc->pkt_type_color & IONIC_RXQ_COMP_PKT_TYPE_MASK;
+	pkt_type = ionic_ptype_table[ptype];
+	if (pkt_type == RTE_PTYPE_UNKNOWN) {
+		struct rte_ether_hdr *eth_h = rte_pktmbuf_mtod(rxm,
 				struct rte_ether_hdr *);
-			uint16_t ether_type = eth_h->ether_type;
-			if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP))
-				pkt_type = RTE_PTYPE_L2_ETHER_ARP;
-			else
-				pkt_type = RTE_PTYPE_UNKNOWN;
-			stats->mtods++;
-			break;
-		}
+		uint16_t ether_type = eth_h->ether_type;
+		if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP))
+			pkt_type = RTE_PTYPE_L2_ETHER_ARP;
+		else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_LLDP))
+			pkt_type = RTE_PTYPE_L2_ETHER_LLDP;
+		else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_1588))
+			pkt_type = RTE_PTYPE_L2_ETHER_TIMESYNC;
+		stats->mtods++;
 	}
 
 	rxm->packet_type = pkt_type;
Signature · 1 line
2.17.1
#89 lore raw

PATCH 24/35 net/ionic: add a lookup table for checksum flags

In reply to Andrew Boyer

This improves performance by reducing branching.

---
 drivers/net/ionic/ionic_rxtx.c | 47 ++++++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 14 deletions(-)
drivers/net/ionic/ionic_rxtx.c +33 -14
index bb09c4eb1f..134589b016 100644
@@ -804,6 +804,36 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	return 0;
 }
 
+#define IONIC_CSUM_FLAG_MASK (IONIC_RXQ_COMP_CSUM_F_VLAN - 1)
+static const uint64_t ionic_csum_flags[IONIC_CSUM_FLAG_MASK]
+		__rte_cache_aligned = {
+	/* IP_BAD set */
+	[IONIC_RXQ_COMP_CSUM_F_IP_BAD] = RTE_MBUF_F_RX_IP_CKSUM_BAD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_BAD | IONIC_RXQ_COMP_CSUM_F_TCP_OK] =
+			RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_BAD | IONIC_RXQ_COMP_CSUM_F_TCP_BAD] =
+			RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_BAD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_BAD | IONIC_RXQ_COMP_CSUM_F_UDP_OK] =
+			RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_BAD | IONIC_RXQ_COMP_CSUM_F_UDP_BAD] =
+			RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_BAD,
+	/* IP_OK set */
+	[IONIC_RXQ_COMP_CSUM_F_IP_OK] = RTE_MBUF_F_RX_IP_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_OK | IONIC_RXQ_COMP_CSUM_F_TCP_OK] =
+			RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_OK | IONIC_RXQ_COMP_CSUM_F_TCP_BAD] =
+			RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_BAD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_OK | IONIC_RXQ_COMP_CSUM_F_UDP_OK] =
+			RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_OK | IONIC_RXQ_COMP_CSUM_F_UDP_BAD] =
+			RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_BAD,
+	/* No IP flag set */
+	[IONIC_RXQ_COMP_CSUM_F_TCP_OK] = RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_TCP_BAD] = RTE_MBUF_F_RX_L4_CKSUM_BAD,
+	[IONIC_RXQ_COMP_CSUM_F_UDP_OK] = RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_UDP_BAD] = RTE_MBUF_F_RX_L4_CKSUM_BAD,
+};
+
 /* RTE_PTYPE_UNKNOWN is 0x0 */
 static const uint32_t ionic_ptype_table[IONIC_RXQ_COMP_PKT_TYPE_MASK]
 		__rte_cache_aligned = {
@@ -836,7 +866,7 @@ ionic_rx_clean_one(struct ionic_rx_qcq *rxq,
 	uint32_t pkt_type;
 	uint32_t left, i;
 	uint16_t cq_desc_len;
-	uint8_t ptype;
+	uint8_t ptype, cflags;
 	void **info;
 
 	cq_desc_len = rte_le_to_cpu_16(cq_desc->len);
@@ -894,19 +924,8 @@ ionic_rx_clean_one(struct ionic_rx_qcq *rxq,
 
 	/* Checksum */
 	if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_CALC) {
-		if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_IP_OK)
-			pkt_flags |= RTE_MBUF_F_RX_IP_CKSUM_GOOD;
-		else if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_IP_BAD)
-			pkt_flags |= RTE_MBUF_F_RX_IP_CKSUM_BAD;
-
-		if ((cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_TCP_OK) ||
-			(cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_UDP_OK))
-			pkt_flags |= RTE_MBUF_F_RX_L4_CKSUM_GOOD;
-		else if ((cq_desc->csum_flags &
-				IONIC_RXQ_COMP_CSUM_F_TCP_BAD) ||
-				(cq_desc->csum_flags &
-				IONIC_RXQ_COMP_CSUM_F_UDP_BAD))
-			pkt_flags |= RTE_MBUF_F_RX_L4_CKSUM_BAD;
+		cflags = cq_desc->csum_flags & IONIC_CSUM_FLAG_MASK;
+		pkt_flags |= ionic_csum_flags[cflags];
 	}
 
 	rxm->ol_flags = pkt_flags;
Signature · 1 line
2.17.1
#90 lore raw

PATCH 24/35 net/ionic: add a lookup table for checksum flags

In reply to Andrew Boyer

This improves performance by reducing branching.

---
 drivers/net/ionic/ionic_rxtx.c | 47 ++++++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 14 deletions(-)
drivers/net/ionic/ionic_rxtx.c +33 -14
index bb09c4eb1f..134589b016 100644
@@ -804,6 +804,36 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	return 0;
 }
 
+#define IONIC_CSUM_FLAG_MASK (IONIC_RXQ_COMP_CSUM_F_VLAN - 1)
+static const uint64_t ionic_csum_flags[IONIC_CSUM_FLAG_MASK]
+		__rte_cache_aligned = {
+	/* IP_BAD set */
+	[IONIC_RXQ_COMP_CSUM_F_IP_BAD] = RTE_MBUF_F_RX_IP_CKSUM_BAD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_BAD | IONIC_RXQ_COMP_CSUM_F_TCP_OK] =
+			RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_BAD | IONIC_RXQ_COMP_CSUM_F_TCP_BAD] =
+			RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_BAD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_BAD | IONIC_RXQ_COMP_CSUM_F_UDP_OK] =
+			RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_BAD | IONIC_RXQ_COMP_CSUM_F_UDP_BAD] =
+			RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_BAD,
+	/* IP_OK set */
+	[IONIC_RXQ_COMP_CSUM_F_IP_OK] = RTE_MBUF_F_RX_IP_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_OK | IONIC_RXQ_COMP_CSUM_F_TCP_OK] =
+			RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_OK | IONIC_RXQ_COMP_CSUM_F_TCP_BAD] =
+			RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_BAD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_OK | IONIC_RXQ_COMP_CSUM_F_UDP_OK] =
+			RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_IP_OK | IONIC_RXQ_COMP_CSUM_F_UDP_BAD] =
+			RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_BAD,
+	/* No IP flag set */
+	[IONIC_RXQ_COMP_CSUM_F_TCP_OK] = RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_TCP_BAD] = RTE_MBUF_F_RX_L4_CKSUM_BAD,
+	[IONIC_RXQ_COMP_CSUM_F_UDP_OK] = RTE_MBUF_F_RX_L4_CKSUM_GOOD,
+	[IONIC_RXQ_COMP_CSUM_F_UDP_BAD] = RTE_MBUF_F_RX_L4_CKSUM_BAD,
+};
+
 /* RTE_PTYPE_UNKNOWN is 0x0 */
 static const uint32_t ionic_ptype_table[IONIC_RXQ_COMP_PKT_TYPE_MASK]
 		__rte_cache_aligned = {
@@ -836,7 +866,7 @@ ionic_rx_clean_one(struct ionic_rx_qcq *rxq,
 	uint32_t pkt_type;
 	uint32_t left, i;
 	uint16_t cq_desc_len;
-	uint8_t ptype;
+	uint8_t ptype, cflags;
 	void **info;
 
 	cq_desc_len = rte_le_to_cpu_16(cq_desc->len);
@@ -894,19 +924,8 @@ ionic_rx_clean_one(struct ionic_rx_qcq *rxq,
 
 	/* Checksum */
 	if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_CALC) {
-		if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_IP_OK)
-			pkt_flags |= RTE_MBUF_F_RX_IP_CKSUM_GOOD;
-		else if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_IP_BAD)
-			pkt_flags |= RTE_MBUF_F_RX_IP_CKSUM_BAD;
-
-		if ((cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_TCP_OK) ||
-			(cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_UDP_OK))
-			pkt_flags |= RTE_MBUF_F_RX_L4_CKSUM_GOOD;
-		else if ((cq_desc->csum_flags &
-				IONIC_RXQ_COMP_CSUM_F_TCP_BAD) ||
-				(cq_desc->csum_flags &
-				IONIC_RXQ_COMP_CSUM_F_UDP_BAD))
-			pkt_flags |= RTE_MBUF_F_RX_L4_CKSUM_BAD;
+		cflags = cq_desc->csum_flags & IONIC_CSUM_FLAG_MASK;
+		pkt_flags |= ionic_csum_flags[cflags];
 	}
 
 	rxm->ol_flags = pkt_flags;
Signature · 1 line
2.17.1
#91 lore raw

PATCH 25/35 net/ionic: advertise supported packet types

In reply to Andrew Boyer

This improves performance, since clients may be able to skip SW packet classification.

---
 doc/guides/rel_notes/release_22_11.rst |  1 +
 drivers/net/ionic/ionic_ethdev.c       |  1 +
 drivers/net/ionic/ionic_rxtx.c         | 19 +++++++++++++++++++
 drivers/net/ionic/ionic_rxtx.h         |  2 ++
 4 files changed, 23 insertions(+)
doc/guides/rel_notes/release_22_11.rst +1 -0
index 0c962f9637..5c3bd15e55 100644
@@ -85,6 +85,7 @@ New Features
   * Updated to reflect that Pensando has been acquired by AMD.
   * Enhanced data path to provide substantial performance improvements.
   * Added support for mbuf fast free.
+  * Added support for advertising packet types.
 
 Removed Items
 -------------
drivers/net/ionic/ionic_ethdev.c +1 -0
index 38241d41ec..39bbe60d79 100644
@@ -70,6 +70,7 @@ static const struct rte_eth_desc_lim tx_desc_lim_v1 = {
 
 static const struct eth_dev_ops ionic_eth_dev_ops = {
 	.dev_infos_get          = ionic_dev_info_get,
+	.dev_supported_ptypes_get = ionic_dev_supported_ptypes_get,
 	.dev_configure          = ionic_dev_configure,
 	.mtu_set                = ionic_dev_mtu_set,
 	.dev_start              = ionic_dev_start,
drivers/net/ionic/ionic_rxtx.c +19 -0
index 134589b016..24fd8fcf04 100644
@@ -850,6 +850,25 @@ static const uint32_t ionic_ptype_table[IONIC_RXQ_COMP_PKT_TYPE_MASK]
 		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_UDP,
 };
 
+const uint32_t *
+ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
+{
+	/* See ionic_ptype_table[] */
+	static const uint32_t ptypes[] = {
+		RTE_PTYPE_L2_ETHER,
+		RTE_PTYPE_L2_ETHER_TIMESYNC,
+		RTE_PTYPE_L2_ETHER_LLDP,
+		RTE_PTYPE_L2_ETHER_ARP,
+		RTE_PTYPE_L3_IPV4,
+		RTE_PTYPE_L3_IPV6,
+		RTE_PTYPE_L4_TCP,
+		RTE_PTYPE_L4_UDP,
+		RTE_PTYPE_UNKNOWN
+	};
+
+	return ptypes;
+}
+
 /*
  * Cleans one descriptor. Connects the filled mbufs into a chain.
  * Does not advance the tail index.
drivers/net/ionic/ionic_rxtx.h +2 -0
index 79ec1112de..de51f21012 100644
@@ -40,4 +40,6 @@ void ionic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 void ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	struct rte_eth_txq_info *qinfo);
 
+const uint32_t *ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev);
+
 #endif /* _IONIC_RXTX_H_ */
Signature · 1 line
2.17.1
#92 lore raw

PATCH 25/35 net/ionic: advertise supported packet types

In reply to Andrew Boyer

This improves performance, since clients may be able to skip SW packet classification.

---
 doc/guides/rel_notes/release_22_11.rst |  1 +
 drivers/net/ionic/ionic_ethdev.c       |  1 +
 drivers/net/ionic/ionic_rxtx.c         | 19 +++++++++++++++++++
 drivers/net/ionic/ionic_rxtx.h         |  2 ++
 4 files changed, 23 insertions(+)
doc/guides/rel_notes/release_22_11.rst +1 -0
index 2fdc82b673..2b62310e06 100644
@@ -166,6 +166,7 @@ New Features
   * Updated to reflect that Pensando has been acquired by AMD.
   * Enhanced data path to provide substantial performance improvements.
   * Added support for mbuf fast free.
+  * Added support for advertising packet types.
 
 * **Added support for MACsec in rte_security.**
 
drivers/net/ionic/ionic_ethdev.c +1 -0
index 38241d41ec..39bbe60d79 100644
@@ -70,6 +70,7 @@ static const struct rte_eth_desc_lim tx_desc_lim_v1 = {
 
 static const struct eth_dev_ops ionic_eth_dev_ops = {
 	.dev_infos_get          = ionic_dev_info_get,
+	.dev_supported_ptypes_get = ionic_dev_supported_ptypes_get,
 	.dev_configure          = ionic_dev_configure,
 	.mtu_set                = ionic_dev_mtu_set,
 	.dev_start              = ionic_dev_start,
drivers/net/ionic/ionic_rxtx.c +19 -0
index 134589b016..24fd8fcf04 100644
@@ -850,6 +850,25 @@ static const uint32_t ionic_ptype_table[IONIC_RXQ_COMP_PKT_TYPE_MASK]
 		RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_UDP,
 };
 
+const uint32_t *
+ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
+{
+	/* See ionic_ptype_table[] */
+	static const uint32_t ptypes[] = {
+		RTE_PTYPE_L2_ETHER,
+		RTE_PTYPE_L2_ETHER_TIMESYNC,
+		RTE_PTYPE_L2_ETHER_LLDP,
+		RTE_PTYPE_L2_ETHER_ARP,
+		RTE_PTYPE_L3_IPV4,
+		RTE_PTYPE_L3_IPV6,
+		RTE_PTYPE_L4_TCP,
+		RTE_PTYPE_L4_UDP,
+		RTE_PTYPE_UNKNOWN
+	};
+
+	return ptypes;
+}
+
 /*
  * Cleans one descriptor. Connects the filled mbufs into a chain.
  * Does not advance the tail index.
drivers/net/ionic/ionic_rxtx.h +2 -0
index 79ec1112de..de51f21012 100644
@@ -40,4 +40,6 @@ void ionic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 void ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	struct rte_eth_txq_info *qinfo);
 
+const uint32_t *ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev);
+
 #endif /* _IONIC_RXTX_H_ */
Signature · 1 line
2.17.1
#93 lore raw

PATCH 26/35 net/ionic: add Rx descriptor status functions

In reply to Andrew Boyer

These may be useful for clients.

---
 doc/guides/nics/features/ionic.ini     |  1 +
 doc/guides/rel_notes/release_22_11.rst |  1 +
 drivers/net/ionic/ionic_ethdev.c       |  2 ++
 drivers/net/ionic/ionic_rxtx.c         | 39 ++++++++++++++++++++++++++
 drivers/net/ionic/ionic_rxtx.h         |  2 ++
 5 files changed, 45 insertions(+)
doc/guides/nics/features/ionic.ini +1 -0
index 77947bfd22..e01ba87135 100644
@@ -27,6 +27,7 @@ CRC offload          = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 Packet type parsing  = Y
+Rx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/rel_notes/release_22_11.rst +1 -0
index 5c3bd15e55..d2e82979e6 100644
@@ -86,6 +86,7 @@ New Features
   * Enhanced data path to provide substantial performance improvements.
   * Added support for mbuf fast free.
   * Added support for advertising packet types.
+  * Added support for descriptor status functions.
 
 Removed Items
 -------------
drivers/net/ionic/ionic_ethdev.c +2 -0
index 39bbe60d79..7ac7006d88 100644
@@ -984,6 +984,8 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 	eth_dev->tx_pkt_burst = &ionic_xmit_pkts;
 	eth_dev->tx_pkt_prepare = &ionic_prep_pkts;
 
+	eth_dev->rx_descriptor_status = ionic_dev_rx_descriptor_status;
+
 	/* Multi-process not supported, primary does initialization anyway */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
drivers/net/ionic/ionic_rxtx.c +39 -0
index 24fd8fcf04..64cbbd9815 100644
@@ -1235,3 +1235,42 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 	return rx_svc.nb_rx;
 }
+
+int
+ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset)
+{
+	struct ionic_rx_qcq *rxq = rx_queue;
+	struct ionic_qcq *qcq = &rxq->qcq;
+	struct ionic_rxq_comp *cq_desc;
+	uint16_t mask, head, tail, pos;
+	bool done_color;
+
+	mask = qcq->q.size_mask;
+
+	/* offset must be within the size of the ring */
+	if (offset > mask)
+		return -EINVAL;
+
+	head = qcq->q.head_idx;
+	tail = qcq->q.tail_idx;
+
+	/* offset is beyond what is posted */
+	if (offset >= ((head - tail) & mask))
+		return RTE_ETH_RX_DESC_UNAVAIL;
+
+	/* interested in this absolute position in the rxq */
+	pos = (tail + offset) & mask;
+
+	/* rx cq position == rx q position */
+	cq_desc = qcq->cq.base;
+	cq_desc = &cq_desc[pos];
+
+	/* expected done color at this position */
+	done_color = qcq->cq.done_color != (pos < tail);
+
+	/* has the hw indicated the done color at this position? */
+	if (color_match(cq_desc->pkt_type_color, done_color))
+		return RTE_ETH_RX_DESC_DONE;
+
+	return RTE_ETH_RX_DESC_AVAIL;
+}
drivers/net/ionic/ionic_rxtx.h +2 -0
index de51f21012..465001a063 100644
@@ -40,6 +40,8 @@ void ionic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 void ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	struct rte_eth_txq_info *qinfo);
 
+int ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+
 const uint32_t *ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 
 #endif /* _IONIC_RXTX_H_ */
Signature · 1 line
2.17.1
#94 lore raw

PATCH 26/35 net/ionic: add Rx descriptor status functions

In reply to Andrew Boyer

These may be useful for clients.

---
 doc/guides/nics/features/ionic.ini     |  1 +
 doc/guides/rel_notes/release_22_11.rst |  1 +
 drivers/net/ionic/ionic_ethdev.c       |  2 ++
 drivers/net/ionic/ionic_rxtx.c         | 39 ++++++++++++++++++++++++++
 drivers/net/ionic/ionic_rxtx.h         |  2 ++
 5 files changed, 45 insertions(+)
doc/guides/nics/features/ionic.ini +1 -0
index 77947bfd22..e01ba87135 100644
@@ -27,6 +27,7 @@ CRC offload          = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 Packet type parsing  = Y
+Rx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
doc/guides/rel_notes/release_22_11.rst +1 -0
index 2b62310e06..d8a97f8ef2 100644
@@ -167,6 +167,7 @@ New Features
   * Enhanced data path to provide substantial performance improvements.
   * Added support for mbuf fast free.
   * Added support for advertising packet types.
+  * Added support for descriptor status functions.
 
 * **Added support for MACsec in rte_security.**
 
drivers/net/ionic/ionic_ethdev.c +2 -0
index 39bbe60d79..7ac7006d88 100644
@@ -984,6 +984,8 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 	eth_dev->tx_pkt_burst = &ionic_xmit_pkts;
 	eth_dev->tx_pkt_prepare = &ionic_prep_pkts;
 
+	eth_dev->rx_descriptor_status = ionic_dev_rx_descriptor_status;
+
 	/* Multi-process not supported, primary does initialization anyway */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
drivers/net/ionic/ionic_rxtx.c +39 -0
index 24fd8fcf04..64cbbd9815 100644
@@ -1235,3 +1235,42 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 	return rx_svc.nb_rx;
 }
+
+int
+ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset)
+{
+	struct ionic_rx_qcq *rxq = rx_queue;
+	struct ionic_qcq *qcq = &rxq->qcq;
+	struct ionic_rxq_comp *cq_desc;
+	uint16_t mask, head, tail, pos;
+	bool done_color;
+
+	mask = qcq->q.size_mask;
+
+	/* offset must be within the size of the ring */
+	if (offset > mask)
+		return -EINVAL;
+
+	head = qcq->q.head_idx;
+	tail = qcq->q.tail_idx;
+
+	/* offset is beyond what is posted */
+	if (offset >= ((head - tail) & mask))
+		return RTE_ETH_RX_DESC_UNAVAIL;
+
+	/* interested in this absolute position in the rxq */
+	pos = (tail + offset) & mask;
+
+	/* rx cq position == rx q position */
+	cq_desc = qcq->cq.base;
+	cq_desc = &cq_desc[pos];
+
+	/* expected done color at this position */
+	done_color = qcq->cq.done_color != (pos < tail);
+
+	/* has the hw indicated the done color at this position? */
+	if (color_match(cq_desc->pkt_type_color, done_color))
+		return RTE_ETH_RX_DESC_DONE;
+
+	return RTE_ETH_RX_DESC_AVAIL;
+}
drivers/net/ionic/ionic_rxtx.h +2 -0
index de51f21012..465001a063 100644
@@ -40,6 +40,8 @@ void ionic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 void ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	struct rte_eth_txq_info *qinfo);
 
+int ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+
 const uint32_t *ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 
 #endif /* _IONIC_RXTX_H_ */
Signature · 1 line
2.17.1
#95 lore raw

PATCH 27/35 net/ionic: add Tx descriptor status function

In reply to Andrew Boyer

This may be useful for clients.

---
 doc/guides/nics/features/ionic.ini |  1 +
 drivers/net/ionic/ionic_ethdev.c   |  1 +
 drivers/net/ionic/ionic_rxtx.c     | 51 ++++++++++++++++++++++++++++++
 drivers/net/ionic/ionic_rxtx.h     |  1 +
 4 files changed, 54 insertions(+)
doc/guides/nics/features/ionic.ini +1 -0
index e01ba87135..af0fc5462a 100644
@@ -28,6 +28,7 @@ L3 checksum offload  = Y
 L4 checksum offload  = Y
 Packet type parsing  = Y
 Rx descriptor status = Y
+Tx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
drivers/net/ionic/ionic_ethdev.c +1 -0
index 7ac7006d88..cf74600f22 100644
@@ -985,6 +985,7 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 	eth_dev->tx_pkt_prepare = &ionic_prep_pkts;
 
 	eth_dev->rx_descriptor_status = ionic_dev_rx_descriptor_status;
+	eth_dev->tx_descriptor_status = ionic_dev_tx_descriptor_status;
 
 	/* Multi-process not supported, primary does initialization anyway */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
drivers/net/ionic/ionic_rxtx.c +51 -0

54 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx.h +1 -0
index 465001a063..f950d6472c 100644
@@ -41,6 +41,7 @@ void ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	struct rte_eth_txq_info *qinfo);
 
 int ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+int ionic_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
 
 const uint32_t *ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 
Signature · 1 line
2.17.1
#96 lore raw

PATCH 27/35 net/ionic: add Tx descriptor status function

In reply to Andrew Boyer

This may be useful for clients.

---
 doc/guides/nics/features/ionic.ini |  1 +
 drivers/net/ionic/ionic_ethdev.c   |  1 +
 drivers/net/ionic/ionic_rxtx.c     | 51 ++++++++++++++++++++++++++++++
 drivers/net/ionic/ionic_rxtx.h     |  1 +
 4 files changed, 54 insertions(+)
doc/guides/nics/features/ionic.ini +1 -0
index e01ba87135..af0fc5462a 100644
@@ -28,6 +28,7 @@ L3 checksum offload  = Y
 L4 checksum offload  = Y
 Packet type parsing  = Y
 Rx descriptor status = Y
+Tx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
drivers/net/ionic/ionic_ethdev.c +1 -0
index 7ac7006d88..cf74600f22 100644
@@ -985,6 +985,7 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 	eth_dev->tx_pkt_prepare = &ionic_prep_pkts;
 
 	eth_dev->rx_descriptor_status = ionic_dev_rx_descriptor_status;
+	eth_dev->tx_descriptor_status = ionic_dev_tx_descriptor_status;
 
 	/* Multi-process not supported, primary does initialization anyway */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
drivers/net/ionic/ionic_rxtx.c +51 -0

54 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx.h +1 -0
index 465001a063..f950d6472c 100644
@@ -41,6 +41,7 @@ void ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	struct rte_eth_txq_info *qinfo);
 
 int ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+int ionic_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
 
 const uint32_t *ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 
Signature · 1 line
2.17.1
#97 lore raw

PATCH 28/35 net/ionic: add Q-in-CMB option controlled by devarg

In reply to Andrew Boyer

When 'ionic_cmb' is set to '1', queue memory will be allocated from the device's onboard memory (Controller Memory Buffer). In some configurations, this will dramatically reduce packet latency and increase PPS.

Add the WC_ACTIVATE flag to the PCI driver flags. Write combining must be enabled to achieve the maximum PPS.

When the queue is in the CMB, descriptors cannot be prefetched.

---
 doc/guides/nics/ionic.rst              | 12 ++++++
 doc/guides/rel_notes/release_22_11.rst |  1 +
 drivers/net/ionic/ionic.h              |  5 +++
 drivers/net/ionic/ionic_dev.h          |  3 ++
 drivers/net/ionic/ionic_dev_pci.c      | 60 +++++++++++++++++++++++++-
 drivers/net/ionic/ionic_ethdev.c       |  9 ++++
 drivers/net/ionic/ionic_lif.c          | 38 ++++++++++++++++
 drivers/net/ionic/ionic_lif.h          |  2 +
 drivers/net/ionic/ionic_rxtx.c         |  9 ++--
 9 files changed, 135 insertions(+), 4 deletions(-)
doc/guides/nics/ionic.rst +12 -0
index 24b57fc0f5..2713771e4f 100644
@@ -32,6 +32,18 @@ The ionic PMD requires firmware which supports 16 segment transmit SGLs.
 This support was added prior to version 1.0. For help upgrading older versions,
 please contact AMD Pensando support.
 
+Runtime Configuration
+---------------------
+
+- ``Queue in CMB support`` (default ``0``)
+
+  Queue memory can be allocated from the Controller Memory Buffer (CMB) using
+  the ``ionic_cmb`` ``devargs`` parameter.
+
+  For example::
+
+    -a 0000:b5:00.0,ionic_cmb=1
+
 Building DPDK
 -------------
 
doc/guides/rel_notes/release_22_11.rst +1 -0
index d2e82979e6..974400d0a6 100644
@@ -87,6 +87,7 @@ New Features
   * Added support for mbuf fast free.
   * Added support for advertising packet types.
   * Added support for descriptor status functions.
+  * Added Q-in-CMB feature controlled by devarg ionic_cmb.
 
 Removed Items
 -------------
drivers/net/ionic/ionic.h +5 -0
index 6bfab623f7..1a38e01bc9 100644
@@ -24,6 +24,9 @@
 #define IONIC_DEV_ID_ETH_VF		0x1003
 #define IONIC_DEV_ID_ETH_MGMT		0x1004
 
+/* Devargs */
+#define PMD_IONIC_CMB_KVARG		"ionic_cmb"
+
 enum ionic_mac_type {
 	IONIC_MAC_UNKNOWN = 0,
 	IONIC_MAC_CAPRI,
@@ -62,9 +65,11 @@ struct ionic_adapter {
 	uint32_t link_speed;
 	uint32_t nintrs;
 	bool intrs[IONIC_INTR_CTRL_REGS_MAX];
+	bool q_in_cmb;
 	bool link_up;
 	char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN];
 	void *bus_dev;
+	uint64_t cmb_offset;
 };
 
 /** ionic_admin_ctx - Admin command context.
drivers/net/ionic/ionic_dev.h +3 -0
index 6a80ebc71b..6b0540f615 100644
@@ -176,9 +176,12 @@ struct ionic_adapter;
 struct ionic_qcq;
 struct rte_mempool;
 struct rte_eth_dev;
+struct rte_devargs;
 
 struct ionic_dev_intf {
 	int  (*setup)(struct ionic_adapter *adapter);
+	int  (*devargs)(struct ionic_adapter *adapter,
+			struct rte_devargs *devargs);
 	void (*copy_bus_info)(struct ionic_adapter *adapter,
 			struct rte_eth_dev *eth_dev);
 	int  (*configure_intr)(struct ionic_adapter *adapter);
drivers/net/ionic/ionic_dev_pci.c +59 -1

87 lines not on this page · raw message

drivers/net/ionic/ionic_ethdev.c +9 -0
index cf74600f22..a6e7c7fa9f 100644
@@ -1118,6 +1118,15 @@ eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev,
 
 	adapter->intf = intf;
 
+	/* Parse device arguments */
+	if (adapter->intf->devargs) {
+		err = (*adapter->intf->devargs)(adapter, rte_dev->devargs);
+		if (err) {
+			IONIC_PRINT(ERR, "Cannot parse device arguments");
+			goto err_free_adapter;
+		}
+	}
+
 	/* Discover ionic dev resources */
 	err = ionic_setup(adapter);
 	if (err) {
drivers/net/ionic/ionic_lif.c +38 -0
index ac9b69fc70..bb107b30e9 100644
@@ -660,6 +660,21 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 		ionic_q_sg_map(&new->q, sg_base, sg_base_pa);
 	}
 
+	if (flags & IONIC_QCQ_F_CMB) {
+		/* alloc descriptor ring from nic memory */
+		if (lif->adapter->cmb_offset + q_size >
+				lif->adapter->bars.bar[2].len) {
+			IONIC_PRINT(ERR, "Cannot reserve queue from NIC mem");
+			return -ENOMEM;
+		}
+		q_base = (void *)
+			((uintptr_t)lif->adapter->bars.bar[2].vaddr +
+			 (uintptr_t)lif->adapter->cmb_offset);
+		/* CMB PA is a relative address */
+		q_base_pa = lif->adapter->cmb_offset;
+		lif->adapter->cmb_offset += q_size;
+	}
+
 	IONIC_PRINT(DEBUG, "Q-Base-PA = %#jx CQ-Base-PA = %#jx "
 		"SG-base-PA = %#jx",
 		q_base_pa, cq_base_pa, sg_base_pa);
@@ -744,6 +759,8 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 	int err;
 
 	flags = IONIC_QCQ_F_SG;
+	if (lif->state & IONIC_LIF_F_Q_IN_CMB)
+		flags |= IONIC_QCQ_F_CMB;
 
 	seg_size = rte_pktmbuf_data_room_size(mb_pool);
 
@@ -806,6 +823,8 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 	int err;
 
 	flags = IONIC_QCQ_F_SG;
+	if (lif->state & IONIC_LIF_F_Q_IN_CMB)
+		flags |= IONIC_QCQ_F_CMB;
 
 	num_segs_fw = IONIC_TX_MAX_SG_ELEMS_V1 + 1;
 
@@ -994,6 +1013,19 @@ ionic_lif_alloc(struct ionic_lif *lif)
 		return -ENXIO;
 	}
 
+	if (adapter->q_in_cmb) {
+		if (adapter->bars.num_bars >= 3 &&
+		    lif->qtype_info[IONIC_QTYPE_RXQ].version >= 2 &&
+		    lif->qtype_info[IONIC_QTYPE_TXQ].version >= 3) {
+			IONIC_PRINT(INFO, "%s enabled on %s",
+				PMD_IONIC_CMB_KVARG, lif->name);
+			lif->state |= IONIC_LIF_F_Q_IN_CMB;
+		} else {
+			IONIC_PRINT(ERR, "%s not supported on %s, disabled",
+				PMD_IONIC_CMB_KVARG, lif->name);
+		}
+	}
+
 	IONIC_PRINT(DEBUG, "Allocating Lif Info");
 
 	rte_spinlock_init(&lif->adminq_lock);
@@ -1537,6 +1569,9 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq)
 	};
 	int err;
 
+	if (txq->flags & IONIC_QCQ_F_CMB)
+		ctx.cmd.q_init.flags |= rte_cpu_to_le_16(IONIC_QINIT_F_CMB);
+
 	IONIC_PRINT(DEBUG, "txq_init.index %d", q->index);
 	IONIC_PRINT(DEBUG, "txq_init.ring_base 0x%" PRIx64 "", q->base_pa);
 	IONIC_PRINT(DEBUG, "txq_init.ring_size %d",
@@ -1588,6 +1623,9 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq)
 	};
 	int err;
 
+	if (rxq->flags & IONIC_QCQ_F_CMB)
+		ctx.cmd.q_init.flags |= rte_cpu_to_le_16(IONIC_QINIT_F_CMB);
+
 	IONIC_PRINT(DEBUG, "rxq_init.index %d", q->index);
 	IONIC_PRINT(DEBUG, "rxq_init.ring_base 0x%" PRIx64 "", q->base_pa);
 	IONIC_PRINT(DEBUG, "rxq_init.ring_size %d",
drivers/net/ionic/ionic_lif.h +2 -0
index 5231909213..ec9cb24a61 100644
@@ -49,6 +49,7 @@ 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_CMB		BIT(5)
 #define IONIC_QCQ_F_CSUM_L3	BIT(7)
 #define IONIC_QCQ_F_CSUM_UDP	BIT(8)
 #define IONIC_QCQ_F_CSUM_TCP	BIT(9)
@@ -126,6 +127,7 @@ struct ionic_qtype_info {
 #define IONIC_LIF_F_LINK_CHECK_NEEDED	BIT(1)
 #define IONIC_LIF_F_UP			BIT(2)
 #define IONIC_LIF_F_FW_RESET		BIT(3)
+#define IONIC_LIF_F_Q_IN_CMB		BIT(4)
 
 #define IONIC_LIF_NAME_MAX_SZ		(32)
 
drivers/net/ionic/ionic_rxtx.c +6 -3
index 4f84fa7df1..fceb8333f6 100644
@@ -600,7 +600,8 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	int err;
 
 	struct ionic_txq_desc *desc_base = q->base;
-	rte_prefetch0(&desc_base[q->head_idx]);
+	if (!(txq->flags & IONIC_QCQ_F_CMB))
+		rte_prefetch0(&desc_base[q->head_idx]);
 	rte_prefetch0(IONIC_INFO_PTR(q, q->head_idx));
 
 	if (tx_pkts) {
@@ -619,7 +620,8 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	while (nb_tx < nb_pkts) {
 		uint16_t next_idx = Q_NEXT_TO_POST(q, 1);
-		rte_prefetch0(&desc_base[next_idx]);
+		if (!(txq->flags & IONIC_QCQ_F_CMB))
+			rte_prefetch0(&desc_base[next_idx]);
 		rte_prefetch0(IONIC_INFO_PTR(q, next_idx));
 
 		if (nb_tx + 1 < nb_pkts) {
@@ -1172,7 +1174,8 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,
 		/* Prefetch 4 x 16B comp */
 		rte_prefetch0(&cq_desc_base[Q_NEXT_TO_SRVC(cq, 4)]);
 		/* Prefetch 4 x 16B descriptors */
-		rte_prefetch0(&q_desc_base[Q_NEXT_TO_POST(q, 4)]);
+		if (!(rxq->flags & IONIC_QCQ_F_CMB))
+			rte_prefetch0(&q_desc_base[Q_NEXT_TO_POST(q, 4)]);
 
 		ionic_rx_clean_one(rxq, cq_desc, rx_svc);
 
Signature · 1 line
2.17.1
#98 lore raw

PATCH 28/35 net/ionic: add Q-in-CMB option controlled by devarg

In reply to Andrew Boyer

When 'ionic_cmb' is set to '1', queue memory will be allocated from the device's onboard memory (Controller Memory Buffer). In some configurations, this will dramatically reduce packet latency and increase PPS.

Add the WC_ACTIVATE flag to the PCI driver flags. Write combining must be enabled to achieve the maximum PPS.

When the queue is in the CMB, descriptors cannot be prefetched.

---
 doc/guides/nics/ionic.rst              | 12 ++++++
 doc/guides/rel_notes/release_22_11.rst |  1 +
 drivers/net/ionic/ionic.h              |  5 +++
 drivers/net/ionic/ionic_dev.h          |  3 ++
 drivers/net/ionic/ionic_dev_pci.c      | 60 +++++++++++++++++++++++++-
 drivers/net/ionic/ionic_ethdev.c       |  9 ++++
 drivers/net/ionic/ionic_lif.c          | 38 ++++++++++++++++
 drivers/net/ionic/ionic_lif.h          |  2 +
 drivers/net/ionic/ionic_rxtx.c         |  9 ++--
 9 files changed, 135 insertions(+), 4 deletions(-)
doc/guides/nics/ionic.rst +12 -0
index be13955a82..f841041fb5 100644
@@ -32,6 +32,18 @@ The ionic PMD requires firmware which supports 16 segment transmit SGLs.
 This support was added prior to version 1.0. For help upgrading older versions,
 please contact AMD Pensando support.
 
+Runtime Configuration
+---------------------
+
+- ``Queue in CMB support`` (default ``0``)
+
+  Queue memory can be allocated from the Controller Memory Buffer (CMB) using
+  the ``ionic_cmb`` ``devargs`` parameter.
+
+  For example::
+
+    -a 0000:b5:00.0,ionic_cmb=1
+
 Building DPDK
 -------------
 
doc/guides/rel_notes/release_22_11.rst +1 -0
index d8a97f8ef2..929b23ee8c 100644
@@ -168,6 +168,7 @@ New Features
   * Added support for mbuf fast free.
   * Added support for advertising packet types.
   * Added support for descriptor status functions.
+  * Added Q-in-CMB feature controlled by devarg ionic_cmb.
 
 * **Added support for MACsec in rte_security.**
 
drivers/net/ionic/ionic.h +5 -0
index 6bfab623f7..1a38e01bc9 100644
@@ -24,6 +24,9 @@
 #define IONIC_DEV_ID_ETH_VF		0x1003
 #define IONIC_DEV_ID_ETH_MGMT		0x1004
 
+/* Devargs */
+#define PMD_IONIC_CMB_KVARG		"ionic_cmb"
+
 enum ionic_mac_type {
 	IONIC_MAC_UNKNOWN = 0,
 	IONIC_MAC_CAPRI,
@@ -62,9 +65,11 @@ struct ionic_adapter {
 	uint32_t link_speed;
 	uint32_t nintrs;
 	bool intrs[IONIC_INTR_CTRL_REGS_MAX];
+	bool q_in_cmb;
 	bool link_up;
 	char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN];
 	void *bus_dev;
+	uint64_t cmb_offset;
 };
 
 /** ionic_admin_ctx - Admin command context.
drivers/net/ionic/ionic_dev.h +3 -0
index 6a80ebc71b..6b0540f615 100644
@@ -176,9 +176,12 @@ struct ionic_adapter;
 struct ionic_qcq;
 struct rte_mempool;
 struct rte_eth_dev;
+struct rte_devargs;
 
 struct ionic_dev_intf {
 	int  (*setup)(struct ionic_adapter *adapter);
+	int  (*devargs)(struct ionic_adapter *adapter,
+			struct rte_devargs *devargs);
 	void (*copy_bus_info)(struct ionic_adapter *adapter,
 			struct rte_eth_dev *eth_dev);
 	int  (*configure_intr)(struct ionic_adapter *adapter);
drivers/net/ionic/ionic_dev_pci.c +59 -1

87 lines not on this page · raw message

drivers/net/ionic/ionic_ethdev.c +9 -0
index cf74600f22..a6e7c7fa9f 100644
@@ -1118,6 +1118,15 @@ eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev,
 
 	adapter->intf = intf;
 
+	/* Parse device arguments */
+	if (adapter->intf->devargs) {
+		err = (*adapter->intf->devargs)(adapter, rte_dev->devargs);
+		if (err) {
+			IONIC_PRINT(ERR, "Cannot parse device arguments");
+			goto err_free_adapter;
+		}
+	}
+
 	/* Discover ionic dev resources */
 	err = ionic_setup(adapter);
 	if (err) {
drivers/net/ionic/ionic_lif.c +38 -0
index ac9b69fc70..bb107b30e9 100644
@@ -660,6 +660,21 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 		ionic_q_sg_map(&new->q, sg_base, sg_base_pa);
 	}
 
+	if (flags & IONIC_QCQ_F_CMB) {
+		/* alloc descriptor ring from nic memory */
+		if (lif->adapter->cmb_offset + q_size >
+				lif->adapter->bars.bar[2].len) {
+			IONIC_PRINT(ERR, "Cannot reserve queue from NIC mem");
+			return -ENOMEM;
+		}
+		q_base = (void *)
+			((uintptr_t)lif->adapter->bars.bar[2].vaddr +
+			 (uintptr_t)lif->adapter->cmb_offset);
+		/* CMB PA is a relative address */
+		q_base_pa = lif->adapter->cmb_offset;
+		lif->adapter->cmb_offset += q_size;
+	}
+
 	IONIC_PRINT(DEBUG, "Q-Base-PA = %#jx CQ-Base-PA = %#jx "
 		"SG-base-PA = %#jx",
 		q_base_pa, cq_base_pa, sg_base_pa);
@@ -744,6 +759,8 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 	int err;
 
 	flags = IONIC_QCQ_F_SG;
+	if (lif->state & IONIC_LIF_F_Q_IN_CMB)
+		flags |= IONIC_QCQ_F_CMB;
 
 	seg_size = rte_pktmbuf_data_room_size(mb_pool);
 
@@ -806,6 +823,8 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index,
 	int err;
 
 	flags = IONIC_QCQ_F_SG;
+	if (lif->state & IONIC_LIF_F_Q_IN_CMB)
+		flags |= IONIC_QCQ_F_CMB;
 
 	num_segs_fw = IONIC_TX_MAX_SG_ELEMS_V1 + 1;
 
@@ -994,6 +1013,19 @@ ionic_lif_alloc(struct ionic_lif *lif)
 		return -ENXIO;
 	}
 
+	if (adapter->q_in_cmb) {
+		if (adapter->bars.num_bars >= 3 &&
+		    lif->qtype_info[IONIC_QTYPE_RXQ].version >= 2 &&
+		    lif->qtype_info[IONIC_QTYPE_TXQ].version >= 3) {
+			IONIC_PRINT(INFO, "%s enabled on %s",
+				PMD_IONIC_CMB_KVARG, lif->name);
+			lif->state |= IONIC_LIF_F_Q_IN_CMB;
+		} else {
+			IONIC_PRINT(ERR, "%s not supported on %s, disabled",
+				PMD_IONIC_CMB_KVARG, lif->name);
+		}
+	}
+
 	IONIC_PRINT(DEBUG, "Allocating Lif Info");
 
 	rte_spinlock_init(&lif->adminq_lock);
@@ -1537,6 +1569,9 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq)
 	};
 	int err;
 
+	if (txq->flags & IONIC_QCQ_F_CMB)
+		ctx.cmd.q_init.flags |= rte_cpu_to_le_16(IONIC_QINIT_F_CMB);
+
 	IONIC_PRINT(DEBUG, "txq_init.index %d", q->index);
 	IONIC_PRINT(DEBUG, "txq_init.ring_base 0x%" PRIx64 "", q->base_pa);
 	IONIC_PRINT(DEBUG, "txq_init.ring_size %d",
@@ -1588,6 +1623,9 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq)
 	};
 	int err;
 
+	if (rxq->flags & IONIC_QCQ_F_CMB)
+		ctx.cmd.q_init.flags |= rte_cpu_to_le_16(IONIC_QINIT_F_CMB);
+
 	IONIC_PRINT(DEBUG, "rxq_init.index %d", q->index);
 	IONIC_PRINT(DEBUG, "rxq_init.ring_base 0x%" PRIx64 "", q->base_pa);
 	IONIC_PRINT(DEBUG, "rxq_init.ring_size %d",
drivers/net/ionic/ionic_lif.h +2 -0
index 5231909213..ec9cb24a61 100644
@@ -49,6 +49,7 @@ 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_CMB		BIT(5)
 #define IONIC_QCQ_F_CSUM_L3	BIT(7)
 #define IONIC_QCQ_F_CSUM_UDP	BIT(8)
 #define IONIC_QCQ_F_CSUM_TCP	BIT(9)
@@ -126,6 +127,7 @@ struct ionic_qtype_info {
 #define IONIC_LIF_F_LINK_CHECK_NEEDED	BIT(1)
 #define IONIC_LIF_F_UP			BIT(2)
 #define IONIC_LIF_F_FW_RESET		BIT(3)
+#define IONIC_LIF_F_Q_IN_CMB		BIT(4)
 
 #define IONIC_LIF_NAME_MAX_SZ		(32)
 
drivers/net/ionic/ionic_rxtx.c +6 -3
index 4f84fa7df1..fceb8333f6 100644
@@ -600,7 +600,8 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	int err;
 
 	struct ionic_txq_desc *desc_base = q->base;
-	rte_prefetch0(&desc_base[q->head_idx]);
+	if (!(txq->flags & IONIC_QCQ_F_CMB))
+		rte_prefetch0(&desc_base[q->head_idx]);
 	rte_prefetch0(IONIC_INFO_PTR(q, q->head_idx));
 
 	if (tx_pkts) {
@@ -619,7 +620,8 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	while (nb_tx < nb_pkts) {
 		uint16_t next_idx = Q_NEXT_TO_POST(q, 1);
-		rte_prefetch0(&desc_base[next_idx]);
+		if (!(txq->flags & IONIC_QCQ_F_CMB))
+			rte_prefetch0(&desc_base[next_idx]);
 		rte_prefetch0(IONIC_INFO_PTR(q, next_idx));
 
 		if (nb_tx + 1 < nb_pkts) {
@@ -1172,7 +1174,8 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,
 		/* Prefetch 4 x 16B comp */
 		rte_prefetch0(&cq_desc_base[Q_NEXT_TO_SRVC(cq, 4)]);
 		/* Prefetch 4 x 16B descriptors */
-		rte_prefetch0(&q_desc_base[Q_NEXT_TO_POST(q, 4)]);
+		if (!(rxq->flags & IONIC_QCQ_F_CMB))
+			rte_prefetch0(&q_desc_base[Q_NEXT_TO_POST(q, 4)]);
 
 		ionic_rx_clean_one(rxq, cq_desc, rx_svc);
 
Signature · 1 line
2.17.1
#99 lore raw

PATCH 29/35 net/ionic: update array allocations to use calloc

In reply to Andrew Boyer

Use rte_calloc() where appropriate.
This makes the code clearer.

---
 drivers/net/ionic/ionic_ethdev.c |  6 +++---
 drivers/net/ionic/ionic_lif.c    | 12 ++++++------
 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/ionic/ionic_ethdev.c +3 -3
index a6e7c7fa9f..43fa5f8bbf 100644
@@ -1003,9 +1003,9 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 		adapter->max_mac_addrs);
 
 	/* Allocate memory for storing MAC addresses */
-	eth_dev->data->mac_addrs = rte_zmalloc("ionic",
-		RTE_ETHER_ADDR_LEN * adapter->max_mac_addrs, 0);
-
+	eth_dev->data->mac_addrs = rte_calloc("ionic",
+					adapter->max_mac_addrs,
+					RTE_ETHER_ADDR_LEN, 0);
 	if (eth_dev->data->mac_addrs == NULL) {
 		IONIC_PRINT(ERR, "Failed to allocate %u bytes needed to "
 			"store MAC addresses",
drivers/net/ionic/ionic_lif.c +6 -6
index bb107b30e9..fbeec8ef2e 100644
@@ -1037,17 +1037,17 @@ ionic_lif_alloc(struct ionic_lif *lif)
 		return -ENOMEM;
 	}
 
-	lif->txqcqs = rte_zmalloc("ionic", sizeof(*lif->txqcqs) *
-		adapter->max_ntxqs_per_lif, 0);
-
+	lif->txqcqs = rte_calloc("ionic",
+				adapter->max_ntxqs_per_lif,
+				sizeof(*lif->txqcqs), 0);
 	if (!lif->txqcqs) {
 		IONIC_PRINT(ERR, "Cannot allocate tx queues array");
 		return -ENOMEM;
 	}
 
-	lif->rxqcqs = rte_zmalloc("ionic", sizeof(*lif->rxqcqs) *
-		adapter->max_nrxqs_per_lif, 0);
-
+	lif->rxqcqs = rte_calloc("ionic",
+				adapter->max_nrxqs_per_lif,
+				sizeof(*lif->rxqcqs), 0);
 	if (!lif->rxqcqs) {
 		IONIC_PRINT(ERR, "Cannot allocate rx queues array");
 		return -ENOMEM;
Signature · 1 line
2.17.1
#100 lore raw

PATCH 29/35 net/ionic: update array allocations to use calloc

In reply to Andrew Boyer

Use rte_calloc() where appropriate.
This makes the code clearer.

---
 drivers/net/ionic/ionic_ethdev.c |  6 +++---
 drivers/net/ionic/ionic_lif.c    | 12 ++++++------
 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/ionic/ionic_ethdev.c +3 -3
index a6e7c7fa9f..43fa5f8bbf 100644
@@ -1003,9 +1003,9 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 		adapter->max_mac_addrs);
 
 	/* Allocate memory for storing MAC addresses */
-	eth_dev->data->mac_addrs = rte_zmalloc("ionic",
-		RTE_ETHER_ADDR_LEN * adapter->max_mac_addrs, 0);
-
+	eth_dev->data->mac_addrs = rte_calloc("ionic",
+					adapter->max_mac_addrs,
+					RTE_ETHER_ADDR_LEN, 0);
 	if (eth_dev->data->mac_addrs == NULL) {
 		IONIC_PRINT(ERR, "Failed to allocate %u bytes needed to "
 			"store MAC addresses",
drivers/net/ionic/ionic_lif.c +6 -6
index bb107b30e9..fbeec8ef2e 100644
@@ -1037,17 +1037,17 @@ ionic_lif_alloc(struct ionic_lif *lif)
 		return -ENOMEM;
 	}
 
-	lif->txqcqs = rte_zmalloc("ionic", sizeof(*lif->txqcqs) *
-		adapter->max_ntxqs_per_lif, 0);
-
+	lif->txqcqs = rte_calloc("ionic",
+				adapter->max_ntxqs_per_lif,
+				sizeof(*lif->txqcqs), 0);
 	if (!lif->txqcqs) {
 		IONIC_PRINT(ERR, "Cannot allocate tx queues array");
 		return -ENOMEM;
 	}
 
-	lif->rxqcqs = rte_zmalloc("ionic", sizeof(*lif->rxqcqs) *
-		adapter->max_nrxqs_per_lif, 0);
-
+	lif->rxqcqs = rte_calloc("ionic",
+				adapter->max_nrxqs_per_lif,
+				sizeof(*lif->rxqcqs), 0);
 	if (!lif->rxqcqs) {
 		IONIC_PRINT(ERR, "Cannot allocate rx queues array");
 		return -ENOMEM;
Signature · 1 line
2.17.1
#101 lore raw

PATCH 30/35 net/ionic: add alignment and socket info in allocations

In reply to Andrew Boyer

This will avoid memory access penalties on NUMA systems.

---
 drivers/net/ionic/ionic_ethdev.c    |  5 +++--
 drivers/net/ionic/ionic_lif.c       | 13 ++++++++-----
 drivers/net/ionic/ionic_rx_filter.c |  3 +--
 3 files changed, 12 insertions(+), 9 deletions(-)
drivers/net/ionic/ionic_ethdev.c +3 -2
index 43fa5f8bbf..36fb09b810 100644
@@ -1005,7 +1005,8 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 	/* Allocate memory for storing MAC addresses */
 	eth_dev->data->mac_addrs = rte_calloc("ionic",
 					adapter->max_mac_addrs,
-					RTE_ETHER_ADDR_LEN, 0);
+					RTE_ETHER_ADDR_LEN,
+					RTE_CACHE_LINE_SIZE);
 	if (eth_dev->data->mac_addrs == NULL) {
 		IONIC_PRINT(ERR, "Failed to allocate %u bytes needed to "
 			"store MAC addresses",
@@ -1083,7 +1084,7 @@ eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev,
 		goto err;
 	}
 
-	adapter = rte_zmalloc("ionic", sizeof(*adapter), 0);
+	adapter = rte_zmalloc("ionic", sizeof(*adapter), RTE_CACHE_LINE_SIZE);
 	if (!adapter) {
 		IONIC_PRINT(ERR, "OOM");
 		err = -ENOMEM;
drivers/net/ionic/ionic_lif.c +8 -5
index fbeec8ef2e..cf9605c791 100644
@@ -598,7 +598,8 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 		total_size += rte_mem_page_size();
 	}
 
-	new = rte_zmalloc("ionic", struct_size, 0);
+	new = rte_zmalloc_socket("ionic", struct_size,
+				RTE_CACHE_LINE_SIZE, socket_id);
 	if (!new) {
 		IONIC_PRINT(ERR, "Cannot allocate queue structure");
 		return -ENOMEM;
@@ -1037,17 +1038,19 @@ ionic_lif_alloc(struct ionic_lif *lif)
 		return -ENOMEM;
 	}
 
-	lif->txqcqs = rte_calloc("ionic",
+	lif->txqcqs = rte_calloc_socket("ionic",
 				adapter->max_ntxqs_per_lif,
-				sizeof(*lif->txqcqs), 0);
+				sizeof(*lif->txqcqs),
+				RTE_CACHE_LINE_SIZE, socket_id);
 	if (!lif->txqcqs) {
 		IONIC_PRINT(ERR, "Cannot allocate tx queues array");
 		return -ENOMEM;
 	}
 
-	lif->rxqcqs = rte_calloc("ionic",
+	lif->rxqcqs = rte_calloc_socket("ionic",
 				adapter->max_nrxqs_per_lif,
-				sizeof(*lif->rxqcqs), 0);
+				sizeof(*lif->rxqcqs),
+				RTE_CACHE_LINE_SIZE, socket_id);
 	if (!lif->rxqcqs) {
 		IONIC_PRINT(ERR, "Cannot allocate rx queues array");
 		return -ENOMEM;
drivers/net/ionic/ionic_rx_filter.c +1 -2
index fdedb9e288..5f9b569f64 100644
@@ -55,8 +55,7 @@ ionic_rx_filter_save(struct ionic_lif *lif, uint32_t flow_id,
 	struct ionic_rx_filter *f;
 	uint32_t key;
 
-	f = rte_zmalloc("ionic", sizeof(*f), 0);
-
+	f = rte_zmalloc("ionic", sizeof(*f), RTE_CACHE_LINE_SIZE);
 	if (!f)
 		return -ENOMEM;
 
Signature · 1 line
2.17.1
#102 lore raw

PATCH 30/35 net/ionic: add alignment and socket info in allocations

In reply to Andrew Boyer

This will avoid memory access penalties on NUMA systems.

---
 drivers/net/ionic/ionic_ethdev.c    |  5 +++--
 drivers/net/ionic/ionic_lif.c       | 13 ++++++++-----
 drivers/net/ionic/ionic_rx_filter.c |  3 +--
 3 files changed, 12 insertions(+), 9 deletions(-)
drivers/net/ionic/ionic_ethdev.c +3 -2
index 43fa5f8bbf..36fb09b810 100644
@@ -1005,7 +1005,8 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 	/* Allocate memory for storing MAC addresses */
 	eth_dev->data->mac_addrs = rte_calloc("ionic",
 					adapter->max_mac_addrs,
-					RTE_ETHER_ADDR_LEN, 0);
+					RTE_ETHER_ADDR_LEN,
+					RTE_CACHE_LINE_SIZE);
 	if (eth_dev->data->mac_addrs == NULL) {
 		IONIC_PRINT(ERR, "Failed to allocate %u bytes needed to "
 			"store MAC addresses",
@@ -1083,7 +1084,7 @@ eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev,
 		goto err;
 	}
 
-	adapter = rte_zmalloc("ionic", sizeof(*adapter), 0);
+	adapter = rte_zmalloc("ionic", sizeof(*adapter), RTE_CACHE_LINE_SIZE);
 	if (!adapter) {
 		IONIC_PRINT(ERR, "OOM");
 		err = -ENOMEM;
drivers/net/ionic/ionic_lif.c +8 -5
index fbeec8ef2e..cf9605c791 100644
@@ -598,7 +598,8 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 		total_size += rte_mem_page_size();
 	}
 
-	new = rte_zmalloc("ionic", struct_size, 0);
+	new = rte_zmalloc_socket("ionic", struct_size,
+				RTE_CACHE_LINE_SIZE, socket_id);
 	if (!new) {
 		IONIC_PRINT(ERR, "Cannot allocate queue structure");
 		return -ENOMEM;
@@ -1037,17 +1038,19 @@ ionic_lif_alloc(struct ionic_lif *lif)
 		return -ENOMEM;
 	}
 
-	lif->txqcqs = rte_calloc("ionic",
+	lif->txqcqs = rte_calloc_socket("ionic",
 				adapter->max_ntxqs_per_lif,
-				sizeof(*lif->txqcqs), 0);
+				sizeof(*lif->txqcqs),
+				RTE_CACHE_LINE_SIZE, socket_id);
 	if (!lif->txqcqs) {
 		IONIC_PRINT(ERR, "Cannot allocate tx queues array");
 		return -ENOMEM;
 	}
 
-	lif->rxqcqs = rte_calloc("ionic",
+	lif->rxqcqs = rte_calloc_socket("ionic",
 				adapter->max_nrxqs_per_lif,
-				sizeof(*lif->rxqcqs), 0);
+				sizeof(*lif->rxqcqs),
+				RTE_CACHE_LINE_SIZE, socket_id);
 	if (!lif->rxqcqs) {
 		IONIC_PRINT(ERR, "Cannot allocate rx queues array");
 		return -ENOMEM;
drivers/net/ionic/ionic_rx_filter.c +1 -2
index fdedb9e288..5f9b569f64 100644
@@ -55,8 +55,7 @@ ionic_rx_filter_save(struct ionic_lif *lif, uint32_t flow_id,
 	struct ionic_rx_filter *f;
 	uint32_t key;
 
-	f = rte_zmalloc("ionic", sizeof(*f), 0);
-
+	f = rte_zmalloc("ionic", sizeof(*f), RTE_CACHE_LINE_SIZE);
 	if (!f)
 		return -ENOMEM;
 
Signature · 1 line
2.17.1
#103 lore raw

PATCH 31/35 net/ionic: allow client to specify Tx free threshold

In reply to Andrew Boyer

Some clients have opinions about how often to flush the transmit ring.

The default value is the number of Tx descriptors minus the default Tx burst size.

---
 drivers/net/ionic/ionic_dev.h    |  1 +
 drivers/net/ionic/ionic_ethdev.c |  4 ++--
 drivers/net/ionic/ionic_lif.h    |  1 +
 drivers/net/ionic/ionic_rxtx.c   | 17 +++++++++++++++--
 4 files changed, 19 insertions(+), 4 deletions(-)
drivers/net/ionic/ionic_dev.h +1 -0
index 6b0540f615..d696de45e0 100644
@@ -20,6 +20,7 @@
 #define IONIC_MAX_RING_DESC		32768
 #define IONIC_MIN_RING_DESC		16
 #define IONIC_DEF_TXRX_DESC		4096
+#define IONIC_DEF_TXRX_BURST		32
 
 #define IONIC_DEVCMD_TIMEOUT		5	/* devcmd_timeout */
 #define IONIC_DEVCMD_CHECK_PERIOD_US	10	/* devcmd status chk period */
drivers/net/ionic/ionic_ethdev.c +2 -2
index 36fb09b810..28297879cf 100644
@@ -429,8 +429,8 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 	dev_info->tx_desc_lim = tx_desc_lim_v1;
 
 	/* Driver-preferred Rx/Tx parameters */
-	dev_info->default_rxportconf.burst_size = 32;
-	dev_info->default_txportconf.burst_size = 32;
+	dev_info->default_rxportconf.burst_size = IONIC_DEF_TXRX_BURST;
+	dev_info->default_txportconf.burst_size = IONIC_DEF_TXRX_BURST;
 	dev_info->default_rxportconf.nb_queues = 1;
 	dev_info->default_txportconf.nb_queues = 1;
 	dev_info->default_rxportconf.ring_size = IONIC_DEF_TXRX_DESC;
drivers/net/ionic/ionic_lif.h +1 -0
index ec9cb24a61..e4af138a51 100644
@@ -104,6 +104,7 @@ struct ionic_tx_qcq {
 
 	/* cacheline2 */
 	uint16_t num_segs_fw;	/* # segs supported by current FW */
+	uint16_t free_thresh;
 	uint16_t flags;
 
 	struct ionic_tx_stats stats;
drivers/net/ionic/ionic_rxtx.c +15 -2
index fceb8333f6..9a346f4143 100644
@@ -223,6 +223,13 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id,
 	if (!rte_is_power_of_2(nb_desc) || nb_desc < IONIC_MIN_RING_DESC)
 		return -EINVAL; /* or use IONIC_DEFAULT_RING_DESC */
 
+	if (tx_conf->tx_free_thresh > nb_desc) {
+		IONIC_PRINT(ERR,
+			"tx_free_thresh must be less than nb_desc (%u)",
+			nb_desc);
+		return -EINVAL;
+	}
+
 	/* Free memory prior to re-allocation if needed... */
 	if (eth_dev->data->tx_queues[tx_queue_id] != NULL) {
 		ionic_dev_tx_queue_release(eth_dev, tx_queue_id);
@@ -252,6 +259,10 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id,
 	if (offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
 		txq->flags |= IONIC_QCQ_F_FAST_FREE;
 
+	txq->free_thresh =
+		tx_conf->tx_free_thresh ? tx_conf->tx_free_thresh :
+		nb_desc - IONIC_DEF_TXRX_BURST;
+
 	eth_dev->data->tx_queues[tx_queue_id] = txq;
 
 	return 0;
@@ -609,8 +620,10 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		rte_mbuf_prefetch_part2(tx_pkts[0]);
 	}
 
-	/* Cleaning old buffers */
-	ionic_tx_flush(txq);
+	if (unlikely(ionic_q_space_avail(q) < txq->free_thresh)) {
+		/* Cleaning old buffers */
+		ionic_tx_flush(txq);
+	}
 
 	nb_avail = ionic_q_space_avail(q);
 	if (unlikely(nb_avail < nb_pkts)) {
Signature · 1 line
2.17.1
#104 lore raw

PATCH 31/35 net/ionic: allow client to specify Tx free threshold

In reply to Andrew Boyer

Some clients have opinions about how often to flush the transmit ring.

The default value is the number of Tx descriptors minus the default Tx burst size.

---
 drivers/net/ionic/ionic_dev.h    |  1 +
 drivers/net/ionic/ionic_ethdev.c |  4 ++--
 drivers/net/ionic/ionic_lif.h    |  1 +
 drivers/net/ionic/ionic_rxtx.c   | 17 +++++++++++++++--
 4 files changed, 19 insertions(+), 4 deletions(-)
drivers/net/ionic/ionic_dev.h +1 -0
index 6b0540f615..d696de45e0 100644
@@ -20,6 +20,7 @@
 #define IONIC_MAX_RING_DESC		32768
 #define IONIC_MIN_RING_DESC		16
 #define IONIC_DEF_TXRX_DESC		4096
+#define IONIC_DEF_TXRX_BURST		32
 
 #define IONIC_DEVCMD_TIMEOUT		5	/* devcmd_timeout */
 #define IONIC_DEVCMD_CHECK_PERIOD_US	10	/* devcmd status chk period */
drivers/net/ionic/ionic_ethdev.c +2 -2
index 36fb09b810..28297879cf 100644
@@ -429,8 +429,8 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 	dev_info->tx_desc_lim = tx_desc_lim_v1;
 
 	/* Driver-preferred Rx/Tx parameters */
-	dev_info->default_rxportconf.burst_size = 32;
-	dev_info->default_txportconf.burst_size = 32;
+	dev_info->default_rxportconf.burst_size = IONIC_DEF_TXRX_BURST;
+	dev_info->default_txportconf.burst_size = IONIC_DEF_TXRX_BURST;
 	dev_info->default_rxportconf.nb_queues = 1;
 	dev_info->default_txportconf.nb_queues = 1;
 	dev_info->default_rxportconf.ring_size = IONIC_DEF_TXRX_DESC;
drivers/net/ionic/ionic_lif.h +1 -0
index ec9cb24a61..e4af138a51 100644
@@ -104,6 +104,7 @@ struct ionic_tx_qcq {
 
 	/* cacheline2 */
 	uint16_t num_segs_fw;	/* # segs supported by current FW */
+	uint16_t free_thresh;
 	uint16_t flags;
 
 	struct ionic_tx_stats stats;
drivers/net/ionic/ionic_rxtx.c +15 -2
index fceb8333f6..9a346f4143 100644
@@ -223,6 +223,13 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id,
 	if (!rte_is_power_of_2(nb_desc) || nb_desc < IONIC_MIN_RING_DESC)
 		return -EINVAL; /* or use IONIC_DEFAULT_RING_DESC */
 
+	if (tx_conf->tx_free_thresh > nb_desc) {
+		IONIC_PRINT(ERR,
+			"tx_free_thresh must be less than nb_desc (%u)",
+			nb_desc);
+		return -EINVAL;
+	}
+
 	/* Free memory prior to re-allocation if needed... */
 	if (eth_dev->data->tx_queues[tx_queue_id] != NULL) {
 		ionic_dev_tx_queue_release(eth_dev, tx_queue_id);
@@ -252,6 +259,10 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id,
 	if (offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
 		txq->flags |= IONIC_QCQ_F_FAST_FREE;
 
+	txq->free_thresh =
+		tx_conf->tx_free_thresh ? tx_conf->tx_free_thresh :
+		nb_desc - IONIC_DEF_TXRX_BURST;
+
 	eth_dev->data->tx_queues[tx_queue_id] = txq;
 
 	return 0;
@@ -609,8 +620,10 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		rte_mbuf_prefetch_part2(tx_pkts[0]);
 	}
 
-	/* Cleaning old buffers */
-	ionic_tx_flush(txq);
+	if (unlikely(ionic_q_space_avail(q) < txq->free_thresh)) {
+		/* Cleaning old buffers */
+		ionic_tx_flush(txq);
+	}
 
 	nb_avail = ionic_q_space_avail(q);
 	if (unlikely(nb_avail < nb_pkts)) {
Signature · 1 line
2.17.1
#105 lore raw

PATCH 32/35 net/ionic: add optimized handlers for non-scattered Rx/Tx

In reply to Andrew Boyer

The code is very similar, but the simple case can skip a few branches in the hot path. This improves PPS when 10KB mbufs are used.

S/G is enabled on the Rx side by offload DEV_RX_OFFLOAD_SCATTER. S/G is enabled on the Tx side by offload DEV_TX_OFFLOAD_MULTI_SEGS.

S/G is automatically enabled on the Rx side if the provided mbufs are too small to hold the maximum possible frame.

To enable S/G in testpmd, add these args:
--rx-offloads=0x2000 --tx-offloads=0x8000

---
 doc/guides/rel_notes/release_22_11.rst |   1 +
 drivers/net/ionic/ionic_ethdev.c       |  25 +-
 drivers/net/ionic/ionic_lif.c          |  61 ++-
 drivers/net/ionic/ionic_lif.h          |   1 +
 drivers/net/ionic/ionic_rxtx.c         | 576 ++-----------------------
 drivers/net/ionic/ionic_rxtx.h         |  46 +-
 drivers/net/ionic/ionic_rxtx_sg.c      | 496 +++++++++++++++++++++
 drivers/net/ionic/ionic_rxtx_simple.c  | 417 ++++++++++++++++++
 drivers/net/ionic/meson.build          |   2 +
 9 files changed, 1054 insertions(+), 571 deletions(-)
 create mode 100644 drivers/net/ionic/ionic_rxtx_sg.c
 create mode 100644 drivers/net/ionic/ionic_rxtx_simple.c
doc/guides/rel_notes/release_22_11.rst +1 -0
index 974400d0a6..9992236217 100644
@@ -88,6 +88,7 @@ New Features
   * Added support for advertising packet types.
   * Added support for descriptor status functions.
   * Added Q-in-CMB feature controlled by devarg ionic_cmb.
+  * Added optimized handlers for non-scattered Rx and Tx.
 
 Removed Items
 -------------
drivers/net/ionic/ionic_ethdev.c +19 -6
index 28297879cf..d29aa717e3 100644
@@ -828,8 +828,6 @@ ionic_dev_configure(struct rte_eth_dev *eth_dev)
 
 	ionic_lif_configure(lif);
 
-	ionic_lif_set_features(lif);
-
 	return 0;
 }
 
@@ -883,6 +881,13 @@ ionic_dev_start(struct rte_eth_dev *eth_dev)
 	if (dev_conf->lpbk_mode)
 		IONIC_PRINT(WARNING, "Loopback mode not supported");
 
+	/* Re-set features in case SG flag was added in rx_queue_setup() */
+	err = ionic_lif_set_features(lif);
+	if (err) {
+		IONIC_PRINT(ERR, "Cannot set LIF features: %d", err);
+		return err;
+	}
+
 	lif->frame_size = eth_dev->data->mtu + IONIC_ETH_OVERHEAD;
 
 	err = ionic_lif_change_mtu(lif, eth_dev->data->mtu);
@@ -917,6 +922,18 @@ ionic_dev_start(struct rte_eth_dev *eth_dev)
 				speed);
 	}
 
+	if (lif->hw_features & IONIC_ETH_HW_RX_SG)
+		eth_dev->rx_pkt_burst = &ionic_recv_pkts_sg;
+	else
+		eth_dev->rx_pkt_burst = &ionic_recv_pkts;
+
+	if (lif->hw_features & IONIC_ETH_HW_TX_SG)
+		eth_dev->tx_pkt_burst = &ionic_xmit_pkts_sg;
+	else
+		eth_dev->tx_pkt_burst = &ionic_xmit_pkts;
+
+	eth_dev->tx_pkt_prepare = &ionic_prep_pkts;
+
 	ionic_dev_link_update(eth_dev, 0);
 
 	return 0;
@@ -980,10 +997,6 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 	IONIC_PRINT_CALL();
 
 	eth_dev->dev_ops = &ionic_eth_dev_ops;
-	eth_dev->rx_pkt_burst = &ionic_recv_pkts;
-	eth_dev->tx_pkt_burst = &ionic_xmit_pkts;
-	eth_dev->tx_pkt_prepare = &ionic_prep_pkts;
-
 	eth_dev->rx_descriptor_status = ionic_dev_rx_descriptor_status;
 	eth_dev->tx_descriptor_status = ionic_dev_tx_descriptor_status;
 
drivers/net/ionic/ionic_lif.c +44 -17

123 lines not on this page · raw message

drivers/net/ionic/ionic_lif.h +1 -0
index e4af138a51..2aa9f774ff 100644
@@ -188,6 +188,7 @@ void ionic_lif_stop(struct ionic_lif *lif);
 
 void ionic_lif_configure(struct ionic_lif *lif);
 void ionic_lif_configure_vlan_offload(struct ionic_lif *lif, int mask);
+void ionic_lif_configure_rx_sg_offload(struct ionic_lif *lif);
 void ionic_lif_reset(struct ionic_lif *lif);
 
 int ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr);
drivers/net/ionic/ionic_rxtx.c +35 -541

695 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx.h +39 -7

63 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx_sg.c new file +496 -0

496 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx_simple.c new file +417 -0

417 lines not on this page · raw message

drivers/net/ionic/meson.build +2 -0
index 2869e0027c..629e6a037d 100644
@@ -16,4 +16,6 @@ sources = files(
         'ionic_main.c',
         'ionic_rx_filter.c',
         'ionic_rxtx.c',
+        'ionic_rxtx_simple.c',
+        'ionic_rxtx_sg.c',
 )
Signature · 1 line
2.17.1
#106 lore raw

PATCH 32/35 net/ionic: add optimized handlers for non-scattered Rx/Tx

In reply to Andrew Boyer

The code is very similar, but the simple case can skip a few branches in the hot path. This improves PPS when 10KB mbufs are used.

S/G is enabled on the Rx side by offload DEV_RX_OFFLOAD_SCATTER. S/G is enabled on the Tx side by offload DEV_TX_OFFLOAD_MULTI_SEGS.

S/G is automatically enabled on the Rx side if the provided mbufs are too small to hold the maximum possible frame.

To enable S/G in testpmd, add these args:
--rx-offloads=0x2000 --tx-offloads=0x8000

---
 doc/guides/rel_notes/release_22_11.rst |   1 +
 drivers/net/ionic/ionic_ethdev.c       |  25 +-
 drivers/net/ionic/ionic_lif.c          |  61 ++-
 drivers/net/ionic/ionic_lif.h          |   1 +
 drivers/net/ionic/ionic_rxtx.c         | 576 ++-----------------------
 drivers/net/ionic/ionic_rxtx.h         |  46 +-
 drivers/net/ionic/ionic_rxtx_sg.c      | 496 +++++++++++++++++++++
 drivers/net/ionic/ionic_rxtx_simple.c  | 417 ++++++++++++++++++
 drivers/net/ionic/meson.build          |   2 +
 9 files changed, 1054 insertions(+), 571 deletions(-)
 create mode 100644 drivers/net/ionic/ionic_rxtx_sg.c
 create mode 100644 drivers/net/ionic/ionic_rxtx_simple.c
doc/guides/rel_notes/release_22_11.rst +1 -0
index 929b23ee8c..b78a6096d6 100644
@@ -169,6 +169,7 @@ New Features
   * Added support for advertising packet types.
   * Added support for descriptor status functions.
   * Added Q-in-CMB feature controlled by devarg ionic_cmb.
+  * Added optimized handlers for non-scattered Rx and Tx.
 
 * **Added support for MACsec in rte_security.**
 
drivers/net/ionic/ionic_ethdev.c +19 -6
index 28297879cf..d29aa717e3 100644
@@ -828,8 +828,6 @@ ionic_dev_configure(struct rte_eth_dev *eth_dev)
 
 	ionic_lif_configure(lif);
 
-	ionic_lif_set_features(lif);
-
 	return 0;
 }
 
@@ -883,6 +881,13 @@ ionic_dev_start(struct rte_eth_dev *eth_dev)
 	if (dev_conf->lpbk_mode)
 		IONIC_PRINT(WARNING, "Loopback mode not supported");
 
+	/* Re-set features in case SG flag was added in rx_queue_setup() */
+	err = ionic_lif_set_features(lif);
+	if (err) {
+		IONIC_PRINT(ERR, "Cannot set LIF features: %d", err);
+		return err;
+	}
+
 	lif->frame_size = eth_dev->data->mtu + IONIC_ETH_OVERHEAD;
 
 	err = ionic_lif_change_mtu(lif, eth_dev->data->mtu);
@@ -917,6 +922,18 @@ ionic_dev_start(struct rte_eth_dev *eth_dev)
 				speed);
 	}
 
+	if (lif->hw_features & IONIC_ETH_HW_RX_SG)
+		eth_dev->rx_pkt_burst = &ionic_recv_pkts_sg;
+	else
+		eth_dev->rx_pkt_burst = &ionic_recv_pkts;
+
+	if (lif->hw_features & IONIC_ETH_HW_TX_SG)
+		eth_dev->tx_pkt_burst = &ionic_xmit_pkts_sg;
+	else
+		eth_dev->tx_pkt_burst = &ionic_xmit_pkts;
+
+	eth_dev->tx_pkt_prepare = &ionic_prep_pkts;
+
 	ionic_dev_link_update(eth_dev, 0);
 
 	return 0;
@@ -980,10 +997,6 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 	IONIC_PRINT_CALL();
 
 	eth_dev->dev_ops = &ionic_eth_dev_ops;
-	eth_dev->rx_pkt_burst = &ionic_recv_pkts;
-	eth_dev->tx_pkt_burst = &ionic_xmit_pkts;
-	eth_dev->tx_pkt_prepare = &ionic_prep_pkts;
-
 	eth_dev->rx_descriptor_status = ionic_dev_rx_descriptor_status;
 	eth_dev->tx_descriptor_status = ionic_dev_tx_descriptor_status;
 
drivers/net/ionic/ionic_lif.c +44 -17

123 lines not on this page · raw message

drivers/net/ionic/ionic_lif.h +1 -0
index e4af138a51..2aa9f774ff 100644
@@ -188,6 +188,7 @@ void ionic_lif_stop(struct ionic_lif *lif);
 
 void ionic_lif_configure(struct ionic_lif *lif);
 void ionic_lif_configure_vlan_offload(struct ionic_lif *lif, int mask);
+void ionic_lif_configure_rx_sg_offload(struct ionic_lif *lif);
 void ionic_lif_reset(struct ionic_lif *lif);
 
 int ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr);
drivers/net/ionic/ionic_rxtx.c +35 -541

695 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx.h +39 -7

63 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx_sg.c new file +496 -0

496 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx_simple.c new file +417 -0

417 lines not on this page · raw message

drivers/net/ionic/meson.build +2 -0
index 2869e0027c..629e6a037d 100644
@@ -16,4 +16,6 @@ sources = files(
         'ionic_main.c',
         'ionic_rx_filter.c',
         'ionic_rxtx.c',
+        'ionic_rxtx_simple.c',
+        'ionic_rxtx_sg.c',
 )
Signature · 1 line
2.17.1
#107 lore raw

PATCH 33/35 net/ionic: use a helper variable for page size

In reply to Andrew Boyer

This improves readability.

---
 drivers/net/ionic/ionic_lif.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)
drivers/net/ionic/ionic_lif.c +12 -14
index affb6a44af..0affdd9dc4 100644
@@ -576,6 +576,7 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 	rte_iova_t q_base_pa = 0;
 	rte_iova_t cq_base_pa = 0;
 	rte_iova_t sg_base_pa = 0;
+	size_t page_size = rte_mem_page_size();
 	int err;
 
 	*qcq = NULL;
@@ -584,18 +585,18 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 	cq_size = num_descs * cq_desc_size;
 	sg_size = num_descs * sg_desc_size;
 
-	total_size = RTE_ALIGN(q_size, rte_mem_page_size()) +
-			RTE_ALIGN(cq_size, rte_mem_page_size());
+	total_size = RTE_ALIGN(q_size, page_size) +
+			RTE_ALIGN(cq_size, page_size);
 	/*
 	 * Note: aligning q_size/cq_size is not enough due to cq_base address
 	 * aligning as q_base could be not aligned to the page.
-	 * Adding rte_mem_page_size().
+	 * Adding page_size.
 	 */
-	total_size += rte_mem_page_size();
+	total_size += page_size;
 
 	if (flags & IONIC_QCQ_F_SG) {
-		total_size += RTE_ALIGN(sg_size, rte_mem_page_size());
-		total_size += rte_mem_page_size();
+		total_size += RTE_ALIGN(sg_size, page_size);
+		total_size += page_size;
 	}
 
 	new = rte_zmalloc_socket("ionic", struct_size,
@@ -610,7 +611,7 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 	/* Most queue types will store 1 ptr per descriptor */
 	new->q.info = rte_calloc_socket("ionic",
 				num_descs * num_segs, sizeof(void *),
-				rte_mem_page_size(), socket_id);
+				page_size, socket_id);
 	if (!new->q.info) {
 		IONIC_PRINT(ERR, "Cannot allocate queue info");
 		err = -ENOMEM;
@@ -648,16 +649,13 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 	q_base = new->base;
 	q_base_pa = new->base_pa;
 
-	cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size,
-			rte_mem_page_size());
-	cq_base_pa = RTE_ALIGN(q_base_pa + q_size,
-			rte_mem_page_size());
+	cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size, page_size);
+	cq_base_pa = RTE_ALIGN(q_base_pa + q_size, page_size);
 
 	if (flags & IONIC_QCQ_F_SG) {
 		sg_base = (void *)RTE_ALIGN((uintptr_t)cq_base + cq_size,
-				rte_mem_page_size());
-		sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size,
-				rte_mem_page_size());
+				page_size);
+		sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size, page_size);
 		ionic_q_sg_map(&new->q, sg_base, sg_base_pa);
 	}
 
Signature · 1 line
2.17.1
#108 lore raw

PATCH 33/35 net/ionic: use a helper variable for page size

In reply to Andrew Boyer

This improves readability.

---
 drivers/net/ionic/ionic_lif.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)
drivers/net/ionic/ionic_lif.c +12 -14
index affb6a44af..0affdd9dc4 100644
@@ -576,6 +576,7 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 	rte_iova_t q_base_pa = 0;
 	rte_iova_t cq_base_pa = 0;
 	rte_iova_t sg_base_pa = 0;
+	size_t page_size = rte_mem_page_size();
 	int err;
 
 	*qcq = NULL;
@@ -584,18 +585,18 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 	cq_size = num_descs * cq_desc_size;
 	sg_size = num_descs * sg_desc_size;
 
-	total_size = RTE_ALIGN(q_size, rte_mem_page_size()) +
-			RTE_ALIGN(cq_size, rte_mem_page_size());
+	total_size = RTE_ALIGN(q_size, page_size) +
+			RTE_ALIGN(cq_size, page_size);
 	/*
 	 * Note: aligning q_size/cq_size is not enough due to cq_base address
 	 * aligning as q_base could be not aligned to the page.
-	 * Adding rte_mem_page_size().
+	 * Adding page_size.
 	 */
-	total_size += rte_mem_page_size();
+	total_size += page_size;
 
 	if (flags & IONIC_QCQ_F_SG) {
-		total_size += RTE_ALIGN(sg_size, rte_mem_page_size());
-		total_size += rte_mem_page_size();
+		total_size += RTE_ALIGN(sg_size, page_size);
+		total_size += page_size;
 	}
 
 	new = rte_zmalloc_socket("ionic", struct_size,
@@ -610,7 +611,7 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 	/* Most queue types will store 1 ptr per descriptor */
 	new->q.info = rte_calloc_socket("ionic",
 				num_descs * num_segs, sizeof(void *),
-				rte_mem_page_size(), socket_id);
+				page_size, socket_id);
 	if (!new->q.info) {
 		IONIC_PRINT(ERR, "Cannot allocate queue info");
 		err = -ENOMEM;
@@ -648,16 +649,13 @@ ionic_qcq_alloc(struct ionic_lif *lif,
 	q_base = new->base;
 	q_base_pa = new->base_pa;
 
-	cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size,
-			rte_mem_page_size());
-	cq_base_pa = RTE_ALIGN(q_base_pa + q_size,
-			rte_mem_page_size());
+	cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size, page_size);
+	cq_base_pa = RTE_ALIGN(q_base_pa + q_size, page_size);
 
 	if (flags & IONIC_QCQ_F_SG) {
 		sg_base = (void *)RTE_ALIGN((uintptr_t)cq_base + cq_size,
-				rte_mem_page_size());
-		sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size,
-				rte_mem_page_size());
+				page_size);
+		sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size, page_size);
 		ionic_q_sg_map(&new->q, sg_base, sg_base_pa);
 	}
 
Signature · 1 line
2.17.1
#109 lore raw

PATCH 34/35 net/ionic: retry init commands up to five times

In reply to Andrew Boyer

In some configurations, the FW may return EAGAIN if it is not able to respond to commands immediately. Retry the init commands in this case to prevent errors from reaching the client.

Fix up some return-code stuff while here, for clarity.

---
 drivers/net/ionic/ionic_dev.h  |  1 +
 drivers/net/ionic/ionic_lif.c  | 14 ++++++++++++++
 drivers/net/ionic/ionic_main.c |  4 ++--
 3 files changed, 17 insertions(+), 2 deletions(-)
drivers/net/ionic/ionic_dev.h +1 -0
index d696de45e0..4d07d9206e 100644
@@ -24,6 +24,7 @@
 
 #define IONIC_DEVCMD_TIMEOUT		5	/* devcmd_timeout */
 #define IONIC_DEVCMD_CHECK_PERIOD_US	10	/* devcmd status chk period */
+#define IONIC_DEVCMD_RETRY_WAIT_US	20000
 
 #define IONIC_ALIGN			4096
 
drivers/net/ionic/ionic_lif.c +14 -0
index 0affdd9dc4..bc6de83d56 100644
@@ -1423,10 +1423,17 @@ ionic_lif_adminq_init(struct ionic_lif *lif)
 	struct ionic_admin_qcq *aqcq = lif->adminqcq;
 	struct ionic_queue *q = &aqcq->qcq.q;
 	struct ionic_q_init_comp comp;
+	uint32_t retries = 5;
 	int err;
 
+retry_adminq_init:
 	ionic_dev_cmd_adminq_init(idev, &aqcq->qcq);
 	err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
+	if (err == -EAGAIN && retries > 0) {
+		retries--;
+		rte_delay_us_block(IONIC_DEVCMD_RETRY_WAIT_US);
+		goto retry_adminq_init;
+	}
 	if (err)
 		return err;
 
@@ -1713,12 +1720,19 @@ ionic_lif_init(struct ionic_lif *lif)
 {
 	struct ionic_dev *idev = &lif->adapter->idev;
 	struct ionic_lif_init_comp comp;
+	uint32_t retries = 5;
 	int err;
 
 	memset(&lif->stats_base, 0, sizeof(lif->stats_base));
 
+retry_lif_init:
 	ionic_dev_cmd_lif_init(idev, lif->info_pa);
 	err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
+	if (err == -EAGAIN && retries > 0) {
+		retries--;
+		rte_delay_us_block(IONIC_DEVCMD_RETRY_WAIT_US);
+		goto retry_lif_init;
+	}
 	if (err)
 		return err;
 
drivers/net/ionic/ionic_main.c +2 -2
index 996af0a51f..3d8157dac3 100644
@@ -313,10 +313,10 @@ ionic_dev_cmd_check_error(struct ionic_dev *idev)
 	uint8_t status;
 
 	status = ionic_dev_cmd_status(idev);
-	if (status == 0)
+	if (status == IONIC_RC_SUCCESS)
 		return 0;
 
-	return -EIO;
+	return (status == IONIC_RC_EAGAIN) ? -EAGAIN : -EIO;
 }
 
 int
Signature · 1 line
2.17.1
#110 lore raw

PATCH 34/35 net/ionic: retry init commands up to five times

In reply to Andrew Boyer

In some configurations, the FW may return EAGAIN if it is not able to respond to commands immediately. Retry the init commands in this case to prevent errors from reaching the client.

Fix up some return-code stuff while here, for clarity.

---
 drivers/net/ionic/ionic_dev.h  |  1 +
 drivers/net/ionic/ionic_lif.c  | 14 ++++++++++++++
 drivers/net/ionic/ionic_main.c |  4 ++--
 3 files changed, 17 insertions(+), 2 deletions(-)
drivers/net/ionic/ionic_dev.h +1 -0
index d696de45e0..4d07d9206e 100644
@@ -24,6 +24,7 @@
 
 #define IONIC_DEVCMD_TIMEOUT		5	/* devcmd_timeout */
 #define IONIC_DEVCMD_CHECK_PERIOD_US	10	/* devcmd status chk period */
+#define IONIC_DEVCMD_RETRY_WAIT_US	20000
 
 #define IONIC_ALIGN			4096
 
drivers/net/ionic/ionic_lif.c +14 -0
index 0affdd9dc4..bc6de83d56 100644
@@ -1423,10 +1423,17 @@ ionic_lif_adminq_init(struct ionic_lif *lif)
 	struct ionic_admin_qcq *aqcq = lif->adminqcq;
 	struct ionic_queue *q = &aqcq->qcq.q;
 	struct ionic_q_init_comp comp;
+	uint32_t retries = 5;
 	int err;
 
+retry_adminq_init:
 	ionic_dev_cmd_adminq_init(idev, &aqcq->qcq);
 	err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
+	if (err == -EAGAIN && retries > 0) {
+		retries--;
+		rte_delay_us_block(IONIC_DEVCMD_RETRY_WAIT_US);
+		goto retry_adminq_init;
+	}
 	if (err)
 		return err;
 
@@ -1713,12 +1720,19 @@ ionic_lif_init(struct ionic_lif *lif)
 {
 	struct ionic_dev *idev = &lif->adapter->idev;
 	struct ionic_lif_init_comp comp;
+	uint32_t retries = 5;
 	int err;
 
 	memset(&lif->stats_base, 0, sizeof(lif->stats_base));
 
+retry_lif_init:
 	ionic_dev_cmd_lif_init(idev, lif->info_pa);
 	err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
+	if (err == -EAGAIN && retries > 0) {
+		retries--;
+		rte_delay_us_block(IONIC_DEVCMD_RETRY_WAIT_US);
+		goto retry_lif_init;
+	}
 	if (err)
 		return err;
 
drivers/net/ionic/ionic_main.c +2 -2
index 996af0a51f..3d8157dac3 100644
@@ -313,10 +313,10 @@ ionic_dev_cmd_check_error(struct ionic_dev *idev)
 	uint8_t status;
 
 	status = ionic_dev_cmd_status(idev);
-	if (status == 0)
+	if (status == IONIC_RC_SUCCESS)
 		return 0;
 
-	return -EIO;
+	return (status == IONIC_RC_EAGAIN) ? -EAGAIN : -EIO;
 }
 
 int
Signature · 1 line
2.17.1
#111 lore raw

PATCH 35/35 net/ionic: add watchdogs to protect each queue type

In reply to Andrew Boyer

Ring the doorbell again for the following scenarios:
* No receives posted but Rx queue not empty after deadline
* No transmits posted but Tx work still pending after deadline
* Admin queue work still pending after deadline

This will help the queues recover in the extremely rare case that a doorbell is missed by the FW.

---
 drivers/net/ionic/ionic_dev.h         |  4 +++
 drivers/net/ionic/ionic_lif.h         |  3 ++
 drivers/net/ionic/ionic_main.c        | 22 ++++++++++++
 drivers/net/ionic/ionic_rxtx.c        |  1 +
 drivers/net/ionic/ionic_rxtx_sg.c     | 50 ++++++++++++++++++++++++++-
 drivers/net/ionic/ionic_rxtx_simple.c | 50 ++++++++++++++++++++++++++-
 6 files changed, 128 insertions(+), 2 deletions(-)
drivers/net/ionic/ionic_dev.h +4 -0
index 4d07d9206e..d5d56b778d 100644
@@ -26,6 +26,10 @@
 #define IONIC_DEVCMD_CHECK_PERIOD_US	10	/* devcmd status chk period */
 #define IONIC_DEVCMD_RETRY_WAIT_US	20000
 
+#define IONIC_Q_WDOG_MS			10	/* 10ms */
+#define IONIC_Q_WDOG_MAX_MS		5000	/* 5s */
+#define IONIC_ADMINQ_WDOG_MS		500	/* 500ms */
+
 #define IONIC_ALIGN			4096
 
 struct ionic_adapter;
drivers/net/ionic/ionic_lif.h +3 -0
index 2aa9f774ff..1f4686f340 100644
@@ -85,6 +85,8 @@ struct ionic_rx_qcq {
 	struct rte_mempool *mb_pool;
 	uint64_t rearm_data;
 	uint64_t rearm_seg_data;
+	uint64_t last_wdog_cycles;
+	uint64_t wdog_ms;
 	uint16_t frame_size;	/* Based on configured MTU */
 	uint16_t hdr_seg_size;	/* Length of first segment of RX chain */
 	uint16_t seg_size;	/* Length of all subsequent segments */
@@ -103,6 +105,7 @@ struct ionic_tx_qcq {
 	struct ionic_qcq qcq;
 
 	/* cacheline2 */
+	uint64_t last_wdog_cycles;
 	uint16_t num_segs_fw;	/* # segs supported by current FW */
 	uint16_t free_thresh;
 	uint16_t flags;
drivers/net/ionic/ionic_main.c +22 -0
index 3d8157dac3..8330d8dfc1 100644
@@ -230,10 +230,16 @@ static int
 ionic_adminq_wait_for_completion(struct ionic_lif *lif,
 		struct ionic_admin_ctx *ctx, unsigned long max_wait)
 {
+	struct ionic_queue *q = &lif->adminqcq->qcq.q;
 	unsigned long step_usec = IONIC_DEVCMD_CHECK_PERIOD_US;
+	unsigned long step_deadline;
 	unsigned long max_wait_usec = max_wait * 1000000L;
 	unsigned long elapsed_usec = 0;
 	int budget = 8;
+	uint16_t idx;
+	void **info;
+
+	step_deadline = IONIC_ADMINQ_WDOG_MS * 1000 / step_usec;
 
 	while (ctx->pending_work && elapsed_usec < max_wait_usec) {
 		/*
@@ -245,10 +251,26 @@ ionic_adminq_wait_for_completion(struct ionic_lif *lif,
 		ionic_qcq_service(&lif->adminqcq->qcq, budget,
 				ionic_adminq_service, NULL);
 
+		/*
+		 * Ring the doorbell again if work is pending after deadline.
+		 */
+		if (ctx->pending_work && !step_deadline) {
+			step_deadline = IONIC_ADMINQ_WDOG_MS *
+				1000 / step_usec;
+
+			rte_spinlock_lock(&lif->adminq_lock);
+			idx = Q_NEXT_TO_POST(q, -1);
+			info = IONIC_INFO_PTR(q, idx);
+			if (info[0] == ctx)
+				ionic_q_flush(q);
+			rte_spinlock_unlock(&lif->adminq_lock);
+		}
+
 		rte_spinlock_unlock(&lif->adminq_service_lock);
 
 		rte_delay_us_block(step_usec);
 		elapsed_usec += step_usec;
+		step_deadline--;
 	}
 
 	return (!ctx->pending_work);
drivers/net/ionic/ionic_rxtx.c +1 -0
index 64733da535..967cc7dc9a 100644
@@ -551,6 +551,7 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	}
 
 	rxq->mb_pool = mp;
+	rxq->wdog_ms = IONIC_Q_WDOG_MS;
 
 	/*
 	 * Note: the interface does not currently support
drivers/net/ionic/ionic_rxtx_sg.c +49 -1

77 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx_simple.c +49 -1

77 lines not on this page · raw message

Signature · 1 line
2.17.1
#112 lore raw

PATCH 35/35 net/ionic: add watchdogs to protect each queue type

In reply to Andrew Boyer

Ring the doorbell again for the following scenarios:
* No receives posted but Rx queue not empty after deadline
* No transmits posted but Tx work still pending after deadline
* Admin queue work still pending after deadline

This will help the queues recover in the extremely rare case that a doorbell is missed by the FW.

---
 drivers/net/ionic/ionic_dev.h         |  4 +++
 drivers/net/ionic/ionic_lif.h         |  3 ++
 drivers/net/ionic/ionic_main.c        | 22 ++++++++++++
 drivers/net/ionic/ionic_rxtx.c        |  1 +
 drivers/net/ionic/ionic_rxtx_sg.c     | 50 ++++++++++++++++++++++++++-
 drivers/net/ionic/ionic_rxtx_simple.c | 50 ++++++++++++++++++++++++++-
 6 files changed, 128 insertions(+), 2 deletions(-)
drivers/net/ionic/ionic_dev.h +4 -0
index 4d07d9206e..d5d56b778d 100644
@@ -26,6 +26,10 @@
 #define IONIC_DEVCMD_CHECK_PERIOD_US	10	/* devcmd status chk period */
 #define IONIC_DEVCMD_RETRY_WAIT_US	20000
 
+#define IONIC_Q_WDOG_MS			10	/* 10ms */
+#define IONIC_Q_WDOG_MAX_MS		5000	/* 5s */
+#define IONIC_ADMINQ_WDOG_MS		500	/* 500ms */
+
 #define IONIC_ALIGN			4096
 
 struct ionic_adapter;
drivers/net/ionic/ionic_lif.h +3 -0
index 2aa9f774ff..1f4686f340 100644
@@ -85,6 +85,8 @@ struct ionic_rx_qcq {
 	struct rte_mempool *mb_pool;
 	uint64_t rearm_data;
 	uint64_t rearm_seg_data;
+	uint64_t last_wdog_cycles;
+	uint64_t wdog_ms;
 	uint16_t frame_size;	/* Based on configured MTU */
 	uint16_t hdr_seg_size;	/* Length of first segment of RX chain */
 	uint16_t seg_size;	/* Length of all subsequent segments */
@@ -103,6 +105,7 @@ struct ionic_tx_qcq {
 	struct ionic_qcq qcq;
 
 	/* cacheline2 */
+	uint64_t last_wdog_cycles;
 	uint16_t num_segs_fw;	/* # segs supported by current FW */
 	uint16_t free_thresh;
 	uint16_t flags;
drivers/net/ionic/ionic_main.c +22 -0
index 3d8157dac3..8330d8dfc1 100644
@@ -230,10 +230,16 @@ static int
 ionic_adminq_wait_for_completion(struct ionic_lif *lif,
 		struct ionic_admin_ctx *ctx, unsigned long max_wait)
 {
+	struct ionic_queue *q = &lif->adminqcq->qcq.q;
 	unsigned long step_usec = IONIC_DEVCMD_CHECK_PERIOD_US;
+	unsigned long step_deadline;
 	unsigned long max_wait_usec = max_wait * 1000000L;
 	unsigned long elapsed_usec = 0;
 	int budget = 8;
+	uint16_t idx;
+	void **info;
+
+	step_deadline = IONIC_ADMINQ_WDOG_MS * 1000 / step_usec;
 
 	while (ctx->pending_work && elapsed_usec < max_wait_usec) {
 		/*
@@ -245,10 +251,26 @@ ionic_adminq_wait_for_completion(struct ionic_lif *lif,
 		ionic_qcq_service(&lif->adminqcq->qcq, budget,
 				ionic_adminq_service, NULL);
 
+		/*
+		 * Ring the doorbell again if work is pending after deadline.
+		 */
+		if (ctx->pending_work && !step_deadline) {
+			step_deadline = IONIC_ADMINQ_WDOG_MS *
+				1000 / step_usec;
+
+			rte_spinlock_lock(&lif->adminq_lock);
+			idx = Q_NEXT_TO_POST(q, -1);
+			info = IONIC_INFO_PTR(q, idx);
+			if (info[0] == ctx)
+				ionic_q_flush(q);
+			rte_spinlock_unlock(&lif->adminq_lock);
+		}
+
 		rte_spinlock_unlock(&lif->adminq_service_lock);
 
 		rte_delay_us_block(step_usec);
 		elapsed_usec += step_usec;
+		step_deadline--;
 	}
 
 	return (!ctx->pending_work);
drivers/net/ionic/ionic_rxtx.c +1 -0
index 64733da535..967cc7dc9a 100644
@@ -551,6 +551,7 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	}
 
 	rxq->mb_pool = mp;
+	rxq->wdog_ms = IONIC_Q_WDOG_MS;
 
 	/*
 	 * Note: the interface does not currently support
drivers/net/ionic/ionic_rxtx_sg.c +49 -1

77 lines not on this page · raw message

drivers/net/ionic/ionic_rxtx_simple.c +49 -1

77 lines not on this page · raw message

Signature · 1 line
2.17.1