DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Boyer <aboyer@pensando.io>
To: dev@dpdk.org
Cc: Alfredo Cardigliano <cardigliano@ntop.org>,
	Andrew Boyer <aboyer@pensando.io>
Subject: [dpdk-dev] [PATCH v2 3/7] net/ionic: remove multi-LIF support
Date: Wed, 16 Dec 2020 13:12:53 -0800	[thread overview]
Message-ID: <20201216211257.37195-4-aboyer@pensando.io> (raw)
In-Reply-To: <20201216211257.37195-1-aboyer@pensando.io>
In-Reply-To: <20201210142231.63209-1-aboyer@pensando.io>

This feature is unused, so remove it.

There is exactly one adapter / lif / ethdev per port.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
---
 drivers/net/ionic/ionic.h        |  3 +-
 drivers/net/ionic/ionic_dev.c    | 16 ++--------
 drivers/net/ionic/ionic_dev.h    |  8 ++---
 drivers/net/ionic/ionic_ethdev.c | 50 ++++++++++++--------------------
 drivers/net/ionic/ionic_lif.c    | 24 ++++-----------
 drivers/net/ionic/ionic_lif.h    |  1 -
 6 files changed, 31 insertions(+), 71 deletions(-)

diff --git a/drivers/net/ionic/ionic.h b/drivers/net/ionic/ionic.h
index 7ad0ab69e..49d1fc003 100644
--- a/drivers/net/ionic/ionic.h
+++ b/drivers/net/ionic/ionic.h
@@ -51,9 +51,8 @@ struct ionic_adapter {
 	const char *name;
 	struct ionic_dev_bar bars[IONIC_BARS_MAX];
 	struct ionic_identity	ident;
-	struct ionic_lif *lifs[IONIC_LIFS_MAX];
+	struct ionic_lif *lif;
 	uint32_t num_bars;
-	uint32_t nlifs;
 	uint32_t max_ntxqs_per_lif;
 	uint32_t max_nrxqs_per_lif;
 	uint32_t max_mac_addrs;
diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c
index f32966521..4b5e24f98 100644
--- a/drivers/net/ionic/ionic_dev.c
+++ b/drivers/net/ionic/ionic_dev.c
@@ -288,12 +288,10 @@ 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, uint16_t lif_index,
-		       rte_iova_t info_pa)
+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.index = lif_index,
 		.lif_init.info_pa = info_pa,
 	};
 
@@ -301,11 +299,10 @@ ionic_dev_cmd_lif_init(struct ionic_dev *idev, uint16_t lif_index,
 }
 
 void
-ionic_dev_cmd_lif_reset(struct ionic_dev *idev, uint16_t lif_index)
+ionic_dev_cmd_lif_reset(struct ionic_dev *idev)
 {
 	union ionic_dev_cmd cmd = {
 		.lif_init.opcode = IONIC_CMD_LIF_RESET,
-		.lif_init.index = lif_index,
 	};
 
 	ionic_dev_cmd_go(idev, &cmd);
@@ -317,12 +314,6 @@ ionic_db_map(struct ionic_lif *lif, struct ionic_queue *q)
 	return lif->kern_dbpage + q->hw_type;
 }
 
-int
-ionic_db_page_num(struct ionic_lif *lif, int pid)
-{
-	return (lif->index * 0) + pid;
-}
-
 void
 ionic_intr_init(struct ionic_dev *idev, struct ionic_intr_info *intr,
 		unsigned long index)
@@ -334,14 +325,13 @@ 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 lif_index, uint16_t intr_index)
+		uint16_t intr_index)
 {
 	struct ionic_queue *q = &qcq->q;
 	struct ionic_cq *cq = &qcq->cq;
 
 	union ionic_dev_cmd cmd = {
 		.q_init.opcode = IONIC_CMD_Q_INIT,
-		.q_init.lif_index = lif_index,
 		.q_init.type = q->type,
 		.q_init.index = q->index,
 		.q_init.flags = IONIC_QINIT_F_ENA,
diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h
index 026c4a9f3..6588a373f 100644
--- a/drivers/net/ionic/ionic_dev.h
+++ b/drivers/net/ionic/ionic_dev.h
@@ -232,15 +232,13 @@ void ionic_dev_cmd_port_loopback(struct ionic_dev *idev,
 
 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, uint16_t lif_index,
-	rte_iova_t addr);
-void ionic_dev_cmd_lif_reset(struct ionic_dev *idev, uint16_t lif_index);
+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 lif_index, uint16_t intr_index);
+	uint16_t intr_index);
 
 struct ionic_doorbell __iomem *ionic_db_map(struct ionic_lif *lif,
 	struct ionic_queue *q);
-int ionic_db_page_num(struct ionic_lif *lif, int pid);
 
 int ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq,
 	struct ionic_intr_info *intr, uint32_t num_descs,
diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
index 5a360ac08..54d7a6cad 100644
--- a/drivers/net/ionic/ionic_ethdev.c
+++ b/drivers/net/ionic/ionic_ethdev.c
@@ -339,14 +339,11 @@ static void
 ionic_dev_interrupt_handler(void *param)
 {
 	struct ionic_adapter *adapter = (struct ionic_adapter *)param;
-	uint32_t i;
 
 	IONIC_PRINT(DEBUG, "->");
 
-	for (i = 0; i < adapter->nlifs; i++) {
-		if (adapter->lifs[i])
-			ionic_notifyq_handler(adapter->lifs[i], -1);
-	}
+	if (adapter->lif)
+		ionic_notifyq_handler(adapter->lif, -1);
 }
 
 static int
@@ -1008,10 +1005,9 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
 	rte_eth_copy_pci_info(eth_dev, pci_dev);
 	eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 
-	lif->index = adapter->nlifs;
 	lif->eth_dev = eth_dev;
 	lif->adapter = adapter;
-	adapter->lifs[adapter->nlifs] = lif;
+	adapter->lif = lif;
 
 	IONIC_PRINT(DEBUG, "Up to %u MAC addresses supported",
 		adapter->max_mac_addrs);
@@ -1066,7 +1062,7 @@ eth_ionic_dev_uninit(struct rte_eth_dev *eth_dev)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
-	adapter->lifs[lif->index] = NULL;
+	adapter->lif = NULL;
 
 	ionic_lif_deinit(lif);
 	ionic_lif_free(lif);
@@ -1243,22 +1239,19 @@ eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 
 	adapter->max_mac_addrs = adapter->ident.lif.eth.max_ucast_filters;
 
