net/ionic: remove multi-LIF support
authorAndrew Boyer <aboyer@pensando.io>
Wed, 16 Dec 2020 21:12:53 +0000 (13:12 -0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 13 Jan 2021 17:51:58 +0000 (18:51 +0100)
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
drivers/net/ionic/ionic_dev.c
drivers/net/ionic/ionic_dev.h
drivers/net/ionic/ionic_ethdev.c
drivers/net/ionic/ionic_lif.c
drivers/net/ionic/ionic_lif.h

index 7ad0ab6..49d1fc0 100644 (file)
@@ -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;
index f329665..4b5e24f 100644 (file)
@@ -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,
index 026c4a9..6588a37 100644 (file)
@@ -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,
index 5a360ac..54d7a6c 100644 (file)
@@ -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);
        }
index 875c7e5..4b5221b 100644 (file)
@@ -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,
index b80931c..c1d15dc 100644 (file)
@@ -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;