LCOV - code coverage report
Current view: top level - drivers/net/bnx2x - bnx2x_ethdev.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 4 332 1.2 %
Date: 2025-01-02 22:41:34 Functions: 4 32 12.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 126 1.6 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright (c) 2013-2015 Brocade Communications Systems, Inc.
       3                 :            :  * Copyright (c) 2015-2018 Cavium Inc.
       4                 :            :  * All rights reserved.
       5                 :            :  * www.cavium.com
       6                 :            :  */
       7                 :            : 
       8                 :            : #include "bnx2x.h"
       9                 :            : #include "bnx2x_rxtx.h"
      10                 :            : 
      11                 :            : #include <rte_string_fns.h>
      12                 :            : #include <dev_driver.h>
      13                 :            : #include <ethdev_pci.h>
      14                 :            : #include <rte_alarm.h>
      15                 :            : 
      16                 :            : /*
      17                 :            :  * The set of PCI devices this driver supports
      18                 :            :  */
      19                 :            : #define BROADCOM_PCI_VENDOR_ID 0x14E4
      20                 :            : #define QLOGIC_PCI_VENDOR_ID 0x1077
      21                 :            : static const struct rte_pci_id pci_id_bnx2x_map[] = {
      22                 :            :         { RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57800) },
      23                 :            :         { RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57711) },
      24                 :            :         { RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57810) },
      25                 :            :         { RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57811) },
      26                 :            :         { RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57840_OBS) },
      27                 :            :         { RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57840_4_10) },
      28                 :            :         { RTE_PCI_DEVICE(QLOGIC_PCI_VENDOR_ID, CHIP_NUM_57840_4_10) },
      29                 :            :         { RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57840_2_20) },
      30                 :            : #ifdef RTE_LIBRTE_BNX2X_MF_SUPPORT
      31                 :            :         { RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57810_MF) },
      32                 :            :         { RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57811_MF) },
      33                 :            :         { RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57840_MF) },
      34                 :            :         { RTE_PCI_DEVICE(QLOGIC_PCI_VENDOR_ID, CHIP_NUM_57840_MF) },
      35                 :            : #endif
      36                 :            :         { .vendor_id = 0, }
      37                 :            : };
      38                 :            : 
      39                 :            : static const struct rte_pci_id pci_id_bnx2xvf_map[] = {
      40                 :            :         { RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57800_VF) },
      41                 :            :         { RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57810_VF) },
      42                 :            :         { RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57811_VF) },
      43                 :            :         { RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57840_VF) },
      44                 :            :         { RTE_PCI_DEVICE(QLOGIC_PCI_VENDOR_ID, CHIP_NUM_57840_VF) },
      45                 :            :         { .vendor_id = 0, }
      46                 :            : };
      47                 :            : 
      48                 :            : struct rte_bnx2x_xstats_name_off {
      49                 :            :         char name[RTE_ETH_XSTATS_NAME_SIZE];
      50                 :            :         uint32_t offset_hi;
      51                 :            :         uint32_t offset_lo;
      52                 :            : };
      53                 :            : 
      54                 :            : static const struct rte_bnx2x_xstats_name_off bnx2x_xstats_strings[] = {
      55                 :            :         {"rx_buffer_drops",
      56                 :            :                 offsetof(struct bnx2x_eth_stats, brb_drop_hi),
      57                 :            :                 offsetof(struct bnx2x_eth_stats, brb_drop_lo)},
      58                 :            :         {"rx_buffer_truncates",
      59                 :            :                 offsetof(struct bnx2x_eth_stats, brb_truncate_hi),
      60                 :            :                 offsetof(struct bnx2x_eth_stats, brb_truncate_lo)},
      61                 :            :         {"rx_buffer_truncate_discard",
      62                 :            :                 offsetof(struct bnx2x_eth_stats, brb_truncate_discard),
      63                 :            :                 offsetof(struct bnx2x_eth_stats, brb_truncate_discard)},
      64                 :            :         {"mac_filter_discard",
      65                 :            :                 offsetof(struct bnx2x_eth_stats, mac_filter_discard),
      66                 :            :                 offsetof(struct bnx2x_eth_stats, mac_filter_discard)},
      67                 :            :         {"no_match_vlan_tag_discard",
      68                 :            :                 offsetof(struct bnx2x_eth_stats, mf_tag_discard),
      69                 :            :                 offsetof(struct bnx2x_eth_stats, mf_tag_discard)},
      70                 :            :         {"tx_pause",
      71                 :            :                 offsetof(struct bnx2x_eth_stats, pause_frames_sent_hi),
      72                 :            :                 offsetof(struct bnx2x_eth_stats, pause_frames_sent_lo)},
      73                 :            :         {"rx_pause",
      74                 :            :                 offsetof(struct bnx2x_eth_stats, pause_frames_received_hi),
      75                 :            :                 offsetof(struct bnx2x_eth_stats, pause_frames_received_lo)},
      76                 :            :         {"tx_priority_flow_control",
      77                 :            :                 offsetof(struct bnx2x_eth_stats, pfc_frames_sent_hi),
      78                 :            :                 offsetof(struct bnx2x_eth_stats, pfc_frames_sent_lo)},
      79                 :            :         {"rx_priority_flow_control",
      80                 :            :                 offsetof(struct bnx2x_eth_stats, pfc_frames_received_hi),
      81                 :            :                 offsetof(struct bnx2x_eth_stats, pfc_frames_received_lo)}
      82                 :            : };
      83                 :            : 
      84                 :            : static int
      85                 :          0 : bnx2x_link_update(struct rte_eth_dev *dev)
      86                 :            : {
      87                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
      88                 :            :         struct rte_eth_link link;
      89                 :            : 
      90                 :          0 :         PMD_INIT_FUNC_TRACE(sc);
      91                 :            : 
      92                 :            :         memset(&link, 0, sizeof(link));
      93                 :            :         mb();
      94                 :          0 :         link.link_speed = sc->link_vars.line_speed;
      95         [ #  # ]:          0 :         switch (sc->link_vars.duplex) {
      96                 :          0 :                 case DUPLEX_FULL:
      97                 :          0 :                         link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
      98                 :          0 :                         break;
      99                 :            :                 case DUPLEX_HALF:
     100                 :            :                         link.link_duplex = RTE_ETH_LINK_HALF_DUPLEX;
     101                 :            :                         break;
     102                 :            :         }
     103                 :          0 :         link.link_autoneg = !(dev->data->dev_conf.link_speeds &
     104                 :            :                  RTE_ETH_LINK_SPEED_FIXED);
     105         [ #  # ]:          0 :         link.link_status = sc->link_vars.link_up;
     106                 :            : 
     107                 :          0 :         return rte_eth_linkstatus_set(dev, &link);
     108                 :            : }
     109                 :            : 
     110                 :            : static void
     111                 :          0 : bnx2x_interrupt_action(struct rte_eth_dev *dev, int intr_cxt)
     112                 :            : {
     113                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     114                 :            :         uint32_t link_status;
     115                 :            : 
     116                 :          0 :         bnx2x_intr_legacy(sc);
     117                 :            : 
     118   [ #  #  #  # ]:          0 :         if ((atomic_load_acq_long(&sc->periodic_flags) == PERIODIC_GO) &&
     119                 :            :             !intr_cxt)
     120                 :          0 :                 bnx2x_periodic_callout(sc);
     121                 :          0 :         link_status = REG_RD(sc, sc->link_params.shmem_base +
     122                 :            :                         offsetof(struct shmem_region,
     123                 :            :                                 port_mb[sc->link_params.port].link_status));
     124         [ #  # ]:          0 :         if ((link_status & LINK_STATUS_LINK_UP) != dev->data->dev_link.link_status)
     125                 :          0 :                 bnx2x_link_update(dev);
     126                 :          0 : }
     127                 :            : 
     128                 :            : static void
     129                 :          0 : bnx2x_interrupt_handler(void *param)
     130                 :            : {
     131                 :            :         struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
     132                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     133                 :            : 
     134                 :            :         PMD_DEBUG_PERIODIC_LOG(INFO, sc, "Interrupt handled");
     135                 :            : 
     136                 :          0 :         bnx2x_interrupt_action(dev, 1);
     137                 :          0 :         rte_intr_ack(sc->pci_dev->intr_handle);
     138                 :          0 : }
     139                 :            : 
     140                 :          0 : static void bnx2x_periodic_start(void *param)
     141                 :            : {
     142                 :            :         struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
     143                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     144                 :            :         int ret = 0;
     145                 :            : 
     146                 :          0 :         atomic_store_rel_long(&sc->periodic_flags, PERIODIC_GO);
     147                 :          0 :         bnx2x_interrupt_action(dev, 0);
     148         [ #  # ]:          0 :         if (IS_PF(sc)) {
     149                 :          0 :                 ret = rte_eal_alarm_set(BNX2X_SP_TIMER_PERIOD,
     150                 :            :                                         bnx2x_periodic_start, (void *)dev);
     151         [ #  # ]:          0 :                 if (ret) {
     152                 :          0 :                         PMD_DRV_LOG(ERR, sc, "Unable to start periodic"
     153                 :            :                                              " timer rc %d", ret);
     154                 :            :                 }
     155                 :            :         }
     156                 :          0 : }
     157                 :            : 
     158                 :          0 : void bnx2x_periodic_stop(void *param)
     159                 :            : {
     160                 :            :         struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
     161                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     162                 :            : 
     163                 :          0 :         atomic_store_rel_long(&sc->periodic_flags, PERIODIC_STOP);
     164                 :            : 
     165                 :          0 :         rte_eal_alarm_cancel(bnx2x_periodic_start, (void *)dev);
     166                 :            : 
     167                 :          0 :         PMD_DRV_LOG(DEBUG, sc, "Periodic poll stopped");
     168                 :          0 : }
     169                 :            : 
     170                 :            : /*
     171                 :            :  * Devops - helper functions can be called from user application
     172                 :            :  */
     173                 :            : 
     174                 :            : static int
     175                 :          0 : bnx2x_dev_configure(struct rte_eth_dev *dev)
     176                 :            : {
     177                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     178                 :            : 
     179                 :          0 :         int mp_ncpus = sysconf(_SC_NPROCESSORS_CONF);
     180                 :            : 
     181                 :          0 :         PMD_INIT_FUNC_TRACE(sc);
     182                 :            : 
     183                 :          0 :         sc->mtu = dev->data->dev_conf.rxmode.mtu;
     184                 :            : 
     185         [ #  # ]:          0 :         if (dev->data->nb_tx_queues > dev->data->nb_rx_queues) {
     186                 :          0 :                 PMD_DRV_LOG(ERR, sc, "The number of TX queues is greater than number of RX queues");
     187                 :          0 :                 return -EINVAL;
     188                 :            :         }
     189                 :            : 
     190                 :          0 :         sc->num_queues = MAX(dev->data->nb_rx_queues, dev->data->nb_tx_queues);
     191         [ #  # ]:          0 :         if (sc->num_queues > mp_ncpus) {
     192                 :          0 :                 PMD_DRV_LOG(ERR, sc, "The number of queues is more than number of CPUs");
     193                 :          0 :                 return -EINVAL;
     194                 :            :         }
     195                 :            : 
     196                 :          0 :         PMD_DRV_LOG(DEBUG, sc, "num_queues=%d, mtu=%d",
     197                 :            :                        sc->num_queues, sc->mtu);
     198                 :            : 
     199                 :            :         /* allocate ilt */
     200         [ #  # ]:          0 :         if (bnx2x_alloc_ilt_mem(sc) != 0) {
     201                 :          0 :                 PMD_DRV_LOG(ERR, sc, "bnx2x_alloc_ilt_mem was failed");
     202                 :          0 :                 return -ENXIO;
     203                 :            :         }
     204                 :            : 
     205                 :          0 :         bnx2x_dev_rxtx_init_dummy(dev);
     206                 :          0 :         return 0;
     207                 :            : }
     208                 :            : 
     209                 :            : static int
     210                 :          0 : bnx2x_dev_start(struct rte_eth_dev *dev)
     211                 :            : {
     212                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     213                 :            :         int ret = 0;
     214                 :            :         uint16_t i;
     215                 :            : 
     216                 :          0 :         PMD_INIT_FUNC_TRACE(sc);
     217                 :            : 
     218                 :            :         /* start the periodic callout */
     219         [ #  # ]:          0 :         if (IS_PF(sc)) {
     220         [ #  # ]:          0 :                 if (atomic_load_acq_long(&sc->periodic_flags) ==
     221                 :            :                     PERIODIC_STOP) {
     222                 :          0 :                         bnx2x_periodic_start(dev);
     223                 :          0 :                         PMD_DRV_LOG(DEBUG, sc, "Periodic poll re-started");
     224                 :            :                 }
     225                 :            :         }
     226                 :            : 
     227                 :          0 :         ret = bnx2x_init(sc);
     228         [ #  # ]:          0 :         if (ret) {
     229                 :          0 :                 PMD_DRV_LOG(DEBUG, sc, "bnx2x_init failed (%d)", ret);
     230                 :          0 :                 return -1;
     231                 :            :         }
     232                 :            : 
     233         [ #  # ]:          0 :         if (IS_PF(sc)) {
     234                 :          0 :                 rte_intr_callback_register(sc->pci_dev->intr_handle,
     235                 :            :                                 bnx2x_interrupt_handler, (void *)dev);
     236                 :            : 
     237         [ #  # ]:          0 :                 if (rte_intr_enable(sc->pci_dev->intr_handle))
     238                 :          0 :                         PMD_DRV_LOG(ERR, sc, "rte_intr_enable failed");
     239                 :            :         }
     240                 :            : 
     241                 :            :         /* Configure the previously stored Multicast address list */
     242         [ #  # ]:          0 :         if (IS_VF(sc))
     243                 :          0 :                 bnx2x_vfpf_set_mcast(sc, sc->mc_addrs, sc->mc_addrs_num);
     244                 :          0 :         bnx2x_dev_rxtx_init(dev);
     245                 :            : 
     246                 :          0 :         bnx2x_print_device_info(sc);
     247                 :            : 
     248         [ #  # ]:          0 :         for (i = 0; i < dev->data->nb_tx_queues; i++)
     249                 :          0 :                 dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
     250         [ #  # ]:          0 :         for (i = 0; i < dev->data->nb_rx_queues; i++)
     251                 :          0 :                 dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
     252                 :            : 
     253                 :            :         return ret;
     254                 :            : }
     255                 :            : 
     256                 :            : static int
     257                 :          0 : bnx2x_dev_stop(struct rte_eth_dev *dev)
     258                 :            : {
     259                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     260                 :            :         int ret = 0;
     261                 :            :         uint16_t i;
     262                 :            : 
     263                 :          0 :         PMD_INIT_FUNC_TRACE(sc);
     264                 :            : 
     265                 :          0 :         bnx2x_dev_rxtx_init_dummy(dev);
     266                 :            : 
     267         [ #  # ]:          0 :         if (IS_PF(sc)) {
     268                 :          0 :                 rte_intr_disable(sc->pci_dev->intr_handle);
     269                 :          0 :                 rte_intr_callback_unregister(sc->pci_dev->intr_handle,
     270                 :            :                                 bnx2x_interrupt_handler, (void *)dev);
     271                 :            : 
     272                 :            :                 /* stop the periodic callout */
     273                 :          0 :                 bnx2x_periodic_stop(dev);
     274                 :            :         }
     275                 :            :         /* Remove the configured Multicast list
     276                 :            :          * Sending NULL for the list of address and the
     277                 :            :          * Number is set to 0 denoting DEL_CMD
     278                 :            :          */
     279         [ #  # ]:          0 :         if (IS_VF(sc))
     280                 :          0 :                 bnx2x_vfpf_set_mcast(sc, NULL, 0);
     281                 :          0 :         ret = bnx2x_nic_unload(sc, UNLOAD_NORMAL, FALSE);
     282         [ #  # ]:          0 :         if (ret) {
     283                 :          0 :                 PMD_DRV_LOG(DEBUG, sc, "bnx2x_nic_unload failed (%d)", ret);
     284                 :          0 :                 return ret;
     285                 :            :         }
     286                 :            : 
     287         [ #  # ]:          0 :         for (i = 0; i < dev->data->nb_tx_queues; i++)
     288                 :          0 :                 dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
     289         [ #  # ]:          0 :         for (i = 0; i < dev->data->nb_rx_queues; i++)
     290                 :          0 :                 dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
     291                 :            : 
     292                 :            :         return 0;
     293                 :            : }
     294                 :            : 
     295                 :            : static int
     296                 :          0 : bnx2x_dev_close(struct rte_eth_dev *dev)
     297                 :            : {
     298                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     299                 :            : 
     300                 :          0 :         PMD_INIT_FUNC_TRACE(sc);
     301                 :            : 
     302                 :            :         /* only close in case of the primary process */
     303         [ #  # ]:          0 :         if (rte_eal_process_type() != RTE_PROC_PRIMARY)
     304                 :            :                 return 0;
     305                 :            : 
     306         [ #  # ]:          0 :         if (IS_VF(sc))
     307                 :          0 :                 bnx2x_vf_close(sc);
     308                 :            : 
     309                 :          0 :         bnx2x_dev_clear_queues(dev);
     310                 :          0 :         memset(&(dev->data->dev_link), 0 , sizeof(struct rte_eth_link));
     311                 :            : 
     312                 :            :         /* free ilt */
     313                 :          0 :         bnx2x_free_ilt_mem(sc);
     314                 :            : 
     315                 :            :         /* mac_addrs must not be freed alone because part of dev_private */
     316                 :          0 :         dev->data->mac_addrs = NULL;
     317                 :            : 
     318                 :          0 :         return 0;
     319                 :            : }
     320                 :            : 
     321                 :            : static int
     322                 :          0 : bnx2x_promisc_enable(struct rte_eth_dev *dev)
     323                 :            : {
     324                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     325                 :            : 
     326                 :          0 :         PMD_INIT_FUNC_TRACE(sc);
     327                 :          0 :         sc->rx_mode = BNX2X_RX_MODE_PROMISC;
     328         [ #  # ]:          0 :         if (rte_eth_allmulticast_get(dev->data->port_id) == 1)
     329                 :          0 :                 sc->rx_mode = BNX2X_RX_MODE_ALLMULTI_PROMISC;
     330                 :          0 :         bnx2x_set_rx_mode(sc);
     331                 :            : 
     332                 :          0 :         return 0;
     333                 :            : }
     334                 :            : 
     335                 :            : static int
     336                 :          0 : bnx2x_promisc_disable(struct rte_eth_dev *dev)
     337                 :            : {
     338                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     339                 :            : 
     340                 :          0 :         PMD_INIT_FUNC_TRACE(sc);
     341                 :          0 :         sc->rx_mode = BNX2X_RX_MODE_NORMAL;
     342         [ #  # ]:          0 :         if (rte_eth_allmulticast_get(dev->data->port_id) == 1)
     343                 :          0 :                 sc->rx_mode = BNX2X_RX_MODE_ALLMULTI;
     344                 :          0 :         bnx2x_set_rx_mode(sc);
     345                 :            : 
     346                 :          0 :         return 0;
     347                 :            : }
     348                 :            : 
     349                 :            : static int
     350                 :          0 : bnx2x_dev_allmulticast_enable(struct rte_eth_dev *dev)
     351                 :            : {
     352                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     353                 :            : 
     354                 :          0 :         PMD_INIT_FUNC_TRACE(sc);
     355                 :          0 :         sc->rx_mode = BNX2X_RX_MODE_ALLMULTI;
     356         [ #  # ]:          0 :         if (rte_eth_promiscuous_get(dev->data->port_id) == 1)
     357                 :          0 :                 sc->rx_mode = BNX2X_RX_MODE_ALLMULTI_PROMISC;
     358                 :          0 :         bnx2x_set_rx_mode(sc);
     359                 :            : 
     360                 :          0 :         return 0;
     361                 :            : }
     362                 :            : 
     363                 :            : static int
     364                 :          0 : bnx2x_dev_allmulticast_disable(struct rte_eth_dev *dev)
     365                 :            : {
     366                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     367                 :            : 
     368                 :          0 :         PMD_INIT_FUNC_TRACE(sc);
     369                 :          0 :         sc->rx_mode = BNX2X_RX_MODE_NORMAL;
     370         [ #  # ]:          0 :         if (rte_eth_promiscuous_get(dev->data->port_id) == 1)
     371                 :          0 :                 sc->rx_mode = BNX2X_RX_MODE_PROMISC;
     372                 :          0 :         bnx2x_set_rx_mode(sc);
     373                 :            : 
     374                 :          0 :         return 0;
     375                 :            : }
     376                 :            : 
     377                 :            : static int
     378                 :          0 : bnx2x_dev_set_mc_addr_list(struct rte_eth_dev *dev,
     379                 :            :                 struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num)
     380                 :            : {
     381                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     382                 :            :         int err;
     383                 :          0 :         PMD_INIT_FUNC_TRACE(sc);
     384                 :            :         /* flush previous addresses */
     385                 :          0 :         err = bnx2x_vfpf_set_mcast(sc, NULL, 0);
     386         [ #  # ]:          0 :         if (err)
     387                 :            :                 return err;
     388                 :          0 :         sc->mc_addrs_num = 0;
     389                 :            : 
     390                 :            :         /* Add new ones */
     391                 :          0 :         err = bnx2x_vfpf_set_mcast(sc, mc_addrs, mc_addrs_num);
     392         [ #  # ]:          0 :         if (err)
     393                 :            :                 return err;
     394                 :            : 
     395                 :          0 :         sc->mc_addrs_num = mc_addrs_num;
     396                 :          0 :         memcpy(sc->mc_addrs, mc_addrs, mc_addrs_num * sizeof(*mc_addrs));
     397                 :            : 
     398                 :          0 :         return 0;
     399                 :            : }
     400                 :            : 
     401                 :            : static int
     402                 :          0 : bnx2x_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete)
     403                 :            : {
     404                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     405                 :            : 
     406                 :          0 :         PMD_INIT_FUNC_TRACE(sc);
     407                 :            : 
     408                 :          0 :         return bnx2x_link_update(dev);
     409                 :            : }
     410                 :            : 
     411                 :            : static int
     412                 :          0 : bnx2xvf_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete)
     413                 :            : {
     414                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     415                 :            :         int ret = 0;
     416                 :            : 
     417                 :          0 :         ret = bnx2x_link_update(dev);
     418                 :            : 
     419                 :          0 :         bnx2x_check_bull(sc);
     420         [ #  # ]:          0 :         if (sc->old_bulletin.valid_bitmap & (1 << CHANNEL_DOWN)) {
     421                 :          0 :                 PMD_DRV_LOG(ERR, sc, "PF indicated channel is down."
     422                 :            :                                 "VF device is no longer operational");
     423                 :          0 :                 dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN;
     424                 :            :         }
     425                 :            : 
     426                 :          0 :         return ret;
     427                 :            : }
     428                 :            : 
     429                 :            : static int
     430                 :          0 : bnx2x_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
     431                 :            : {
     432                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     433                 :            :         uint32_t brb_truncate_discard;
     434                 :            :         uint64_t brb_drops;
     435                 :            :         uint64_t brb_truncates;
     436                 :            : 
     437                 :          0 :         PMD_INIT_FUNC_TRACE(sc);
     438                 :            : 
     439                 :          0 :         bnx2x_stats_handle(sc, STATS_EVENT_UPDATE);
     440                 :            : 
     441                 :            :         memset(stats, 0, sizeof (struct rte_eth_stats));
     442                 :            : 
     443                 :          0 :         stats->ipackets =
     444                 :          0 :                 HILO_U64(sc->eth_stats.total_unicast_packets_received_hi,
     445                 :          0 :                                 sc->eth_stats.total_unicast_packets_received_lo) +
     446                 :          0 :                 HILO_U64(sc->eth_stats.total_multicast_packets_received_hi,
     447                 :          0 :                                 sc->eth_stats.total_multicast_packets_received_lo) +
     448                 :          0 :                 HILO_U64(sc->eth_stats.total_broadcast_packets_received_hi,
     449                 :            :                                 sc->eth_stats.total_broadcast_packets_received_lo);
     450                 :            : 
     451                 :          0 :         stats->opackets =
     452                 :          0 :                 HILO_U64(sc->eth_stats.total_unicast_packets_transmitted_hi,
     453                 :          0 :                                 sc->eth_stats.total_unicast_packets_transmitted_lo) +
     454                 :          0 :                 HILO_U64(sc->eth_stats.total_multicast_packets_transmitted_hi,
     455                 :          0 :                                 sc->eth_stats.total_multicast_packets_transmitted_lo) +
     456                 :          0 :                 HILO_U64(sc->eth_stats.total_broadcast_packets_transmitted_hi,
     457                 :            :                                 sc->eth_stats.total_broadcast_packets_transmitted_lo);
     458                 :            : 
     459                 :          0 :         stats->ibytes =
     460                 :          0 :                 HILO_U64(sc->eth_stats.total_bytes_received_hi,
     461                 :            :                                 sc->eth_stats.total_bytes_received_lo);
     462                 :            : 
     463                 :          0 :         stats->obytes =
     464                 :          0 :                 HILO_U64(sc->eth_stats.total_bytes_transmitted_hi,
     465                 :            :                                 sc->eth_stats.total_bytes_transmitted_lo);
     466                 :            : 
     467                 :          0 :         stats->ierrors =
     468                 :          0 :                 HILO_U64(sc->eth_stats.error_bytes_received_hi,
     469                 :            :                                 sc->eth_stats.error_bytes_received_lo);
     470                 :            : 
     471                 :            :         stats->oerrors = 0;
     472                 :            : 
     473                 :          0 :         stats->rx_nombuf =
     474                 :          0 :                 HILO_U64(sc->eth_stats.no_buff_discard_hi,
     475                 :            :                                 sc->eth_stats.no_buff_discard_lo);
     476                 :            : 
     477                 :          0 :         brb_drops =
     478                 :          0 :                 HILO_U64(sc->eth_stats.brb_drop_hi,
     479                 :            :                          sc->eth_stats.brb_drop_lo);
     480                 :            : 
     481                 :          0 :         brb_truncates =
     482                 :          0 :                 HILO_U64(sc->eth_stats.brb_truncate_hi,
     483                 :            :                          sc->eth_stats.brb_truncate_lo);
     484                 :            : 
     485                 :          0 :         brb_truncate_discard = sc->eth_stats.brb_truncate_discard;
     486                 :            : 
     487                 :          0 :         stats->imissed = brb_drops + brb_truncates +
     488                 :          0 :                          brb_truncate_discard + stats->rx_nombuf;
     489                 :            : 
     490                 :          0 :         return 0;
     491                 :            : }
     492                 :            : 
     493                 :            : static int
     494                 :          0 : bnx2x_get_xstats_names(__rte_unused struct rte_eth_dev *dev,
     495                 :            :                        struct rte_eth_xstat_name *xstats_names,
     496                 :            :                        __rte_unused unsigned limit)
     497                 :            : {
     498                 :            :         unsigned int i, stat_cnt = RTE_DIM(bnx2x_xstats_strings);
     499                 :            : 
     500         [ #  # ]:          0 :         if (xstats_names != NULL)
     501         [ #  # ]:          0 :                 for (i = 0; i < stat_cnt; i++)
     502                 :          0 :                         strlcpy(xstats_names[i].name,
     503                 :            :                                 bnx2x_xstats_strings[i].name,
     504                 :            :                                 sizeof(xstats_names[i].name));
     505                 :            : 
     506                 :          0 :         return stat_cnt;
     507                 :            : }
     508                 :            : 
     509                 :            : static int
     510                 :          0 : bnx2x_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
     511                 :            :                      unsigned int n)
     512                 :            : {
     513                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     514                 :            :         unsigned int num = RTE_DIM(bnx2x_xstats_strings);
     515                 :            : 
     516         [ #  # ]:          0 :         if (n < num)
     517                 :            :                 return num;
     518                 :            : 
     519                 :          0 :         bnx2x_stats_handle(sc, STATS_EVENT_UPDATE);
     520                 :            : 
     521         [ #  # ]:          0 :         for (num = 0; num < n; num++) {
     522                 :          0 :                 if (bnx2x_xstats_strings[num].offset_hi !=
     523         [ #  # ]:          0 :                     bnx2x_xstats_strings[num].offset_lo)
     524                 :          0 :                         xstats[num].value = HILO_U64(
     525                 :            :                                           *(uint32_t *)((char *)&sc->eth_stats +
     526                 :            :                                           bnx2x_xstats_strings[num].offset_hi),
     527                 :            :                                           *(uint32_t *)((char *)&sc->eth_stats +
     528                 :            :                                           bnx2x_xstats_strings[num].offset_lo));
     529                 :            :                 else
     530                 :          0 :                         xstats[num].value =
     531                 :          0 :                                           *(uint64_t *)((char *)&sc->eth_stats +
     532                 :          0 :                                           bnx2x_xstats_strings[num].offset_lo);
     533                 :          0 :                 xstats[num].id = num;
     534                 :            :         }
     535                 :            : 
     536                 :            :         return num;
     537                 :            : }
     538                 :            : 
     539                 :            : static int
     540                 :          0 : bnx2x_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
     541                 :            : {
     542                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     543                 :            : 
     544                 :          0 :         dev_info->max_rx_queues  = sc->max_rx_queues;
     545                 :          0 :         dev_info->max_tx_queues  = sc->max_tx_queues;
     546                 :          0 :         dev_info->min_rx_bufsize = BNX2X_MIN_RX_BUF_SIZE;
     547                 :          0 :         dev_info->max_rx_pktlen  = BNX2X_MAX_RX_PKT_LEN;
     548                 :          0 :         dev_info->max_mac_addrs  = BNX2X_MAX_MAC_ADDRS;
     549                 :          0 :         dev_info->speed_capa = RTE_ETH_LINK_SPEED_10G | RTE_ETH_LINK_SPEED_20G;
     550                 :            : 
     551                 :          0 :         dev_info->rx_desc_lim.nb_max = MAX_RX_AVAIL;
     552   [ #  #  #  #  :          0 :         dev_info->rx_desc_lim.nb_min = MIN_RX_SIZE_NONTPA;
                   #  # ]
     553                 :          0 :         dev_info->rx_desc_lim.nb_mtu_seg_max = 1;
     554                 :          0 :         dev_info->tx_desc_lim.nb_max = MAX_TX_AVAIL;
     555                 :            : 
     556                 :          0 :         return 0;
     557                 :            : }
     558                 :            : 
     559                 :            : static int
     560                 :          0 : bnx2x_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
     561                 :            :                 uint32_t index, uint32_t pool)
     562                 :            : {
     563                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     564                 :            : 
     565         [ #  # ]:          0 :         if (sc->mac_ops.mac_addr_add) {
     566                 :          0 :                 sc->mac_ops.mac_addr_add(dev, mac_addr, index, pool);
     567                 :          0 :                 return 0;
     568                 :            :         }
     569                 :            :         return -ENOTSUP;
     570                 :            : }
     571                 :            : 
     572                 :            : static void
     573                 :          0 : bnx2x_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
     574                 :            : {
     575                 :          0 :         struct bnx2x_softc *sc = dev->data->dev_private;
     576                 :            : 
     577         [ #  # ]:          0 :         if (sc->mac_ops.mac_addr_remove)
     578                 :          0 :                 sc->mac_ops.mac_addr_remove(dev, index);
     579                 :          0 : }
     580                 :            : 
     581                 :            : static const struct eth_dev_ops bnx2x_eth_dev_ops = {
     582                 :            :         .dev_configure                = bnx2x_dev_configure,
     583                 :            :         .dev_start                    = bnx2x_dev_start,
     584                 :            :         .dev_stop                     = bnx2x_dev_stop,
     585                 :            :         .dev_close                    = bnx2x_dev_close,
     586                 :            :         .promiscuous_enable           = bnx2x_promisc_enable,
     587                 :            :         .promiscuous_disable          = bnx2x_promisc_disable,
     588                 :            :         .allmulticast_enable          = bnx2x_dev_allmulticast_enable,
     589                 :            :         .allmulticast_disable         = bnx2x_dev_allmulticast_disable,
     590                 :            :         .link_update                  = bnx2x_dev_link_update,
     591                 :            :         .stats_get                    = bnx2x_dev_stats_get,
     592                 :            :         .xstats_get                   = bnx2x_dev_xstats_get,
     593                 :            :         .xstats_get_names             = bnx2x_get_xstats_names,
     594                 :            :         .dev_infos_get                = bnx2x_dev_infos_get,
     595                 :            :         .rx_queue_setup               = bnx2x_dev_rx_queue_setup,
     596                 :            :         .rx_queue_release             = bnx2x_dev_rx_queue_release,
     597                 :            :         .tx_queue_setup               = bnx2x_dev_tx_queue_setup,
     598                 :            :         .tx_queue_release             = bnx2x_dev_tx_queue_release,
     599                 :            :         .mac_addr_add                 = bnx2x_mac_addr_add,
     600                 :            :         .mac_addr_remove              = bnx2x_mac_addr_remove,
     601                 :            : };
     602                 :            : 
     603                 :            : /*
     604                 :            :  * dev_ops for virtual function
     605                 :            :  */
     606                 :            : static const struct eth_dev_ops bnx2xvf_eth_dev_ops = {
     607                 :            :         .dev_configure                = bnx2x_dev_configure,
     608                 :            :         .dev_start                    = bnx2x_dev_start,
     609                 :            :         .dev_stop                     = bnx2x_dev_stop,
     610                 :            :         .dev_close                    = bnx2x_dev_close,
     611                 :            :         .promiscuous_enable           = bnx2x_promisc_enable,
     612                 :            :         .promiscuous_disable          = bnx2x_promisc_disable,
     613                 :            :         .allmulticast_enable          = bnx2x_dev_allmulticast_enable,
     614                 :            :         .allmulticast_disable         = bnx2x_dev_allmulticast_disable,
     615                 :            :         .set_mc_addr_list             = bnx2x_dev_set_mc_addr_list,
     616                 :            :         .link_update                  = bnx2xvf_dev_link_update,
     617                 :            :         .stats_get                    = bnx2x_dev_stats_get,
     618                 :            :         .xstats_get                   = bnx2x_dev_xstats_get,
     619                 :            :         .xstats_get_names             = bnx2x_get_xstats_names,
     620                 :            :         .dev_infos_get                = bnx2x_dev_infos_get,
     621                 :            :         .rx_queue_setup               = bnx2x_dev_rx_queue_setup,
     622                 :            :         .rx_queue_release             = bnx2x_dev_rx_queue_release,
     623                 :            :         .tx_queue_setup               = bnx2x_dev_tx_queue_setup,
     624                 :            :         .tx_queue_release             = bnx2x_dev_tx_queue_release,
     625                 :            :         .mac_addr_add                 = bnx2x_mac_addr_add,
     626                 :            :         .mac_addr_remove              = bnx2x_mac_addr_remove,
     627                 :            : };
     628                 :            : 
     629                 :            : 
     630                 :            : static int
     631                 :          0 : bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf)
     632                 :            : {
     633                 :            :         int ret = 0;
     634                 :            :         struct rte_pci_device *pci_dev;
     635                 :            :         struct rte_pci_addr pci_addr;
     636                 :            :         struct bnx2x_softc *sc;
     637                 :            :         static bool adapter_info = true;
     638                 :            : 
     639                 :            :         /* Extract key data structures */
     640                 :          0 :         sc = eth_dev->data->dev_private;
     641                 :          0 :         pci_dev = RTE_DEV_TO_PCI(eth_dev->device);
     642                 :          0 :         pci_addr = pci_dev->addr;
     643                 :            : 
     644                 :          0 :         snprintf(sc->devinfo.name, NAME_SIZE, PCI_SHORT_PRI_FMT ":dpdk-port-%u",
     645                 :            :                  pci_addr.bus, pci_addr.devid, pci_addr.function,
     646                 :          0 :                  eth_dev->data->port_id);
     647                 :            : 
     648                 :          0 :         PMD_INIT_FUNC_TRACE(sc);
     649                 :            : 
     650         [ #  # ]:          0 :         eth_dev->dev_ops = is_vf ? &bnx2xvf_eth_dev_ops : &bnx2x_eth_dev_ops;
     651                 :            : 
     652         [ #  # ]:          0 :         if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
     653                 :          0 :                 PMD_DRV_LOG(ERR, sc, "Skipping device init from secondary process");
     654                 :          0 :                 return 0;
     655                 :            :         }
     656                 :            : 
     657                 :          0 :         rte_eth_copy_pci_info(eth_dev, pci_dev);
     658                 :            : 
     659                 :          0 :         sc->pcie_bus    = pci_dev->addr.bus;
     660                 :          0 :         sc->pcie_device = pci_dev->addr.devid;
     661                 :            : 
     662                 :          0 :         sc->devinfo.vendor_id    = pci_dev->id.vendor_id;
     663                 :          0 :         sc->devinfo.device_id    = pci_dev->id.device_id;
     664                 :          0 :         sc->devinfo.subvendor_id = pci_dev->id.subsystem_vendor_id;
     665                 :          0 :         sc->devinfo.subdevice_id = pci_dev->id.subsystem_device_id;
     666                 :            : 
     667         [ #  # ]:          0 :         if (is_vf)
     668                 :          0 :                 sc->flags = BNX2X_IS_VF_FLAG;
     669                 :            : 
     670                 :          0 :         sc->pcie_func = pci_dev->addr.function;
     671                 :          0 :         sc->bar[BAR0].base_addr = (void *)pci_dev->mem_resource[0].addr;
     672         [ #  # ]:          0 :         if (is_vf)
     673                 :          0 :                 sc->bar[BAR1].base_addr = (void *)
     674                 :          0 :                         ((uintptr_t)pci_dev->mem_resource[0].addr + PXP_VF_ADDR_DB_START);
     675                 :            :         else
     676                 :          0 :                 sc->bar[BAR1].base_addr = pci_dev->mem_resource[2].addr;
     677                 :            : 
     678         [ #  # ]:          0 :         assert(sc->bar[BAR0].base_addr);
     679         [ #  # ]:          0 :         assert(sc->bar[BAR1].base_addr);
     680                 :            : 
     681                 :          0 :         bnx2x_load_firmware(sc);
     682         [ #  # ]:          0 :         assert(sc->firmware);
     683                 :            : 
     684         [ #  # ]:          0 :         if (eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf & RTE_ETH_RSS_NONFRAG_IPV4_UDP)
     685                 :          0 :                 sc->udp_rss = 1;
     686                 :            : 
     687                 :          0 :         sc->rx_budget = BNX2X_RX_BUDGET;
     688                 :          0 :         sc->hc_rx_ticks = BNX2X_RX_TICKS;
     689                 :          0 :         sc->hc_tx_ticks = BNX2X_TX_TICKS;
     690                 :            : 
     691                 :          0 :         sc->interrupt_mode = INTR_MODE_SINGLE_MSIX;
     692                 :          0 :         sc->rx_mode = BNX2X_RX_MODE_NORMAL;
     693                 :            : 
     694                 :          0 :         sc->pci_dev = pci_dev;
     695                 :          0 :         ret = bnx2x_attach(sc);
     696         [ #  # ]:          0 :         if (ret) {
     697                 :          0 :                 PMD_DRV_LOG(ERR, sc, "bnx2x_attach failed (%d)", ret);
     698                 :          0 :                 return ret;
     699                 :            :         }
     700                 :            : 
     701                 :            :         /* Print important adapter info for the user. */
     702         [ #  # ]:          0 :         if (adapter_info) {
     703                 :          0 :                 bnx2x_print_adapter_info(sc);
     704                 :          0 :                 adapter_info = false;
     705                 :            :         }
     706                 :            : 
     707                 :            :         /* schedule periodic poll for slowpath link events */
     708         [ #  # ]:          0 :         if (IS_PF(sc)) {
     709                 :          0 :                 PMD_DRV_LOG(DEBUG, sc, "Scheduling periodic poll for slowpath link events");
     710                 :          0 :                 ret = rte_eal_alarm_set(BNX2X_SP_TIMER_PERIOD,
     711                 :            :                                         bnx2x_periodic_start, (void *)eth_dev);
     712         [ #  # ]:          0 :                 if (ret) {
     713                 :          0 :                         PMD_DRV_LOG(ERR, sc, "Unable to start periodic"
     714                 :            :                                              " timer rc %d", ret);
     715                 :          0 :                         return -EINVAL;
     716                 :            :                 }
     717                 :            :         }
     718                 :            : 
     719                 :          0 :         eth_dev->data->mac_addrs =
     720                 :          0 :                 (struct rte_ether_addr *)sc->link_params.mac_addr;
     721                 :            : 
     722         [ #  # ]:          0 :         if (IS_VF(sc)) {
     723                 :            :                 rte_spinlock_init(&sc->vf2pf_lock);
     724                 :            : 
     725                 :          0 :                 ret = bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_mbx_msg),
     726                 :            :                                       &sc->vf2pf_mbox_mapping, "vf2pf_mbox",
     727                 :            :                                       RTE_CACHE_LINE_SIZE);
     728         [ #  # ]:          0 :                 if (ret)
     729                 :          0 :                         goto out;
     730                 :            : 
     731                 :          0 :                 sc->vf2pf_mbox = (struct bnx2x_vf_mbx_msg *)
     732                 :          0 :                                          sc->vf2pf_mbox_mapping.vaddr;
     733                 :            : 
     734                 :          0 :                 ret = bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_bulletin),
     735                 :            :                                       &sc->pf2vf_bulletin_mapping, "vf2pf_bull",
     736                 :            :                                       RTE_CACHE_LINE_SIZE);
     737         [ #  # ]:          0 :                 if (ret)
     738                 :          0 :                         goto out;
     739                 :            : 
     740                 :          0 :                 sc->pf2vf_bulletin = (struct bnx2x_vf_bulletin *)
     741                 :          0 :                                              sc->pf2vf_bulletin_mapping.vaddr;
     742                 :            : 
     743                 :          0 :                 ret = bnx2x_vf_get_resources(sc, sc->max_tx_queues,
     744                 :          0 :                                              sc->max_rx_queues);
     745         [ #  # ]:          0 :                 if (ret)
     746                 :          0 :                         goto out;
     747                 :            :         }
     748                 :            : 
     749                 :            :         return 0;
     750                 :            : 
     751                 :          0 : out:
     752         [ #  # ]:          0 :         if (IS_PF(sc))
     753                 :          0 :                 bnx2x_periodic_stop(eth_dev);
     754                 :            : 
     755                 :            :         return ret;
     756                 :            : }
     757                 :            : 
     758                 :            : static int
     759                 :          0 : eth_bnx2x_dev_init(struct rte_eth_dev *eth_dev)
     760                 :            : {
     761                 :          0 :         struct bnx2x_softc *sc = eth_dev->data->dev_private;
     762                 :          0 :         PMD_INIT_FUNC_TRACE(sc);
     763                 :          0 :         return bnx2x_common_dev_init(eth_dev, 0);
     764                 :            : }
     765                 :            : 
     766                 :            : static int
     767                 :          0 : eth_bnx2xvf_dev_init(struct rte_eth_dev *eth_dev)
     768                 :            : {
     769                 :          0 :         struct bnx2x_softc *sc = eth_dev->data->dev_private;
     770                 :          0 :         PMD_INIT_FUNC_TRACE(sc);
     771                 :          0 :         return bnx2x_common_dev_init(eth_dev, 1);
     772                 :            : }
     773                 :            : 
     774                 :          0 : static int eth_bnx2x_dev_uninit(struct rte_eth_dev *eth_dev)
     775                 :            : {
     776                 :          0 :         struct bnx2x_softc *sc = eth_dev->data->dev_private;
     777                 :          0 :         PMD_INIT_FUNC_TRACE(sc);
     778                 :          0 :         bnx2x_dev_close(eth_dev);
     779                 :          0 :         return 0;
     780                 :            : }
     781                 :            : 
     782                 :            : static struct rte_pci_driver rte_bnx2x_pmd;
     783                 :            : static struct rte_pci_driver rte_bnx2xvf_pmd;
     784                 :            : 
     785                 :          0 : static int eth_bnx2x_pci_probe(struct rte_pci_driver *pci_drv,
     786                 :            :         struct rte_pci_device *pci_dev)
     787                 :            : {
     788         [ #  # ]:          0 :         if (pci_drv == &rte_bnx2x_pmd)
     789                 :          0 :                 return rte_eth_dev_pci_generic_probe(pci_dev,
     790                 :            :                                 sizeof(struct bnx2x_softc), eth_bnx2x_dev_init);
     791         [ #  # ]:          0 :         else if (pci_drv == &rte_bnx2xvf_pmd)
     792                 :          0 :                 return rte_eth_dev_pci_generic_probe(pci_dev,
     793                 :            :                                 sizeof(struct bnx2x_softc), eth_bnx2xvf_dev_init);
     794                 :            :         else
     795                 :            :                 return -EINVAL;
     796                 :            : }
     797                 :            : 
     798                 :          0 : static int eth_bnx2x_pci_remove(struct rte_pci_device *pci_dev)
     799                 :            : {
     800                 :          0 :         return rte_eth_dev_pci_generic_remove(pci_dev, eth_bnx2x_dev_uninit);
     801                 :            : }
     802                 :            : 
     803                 :            : static struct rte_pci_driver rte_bnx2x_pmd = {
     804                 :            :         .id_table = pci_id_bnx2x_map,
     805                 :            :         .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
     806                 :            :         .probe = eth_bnx2x_pci_probe,
     807                 :            :         .remove = eth_bnx2x_pci_remove,
     808                 :            : };
     809                 :            : 
     810                 :            : /*
     811                 :            :  * virtual function driver struct
     812                 :            :  */
     813                 :            : static struct rte_pci_driver rte_bnx2xvf_pmd = {
     814                 :            :         .id_table = pci_id_bnx2xvf_map,
     815                 :            :         .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
     816                 :            :         .probe = eth_bnx2x_pci_probe,
     817                 :            :         .remove = eth_bnx2x_pci_remove,
     818                 :            : };
     819                 :            : 
     820                 :        251 : RTE_PMD_REGISTER_PCI(net_bnx2x, rte_bnx2x_pmd);
     821                 :            : RTE_PMD_REGISTER_PCI_TABLE(net_bnx2x, pci_id_bnx2x_map);
     822                 :            : RTE_PMD_REGISTER_KMOD_DEP(net_bnx2x, "* igb_uio | uio_pci_generic | vfio-pci");
     823                 :        251 : RTE_PMD_REGISTER_PCI(net_bnx2xvf, rte_bnx2xvf_pmd);
     824                 :            : RTE_PMD_REGISTER_PCI_TABLE(net_bnx2xvf, pci_id_bnx2xvf_map);
     825                 :            : RTE_PMD_REGISTER_KMOD_DEP(net_bnx2xvf, "* igb_uio | vfio-pci");
     826         [ -  + ]:        251 : RTE_LOG_REGISTER_SUFFIX(bnx2x_logtype_init, init, NOTICE);
     827         [ -  + ]:        251 : RTE_LOG_REGISTER_SUFFIX(bnx2x_logtype_driver, driver, NOTICE);

Generated by: LCOV version 1.14