-	adapter->nlifs = 0;
-	for (i = 0; i < adapter->ident.dev.nlifs; i++) {
-		snprintf(name, sizeof(name), "net_%s_lif_%lu",
-			pci_dev->device.name, i);
-
-		err = rte_eth_dev_create(&pci_dev->device, name,
-			sizeof(struct ionic_lif),
-			NULL, NULL,
-			eth_ionic_dev_init, adapter);
-		if (err) {
-			IONIC_PRINT(ERR, "Cannot create eth device for "
-				"ionic lif %s", name);
-			break;
-		}
+	if (adapter->ident.dev.nlifs != 1) {
+		IONIC_PRINT(ERR, "Unexpected request for %d LIFs",
+			adapter->ident.dev.nlifs);
+		goto err_free_adapter;
+	}
 
-		adapter->nlifs++;
+	snprintf(name, sizeof(name), "%s_lif", pci_dev->device.name);
+	err = rte_eth_dev_create(&pci_dev->device,
+			name, sizeof(struct ionic_lif),
+			NULL, NULL, eth_ionic_dev_init, adapter);
+	if (err) {
+		IONIC_PRINT(ERR, "Cannot create eth device for %s", name);
+		goto err_free_adapter;
 	}
 
 	err = ionic_configure_intr(adapter);
@@ -1283,11 +1276,9 @@ eth_ionic_pci_remove(struct rte_pci_device *pci_dev __rte_unused)
 	struct ionic_adapter *adapter = NULL;
 	struct rte_eth_dev *eth_dev;
 	struct ionic_lif *lif;
-	uint32_t i;
 
-	/* Adapter lookup is using (the first) eth_dev name */
-	snprintf(name, sizeof(name), "net_%s_lif_0",
-		pci_dev->device.name);
+	/* Adapter lookup is using the eth_dev name */
+	snprintf(name, sizeof(name), "%s_lif", pci_dev->device.name);
 
 	eth_dev = rte_eth_dev_allocated(name);
 	if (eth_dev) {
@@ -1298,10 +1289,7 @@ eth_ionic_pci_remove(struct rte_pci_device *pci_dev __rte_unused)
 	if (adapter) {
 		ionic_unconfigure_intr(adapter);
 
-		for (i = 0; i < adapter->nlifs; i++) {
-			lif = adapter->lifs[i];
-			rte_eth_dev_destroy(lif->eth_dev, eth_ionic_dev_uninit);
-		}
+		rte_eth_dev_destroy(eth_dev, eth_ionic_dev_uninit);
 
 		rte_free(adapter);
 	}
diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c
index 875c7e585..4b5221b83 100644
--- a/drivers/net/ionic/ionic_lif.c
+++ b/drivers/net/ionic/ionic_lif.c
@@ -25,7 +25,6 @@ ionic_qcq_enable(struct ionic_qcq *qcq)
 		.pending_work = true,
 		.cmd.q_control = {
 			.opcode = IONIC_CMD_Q_CONTROL,
-			.lif_index = lif->index,
 			.type = q->type,
 			.index = q->index,
 			.oper = IONIC_Q_ENABLE,
@@ -50,7 +49,6 @@ ionic_qcq_disable(struct ionic_qcq *qcq)
 		.pending_work = true,
 		.cmd.q_control = {
 			.opcode = IONIC_CMD_Q_CONTROL,
-			.lif_index = lif->index,
 			.type = q->type,
 			.index = q->index,
 			.oper = IONIC_Q_DISABLE,
@@ -81,7 +79,7 @@ ionic_lif_reset(struct ionic_lif *lif)
 
 	IONIC_PRINT_CALL();
 
-	ionic_dev_cmd_lif_reset(idev, lif->index);
+	ionic_dev_cmd_lif_reset(idev);
 	err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
 	if (err)
 		IONIC_PRINT(WARNING, "Failed to reset %s", lif->name);
@@ -438,7 +436,6 @@ ionic_lif_rx_mode(struct ionic_lif *lif, uint32_t rx_mode)
 		.pending_work = true,
 		.cmd.rx_mode_set = {
 			.opcode = IONIC_CMD_RX_MODE_SET,
-			.lif_index = lif->index,
 			.rx_mode = rx_mode,
 		},
 	};
@@ -530,7 +527,6 @@ ionic_lif_change_mtu(struct ionic_lif *lif, int new_mtu)
 		.pending_work = true,
 		.cmd.lif_setattr = {
 			.opcode = IONIC_CMD_LIF_SETATTR,
-			.index = lif->index,
 			.attr = IONIC_LIF_ATTR_MTU,
 			.mtu = new_mtu,
 		},
@@ -824,7 +820,6 @@ ionic_lif_alloc(struct ionic_lif *lif)
 {
 	struct ionic_adapter *adapter = lif->adapter;
 	uint32_t socket_id = rte_socket_id();
-	int dbpage_num;
 	int err;
 
 	/*
@@ -840,9 +835,7 @@ ionic_lif_alloc(struct ionic_lif *lif)
 	rte_spinlock_init(&lif->adminq_lock);
 	rte_spinlock_init(&lif->adminq_service_lock);
 
-	dbpage_num = ionic_db_page_num(lif, 0);
-
-	lif->kern_dbpage = ionic_bus_map_dbpage(adapter, dbpage_num);
+	lif->kern_dbpage = ionic_bus_map_dbpage(adapter, 0);
 	if (!lif->kern_dbpage) {
 		IONIC_PRINT(ERR, "Cannot map dbpage, aborting");
 		return -ENOMEM;
@@ -1174,7 +1167,7 @@ ionic_lif_adminq_init(struct ionic_lif *lif)
 	struct ionic_q_init_comp comp;
 	int err;
 
-	ionic_dev_cmd_adminq_init(idev, qcq, lif->index, qcq->intr.index);
+	ionic_dev_cmd_adminq_init(idev, qcq, qcq->intr.index);
 	err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
 	if (err)
 		return err;
@@ -1210,7 +1203,6 @@ ionic_lif_notifyq_init(struct ionic_lif *lif)
 		.pending_work = true,
 		.cmd.q_init = {
 			.opcode = IONIC_CMD_Q_INIT,
-			.lif_index = lif->index,
 			.type = q->type,
 			.index = q->index,
 			.flags = (IONIC_QINIT_F_IRQ | IONIC_QINIT_F_ENA),
@@ -1256,7 +1248,6 @@ ionic_lif_set_features(struct ionic_lif *lif)
 		.pending_work = true,
 		.cmd.lif_setattr = {
 			.opcode = IONIC_CMD_LIF_SETATTR,
-			.index = lif->index,
 			.attr = IONIC_LIF_ATTR_FEATURES,
 			.features = lif->features,
 		},
@@ -1318,7 +1309,6 @@ ionic_lif_txq_init(struct ionic_qcq *qcq)
 		.pending_work = true,
 		.cmd.q_init = {
 			.opcode = IONIC_CMD_Q_INIT,
-			.lif_index = lif->index,
 			.type = q->type,
 			.index = q->index,
 			.flags = IONIC_QINIT_F_SG,
@@ -1365,7 +1355,6 @@ ionic_lif_rxq_init(struct ionic_qcq *qcq)
 		.pending_work = true,
 		.cmd.q_init = {
 			.opcode = IONIC_CMD_Q_INIT,
-			.lif_index = lif->index,
 			.type = q->type,
 			.index = q->index,
 			.flags = IONIC_QINIT_F_SG,
@@ -1409,7 +1398,6 @@ ionic_station_set(struct ionic_lif *lif)
 		.pending_work = true,
 		.cmd.lif_getattr = {
 			.opcode = IONIC_CMD_LIF_GETATTR,
-			.index = lif->index,
 			.attr = IONIC_LIF_ATTR_MAC,
 		},
 	};
@@ -1449,7 +1437,6 @@ ionic_lif_set_name(struct ionic_lif *lif)
 		.pending_work = true,
 		.cmd.lif_setattr = {
 			.opcode = IONIC_CMD_LIF_SETATTR,
-			.index = lif->index,
 			.attr = IONIC_LIF_ATTR_NAME,
 		},
 	};
@@ -1469,7 +1456,7 @@ ionic_lif_init(struct ionic_lif *lif)
 
 	memset(&lif->stats_base, 0, sizeof(lif->stats_base));
 
-	ionic_dev_cmd_lif_init(idev, lif->index, lif->info_pa);
+	ionic_dev_cmd_lif_init(idev, lif->info_pa);
 	err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
 	ionic_dev_cmd_comp(idev, &comp);
 	if (err)
@@ -1672,7 +1659,6 @@ int
 ionic_lifs_size(struct ionic_adapter *adapter)
 {
 	struct ionic_identity *ident = &adapter->ident;
-	uint32_t nlifs = ident->dev.nlifs;
 	uint32_t nintrs, dev_nintrs = ident->dev.nintrs;
 
 	adapter->max_ntxqs_per_lif =
@@ -1680,7 +1666,7 @@ ionic_lifs_size(struct ionic_adapter *adapter)
 	adapter->max_nrxqs_per_lif =
 		ident->lif.eth.config.queue_count[IONIC_QTYPE_RXQ];
 
-	nintrs = nlifs * 1 /* notifyq */;
+	nintrs = 1 /* notifyq */;
 
 	if (nintrs > dev_nintrs) {
 		IONIC_PRINT(ERR,
diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h
index b80931c61..c1d15dca6 100644
--- a/drivers/net/ionic/ionic_lif.h
+++ b/drivers/net/ionic/ionic_lif.h
@@ -84,7 +84,6 @@ struct ionic_lif {
 	struct ionic_adapter *adapter;
 	struct rte_eth_dev *eth_dev;
 	uint16_t port_id;  /**< Device port identifier */
-	uint32_t index;
 	uint32_t hw_index;
 	uint32_t state;
 	uint32_t ntxqcqs;
-- 
2.17.1


  parent reply	other threads:[~2020-12-16 21:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-10 14:22 [dpdk-dev] [PATCH 0/6] net/ionic: fixes for stop and start Andrew Boyer
2020-12-10 14:22 ` [dpdk-dev] [PATCH 1/6] net/ionic: preserve RSS state unless RETA size changes Andrew Boyer
2020-12-10 14:22 ` [dpdk-dev] [PATCH 2/6] net/ionic: preserve RX mode across LIF stop/start Andrew Boyer
2020-12-10 14:22 ` [dpdk-dev] [PATCH 3/6] net/ionic: fully implement remove-on-close Andrew Boyer
2020-12-15 13:42   ` Ferruh Yigit
2020-12-16 19:52     ` Andrew Boyer
2020-12-10 14:22 ` [dpdk-dev] [PATCH 4/6] net/ionic: improve link state handling Andrew Boyer
2020-12-10 14:22 ` [dpdk-dev] [PATCH 5/6] net/ionic: improve queue " Andrew Boyer
2020-12-10 14:22 ` [dpdk-dev] [PATCH 6/6] net/ionic: stop queues when LIF is stopped Andrew Boyer
2020-12-15 14:01 ` [dpdk-dev] [PATCH 0/6] net/ionic: fixes for stop and start Ferruh Yigit
2020-12-16 21:12 ` [dpdk-dev] [PATCH v2 0/7] " Andrew Boyer
2021-01-11 17:08   ` Ferruh Yigit
2020-12-16 21:12 ` [dpdk-dev] [PATCH v2 1/7] net/ionic: preserve RSS state unless RETA size changes Andrew Boyer
2020-12-16 21:12 ` [dpdk-dev] [PATCH v2 2/7] net/ionic: preserve Rx mode across LIF stop/start Andrew Boyer
2020-12-16 21:12 ` Andrew Boyer [this message]
2020-12-16 21:12 ` [dpdk-dev] [PATCH v2 4/7] net/ionic: fully implement remove-on-close Andrew Boyer
2020-12-16 21:12 ` [dpdk-dev] [PATCH v2 5/7] net/ionic: improve link state handling Andrew Boyer
2020-12-16 21:12 ` [dpdk-dev] [PATCH v2 6/7] net/ionic: improve queue " Andrew Boyer
2020-12-16 21:12 ` [dpdk-dev] [PATCH v2 7/7] net/ionic: stop queues when LIF is stopped Andrew Boyer

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20201216211257.37195-4-aboyer@pensando.io \
    --to=aboyer@pensando.io \
    --cc=cardigliano@ntop.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).