Skip to contentSkip to conversation

net/ionic: fixes and optimizations

PATCH In review Andrew Boyer 3 participants 37 messages Jan 18, 2021 – Feb 22, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

cover net/ionic: fixes and optimizations

This patch series fixes some transmit issues, adds (better) support for big-endian systems, and improves performance by stripping down some structures and inlining a few functions.

The endianness code has been reviewed internally but not really tested - I do not have access to a big-endian system to test on.

Andrew Boyer (13):
net/ionic: strip out unneeded interrupt code net/ionic: observe endianness in firmware commands net/ionic: observe endianness in Rx filter code net/ionic: add an array-size macro
net/ionic: query firmware for supported queue versions net/ionic: clean up Tx queue version support net/ionic: inline queue flush function net/ionic: inline queue space function net/ionic: observe endiannness in ioread/iowrite net/ionic: fix to allow separate L3 and L4 csum offload net/ionic: convert per-queue offloads into queue flags net/ionic: fix up function attribute tags net/ionic: fix address handling in transmit code

 drivers/net/ionic/ionic_dev.c       |  85 +++----
 drivers/net/ionic/ionic_dev.h       |  41 +++-
 drivers/net/ionic/ionic_ethdev.c    |  38 +--
 drivers/net/ionic/ionic_lif.c       | 361 ++++++++++++++++++----------
 drivers/net/ionic/ionic_lif.h       |  21 +-
 drivers/net/ionic/ionic_main.c      |  38 ++-
 drivers/net/ionic/ionic_osdep.h     |   7 +-
 drivers/net/ionic/ionic_rx_filter.c |  22 +-
 drivers/net/ionic/ionic_rx_filter.h |   1 +
 drivers/net/ionic/ionic_rxtx.c      |  87 ++++---
 10 files changed, 414 insertions(+), 287 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/13 net/ionic: strip out unneeded interrupt code

Only the NotifyQ uses an interrupt, so simplify the other queues.

Simplify ionic_dev_cmd_adminq_init() and ionic_cq_init(). Move ionic_intr_alloc() into ionic_notify_qcq_alloc(). Create ionic_lif_notifyq_deinit().
Simplify ionic_lif_qcq_deinit().
Remove unneeded flags and defines.

---
 drivers/net/ionic/ionic_dev.c |   8 +--
 drivers/net/ionic/ionic_dev.h |  12 ++--
 drivers/net/ionic/ionic_lif.c | 116 ++++++++++++++++------------------
 drivers/net/ionic/ionic_lif.h |   2 -
 4 files changed, 59 insertions(+), 79 deletions(-)
drivers/net/ionic/ionic_dev.c +2 -6
index 4b5e24f98c..3507d4166f 100644
@@ -323,9 +323,7 @@ ionic_intr_init(struct ionic_dev *idev, struct ionic_intr_info *intr,
 }
 
 void
-ionic_dev_cmd_adminq_init(struct ionic_dev *idev,
-		struct ionic_qcq *qcq,
-		uint16_t intr_index)
+ionic_dev_cmd_adminq_init(struct ionic_dev *idev, struct ionic_qcq *qcq)
 {
 	struct ionic_queue *q = &qcq->q;
 	struct ionic_cq *cq = &qcq->cq;
@@ -335,7 +333,7 @@ ionic_dev_cmd_adminq_init(struct ionic_dev *idev,
 		.q_init.type = q->type,
 		.q_init.index = q->index,
 		.q_init.flags = IONIC_QINIT_F_ENA,
-		.q_init.intr_index = intr_index,
+		.q_init.intr_index = IONIC_INTR_NONE,
 		.q_init.ring_size = rte_log2_u32(q->num_descs),
 		.q_init.ring_base = q->base_pa,
 		.q_init.cq_ring_base = cq->base_pa,
@@ -348,7 +346,6 @@ ionic_dev_cmd_adminq_init(struct ionic_dev *idev,
 
 int
 ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq,
-		struct ionic_intr_info *intr,
 		uint32_t num_descs, size_t desc_size)
 {
 	if (desc_size == 0) {
@@ -365,7 +362,6 @@ ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq,
 	}
 
 	cq->lif = lif;
-	cq->bound_intr = intr;
 	cq->num_descs = num_descs;
 	cq->desc_size = desc_size;
 	cq->tail_idx = 0;
drivers/net/ionic/ionic_dev.h +4 -8
index 6588a373fc..6ee2918959 100644
@@ -165,11 +165,9 @@ struct ionic_queue {
 	struct ionic_doorbell __iomem *db;
 };
 
-#define IONIC_INTR_INDEX_NOT_ASSIGNED	(-1)
-#define IONIC_INTR_NAME_MAX_SZ		(32)
+#define IONIC_INTR_NONE		(-1)
 
 struct ionic_intr_info {
-	char name[IONIC_INTR_NAME_MAX_SZ];
 	int index;
 	uint32_t vector;
 	struct ionic_intr __iomem *ctrl;
@@ -184,7 +182,6 @@ struct ionic_cq {
 	bool done_color;
 	void *base;
 	rte_iova_t base_pa;
-	struct ionic_intr_info *bound_intr;
 };
 
 /** ionic_admin_ctx - Admin command context.
@@ -234,15 +231,14 @@ void ionic_dev_cmd_lif_identify(struct ionic_dev *idev, uint8_t type,
 	uint8_t ver);
 void ionic_dev_cmd_lif_init(struct ionic_dev *idev, rte_iova_t addr);
 void ionic_dev_cmd_lif_reset(struct ionic_dev *idev);
-void ionic_dev_cmd_adminq_init(struct ionic_dev *idev, struct ionic_qcq *qcq,
-	uint16_t intr_index);
+
+void ionic_dev_cmd_adminq_init(struct ionic_dev *idev, struct ionic_qcq *qcq);
 
 struct ionic_doorbell __iomem *ionic_db_map(struct ionic_lif *lif,
 	struct ionic_queue *q);
 
 int ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq,
-	struct ionic_intr_info *intr, uint32_t num_descs,
-	size_t desc_size);
+	uint32_t num_descs, size_t desc_size);
 void ionic_cq_map(struct ionic_cq *cq, void *base, rte_iova_t base_pa);
 void ionic_cq_bind(struct ionic_cq *cq, struct ionic_queue *q);
 typedef bool (*ionic_cq_cb)(struct ionic_cq *cq, uint32_t cq_desc_index,
drivers/net/ionic/ionic_lif.c +53 -63

253 lines not on this page · raw message

drivers/net/ionic/ionic_lif.h +0 -2
index 4f48845eb9..d245c6da01 100644
@@ -48,8 +48,6 @@ struct ionic_rx_stats {
 
 #define IONIC_QCQ_F_INITED	BIT(0)
 #define IONIC_QCQ_F_SG		BIT(1)
-#define IONIC_QCQ_F_INTR	BIT(2)
-#define IONIC_QCQ_F_NOTIFYQ	BIT(3)
 #define IONIC_QCQ_F_DEFERRED	BIT(4)
 
 /* Queue / Completion Queue */
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/13 net/ionic: observe endianness in firmware commands

In reply to Andrew Boyer

The IONIC firmware is little-endian.

---
 drivers/net/ionic/ionic_dev.c    |  27 +++---
 drivers/net/ionic/ionic_ethdev.c |  27 +++---
 drivers/net/ionic/ionic_lif.c    | 138 ++++++++++++++++---------------
 drivers/net/ionic/ionic_main.c   |   6 +-
 4 files changed, 109 insertions(+), 89 deletions(-)
drivers/net/ionic/ionic_dev.c +16 -11
index 3507d4166f..c3016b2d50 100644
@@ -165,7 +165,7 @@ ionic_dev_cmd_port_init(struct ionic_dev *idev)
 	union ionic_dev_cmd cmd = {
 		.port_init.opcode = IONIC_CMD_PORT_INIT,
 		.port_init.index = 0,
-		.port_init.info_pa = idev->port_info_pa,
+		.port_init.info_pa = rte_cpu_to_le_64(idev->port_info_pa),
 	};
 
 	ionic_dev_cmd_go(idev, &cmd);
@@ -202,7 +202,7 @@ ionic_dev_cmd_port_speed(struct ionic_dev *idev, uint32_t speed)
 		.port_setattr.opcode = IONIC_CMD_PORT_SETATTR,
 		.port_setattr.index = 0,
 		.port_setattr.attr = IONIC_PORT_ATTR_SPEED,
-		.port_setattr.speed = speed,
+		.port_setattr.speed = rte_cpu_to_le_32(speed),
 	};
 
 	ionic_dev_cmd_go(idev, &cmd);
@@ -215,7 +215,7 @@ ionic_dev_cmd_port_mtu(struct ionic_dev *idev, uint32_t mtu)
 		.port_setattr.opcode = IONIC_CMD_PORT_SETATTR,
 		.port_setattr.index = 0,
 		.port_setattr.attr = IONIC_PORT_ATTR_MTU,
-		.port_setattr.mtu = mtu,
+		.port_setattr.mtu = rte_cpu_to_le_32(mtu),
 	};
 
 	ionic_dev_cmd_go(idev, &cmd);
@@ -292,7 +292,7 @@ ionic_dev_cmd_lif_init(struct ionic_dev *idev, rte_iova_t info_pa)
 {
 	union ionic_dev_cmd cmd = {
 		.lif_init.opcode = IONIC_CMD_LIF_INIT,
-		.lif_init.info_pa = info_pa,
+		.lif_init.info_pa = rte_cpu_to_le_64(info_pa),
 	};
 
 	ionic_dev_cmd_go(idev, &cmd);
@@ -331,12 +331,12 @@ ionic_dev_cmd_adminq_init(struct ionic_dev *idev, struct ionic_qcq *qcq)
 	union ionic_dev_cmd cmd = {
 		.q_init.opcode = IONIC_CMD_Q_INIT,
 		.q_init.type = q->type,
-		.q_init.index = q->index,
-		.q_init.flags = IONIC_QINIT_F_ENA,
-		.q_init.intr_index = IONIC_INTR_NONE,
+		.q_init.index = rte_cpu_to_le_32(q->index),
+		.q_init.flags = rte_cpu_to_le_16(IONIC_QINIT_F_ENA),
+		.q_init.intr_index = rte_cpu_to_le_16(IONIC_INTR_NONE),
 		.q_init.ring_size = rte_log2_u32(q->num_descs),
-		.q_init.ring_base = q->base_pa,
-		.q_init.cq_ring_base = cq->base_pa,
+		.q_init.ring_base = rte_cpu_to_le_64(q->base_pa),
+		.q_init.cq_ring_base = rte_cpu_to_le_64(cq->base_pa),
 	};
 
 	IONIC_PRINT(DEBUG, "adminq.q_init.ver %u", cmd.q_init.ver);
@@ -517,9 +517,14 @@ ionic_adminq_cb(struct ionic_queue *q,
 	struct ionic_admin_ctx *ctx = cb_arg;
 	struct ionic_admin_comp *cq_desc_base = q->bound_cq->base;
 	struct ionic_admin_comp *cq_desc = &cq_desc_base[cq_desc_index];
+	uint16_t comp_index;
 
-	if (unlikely(cq_desc->comp_index != q_desc_index)) {
-		IONIC_WARN_ON(cq_desc->comp_index != q_desc_index);
+	if (!ctx)
+		return;
+
+	comp_index = rte_le_to_cpu_16(cq_desc->comp_index);
+	if (unlikely(comp_index != q_desc_index)) {
+		IONIC_WARN_ON(comp_index != q_desc_index);
 		return;
 	}
 
drivers/net/ionic/ionic_ethdev.c +16 -11
index 2face7c635..a5b2301e46 100644
@@ -374,13 +374,15 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 	struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
 	struct ionic_adapter *adapter = lif->adapter;
 	struct ionic_identity *ident = &adapter->ident;
+	union ionic_lif_config *cfg = &ident->lif.eth.config;
 
 	IONIC_PRINT_CALL();
 
 	dev_info->max_rx_queues = (uint16_t)
-		ident->lif.eth.config.queue_count[IONIC_QTYPE_RXQ];
+		rte_le_to_cpu_32(cfg->queue_count[IONIC_QTYPE_RXQ]);
 	dev_info->max_tx_queues = (uint16_t)
-		ident->lif.eth.config.queue_count[IONIC_QTYPE_TXQ];
+		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;
@@ -389,7 +391,7 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 	dev_info->max_mtu = IONIC_MAX_MTU;
 
 	dev_info->hash_key_size = IONIC_RSS_HASH_KEY_SIZE;
-	dev_info->reta_size = ident->lif.eth.rss_ind_tbl_sz;
+	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;
 
 	dev_info->speed_capa =
@@ -534,6 +536,7 @@ ionic_dev_rss_reta_update(struct rte_eth_dev *eth_dev,
 	struct ionic_adapter *adapter = lif->adapter;
 	struct ionic_identity *ident = &adapter->ident;
 	uint32_t i, j, index, num;
+	uint16_t tbl_sz = rte_le_to_cpu_16(ident->lif.eth.rss_ind_tbl_sz);
 
 	IONIC_PRINT_CALL();
 
@@ -543,15 +546,15 @@ ionic_dev_rss_reta_update(struct rte_eth_dev *eth_dev,
 		return -EINVAL;
 	}
 
-	if (reta_size != ident->lif.eth.rss_ind_tbl_sz) {
+	if (reta_size != tbl_sz) {
 		IONIC_PRINT(ERR, "The size of hash lookup table configured "
 			"(%d) does not match the number hardware can support "
 			"(%d)",
-			reta_size, ident->lif.eth.rss_ind_tbl_sz);
+			reta_size, tbl_sz);
 		return -EINVAL;
 	}
 
-	num = lif->adapter->ident.lif.eth.rss_ind_tbl_sz / RTE_RETA_GROUP_SIZE;
+	num = tbl_sz / RTE_RETA_GROUP_SIZE;
 
 	for (i = 0; i < num; i++) {
 		for (j = 0; j < RTE_RETA_GROUP_SIZE; j++) {
@@ -574,14 +577,15 @@ ionic_dev_rss_reta_query(struct rte_eth_dev *eth_dev,
 	struct ionic_adapter *adapter = lif->adapter;
 	struct ionic_identity *ident = &adapter->ident;
 	int i, num;
+	uint16_t tbl_sz = rte_le_to_cpu_16(ident->lif.eth.rss_ind_tbl_sz);
 
 	IONIC_PRINT_CALL();
 
-	if (reta_size != ident->lif.eth.rss_ind_tbl_sz) {
+	if (reta_size != tbl_sz) {
 		IONIC_PRINT(ERR, "The size of hash lookup table configured "
 			"(%d) does not match the number hardware can support "
 			"(%d)",
-			reta_size, ident->lif.eth.rss_ind_tbl_sz);
+			reta_size, tbl_sz);
 		return -EINVAL;
 	}
 
@@ -1228,11 +1232,12 @@ eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		goto err_free_adapter;
 	}
 
-	adapter->max_mac_addrs = adapter->ident.lif.eth.max_ucast_filters;
+	adapter->max_mac_addrs =
+		rte_le_to_cpu_32(adapter->ident.lif.eth.max_ucast_filters);
 
-	if (adapter->ident.dev.nlifs != 1) {
+	if (rte_le_to_cpu_32(adapter->ident.dev.nlifs) != 1) {
 		IONIC_PRINT(ERR, "Unexpected request for %d LIFs",
-			adapter->ident.dev.nlifs);
+			rte_le_to_cpu_32(adapter->ident.dev.nlifs));
 		goto err_free_adapter;
 	}
 
drivers/net/ionic/ionic_lif.c +73 -65

360 lines not on this page · raw message

drivers/net/ionic/ionic_main.c +4 -2
index 467696a546..3f15a6f2f2 100644
@@ -340,8 +340,10 @@ ionic_port_identify(struct ionic_adapter *adapter)
 				ioread32(&idev->dev_cmd->data[i]);
 	}
 
-	IONIC_PRINT(INFO, "speed %d", ident->port.config.speed);
-	IONIC_PRINT(INFO, "mtu %d", ident->port.config.mtu);
+	IONIC_PRINT(INFO, "speed %d",
+		rte_le_to_cpu_32(ident->port.config.speed));
+	IONIC_PRINT(INFO, "mtu %d",
+		rte_le_to_cpu_32(ident->port.config.mtu));
 	IONIC_PRINT(INFO, "state %d", ident->port.config.state);
 	IONIC_PRINT(INFO, "an_enable %d", ident->port.config.an_enable);
 	IONIC_PRINT(INFO, "fec_type %d", ident->port.config.fec_type);
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/13 net/ionic: observe endianness in Rx filter code

In reply to Andrew Boyer

The IONIC firmware is little-endian.
Add a new field to struct ionic_rx_filter to store the CPU-endian match type.
Use a local variable for the VLAN when searching the hash table.

---
 drivers/net/ionic/ionic_rx_filter.c | 22 +++++++++++-----------
 drivers/net/ionic/ionic_rx_filter.h |  1 +
 2 files changed, 12 insertions(+), 11 deletions(-)
drivers/net/ionic/ionic_rx_filter.c +11 -11
index fe624538df..320b9019b3 100644
@@ -25,7 +25,7 @@ ionic_rx_filter_del(struct ionic_lif *lif, struct ionic_rx_filter *f)
 		.pending_work = true,
 		.cmd.rx_filter_del = {
 			.opcode = IONIC_CMD_RX_FILTER_DEL,
-			.filter_id = f->filter_id,
+			.filter_id = rte_cpu_to_le_32(f->filter_id),
 		},
 	};
 
@@ -74,25 +74,24 @@ ionic_rx_filter_save(struct ionic_lif *lif, uint32_t flow_id,
 		return -ENOMEM;
 
 	f->flow_id = flow_id;
-	f->filter_id = ctx->comp.rx_filter_add.filter_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));
 
-	switch (f->cmd.match) {
+	switch (f->match) {
 	case IONIC_RX_FILTER_MATCH_VLAN:
-		key = f->cmd.vlan.vlan & IONIC_RX_FILTER_HLISTS_MASK;
+		key = rte_le_to_cpu_16(f->cmd.vlan.vlan);
 		break;
 	case IONIC_RX_FILTER_MATCH_MAC:
 		memcpy(&key, f->cmd.mac.addr, sizeof(key));
-		key &= IONIC_RX_FILTER_HLISTS_MASK;
-		break;
-	case IONIC_RX_FILTER_MATCH_MAC_VLAN:
-		key = f->cmd.mac_vlan.vlan & IONIC_RX_FILTER_HLISTS_MASK;
 		break;
 	default:
 		return -EINVAL;
 	}
 
+	key &= IONIC_RX_FILTER_HLISTS_MASK;
+
 	rte_spinlock_lock(&lif->rx_filters.lock);
 
 	LIST_INSERT_HEAD(&lif->rx_filters.by_hash[key], f, by_hash);
@@ -111,11 +110,12 @@ ionic_rx_filter_by_vlan(struct ionic_lif *lif, uint16_t vid)
 {
 	uint32_t key = vid & IONIC_RX_FILTER_HLISTS_MASK;
 	struct ionic_rx_filter *f;
+	__le16 vid_le = rte_cpu_to_le_16(vid);
 
 	LIST_FOREACH(f, &lif->rx_filters.by_hash[key], by_hash) {
-		if (f->cmd.match != IONIC_RX_FILTER_MATCH_VLAN)
+		if (f->match != IONIC_RX_FILTER_MATCH_VLAN)
 			continue;
-		if (f->cmd.vlan.vlan == vid)
+		if (f->cmd.vlan.vlan == vid_le)
 			return f;
 	}
 
@@ -130,7 +130,7 @@ ionic_rx_filter_by_addr(struct ionic_lif *lif, const uint8_t *addr)
 	struct ionic_rx_filter *f;
 
 	LIST_FOREACH(f, &lif->rx_filters.by_hash[key], by_hash) {
-		if (f->cmd.match != IONIC_RX_FILTER_MATCH_MAC)
+		if (f->match != IONIC_RX_FILTER_MATCH_MAC)
 			continue;
 		if (memcmp(addr, f->cmd.mac.addr, RTE_ETHER_ADDR_LEN) == 0)
 			return f;
drivers/net/ionic/ionic_rx_filter.h +1 -0
index 6204a7b535..e1dd5f910c 100644
@@ -15,6 +15,7 @@ struct ionic_rx_filter {
 	uint32_t flow_id;
 	uint32_t filter_id;
 	uint16_t rxq_index;
+	uint16_t match;
 	struct ionic_rx_filter_add_cmd cmd;
 	LIST_ENTRY(ionic_rx_filter) by_hash;
 	LIST_ENTRY(ionic_rx_filter) by_id;
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/13 net/ionic: add an array-size macro

In reply to Andrew Boyer

Using the IONIC_ARRAY_SIZE() macro makes the code clearer.

---
 drivers/net/ionic/ionic_dev.c    | 10 ++++------
 drivers/net/ionic/ionic_ethdev.c |  3 +--
 drivers/net/ionic/ionic_lif.c    |  9 +++------
 drivers/net/ionic/ionic_main.c   | 32 +++++++++++---------------------
 drivers/net/ionic/ionic_osdep.h  |  2 ++
 5 files changed, 21 insertions(+), 35 deletions(-)
drivers/net/ionic/ionic_dev.c +4 -6
index c3016b2d50..c4e871187d 100644
@@ -87,9 +87,8 @@ void
 ionic_dev_cmd_comp(struct ionic_dev *idev, void *mem)
 {
 	union ionic_dev_cmd_comp *comp = mem;
-	unsigned int i;
-	uint32_t comp_size = sizeof(comp->words) /
-		sizeof(comp->words[0]);
+	uint32_t comp_size = IONIC_ARRAY_SIZE(comp->words);
+	uint32_t i;
 
 	for (i = 0; i < comp_size; i++)
 		comp->words[i] = ioread32(&idev->dev_cmd->comp.words[i]);
@@ -98,9 +97,8 @@ ionic_dev_cmd_comp(struct ionic_dev *idev, void *mem)
 void
 ionic_dev_cmd_go(struct ionic_dev *idev, union ionic_dev_cmd *cmd)
 {
-	unsigned int i;
-	uint32_t cmd_size = sizeof(cmd->words) /
-		sizeof(cmd->words[0]);
+	uint32_t cmd_size = IONIC_ARRAY_SIZE(cmd->words);
+	uint32_t i;
 
 	IONIC_PRINT(DEBUG, "Sending %s (%d) via dev_cmd",
 		    ionic_opcode_to_str(cmd->cmd.opcode), cmd->cmd.opcode);
drivers/net/ionic/ionic_ethdev.c +1 -2
index a5b2301e46..9238bf7d36 100644
@@ -207,8 +207,7 @@ static const struct rte_ionic_xstats_name_off rte_ionic_xstats_strings[] = {
 			tx_desc_data_error)},
 };
 
-#define IONIC_NB_HW_STATS (sizeof(rte_ionic_xstats_strings) / \
-		sizeof(rte_ionic_xstats_strings[0]))
+#define IONIC_NB_HW_STATS IONIC_ARRAY_SIZE(rte_ionic_xstats_strings)
 
 static int
 ionic_dev_fw_version_get(struct rte_eth_dev *eth_dev,
drivers/net/ionic/ionic_lif.c +3 -6
index 15e291b604..df8832f908 100644
@@ -1729,13 +1729,10 @@ ionic_lif_identify(struct ionic_adapter *adapter)
 	struct ionic_dev *idev = &adapter->idev;
 	struct ionic_identity *ident = &adapter->ident;
 	union ionic_lif_config *cfg = &ident->lif.eth.config;
+	uint32_t lif_words = IONIC_ARRAY_SIZE(ident->lif.words);
+	uint32_t cmd_words = IONIC_ARRAY_SIZE(idev->dev_cmd->data);
+	uint32_t i, nwords;
 	int err;
-	unsigned int i;
-	unsigned int lif_words = sizeof(ident->lif.words) /
-		sizeof(ident->lif.words[0]);
-	unsigned int cmd_words = sizeof(idev->dev_cmd->data) /
-		sizeof(idev->dev_cmd->data[0]);
-	unsigned int nwords;
 
 	ionic_dev_cmd_lif_identify(idev, IONIC_LIF_TYPE_CLASSIC,
 		IONIC_IDENTITY_VERSION_1);
drivers/net/ionic/ionic_main.c +11 -21
index 3f15a6f2f2..12b8d682cd 100644
@@ -263,15 +263,11 @@ ionic_identify(struct ionic_adapter *adapter)
 {
 	struct ionic_dev *idev = &adapter->idev;
 	struct ionic_identity *ident = &adapter->ident;
-	int err = 0;
-	uint32_t i;
-	unsigned int nwords;
-	uint32_t drv_size = sizeof(ident->drv.words) /
-		sizeof(ident->drv.words[0]);
-	uint32_t cmd_size = sizeof(idev->dev_cmd->data) /
-		sizeof(idev->dev_cmd->data[0]);
-	uint32_t dev_size = sizeof(ident->dev.words) /
-		sizeof(ident->dev.words[0]);
+	uint32_t drv_size = IONIC_ARRAY_SIZE(ident->drv.words);
+	uint32_t cmd_size = IONIC_ARRAY_SIZE(idev->dev_cmd->data);
+	uint32_t dev_size = IONIC_ARRAY_SIZE(ident->dev.words);
+	uint32_t i, nwords;
+	int err;
 
 	memset(ident, 0, sizeof(*ident));
 
@@ -323,12 +319,9 @@ ionic_port_identify(struct ionic_adapter *adapter)
 {
 	struct ionic_dev *idev = &adapter->idev;
 	struct ionic_identity *ident = &adapter->ident;
-	unsigned int port_words = sizeof(ident->port.words) /
-		sizeof(ident->port.words[0]);
-	unsigned int cmd_words = sizeof(idev->dev_cmd->data) /
-		sizeof(idev->dev_cmd->data[0]);
-	unsigned int i;
-	unsigned int nwords;
+	uint32_t port_words = IONIC_ARRAY_SIZE(ident->port.words);
+	uint32_t cmd_words = IONIC_ARRAY_SIZE(idev->dev_cmd->data);
+	uint32_t i, nwords;
 	int err;
 
 	ionic_dev_cmd_port_identify(idev);
@@ -374,12 +367,9 @@ ionic_port_init(struct ionic_adapter *adapter)
 	struct ionic_dev *idev = &adapter->idev;
 	struct ionic_identity *ident = &adapter->ident;
 	char z_name[RTE_MEMZONE_NAMESIZE];
-	unsigned int config_words = sizeof(ident->port.config.words) /
-		sizeof(ident->port.config.words[0]);
-	unsigned int cmd_words = sizeof(idev->dev_cmd->data) /
-		sizeof(idev->dev_cmd->data[0]);
-	unsigned int nwords;
-	unsigned int i;
+	uint32_t config_words = IONIC_ARRAY_SIZE(ident->port.config.words);
+	uint32_t cmd_words = IONIC_ARRAY_SIZE(idev->dev_cmd->data);
+	uint32_t i, nwords;
 	int err;
 
 	if (idev->port_info)
drivers/net/ionic/ionic_osdep.h +2 -0
index a55d599184..157b0ca516 100644
@@ -20,6 +20,8 @@
 
 #include "ionic_logs.h"
 
+#define IONIC_ARRAY_SIZE(_arr) (sizeof(_arr) / sizeof((_arr)[0]))
+
 #define BIT(nr)            (1UL << (nr))
 #define BIT_ULL(nr)        (1ULL << (nr))
 
Signature · 1 line
2.17.1
#5 lore raw

Re: [dpdk-dev] [PATCH 04/13] net/ionic: add an array-size macro

Quoted 3 lines · Andrew Boyer

Using the IONIC_ARRAY_SIZE() macro makes the code clearer.

There is already 'RTE_DIM' macro for it (in 'lib/librte_eal/include/rte_common.h'), what do you think using it instead of creating a new one?

#6 lore raw

Re: [dpdk-dev] [PATCH 04/13] net/ionic: add an array-size macro

Quoted 10 lines · Ferruh Yigit
Quoted 2 lines · Andrew Boyer

Using the IONIC_ARRAY_SIZE() macro makes the code clearer.

There is already 'RTE_DIM' macro for it (in 'lib/librte_eal/include/rte_common.h'), what do you think using it instead of creating a new one?

Ah, I got fooled by NICVF_ARRAY_SIZE(), EFX_ARRAY_SIZE(), and friends. Will happily switch to RTE_DIM().

-Andrew

#7 lore raw

PATCH 5/13 net/ionic: query firmware for supported queue versions

In reply to Andrew Boyer

This allows the PMD to better support FW changes.

---
 drivers/net/ionic/ionic_dev.c | 15 ++++++
 drivers/net/ionic/ionic_dev.h |  3 ++
 drivers/net/ionic/ionic_lif.c | 95 +++++++++++++++++++++++++++++++++++
 drivers/net/ionic/ionic_lif.h | 15 ++++++
 4 files changed, 128 insertions(+)
drivers/net/ionic/ionic_dev.c +15 -0
index c4e871187d..eef015686f 100644
@@ -273,6 +273,20 @@ ionic_dev_cmd_port_loopback(struct ionic_dev *idev, uint8_t loopback_mode)
 
 /* LIF commands */
 
+void
+ionic_dev_cmd_queue_identify(struct ionic_dev *idev,
+		uint16_t lif_type, uint8_t qtype, uint8_t qver)
+{
+	union ionic_dev_cmd cmd = {
+		.q_identify.opcode = IONIC_CMD_Q_IDENTIFY,
+		.q_identify.lif_type = rte_cpu_to_le_16(lif_type),
+		.q_identify.type = qtype,
+		.q_identify.ver = qver,
+	};
+
+	ionic_dev_cmd_go(idev, &cmd);
+}
+
 void
 ionic_dev_cmd_lif_identify(struct ionic_dev *idev, uint8_t type, uint8_t ver)
 {
@@ -329,6 +343,7 @@ ionic_dev_cmd_adminq_init(struct ionic_dev *idev, struct ionic_qcq *qcq)
 	union ionic_dev_cmd cmd = {
 		.q_init.opcode = IONIC_CMD_Q_INIT,
 		.q_init.type = q->type,
+		.q_init.ver = qcq->lif->qtype_info[q->type].version,
 		.q_init.index = rte_cpu_to_le_32(q->index),
 		.q_init.flags = rte_cpu_to_le_16(IONIC_QINIT_F_ENA),
 		.q_init.intr_index = rte_cpu_to_le_16(IONIC_INTR_NONE),
drivers/net/ionic/ionic_dev.h +3 -0
index 6ee2918959..6931930543 100644
@@ -227,6 +227,9 @@ void ionic_dev_cmd_port_pause(struct ionic_dev *idev, uint8_t pause_type);
 void ionic_dev_cmd_port_loopback(struct ionic_dev *idev,
 	uint8_t loopback_mode);
 
+void ionic_dev_cmd_queue_identify(struct ionic_dev *idev,
+	uint16_t lif_type, uint8_t qtype, uint8_t qver);
+
 void ionic_dev_cmd_lif_identify(struct ionic_dev *idev, uint8_t type,
 	uint8_t ver);
 void ionic_dev_cmd_lif_init(struct ionic_dev *idev, rte_iova_t addr);
drivers/net/ionic/ionic_lif.c +95 -0

131 lines not on this page · raw message

drivers/net/ionic/ionic_lif.h +15 -0
index d245c6da01..bf5637afce 100644
@@ -73,6 +73,17 @@ struct ionic_qcq {
 #define IONIC_Q_TO_TX_STATS(q)	(&IONIC_Q_TO_QCQ(q)->stats.tx)
 #define IONIC_Q_TO_RX_STATS(q)	(&IONIC_Q_TO_QCQ(q)->stats.rx)
 
+struct ionic_qtype_info {
+	uint8_t  version;
+	uint8_t  supported;
+	uint64_t features;
+	uint16_t desc_sz;
+	uint16_t comp_sz;
+	uint16_t sg_desc_sz;
+	uint16_t max_sg_elems;
+	uint16_t sg_desc_stride;
+};
+
 #define IONIC_LIF_F_INITED		BIT(0)
 #define IONIC_LIF_F_LINK_CHECK_NEEDED	BIT(1)
 #define IONIC_LIF_F_UP			BIT(2)
@@ -112,6 +123,10 @@ struct ionic_lif {
 	struct ionic_lif_info *info;
 	rte_iova_t info_pa;
 	const struct rte_memzone *info_z;
+
+	struct ionic_qtype_info qtype_info[IONIC_QTYPE_MAX];
+	uint8_t qtype_ver[IONIC_QTYPE_MAX];
+
 	struct rte_eth_stats stats_base;
 	struct ionic_lif_stats lif_stats_base;
 };
Signature · 1 line
2.17.1
#8 lore raw

PATCH 6/13 net/ionic: clean up Tx queue version support

In reply to Andrew Boyer

The ionic PMD only supports TX queue version 1 or greater. Version 1 introduced a new SGL format with support for more fragments per descriptor.

---
 drivers/net/ionic/ionic_dev.h    | 2 +-
 drivers/net/ionic/ionic_ethdev.c | 8 ++++----
 drivers/net/ionic/ionic_lif.c    | 7 ++++++-
 drivers/net/ionic/ionic_rxtx.c   | 8 ++++----
 4 files changed, 15 insertions(+), 10 deletions(-)
drivers/net/ionic/ionic_dev.h +1 -1
index 6931930543..ea89218662 100644
@@ -107,7 +107,7 @@ static inline void ionic_struct_size_checks(void)
 
 	/* I/O */
 	RTE_BUILD_BUG_ON(sizeof(struct ionic_txq_desc) != 16);
-	RTE_BUILD_BUG_ON(sizeof(struct ionic_txq_sg_desc) != 128);
+	RTE_BUILD_BUG_ON(sizeof(struct ionic_txq_sg_desc_v1) != 256);
 	RTE_BUILD_BUG_ON(sizeof(struct ionic_txq_comp) != 16);
 
 	RTE_BUILD_BUG_ON(sizeof(struct ionic_rxq_desc) != 16);
drivers/net/ionic/ionic_ethdev.c +4 -4
index 9238bf7d36..bc9a946ab5 100644
@@ -70,12 +70,12 @@ static const struct rte_eth_desc_lim rx_desc_lim = {
 	.nb_align = 1,
 };
 
-static const struct rte_eth_desc_lim tx_desc_lim = {
+static const struct rte_eth_desc_lim tx_desc_lim_v1 = {
 	.nb_max = IONIC_MAX_RING_DESC,
 	.nb_min = IONIC_MIN_RING_DESC,
 	.nb_align = 1,
-	.nb_seg_max = IONIC_TX_MAX_SG_ELEMS,
-	.nb_mtu_seg_max = IONIC_TX_MAX_SG_ELEMS,
+	.nb_seg_max = IONIC_TX_MAX_SG_ELEMS_V1,
+	.nb_mtu_seg_max = IONIC_TX_MAX_SG_ELEMS_V1,
 };
 
 static const struct eth_dev_ops ionic_eth_dev_ops = {
@@ -440,7 +440,7 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 		0;
 
 	dev_info->rx_desc_lim = rx_desc_lim;
-	dev_info->tx_desc_lim = tx_desc_lim;
+	dev_info->tx_desc_lim = tx_desc_lim_v1;
 
 	/* Driver-preferred Rx/Tx parameters */
 	dev_info->default_rxportconf.burst_size = 32;
drivers/net/ionic/ionic_lif.c +6 -1
index 0d2b3d56a7..ec35d81cd5 100644
@@ -761,7 +761,7 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t index, uint16_t ntxq_descs,
 		ntxq_descs,
 		sizeof(struct ionic_txq_desc),
 		sizeof(struct ionic_txq_comp),
-		sizeof(struct ionic_txq_sg_desc),
+		sizeof(struct ionic_txq_sg_desc_v1),
 		&lif->txqcqs[index]);
 	if (err)
 		return err;
@@ -925,6 +925,11 @@ ionic_lif_alloc(struct ionic_lif *lif)
 
 	ionic_lif_queue_identify(lif);
 
+	if (lif->qtype_info[IONIC_QTYPE_TXQ].version < 1) {
+		IONIC_PRINT(ERR, "FW too old, please upgrade");
+		return -ENXIO;
+	}
+
 	IONIC_PRINT(DEBUG, "Allocating Lif Info");
 
 	rte_spinlock_init(&lif->adminq_lock);
drivers/net/ionic/ionic_rxtx.c +4 -4
index 5d0e9d5d5a..c3a44faa21 100644
@@ -311,9 +311,9 @@ static struct ionic_txq_desc *
 ionic_tx_tso_next(struct ionic_queue *q, struct ionic_txq_sg_elem **elem)
 {
 	struct ionic_txq_desc *desc_base = q->base;
-	struct ionic_txq_sg_desc *sg_desc_base = q->sg_base;
+	struct ionic_txq_sg_desc_v1 *sg_desc_base = q->sg_base;
 	struct ionic_txq_desc *desc = &desc_base[q->head_idx];
-	struct ionic_txq_sg_desc *sg_desc = &sg_desc_base[q->head_idx];
+	struct ionic_txq_sg_desc_v1 *sg_desc = &sg_desc_base[q->head_idx];
 
 	*elem = sg_desc->elems;
 	return desc;
@@ -446,9 +446,9 @@ ionic_tx(struct ionic_queue *q, struct rte_mbuf *txm,
 		uint64_t offloads, bool not_xmit_more)
 {
 	struct ionic_txq_desc *desc_base = q->base;
-	struct ionic_txq_sg_desc *sg_desc_base = q->sg_base;
+	struct ionic_txq_sg_desc_v1 *sg_desc_base = q->sg_base;
 	struct ionic_txq_desc *desc = &desc_base[q->head_idx];
-	struct ionic_txq_sg_desc *sg_desc = &sg_desc_base[q->head_idx];
+	struct ionic_txq_sg_desc_v1 *sg_desc = &sg_desc_base[q->head_idx];
 	struct ionic_txq_sg_elem *elem = sg_desc->elems;
 	struct ionic_tx_stats *stats = IONIC_Q_TO_TX_STATS(q);
 	struct rte_mbuf *txm_seg;
Signature · 1 line
2.17.1
#9 lore raw

Re: [dpdk-dev] [PATCH 06/13] net/ionic: clean up Tx queue version support

Quoted 5 lines · Andrew Boyer

The ionic PMD only supports TX queue version 1 or greater. Version 1 introduced a new SGL format with support for more fragments per descriptor.

<...>

drivers/net/ionic/ionic_lif.c ionic_lif_alloc(struct ionic_lif *lif) · line 932

Quoted 9 lines
drivers/net/ionic/ionic_lif.c +5 -0
@@ -925,6 +925,11 @@ ionic_lif_alloc(struct ionic_lif *lif)
 
  	ionic_lif_queue_identify(lif);
 
+	if (lif->qtype_info[IONIC_QTYPE_TXQ].version < 1) {
+		IONIC_PRINT(ERR, "FW too old, please upgrade");
+		return -ENXIO;
+	}
+

Will this affect the end users, if they were using old FW?

Can you please document this new limitation in the diriver documentation and in the release notes?

#10 lore raw

Re: [dpdk-dev] [PATCH 06/13] net/ionic: clean up Tx queue version support

Quoted 22 lines · Ferruh Yigit
Quoted 4 lines · Andrew Boyer

The ionic PMD only supports TX queue version 1 or greater. Version 1 introduced a new SGL format with support for more fragments per descriptor.

<...>

drivers/net/ionic/ionic_lif.c ionic_lif_alloc(struct ionic_lif *lif) · line 930

Quoted 7 lines
drivers/net/ionic/ionic_lif.c +4 -0
@@ -925,6 +925,11 @@ ionic_lif_alloc(struct ionic_lif *lif)
   	ionic_lif_queue_identify(lif);
 +	if (lif->qtype_info[IONIC_QTYPE_TXQ].version < 1) {
+		IONIC_PRINT(ERR, "FW too old, please upgrade");
+		return -ENXIO;
+	}
+

Will this affect the end users, if they were using old FW?

Quoted 1 line

Can you please document this new limitation in the diriver documentation and in the release notes?

I will come up with something.

We don’t believe it’s possible for anyone to be using FW that old; there were only a few customers with cards back then and all have been upgraded. We decided that locking old FW out would be better than adding complexity in the hot path to handle the old data structures.

-Andrew

#11 lore raw

PATCH 7/13 net/ionic: inline queue flush function

In reply to Andrew Boyer

This is hot-path function.

---
 drivers/net/ionic/ionic_dev.c   | 6 ------
 drivers/net/ionic/ionic_dev.h   | 9 ++++++++-
 drivers/net/ionic/ionic_osdep.h | 1 -
 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/ionic/ionic_dev.c +0 -6
index eef015686f..fcb3df482a 100644
@@ -459,12 +459,6 @@ ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa)
 	q->sg_base_pa = base_pa;
 }
 
-void
-ionic_q_flush(struct ionic_queue *q)
-{
-	writeq(IONIC_DBELL_QID(q->hw_index) | q->head_idx, q->db);
-}
-
 void
 ionic_q_post(struct ionic_queue *q, bool ring_doorbell, desc_cb cb,
 	     void *cb_arg)
drivers/net/ionic/ionic_dev.h +8 -1
index ea89218662..55a56434fd 100644
@@ -254,7 +254,6 @@ int ionic_q_init(struct ionic_lif *lif, struct ionic_dev *idev,
 	size_t desc_size, size_t sg_desc_size);
 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);
-void ionic_q_flush(struct ionic_queue *q);
 void ionic_q_post(struct ionic_queue *q, bool ring_doorbell, desc_cb cb,
 	void *cb_arg);
 uint32_t ionic_q_space_avail(struct ionic_queue *q);
@@ -262,6 +261,14 @@ bool ionic_q_has_space(struct ionic_queue *q, uint32_t want);
 void ionic_q_service(struct ionic_queue *q, uint32_t cq_desc_index,
 	uint32_t stop_index, void *service_cb_arg);
 
+static inline void
+ionic_q_flush(struct ionic_queue *q)
+{
+	uint64_t val = IONIC_DBELL_QID(q->hw_index) | q->head_idx;
+
+	rte_write64(val, q->db);
+}
+
 int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
 
 #endif /* _IONIC_DEV_H_ */
drivers/net/ionic/ionic_osdep.h +0 -1
index 157b0ca516..d46687b32f 100644
@@ -45,6 +45,5 @@ typedef uint64_t __le64;
 #define ioread32(reg)		rte_read32(reg)
 #define iowrite8(value, reg)	rte_write8(value, reg)
 #define iowrite32(value, reg)	rte_write32(value, reg)
-#define writeq(value, reg)	rte_write64(value, reg)
 
 #endif
Signature · 1 line
2.17.1
#12 lore raw

Re: [dpdk-dev] [PATCH 07/13] net/ionic: inline queue flush function

Quoted 41 lines · Andrew Boyer

This is hot-path function.

---
  drivers/net/ionic/ionic_dev.c   | 6 ------
  drivers/net/ionic/ionic_dev.h   | 9 ++++++++-
  drivers/net/ionic/ionic_osdep.h | 1 -
  3 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/ionic/ionic_dev.c +0 -6
index eef015686f..fcb3df482a 100644
@@ -459,12 +459,6 @@ ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa)
  	q->sg_base_pa = base_pa;
  }
 
-void
-ionic_q_flush(struct ionic_queue *q)
-{
-	writeq(IONIC_DBELL_QID(q->hw_index) | q->head_idx, q->db);
-}
-
  void
  ionic_q_post(struct ionic_queue *q, bool ring_doorbell, desc_cb cb,
  	     void *cb_arg)
drivers/net/ionic/ionic_dev.h +0 -1
index ea89218662..55a56434fd 100644
@@ -254,7 +254,6 @@ int ionic_q_init(struct ionic_lif *lif, struct ionic_dev *idev,
  	size_t desc_size, size_t sg_desc_size);
  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);
-void ionic_q_flush(struct ionic_queue *q);
  void ionic_q_post(struct ionic_queue *q, bool ring_doorbell, desc_cb cb,
  	void *cb_arg);
  uint32_t ionic_q_space_avail(struct ionic_queue *q);
@@ -262,6 +261,14 @@ bool ionic_q_has_space(struct ionic_queue *q, uint32_t want);
  void ionic_q_service(struct ionic_queue *q, uint32_t cq_desc_index,

drivers/net/ionic/ionic_dev.h bool ionic_q_has_space(struct ionic_queue *q, uint32_t want); · line 271

Quoted 10 lines
drivers/net/ionic/ionic_dev.h +8 -0
  	uint32_t stop_index, void *service_cb_arg);
 
+static inline void
+ionic_q_flush(struct ionic_queue *q)
+{
+	uint64_t val = IONIC_DBELL_QID(q->hw_index) | q->head_idx;
+
+	rte_write64(val, q->db);
+}
+

Please be aware of '__rte_always_inline' attribute if you want to force it, since 'inline' keyword is only a suggestion to the compilers.

Quoted 15 lines
drivers/net/ionic/ionic_dev.h +0 -0
  int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
 
  #endif /* _IONIC_DEV_H_ */
drivers/net/ionic/ionic_osdep.h +0 -1
index 157b0ca516..d46687b32f 100644
@@ -45,6 +45,5 @@ typedef uint64_t __le64;
  #define ioread32(reg)		rte_read32(reg)
  #define iowrite8(value, reg)	rte_write8(value, reg)
  #define iowrite32(value, reg)	rte_write32(value, reg)
-#define writeq(value, reg)	rte_write64(value, reg)
 
  #endif
#13 lore raw

Re: [dpdk-dev] [PATCH 07/13] net/ionic: inline queue flush function

Quoted 46 lines · Ferruh Yigit
Quoted 41 lines · Andrew Boyer

This is hot-path function.

---
 drivers/net/ionic/ionic_dev.c   | 6 ------
 drivers/net/ionic/ionic_dev.h   | 9 ++++++++-
 drivers/net/ionic/ionic_osdep.h | 1 -
 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/ionic/ionic_dev.c +0 -5
index eef015686f..fcb3df482a 100644
@@ -459,12 +459,6 @@ ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa)
 	q->sg_base_pa = base_pa;
 }
 -void
-ionic_q_flush(struct ionic_queue *q)
-{
-	writeq(IONIC_DBELL_QID(q->hw_index) | q->head_idx, q->db);
-}
-
 void
 ionic_q_post(struct ionic_queue *q, bool ring_doorbell, desc_cb cb,
 	     void *cb_arg)
drivers/net/ionic/ionic_dev.h +1 -1
index ea89218662..55a56434fd 100644
@@ -254,7 +254,6 @@ int ionic_q_init(struct ionic_lif *lif, struct ionic_dev *idev,
 	size_t desc_size, size_t sg_desc_size);
 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);
-void ionic_q_flush(struct ionic_queue *q);
 void ionic_q_post(struct ionic_queue *q, bool ring_doorbell, desc_cb cb,
 	void *cb_arg);
 uint32_t ionic_q_space_avail(struct ionic_queue *q);
@@ -262,6 +261,14 @@ bool ionic_q_has_space(struct ionic_queue *q, uint32_t want);
 void ionic_q_service(struct ionic_queue *q, uint32_t cq_desc_index,
 	uint32_t stop_index, void *service_cb_arg);
 +static inline void
+ionic_q_flush(struct ionic_queue *q)
Quoted 9 lines

drivers/net/ionic/ionic_dev.h bool ionic_q_has_space(struct ionic_queue *q, uint32_t want); · line 271

Quoted 6 lines
drivers/net/ionic/ionic_dev.h +6 -0
+{
+	uint64_t val = IONIC_DBELL_QID(q->hw_index) | q->head_idx;
+
+	rte_write64(val, q->db);
+}
+

Please be aware of '__rte_always_inline' attribute if you want to force it, since 'inline' keyword is only a suggestion to the compilers.

Is it though? We are using __rte_always_inline in the hot-path .c file, but I would have said that in a header file the compiler wouldn’t have a choice. Happy to be corrected.

Thanks,
Andrew

Quoted 12 lines
Quoted 12 lines
drivers/net/ionic/ionic_dev.h +0 -0
 int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
   #endif /* _IONIC_DEV_H_ */
drivers/net/ionic/ionic_osdep.h +0 -1
index 157b0ca516..d46687b32f 100644
@@ -45,6 +45,5 @@ typedef uint64_t __le64;
 #define ioread32(reg)		rte_read32(reg)
 #define iowrite8(value, reg)	rte_write8(value, reg)
 #define iowrite32(value, reg)	rte_write32(value, reg)
-#define writeq(value, reg)	rte_write64(value, reg)
   #endif
#14 lore raw

Re: [dpdk-dev] [PATCH 07/13] net/ionic: inline queue flush function

Quoted 59 lines · Andrew Boyer
Quoted 49 lines · On Jan 27, 2021, at 12:36 PM, Ferruh Yigit <[email protected]…
Quoted 44 lines · Andrew Boyer

This is hot-path function.

Signed-off-by Andrew Boyer <[email protected] <mailto:[email protected]>>
Signed-off-by Neel Patel <[email protected] <mailto:[email protected]>>

---
 drivers/net/ionic/ionic_dev.c   | 6 ------
 drivers/net/ionic/ionic_dev.h   | 9 ++++++++-
 drivers/net/ionic/ionic_osdep.h | 1 -

 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/ionic/ionic_dev.c +0 -0
index eef015686f..fcb3df482a 100644
@@ -459,12 +459,6 @@ ionic_q_sg_map(struct ionic_queue *q, void *base, 
 rte_iova_t base_pa)
 q->sg_base_pa = base_pa;
  }

 -void

drivers/net/ionic/ionic_dev.c +0 -5
-ionic_q_flush(struct ionic_queue *q)
-{
-writeq(IONIC_DBELL_QID(q->hw_index) | q->head_idx, q->db);
-}
-

 void
 ionic_q_post(struct ionic_queue *q, bool ring_doorbell, desc_cb cb, void *cb_arg)

drivers/net/ionic/ionic_dev.h +0 -1
index ea89218662..55a56434fd 100644
@@ -254,7 +254,6 @@ int ionic_q_init(struct ionic_lif *lif, struct ionic_dev 
 *idev,
 size_t desc_size, size_t sg_desc_size);
  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);
-void ionic_q_flush(struct ionic_queue *q);
  void ionic_q_post(struct ionic_queue *q, bool ring_doorbell, desc_cb cb,
 void *cb_arg);

 uint32_t ionic_q_space_avail(struct ionic_queue *q);

drivers/net/ionic/ionic_dev.h +0 -0
@@ -262,6 +261,14 @@ bool ionic_q_has_space(struct ionic_queue *q, uint32_t 
 want);
  void ionic_q_service(struct ionic_queue *q, uint32_t cq_desc_index,
 uint32_t stop_index, void *service_cb_arg);

 +static inline void
+ionic_q_flush(struct ionic_queue *q)

Quoted 9 lines

drivers/net/ionic/ionic_dev.h bool ionic_q_has_space(struct ionic_queue *q, uint32_t want); · line 271

Quoted 6 lines
drivers/net/ionic/ionic_dev.h +6 -0
+{
+uint64_t val = IONIC_DBELL_QID(q->hw_index) | q->head_idx;
+
+rte_write64(val, q->db);
+}
+

Please be aware of '__rte_always_inline' attribute if you want to force it, since 'inline' keyword is only a suggestion to the compilers.

Quoted 2 lines

Is it though? We are using __rte_always_inline in the hot-path .c file, but I would have said that in a header file the compiler wouldn’t have a choice. Happy to be corrected.

You are right, in the header file compiler doesn't have much choice, so it should be OK.

Quoted 16 lines

Thanks,
Andrew

Quoted 12 lines
Quoted 12 lines

 int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx); #endif /* _IONIC_DEV_H_ */

drivers/net/ionic/ionic_osdep.h +0 -1
index 157b0ca516..d46687b32f 100644
@@ -45,6 +45,5 @@ typedef uint64_t __le64;
  #define ioread32(reg)rte_read32(reg)
  #define iowrite8(value, reg)rte_write8(value, reg)
  #define iowrite32(value, reg)rte_write32(value, reg)
-#define writeq(value, reg)rte_write64(value, reg)
    #endif
#15 lore raw

PATCH 8/13 net/ionic: inline queue space function

In reply to Andrew Boyer

This is a hot-path function.
Remove ionic_q_has_space() while here.

---
 drivers/net/ionic/ionic_dev.c | 21 +--------------------
 drivers/net/ionic/ionic_dev.h | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 22 deletions(-)
drivers/net/ionic/ionic_dev.c +1 -20
index fcb3df482a..e847741632 100644
@@ -474,25 +474,6 @@ ionic_q_post(struct ionic_queue *q, bool ring_doorbell, desc_cb cb,
 		ionic_q_flush(q);
 }
 
-uint32_t
-ionic_q_space_avail(struct ionic_queue *q)
-{
-	uint32_t avail = q->tail_idx;
-
-	if (q->head_idx >= avail)
-		avail += q->num_descs - q->head_idx - 1;
-	else
-		avail -= q->head_idx + 1;
-
-	return avail;
-}
-
-bool
-ionic_q_has_space(struct ionic_queue *q, uint32_t want)
-{
-	return ionic_q_space_avail(q) >= want;
-}
-
 void
 ionic_q_service(struct ionic_queue *q, uint32_t cq_desc_index,
 		uint32_t stop_index, void *service_cb_arg)
@@ -561,7 +542,7 @@ ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
 
 	rte_spinlock_lock(&lif->adminq_lock);
 
-	if (!ionic_q_has_space(adminq, 1)) {
+	if (ionic_q_space_avail(adminq) < 1) {
 		err = -ENOSPC;
 		goto err_out;
 	}
drivers/net/ionic/ionic_dev.h +13 -2
index 55a56434fd..8847d6cad4 100644
@@ -256,11 +256,22 @@ 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);
 void ionic_q_post(struct ionic_queue *q, bool ring_doorbell, desc_cb cb,
 	void *cb_arg);
-uint32_t ionic_q_space_avail(struct ionic_queue *q);
-bool ionic_q_has_space(struct ionic_queue *q, uint32_t want);
 void ionic_q_service(struct ionic_queue *q, uint32_t cq_desc_index,
 	uint32_t stop_index, void *service_cb_arg);
 
+static inline uint32_t
+ionic_q_space_avail(struct ionic_queue *q)
+{
+	uint32_t avail = q->tail_idx;
+
+	if (q->head_idx >= avail)
+		avail += q->num_descs - q->head_idx - 1;
+	else
+		avail -= q->head_idx + 1;
+
+	return avail;
+}
+
 static inline void
 ionic_q_flush(struct ionic_queue *q)
 {
Signature · 1 line
2.17.1
#16 lore raw

PATCH 9/13 net/ionic: observe endiannness in ioread/iowrite

In reply to Andrew Boyer

The IONIC FW is little-endian.

---
 drivers/net/ionic/ionic_dev.h   | 2 +-
 drivers/net/ionic/ionic_osdep.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ionic/ionic_dev.h +1 -1
index 8847d6cad4..bacbe3f053 100644
@@ -277,7 +277,7 @@ ionic_q_flush(struct ionic_queue *q)
 {
 	uint64_t val = IONIC_DBELL_QID(q->hw_index) | q->head_idx;
 
-	rte_write64(val, q->db);
+	rte_write64(rte_cpu_to_le_64(val), q->db);
 }
 
 int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
drivers/net/ionic/ionic_osdep.h +2 -2
index d46687b32f..b20c1cc8d5 100644
@@ -42,8 +42,8 @@ typedef uint32_t __le32;
 typedef uint64_t __le64;
 
 #define ioread8(reg)		rte_read8(reg)
-#define ioread32(reg)		rte_read32(reg)
+#define ioread32(reg)		rte_read32(rte_le_to_cpu_32(reg))
 #define iowrite8(value, reg)	rte_write8(value, reg)
-#define iowrite32(value, reg)	rte_write32(value, reg)
+#define iowrite32(value, reg)	rte_write32(rte_cpu_to_le_32(value), reg)
 
 #endif
Signature · 1 line
2.17.1
#17 lore raw

PATCH 10/13 net/ionic: fix to allow separate L3 and L4 csum offload

In reply to Andrew Boyer

DTS, at least, expects to be able to specify L4 checksum offload without L3 csum offload. Split up the flag checks.

Fixes a27d901331da ("net/ionic: add Rx and Tx handling")
---
 drivers/net/ionic/ionic_rxtx.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/net/ionic/ionic_rxtx.c +12 -8
index c3a44faa21..d0f8954753 100644
@@ -460,18 +460,22 @@ ionic_tx(struct ionic_queue *q, struct rte_mbuf *txm,
 	uint8_t flags = 0;
 
 	if ((ol_flags & PKT_TX_IP_CKSUM) &&
-			(offloads & DEV_TX_OFFLOAD_IPV4_CKSUM)) {
+	    (offloads & DEV_TX_OFFLOAD_IPV4_CKSUM)) {
 		opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW;
 		flags |= IONIC_TXQ_DESC_FLAG_CSUM_L3;
-		if (((ol_flags & PKT_TX_TCP_CKSUM) &&
-				(offloads & DEV_TX_OFFLOAD_TCP_CKSUM)) ||
-				((ol_flags & PKT_TX_UDP_CKSUM) &&
-				(offloads & DEV_TX_OFFLOAD_UDP_CKSUM)))
-			flags |= IONIC_TXQ_DESC_FLAG_CSUM_L4;
-	} else {
-		stats->no_csum++;
 	}
 
+	if (((ol_flags & PKT_TX_TCP_CKSUM) &&
+	     (offloads & DEV_TX_OFFLOAD_TCP_CKSUM)) ||
+	    ((ol_flags & PKT_TX_UDP_CKSUM) &&
+	     (offloads & DEV_TX_OFFLOAD_UDP_CKSUM))) {
+		opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW;
+		flags |= IONIC_TXQ_DESC_FLAG_CSUM_L4;
+	}
+
+	if (opcode == IONIC_TXQ_DESC_OPCODE_CSUM_NONE)
+		stats->no_csum++;
+
 	has_vlan = (ol_flags & PKT_TX_VLAN_PKT);
 	encap = ((ol_flags & PKT_TX_OUTER_IP_CKSUM) ||
 			(ol_flags & PKT_TX_OUTER_UDP_CKSUM)) &&
Signature · 1 line
2.17.1
#18 lore raw

PATCH 11/13 net/ionic: convert per-queue offloads into queue flags

In reply to Andrew Boyer

This will conserve resources by reducing struct ionic_qcq.

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

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

PATCH 12/13 net/ionic: fix up function attribute tags

In reply to Andrew Boyer

One function marked cold is in the hot path.
Make sure to always inline hot path functions.

Fixes a27d901331da ("net/ionic: add Rx and Tx handling")
---
 drivers/net/ionic/ionic_rxtx.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ionic/ionic_rxtx.c +5 -5
index 918701f463..f49a7cdb0e 100644
@@ -67,7 +67,7 @@ ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	qinfo->conf.tx_deferred_start = txq->flags & IONIC_QCQ_F_DEFERRED;
 }
 
-static inline void __rte_cold
+static __rte_always_inline void
 ionic_tx_flush(struct ionic_cq *cq)
 {
 	struct ionic_queue *q = cq->bound_q;
@@ -448,7 +448,7 @@ ionic_tx_tso(struct ionic_qcq *txq, struct rte_mbuf *txm,
 	return 0;
 }
 
-static int
+static __rte_always_inline int
 ionic_tx(struct ionic_qcq *txq, struct rte_mbuf *txm,
 		bool not_xmit_more)
 {
@@ -736,7 +736,7 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 	return 0;
 }
 
-static void
+static __rte_always_inline void
 ionic_rx_clean(struct ionic_queue *q,
 		uint32_t q_desc_index, uint32_t cq_desc_index,
 		void *cb_arg, void *service_cb_arg)
@@ -897,7 +897,7 @@ ionic_rx_recycle(struct ionic_queue *q, uint32_t q_desc_index,
 	ionic_q_post(q, true, ionic_rx_clean, mbuf);
 }
 
-static int __rte_cold
+static __rte_always_inline int
 ionic_rx_fill(struct ionic_qcq *rxq, uint32_t len)
 {
 	struct ionic_queue *q = &rxq->q;
@@ -1013,7 +1013,7 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 	return 0;
 }
 
-static inline void __rte_cold
+static __rte_always_inline void
 ionic_rxq_service(struct ionic_cq *cq, uint32_t work_to_do,
 		void *service_cb_arg)
 {
Signature · 1 line
2.17.1
#20 lore raw

PATCH 13/13 net/ionic: fix address handling in transmit code

In reply to Andrew Boyer

Don't assume standard headroom.
Use helper variables to improve readability.

Fixes a27d901331da ("net/ionic: add Rx and Tx handling")
---
 drivers/net/ionic/ionic_rxtx.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/net/ionic/ionic_rxtx.c +12 -8
index f49a7cdb0e..b8b3364d11 100644
@@ -334,7 +334,8 @@ ionic_tx_tso(struct ionic_qcq *txq, struct rte_mbuf *txm,
 	struct ionic_txq_desc *desc;
 	struct ionic_txq_sg_elem *elem;
 	struct rte_mbuf *txm_seg;
-	uint64_t desc_addr = 0;
+	rte_iova_t data_iova;
+	uint64_t desc_addr = 0, next_addr;
 	uint16_t desc_len = 0;
 	uint8_t desc_nsge;
 	uint32_t hdrlen;
@@ -371,6 +372,7 @@ ionic_tx_tso(struct ionic_qcq *txq, struct rte_mbuf *txm,
 
 	seglen = hdrlen + mss;
 	left = txm->data_len;
+	data_iova = rte_mbuf_data_iova(txm);
 
 	desc = ionic_tx_tso_next(q, &elem);
 	start = true;
@@ -380,7 +382,7 @@ ionic_tx_tso(struct ionic_qcq *txq, struct rte_mbuf *txm,
 	while (left > 0) {
 		len = RTE_MIN(seglen, left);
 		frag_left = seglen - len;
-		desc_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(txm));
+		desc_addr = rte_cpu_to_le_64(data_iova + offset);
 		desc_len = len;
 		desc_nsge = 0;
 		left -= len;
@@ -404,24 +406,23 @@ ionic_tx_tso(struct ionic_qcq *txq, struct rte_mbuf *txm,
 	txm_seg = txm->next;
 	while (txm_seg != NULL) {
 		offset = 0;
+		data_iova = rte_mbuf_data_iova(txm_seg);
 		left = txm_seg->data_len;
 		stats->frags++;
 
 		while (left > 0) {
-			rte_iova_t data_iova;
-			data_iova = rte_mbuf_data_iova(txm_seg);
-			elem->addr = rte_cpu_to_le_64(data_iova) + offset;
+			next_addr = rte_cpu_to_le_64(data_iova + offset);
 			if (frag_left > 0) {
 				len = RTE_MIN(frag_left, left);
 				frag_left -= len;
+				elem->addr = next_addr;
 				elem->len = len;
 				elem++;
 				desc_nsge++;
 			} else {
 				len = RTE_MIN(mss, left);
 				frag_left = mss - len;
-				data_iova = rte_mbuf_data_iova(txm_seg);
-				desc_addr = rte_cpu_to_le_64(data_iova);
+				desc_addr = next_addr;
 				desc_len = len;
 				desc_nsge = 0;
 			}
@@ -429,6 +430,7 @@ ionic_tx_tso(struct ionic_qcq *txq, struct rte_mbuf *txm,
 			offset += len;
 			if (txm_seg->next != NULL && frag_left > 0)
 				continue;
+
 			done = (txm_seg->next == NULL && left == 0);
 			ionic_tx_tso_post(q, desc, txm_seg,
 				desc_addr, desc_nsge, desc_len,
@@ -463,7 +465,7 @@ ionic_tx(struct ionic_qcq *txq, struct rte_mbuf *txm,
 	bool encap;
 	bool has_vlan;
 	uint64_t ol_flags = txm->ol_flags;
-	uint64_t addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(txm));
+	uint64_t addr;
 	uint8_t opcode = IONIC_TXQ_DESC_OPCODE_CSUM_NONE;
 	uint8_t flags = 0;
 
@@ -493,6 +495,8 @@ ionic_tx(struct ionic_qcq *txq, struct rte_mbuf *txm,
 	flags |= has_vlan ? IONIC_TXQ_DESC_FLAG_VLAN : 0;
 	flags |= encap ? IONIC_TXQ_DESC_FLAG_ENCAP : 0;
 
+	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;
Signature · 1 line
2.17.1
#21 lore raw
In reply to Andrew Boyer
Quoted 9 lines · Andrew Boyer

This patch series fixes some transmit issues, adds (better) support for big-endian systems, and improves performance by stripping down some structures and inlining a few functions.

The endianness code has been reviewed internally but not really tested - I do not have access to a big-endian system to test on.

Quoted 15 lines

Andrew Boyer (13):
net/ionic: strip out unneeded interrupt code net/ionic: observe endianness in firmware commands net/ionic: observe endianness in Rx filter code net/ionic: add an array-size macro
net/ionic: query firmware for supported queue versions net/ionic: clean up Tx queue version support net/ionic: inline queue flush function net/ionic: inline queue space function net/ionic: observe endiannness in ioread/iowrite net/ionic: fix to allow separate L3 and L4 csum offload net/ionic: convert per-queue offloads into queue flags net/ionic: fix up function attribute tags net/ionic: fix address handling in transmit code

I can remove the 4/13 & 6/13 without conflict, and seems there is no dependency to them and new version of them can be sent separately, if you confirm I can proceed with rest of the set now.

#22 lore raw
Quoted 26 lines · Ferruh Yigit
Quoted 6 lines · Andrew Boyer

This patch series fixes some transmit issues, adds (better) support for big-endian systems, and improves performance by stripping down some structures and inlining a few functions.
The endianness code has been reviewed internally but not really tested - I do not have access to a big-endian system to test on.

Quoted 14 lines

Andrew Boyer (13):
net/ionic: strip out unneeded interrupt code net/ionic: observe endianness in firmware commands net/ionic: observe endianness in Rx filter code net/ionic: add an array-size macro
net/ionic: query firmware for supported queue versions net/ionic: clean up Tx queue version support net/ionic: inline queue flush function net/ionic: inline queue space function net/ionic: observe endiannness in ioread/iowrite net/ionic: fix to allow separate L3 and L4 csum offload net/ionic: convert per-queue offloads into queue flags net/ionic: fix up function attribute tags net/ionic: fix address handling in transmit code

Quoted 1 line

I can remove the 4/13 & 6/13 without conflict, and seems there is no dependency to them and new version of them can be sent separately, if you confirm I can proceed with rest of the set now.

Yes please. Do 4 & 6 become v1 patches that stand alone? Or v2 patches that reply to their v1 versions?

-Andrew

#23 lore raw
Quoted 26 lines · Andrew Boyer
Quoted 26 lines · On Jan 27, 2021, at 1:02 PM, Ferruh Yigit <[email protected]…
Quoted 20 lines · Andrew Boyer

This patch series fixes some transmit issues, adds (better) support for big-endian systems, and improves performance by stripping down some structures and inlining a few functions.
The endianness code has been reviewed internally but not really tested - I do not have access to a big-endian system to test on.

Signed-off-by Andrew Boyer <[email protected] <mailto:[email protected]>>

Andrew Boyer (13):
  net/ionic: strip out unneeded interrupt code net/ionic: observe endianness in firmware commands net/ionic: observe endianness in Rx filter code net/ionic: add an array-size macro
  net/ionic: query firmware for supported queue versions net/ionic: clean up Tx queue version support net/ionic: inline queue flush function net/ionic: inline queue space function net/ionic: observe endiannness in ioread/iowrite net/ionic: fix to allow separate L3 and L4 csum offload net/ionic: convert per-queue offloads into queue flags net/ionic: fix up function attribute tags net/ionic: fix address handling in transmit code

Quoted 4 lines
Quoted 1 line

I can remove the 4/13 & 6/13 without conflict, and seems there is no dependency to them and new version of them can be sent separately, if you confirm I can proceed with rest of the set now.

Yes please. Do 4 & 6 become v1 patches that stand alone? Or v2 patches that reply to their v1 versions?

Except 4/13 & 6/13,
Series applied to dpdk-next-net/main, thanks.

Can you please send missing two patches as v2 as reply to v1?

Thanks,
ferruh

#24 lore raw
Quoted 27 lines · Ferruh Yigit
Quoted 26 lines · Andrew Boyer
Quoted 26 lines · On Jan 27, 2021, at 1:02 PM, Ferruh Yigit <[email protected]…
Quoted 20 lines · Andrew Boyer

This patch series fixes some transmit issues, adds (better) support for big-endian systems, and improves performance by stripping down some structures and inlining a few functions.
The endianness code has been reviewed internally but not really tested - I do not have access to a big-endian system to test on.

Signed-off-by Andrew Boyer <[email protected] <mailto:[email protected]>>

Andrew Boyer (13):
  net/ionic: strip out unneeded interrupt code net/ionic: observe endianness in firmware commands net/ionic: observe endianness in Rx filter code net/ionic: add an array-size macro
  net/ionic: query firmware for supported queue versions net/ionic: clean up Tx queue version support net/ionic: inline queue flush function net/ionic: inline queue space function net/ionic: observe endiannness in ioread/iowrite net/ionic: fix to allow separate L3 and L4 csum offload net/ionic: convert per-queue offloads into queue flags net/ionic: fix up function attribute tags net/ionic: fix address handling in transmit code

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I can remove the 4/13 & 6/13 without conflict, and seems there is no dependency to them and new version of them can be sent separately, if you confirm I can proceed with rest of the set now.

Yes please. Do 4 & 6 become v1 patches that stand alone? Or v2 patches that reply to their v1 versions?

Except 4/13 & 6/13,
Series applied to dpdk-next-net/main, thanks.

btw, a few 'IONIC_ARRAY_SIZE' macro usage in the 5/13 converted to 'RTE_DIM' since the patch adding 'IONIC_ARRAY_SIZE' dropped.

Quoted 5 lines

Can you please send missing two patches as v2 as reply to v1?

Thanks,
ferruh

#25 lore raw

PATCH 1/1 net: redefine array size macros

Replace copies of size(arr)/size(arr[0]) with RTE_DIM(). Eventually all of these macro definitions should be removed.

---
 drivers/net/atlantic/atl_hw_regs.h                | 2 +-
 drivers/net/axgbe/axgbe_common.h                  | 2 +-
 drivers/net/bnx2x/bnx2x.h                         | 2 +-
 drivers/net/bnx2x/elink.h                         | 2 +-
 drivers/net/ena/ena_ethdev.c                      | 2 +-
 drivers/net/enic/base/vnic_devcmd.h               | 2 +-
 drivers/net/hns3/hns3_ethdev.h                    | 2 +-
 drivers/net/i40e/base/i40e_osdep.h                | 2 +-
 drivers/net/nfp/nfpcore/nfp-common/nfp_platform.h | 2 +-
 drivers/net/thunderx/base/nicvf_hw.h              | 2 +-
 10 files changed, 10 insertions(+), 10 deletions(-)
drivers/net/atlantic/atl_hw_regs.h +1 -1
index a2d6ca804e..4f6cd35774 100644
@@ -26,7 +26,7 @@
 
 #define mdelay rte_delay_ms
 #define udelay rte_delay_us
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#define ARRAY_SIZE(arr) RTE_DIM(arr)
 #define BIT(x)	(1UL << (x))
 
 #define AQ_HW_WAIT_FOR(_B_, _US_, _N_) \
drivers/net/axgbe/axgbe_common.h +1 -1
index 91404ca01c..ef8706cf0f 100644
@@ -42,7 +42,7 @@
 
 #define BIT(nr)	                       (1 << (nr))
 #ifndef ARRAY_SIZE
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#define ARRAY_SIZE(arr) RTE_DIM(arr)
 #endif
 
 #define AXGBE_HZ				250
drivers/net/bnx2x/bnx2x.h +1 -1
index 69cc1430a4..e13ab15574 100644
@@ -81,7 +81,7 @@
 #endif
 
 #ifndef ARRAY_SIZE
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#define ARRAY_SIZE(arr) RTE_DIM(arr)
 #endif
 #ifndef DIV_ROUND_UP
 #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
drivers/net/bnx2x/elink.h +1 -1
index dd70ac6c66..6b2e85f1e1 100644
@@ -86,7 +86,7 @@ extern void elink_cb_notify_link_changed(struct bnx2x_softc *sc);
 #define ELINK_EVENT_ID_SFP_UNQUALIFIED_MODULE 	1
 #define ELINK_EVENT_ID_SFP_POWER_FAULT 		2
 
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
+#define ARRAY_SIZE(x) RTE_DIM(x)
 /* Debug prints */
 #ifdef ELINK_DEBUG
 
drivers/net/ena/ena_ethdev.c +1 -1
index 20ff3653c6..b4b8794bcc 100644
@@ -47,7 +47,7 @@
 #define ENA_HASH_KEY_SIZE	40
 #define ETH_GSTRING_LEN	32
 
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#define ARRAY_SIZE(x) RTE_DIM(x)
 
 #define ENA_MIN_RING_DESC	128
 
drivers/net/enic/base/vnic_devcmd.h +1 -1
index 96a7c22b21..3157bc8cb5 100644
@@ -63,7 +63,7 @@
 #define _CMD_VTYPE(cmd)          (((cmd) >> _CMD_VTYPESHIFT) & _CMD_VTYPEMASK)
 #define _CMD_N(cmd)              (((cmd) >> _CMD_NSHIFT) & _CMD_NMASK)
 
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#define ARRAY_SIZE(x) RTE_DIM(x)
 
 enum vnic_devcmd_cmd {
 	CMD_NONE                = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_NONE, 0),
drivers/net/hns3/hns3_ethdev.h +1 -1
index 0d17170fa7..db80c2391c 100644
@@ -887,7 +887,7 @@ static inline uint32_t hns3_read_reg(void *base, uint32_t reg)
 #define hns3_read_dev(a, reg) \
 	hns3_read_reg((a)->io_base, (reg))
 
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#define ARRAY_SIZE(x) RTE_DIM(x)
 
 #define NEXT_ITEM_OF_ACTION(act, actions, index)                        \
 	do {								\
drivers/net/i40e/base/i40e_osdep.h +1 -1
index ec9712c3a7..230d400149 100644
@@ -175,7 +175,7 @@ static inline uint64_t i40e_read64_addr(volatile void *addr)
 	I40E_PCI_REG_WRITE(I40E_PCI_REG_ADDR((a), (reg)), (value))
 #define flush(a) i40e_read_addr(I40E_PCI_REG_ADDR((a), (I40E_GLGEN_STAT)))
 
-#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
+#define ARRAY_SIZE(arr) RTE_DIM(arr)
 
 /* memory allocation tracking */
 struct i40e_dma_mem {
drivers/net/nfp/nfpcore/nfp-common/nfp_platform.h +1 -1
index d46574b10e..7b64e2d32b 100644
@@ -23,7 +23,7 @@
 #endif
 
 #ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#define ARRAY_SIZE(x) RTE_DIM(x)
 #endif
 
 #define NFP_ERRNO(err) (errno = (err), -1)
drivers/net/thunderx/base/nicvf_hw.h +1 -1
index fd13ea84b6..d6f3a57703 100644
@@ -17,7 +17,7 @@
 #define	PCI_SUB_DEVICE_ID_CN81XX_NICVF			0xA234
 #define	PCI_SUB_DEVICE_ID_CN83XX_NICVF			0xA334
 
-#define NICVF_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#define NICVF_ARRAY_SIZE(arr) RTE_DIM(arr)
 
 #define NICVF_GET_RX_STATS(reg) \
 	nicvf_reg_read(nic, NIC_VNIC_RX_STAT_0_13 | (reg << 3))
Signature · 1 line
2.17.1
#26 lore raw

PATCH v2 4/13 net/ionic: use the existing array-size macro

Using the RTE_DIM() macro makes the code clearer.

---
 drivers/net/ionic/ionic_dev.c    | 10 ++++------
 drivers/net/ionic/ionic_ethdev.c |  3 +--
 drivers/net/ionic/ionic_lif.c    |  9 +++------
 drivers/net/ionic/ionic_main.c   | 32 +++++++++++---------------------
 4 files changed, 19 insertions(+), 35 deletions(-)
drivers/net/ionic/ionic_dev.c +4 -6
index aba1713fbc..a9f9e2faf9 100644
@@ -87,9 +87,8 @@ void
 ionic_dev_cmd_comp(struct ionic_dev *idev, void *mem)
 {
 	union ionic_dev_cmd_comp *comp = mem;
-	unsigned int i;
-	uint32_t comp_size = sizeof(comp->words) /
-		sizeof(comp->words[0]);
+	uint32_t comp_size = RTE_DIM(comp->words);
+	uint32_t i;
 
 	for (i = 0; i < comp_size; i++)
 		comp->words[i] = ioread32(&idev->dev_cmd->comp.words[i]);
@@ -98,9 +97,8 @@ ionic_dev_cmd_comp(struct ionic_dev *idev, void *mem)
 void
 ionic_dev_cmd_go(struct ionic_dev *idev, union ionic_dev_cmd *cmd)
 {
-	unsigned int i;
-	uint32_t cmd_size = sizeof(cmd->words) /
-		sizeof(cmd->words[0]);
+	uint32_t cmd_size = RTE_DIM(cmd->words);
+	uint32_t i;
 
 	IONIC_PRINT(DEBUG, "Sending %s (%d) via dev_cmd",
 		    ionic_opcode_to_str(cmd->cmd.opcode), cmd->cmd.opcode);
drivers/net/ionic/ionic_ethdev.c +1 -2
index a5b2301e46..747082a263 100644
@@ -207,8 +207,7 @@ static const struct rte_ionic_xstats_name_off rte_ionic_xstats_strings[] = {
 			tx_desc_data_error)},
 };
 
-#define IONIC_NB_HW_STATS (sizeof(rte_ionic_xstats_strings) / \
-		sizeof(rte_ionic_xstats_strings[0]))
+#define IONIC_NB_HW_STATS RTE_DIM(rte_ionic_xstats_strings)
 
 static int
 ionic_dev_fw_version_get(struct rte_eth_dev *eth_dev,
drivers/net/ionic/ionic_lif.c +3 -6
index 3e2edde35d..8dd49b6628 100644
@@ -1824,13 +1824,10 @@ ionic_lif_identify(struct ionic_adapter *adapter)
 	struct ionic_dev *idev = &adapter->idev;
 	struct ionic_identity *ident = &adapter->ident;
 	union ionic_lif_config *cfg = &ident->lif.eth.config;
+	uint32_t lif_words = RTE_DIM(ident->lif.words);
+	uint32_t cmd_words = RTE_DIM(idev->dev_cmd->data);
+	uint32_t i, nwords;
 	int err;
-	unsigned int i;
-	unsigned int lif_words = sizeof(ident->lif.words) /
-		sizeof(ident->lif.words[0]);
-	unsigned int cmd_words = sizeof(idev->dev_cmd->data) /
-		sizeof(idev->dev_cmd->data[0]);
-	unsigned int nwords;
 
 	ionic_dev_cmd_lif_identify(idev, IONIC_LIF_TYPE_CLASSIC,
 		IONIC_IDENTITY_VERSION_1);
drivers/net/ionic/ionic_main.c +11 -21
index 3f15a6f2f2..3f1a764888 100644
@@ -263,15 +263,11 @@ ionic_identify(struct ionic_adapter *adapter)
 {
 	struct ionic_dev *idev = &adapter->idev;
 	struct ionic_identity *ident = &adapter->ident;
-	int err = 0;
-	uint32_t i;
-	unsigned int nwords;
-	uint32_t drv_size = sizeof(ident->drv.words) /
-		sizeof(ident->drv.words[0]);
-	uint32_t cmd_size = sizeof(idev->dev_cmd->data) /
-		sizeof(idev->dev_cmd->data[0]);
-	uint32_t dev_size = sizeof(ident->dev.words) /
-		sizeof(ident->dev.words[0]);
+	uint32_t drv_size = RTE_DIM(ident->drv.words);
+	uint32_t cmd_size = RTE_DIM(idev->dev_cmd->data);
+	uint32_t dev_size = RTE_DIM(ident->dev.words);
+	uint32_t i, nwords;
+	int err;
 
 	memset(ident, 0, sizeof(*ident));
 
@@ -323,12 +319,9 @@ ionic_port_identify(struct ionic_adapter *adapter)
 {
 	struct ionic_dev *idev = &adapter->idev;
 	struct ionic_identity *ident = &adapter->ident;
-	unsigned int port_words = sizeof(ident->port.words) /
-		sizeof(ident->port.words[0]);
-	unsigned int cmd_words = sizeof(idev->dev_cmd->data) /
-		sizeof(idev->dev_cmd->data[0]);
-	unsigned int i;
-	unsigned int nwords;
+	uint32_t port_words = RTE_DIM(ident->port.words);
+	uint32_t cmd_words = RTE_DIM(idev->dev_cmd->data);
+	uint32_t i, nwords;
 	int err;
 
 	ionic_dev_cmd_port_identify(idev);
@@ -374,12 +367,9 @@ ionic_port_init(struct ionic_adapter *adapter)
 	struct ionic_dev *idev = &adapter->idev;
 	struct ionic_identity *ident = &adapter->ident;
 	char z_name[RTE_MEMZONE_NAMESIZE];
-	unsigned int config_words = sizeof(ident->port.config.words) /
-		sizeof(ident->port.config.words[0]);
-	unsigned int cmd_words = sizeof(idev->dev_cmd->data) /
-		sizeof(idev->dev_cmd->data[0]);
-	unsigned int nwords;
-	unsigned int i;
+	uint32_t config_words = RTE_DIM(ident->port.config.words);
+	uint32_t cmd_words = RTE_DIM(idev->dev_cmd->data);
+	uint32_t i, nwords;
 	int err;
 
 	if (idev->port_info)
Signature · 1 line
2.17.1
Applied
#27 lore raw

Re: [dpdk-dev] [PATCH v2 4/13] net/ionic: use the existing array-size macro

Quoted 3 lines · Andrew Boyer

Using the RTE_DIM() macro makes the code clearer.

Applied to dpdk-next-net/main, thanks.

#28 lore raw

PATCH v2 6/13 net/ionic: clean up Tx queue version support

In reply to Andrew Boyer

The ionic PMD only supports Tx queue version 1 or greater. Version 1 introduced a new SGL format with support for more fragments per descriptor.

Add release notes and an explanation to the docs.

---
 doc/guides/nics/ionic.rst              |  4 ++++
 doc/guides/rel_notes/release_21_02.rst | 11 +++++++++++
 drivers/net/ionic/ionic_dev.h          |  2 +-
 drivers/net/ionic/ionic_ethdev.c       |  8 ++++----
 drivers/net/ionic/ionic_lif.c          |  7 ++++++-
 drivers/net/ionic/ionic_rxtx.c         |  8 ++++----
 6 files changed, 30 insertions(+), 10 deletions(-)
doc/guides/nics/ionic.rst +4 -0
index 3b93592c39..0c6147983f 100644
@@ -25,6 +25,10 @@ on the host, check for the PCI devices:
       b5:00.0 Ethernet controller: Device 1dd8:1002
       b6:00.0 Ethernet controller: Device 1dd8:1002
 
+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.
 
 Building DPDK
 -------------
doc/guides/rel_notes/release_21_02.rst +11 -0
index 23dcb370be..76aaf8cbf9 100644
@@ -138,6 +138,17 @@ New Features
   * Added support for aes-cbc sha256-128-hmac cipher combination in OCTEON TX2
     crypto PMD lookaside protocol offload for IPsec.
 
+* **Updated the Pensando ionic driver.**
+
+  Updated the Pensando ionic driver with new features and improvements, including:
+
+  * Fixed bugs related to link autonegotiation.
+  * Fixed bugs related to port start/stop and queue start/stop.
+  * Added support for probing the supported queue versions. Note that
+    extremely old (pre-1.0) firmware will no longer be usable with the PMD.
+  * Removed unused code.
+  * Reduced device startup time.
+
 
 Removed Items
 -------------
drivers/net/ionic/ionic_dev.h +1 -1
index e13b6c82cc..bacbe3f053 100644
@@ -107,7 +107,7 @@ static inline void ionic_struct_size_checks(void)
 
 	/* I/O */
 	RTE_BUILD_BUG_ON(sizeof(struct ionic_txq_desc) != 16);
-	RTE_BUILD_BUG_ON(sizeof(struct ionic_txq_sg_desc) != 128);
+	RTE_BUILD_BUG_ON(sizeof(struct ionic_txq_sg_desc_v1) != 256);
 	RTE_BUILD_BUG_ON(sizeof(struct ionic_txq_comp) != 16);
 
 	RTE_BUILD_BUG_ON(sizeof(struct ionic_rxq_desc) != 16);
drivers/net/ionic/ionic_ethdev.c +4 -4
index 747082a263..83c9dd690a 100644
@@ -70,12 +70,12 @@ static const struct rte_eth_desc_lim rx_desc_lim = {
 	.nb_align = 1,
 };
 
-static const struct rte_eth_desc_lim tx_desc_lim = {
+static const struct rte_eth_desc_lim tx_desc_lim_v1 = {
 	.nb_max = IONIC_MAX_RING_DESC,
 	.nb_min = IONIC_MIN_RING_DESC,
 	.nb_align = 1,
-	.nb_seg_max = IONIC_TX_MAX_SG_ELEMS,
-	.nb_mtu_seg_max = IONIC_TX_MAX_SG_ELEMS,
+	.nb_seg_max = IONIC_TX_MAX_SG_ELEMS_V1,
+	.nb_mtu_seg_max = IONIC_TX_MAX_SG_ELEMS_V1,
 };
 
 static const struct eth_dev_ops ionic_eth_dev_ops = {
@@ -440,7 +440,7 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 		0;
 
 	dev_info->rx_desc_lim = rx_desc_lim;
-	dev_info->tx_desc_lim = tx_desc_lim;
+	dev_info->tx_desc_lim = tx_desc_lim_v1;
 
 	/* Driver-preferred Rx/Tx parameters */
 	dev_info->default_rxportconf.burst_size = 32;
drivers/net/ionic/ionic_lif.c +6 -1
index 8dd49b6628..2a6c494c9d 100644
@@ -761,7 +761,7 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t index, uint16_t ntxq_descs,
 		ntxq_descs,
 		sizeof(struct ionic_txq_desc),
 		sizeof(struct ionic_txq_comp),
-		sizeof(struct ionic_txq_sg_desc),
+		sizeof(struct ionic_txq_sg_desc_v1),
 		&lif->txqcqs[index]);
 	if (err)
 		return err;
@@ -925,6 +925,11 @@ ionic_lif_alloc(struct ionic_lif *lif)
 
 	ionic_lif_queue_identify(lif);
 
+	if (lif->qtype_info[IONIC_QTYPE_TXQ].version < 1) {
+		IONIC_PRINT(ERR, "FW too old, please upgrade");
+		return -ENXIO;
+	}
+
 	IONIC_PRINT(DEBUG, "Allocating Lif Info");
 
 	rte_spinlock_init(&lif->adminq_lock);
drivers/net/ionic/ionic_rxtx.c +4 -4
index c8191e6c01..b8b3364d11 100644
@@ -317,9 +317,9 @@ static struct ionic_txq_desc *
 ionic_tx_tso_next(struct ionic_queue *q, struct ionic_txq_sg_elem **elem)
 {
 	struct ionic_txq_desc *desc_base = q->base;
-	struct ionic_txq_sg_desc *sg_desc_base = q->sg_base;
+	struct ionic_txq_sg_desc_v1 *sg_desc_base = q->sg_base;
 	struct ionic_txq_desc *desc = &desc_base[q->head_idx];
-	struct ionic_txq_sg_desc *sg_desc = &sg_desc_base[q->head_idx];
+	struct ionic_txq_sg_desc_v1 *sg_desc = &sg_desc_base[q->head_idx];
 
 	*elem = sg_desc->elems;
 	return desc;
@@ -456,9 +456,9 @@ ionic_tx(struct ionic_qcq *txq, struct rte_mbuf *txm,
 {
 	struct ionic_queue *q = &txq->q;
 	struct ionic_txq_desc *desc_base = q->base;
-	struct ionic_txq_sg_desc *sg_desc_base = q->sg_base;
+	struct ionic_txq_sg_desc_v1 *sg_desc_base = q->sg_base;
 	struct ionic_txq_desc *desc = &desc_base[q->head_idx];
-	struct ionic_txq_sg_desc *sg_desc = &sg_desc_base[q->head_idx];
+	struct ionic_txq_sg_desc_v1 *sg_desc = &sg_desc_base[q->head_idx];
 	struct ionic_txq_sg_elem *elem = sg_desc->elems;
 	struct ionic_tx_stats *stats = IONIC_Q_TO_TX_STATS(q);
 	struct rte_mbuf *txm_seg;
Signature · 1 line
2.17.1
Applied
#29 lore raw

Re: [dpdk-dev] [PATCH v2 6/13] net/ionic: clean up Tx queue version support

Quoted 7 lines · Andrew Boyer

The ionic PMD only supports Tx queue version 1 or greater. Version 1 introduced a new SGL format with support for more fragments per descriptor.

Add release notes and an explanation to the docs.

Applied to dpdk-next-net/main, thanks.

#30 lore raw

Re: [dpdk-dev] [PATCH v2 6/13] net/ionic: clean up Tx queue version support

In reply to Andrew Boyer

29/01/2021 23:44, Andrew Boyer:

Quoted 8 lines

The ionic PMD only supports Tx queue version 1 or greater. Version 1 introduced a new SGL format with support for more fragments per descriptor.

Add release notes and an explanation to the docs.

---

doc/guides/rel_notes/release_21_02.rst New Features · line 150

Quoted 10 lines
doc/guides/rel_notes/release_21_02.rst +10 -0
+* **Updated the Pensando ionic driver.**
+
+  Updated the Pensando ionic driver with new features and improvements, including:
+
+  * Fixed bugs related to link autonegotiation.
+  * Fixed bugs related to port start/stop and queue start/stop.
+  * Added support for probing the supported queue versions. Note that
+    extremely old (pre-1.0) firmware will no longer be usable with the PMD.
+  * Removed unused code.
+  * Reduced device startup time.

Most of these items are unrelated to the rest of the patch. And in general we don't mention cleanup and fixes in "New Features". Actually we don't mention such minor things in the release notes.

#31 lore raw

Re: [dpdk-dev] [PATCH v2 6/13] net/ionic: clean up Tx queue version support

Quoted 11 lines · Thomas Monjalon

29/01/2021 23:44, Andrew Boyer:

Quoted 6 lines

The ionic PMD only supports Tx queue version 1 or greater. Version 1 introduced a new SGL format with support for more fragments per descriptor.

Add release notes and an explanation to the docs.

Quoted 17 lines

doc/guides/rel_notes/release_21_02.rst New Features · line 150

Quoted 12 lines

---

doc/guides/rel_notes/release_21_02.rst +10 -0
+* **Updated the Pensando ionic driver.**
+
+  Updated the Pensando ionic driver with new features and improvements, including:
+
+  * Fixed bugs related to link autonegotiation.
+  * Fixed bugs related to port start/stop and queue start/stop.
+  * Added support for probing the supported queue versions. Note that
+    extremely old (pre-1.0) firmware will no longer be usable with the PMD.
+  * Removed unused code.
+  * Reduced device startup time.

Most of these items are unrelated to the rest of the patch. And in general we don't mention cleanup and fixes in "New Features". Actually we don't mention such minor things in the release notes.

It describes all of the changes that went in for this release.

Please feel free to remove any you feel are inappropriate - or send me a list and I will send a patch.

Thanks,
Andrew

#32 lore raw

Re: [dpdk-dev] [PATCH v2 6/13] net/ionic: clean up Tx queue version support

05/02/2021 21:26, Andrew Boyer:

Quoted 25 lines
Quoted 8 lines · Thomas Monjalon

29/01/2021 23:44, Andrew Boyer:

Quoted 6 lines

The ionic PMD only supports Tx queue version 1 or greater. Version 1 introduced a new SGL format with support for more fragments per descriptor.

Add release notes and an explanation to the docs.

Quoted 16 lines

doc/guides/rel_notes/release_21_02.rst New Features · line 150

Quoted 12 lines

---

doc/guides/rel_notes/release_21_02.rst +10 -0
+* **Updated the Pensando ionic driver.**
+
+  Updated the Pensando ionic driver with new features and improvements, including:
+
+  * Fixed bugs related to link autonegotiation.
+  * Fixed bugs related to port start/stop and queue start/stop.
+  * Added support for probing the supported queue versions. Note that
+    extremely old (pre-1.0) firmware will no longer be usable with the PMD.
+  * Removed unused code.
+  * Reduced device startup time.

Most of these items are unrelated to the rest of the patch. And in general we don't mention cleanup and fixes in "New Features". Actually we don't mention such minor things in the release notes.

Quoted 1 line

It describes all of the changes that went in for this release.

It is recommended to add items in the release notes in the relevant patch so it allows easy finding of the code mentioned in the release notes.

Quoted 1 line

Please feel free to remove any you feel are inappropriate - or send me a list and I will send a patch.

It's not a big deal. I am just informing you as you are still quite new :) The most important is to avoid the release notes becoming a long list of fixes.

Eventually we could remove the lines "Fixed bugs ..." and "Removed unused code" while doing the last cleanup.

#33 lore raw

Re: [dpdk-dev] [PATCH] net: redefine array size macros

In reply to Andrew Boyer

29/01/2021 23:44, Andrew Boyer:

Quoted 4 lines

Replace copies of size(arr)/size(arr[0]) with RTE_DIM(). Eventually all of these macro definitions should be removed.

Quoted 12 lines
---
 drivers/net/atlantic/atl_hw_regs.h                | 2 +-
 drivers/net/axgbe/axgbe_common.h                  | 2 +-
 drivers/net/bnx2x/bnx2x.h                         | 2 +-
 drivers/net/bnx2x/elink.h                         | 2 +-
 drivers/net/ena/ena_ethdev.c                      | 2 +-
 drivers/net/enic/base/vnic_devcmd.h               | 2 +-
 drivers/net/hns3/hns3_ethdev.h                    | 2 +-
 drivers/net/i40e/base/i40e_osdep.h                | 2 +-
 drivers/net/nfp/nfpcore/nfp-common/nfp_platform.h | 2 +-
 drivers/net/thunderx/base/nicvf_hw.h              | 2 +-
 10 files changed, 10 insertions(+), 10 deletions(-)

Thanks for the cleanup.

In the title, the prefix "net" means librte_net. Here, it should be "drivers/net". I know it's confusing :)

Please check other patches in the series, they are versioned as v2 and numbered 4/13 and 6/13.

#34 lore raw

Re: [dpdk-dev] [PATCH] net: redefine array size macros

Quoted 22 lines · Thomas Monjalon

29/01/2021 23:44, Andrew Boyer:

Quoted 5 lines

Replace copies of size(arr)/size(arr[0]) with RTE_DIM(). Eventually all of these macro definitions should be removed.

---

Quoted 11 lines
drivers/net/atlantic/atl_hw_regs.h                | 2 +-
drivers/net/axgbe/axgbe_common.h                  | 2 +-
drivers/net/bnx2x/bnx2x.h                         | 2 +-
drivers/net/bnx2x/elink.h                         | 2 +-
drivers/net/ena/ena_ethdev.c                      | 2 +-
drivers/net/enic/base/vnic_devcmd.h               | 2 +-
drivers/net/hns3/hns3_ethdev.h                    | 2 +-
drivers/net/i40e/base/i40e_osdep.h                | 2 +-
drivers/net/nfp/nfpcore/nfp-common/nfp_platform.h | 2 +-
drivers/net/thunderx/base/nicvf_hw.h              | 2 +-
10 files changed, 10 insertions(+), 10 deletions(-)
Quoted 7 lines

Thanks for the cleanup.

In the title, the prefix "net" means librte_net. Here, it should be "drivers/net". I know it's confusing :)

Please check other patches in the series, they are versioned as v2 and numbered 4/13 and 6/13.

Thank you for the review - do you want me to resend or can you fix it up yourself?

The 4/13 and 6/13 are fixups that Ferruh asked for, while he applied the rest of the series. I made the 4/13 a v2 replying to the original 4/13 and the 6/13 a v2 replying to the original 6/13. If I messed it up, my apologies!

-Andrew

Reviewed-by
#35 lore raw

Re: [dpdk-dev] [PATCH] net: redefine array size macros

Quoted 24 lines · Andrew Boyer
Quoted 24 lines · On Feb 1, 2021, at 5:28 PM, Thomas Monjalon <[email protected]…

29/01/2021 23:44, Andrew Boyer:

Quoted 15 lines

Replace copies of size(arr)/size(arr[0]) with RTE_DIM(). Eventually all of these macro definitions should be removed.

Signed-off-by Andrew Boyer <[email protected] <mailto:[email protected]>>

---
drivers/net/atlantic/atl_hw_regs.h                | 2 +- drivers/net/axgbe/axgbe_common.h                  | 2 +- drivers/net/bnx2x/bnx2x.h                         | 2 +- drivers/net/bnx2x/elink.h                         | 2 +- drivers/net/ena/ena_ethdev.c                      | 2 +- drivers/net/enic/base/vnic_devcmd.h               | 2 +- drivers/net/hns3/hns3_ethdev.h                    | 2 +- drivers/net/i40e/base/i40e_osdep.h                | 2 +- drivers/net/nfp/nfpcore/nfp-common/nfp_platform.h | 2 +- drivers/net/thunderx/base/nicvf_hw.h              | 2 +-

Quoted 1 line
10 files changed, 10 insertions(+), 10 deletions(-)

Thanks for the cleanup.

Quoted 8 lines
Quoted 5 lines

In the title, the prefix "net" means librte_net. Here, it should be "drivers/net". I know it's confusing :)

Please check other patches in the series, they are versioned as v2 and numbered 4/13 and 6/13.

Thank you for the review - do you want me to resend or can you fix it up yourself?

I can fix the title while merging, thanks for cleanup,

Quoted 3 lines

The 4/13 and 6/13 are fixups that Ferruh asked for, while he applied the rest of the series. I made the 4/13 a v2 replying to the original 4/13 and the 6/13 a v2 replying to the original 6/13. If I messed it up, my apologies!

-Andrew

Applied
#36 lore raw

Re: [dpdk-dev] [PATCH] net: redefine array size macros

Quoted 31 lines · Ferruh Yigit
Quoted 30 lines · Andrew Boyer
Quoted 29 lines · On Feb 1, 2021, at 5:28 PM, Thomas Monjalon <[email protected]…

29/01/2021 23:44, Andrew Boyer:

Quoted 15 lines

Replace copies of size(arr)/size(arr[0]) with RTE_DIM(). Eventually all of these macro definitions should be removed.

Signed-off-by Andrew Boyer <[email protected] <mailto:[email protected]>>

---
drivers/net/atlantic/atl_hw_regs.h                | 2 +- drivers/net/axgbe/axgbe_common.h                  | 2 +- drivers/net/bnx2x/bnx2x.h                         | 2 +- drivers/net/bnx2x/elink.h                         | 2 +- drivers/net/ena/ena_ethdev.c                      | 2 +- drivers/net/enic/base/vnic_devcmd.h               | 2 +- drivers/net/hns3/hns3_ethdev.h                    | 2 +- drivers/net/i40e/base/i40e_osdep.h                | 2 +- drivers/net/nfp/nfpcore/nfp-common/nfp_platform.h | 2 +- drivers/net/thunderx/base/nicvf_hw.h              | 2 +-

Quoted 1 line
10 files changed, 10 insertions(+), 10 deletions(-)

Thanks for the cleanup.

In the title, the prefix "net" means librte_net. Here, it should be "drivers/net". I know it's confusing :)

Please check other patches in the series, they are versioned as v2 and numbered 4/13 and 6/13.

Quoted 7 lines
Quoted 2 lines

Thank you for the review - do you want me to resend or can you fix it up yourself?

I can fix the title while merging, thanks for cleanup,

Applied to dpdk-next-net/main, thanks.

Patch title updated as:
"drivers/net: redefine array size macros"