fix typos using codespell utility
[dpdk.git] / drivers / net / bnx2x / bnx2x.c
index f1bc2dd..06733d1 100644 (file)
@@ -22,7 +22,6 @@
 #include "ecore_init_ops.h"
 
 #include "rte_version.h"
-#include "rte_pci_dev_ids.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -32,7 +31,7 @@
 #define BNX2X_PMD_VER_PREFIX "BNX2X PMD"
 #define BNX2X_PMD_VERSION_MAJOR 1
 #define BNX2X_PMD_VERSION_MINOR 0
-#define BNX2X_PMD_VERSION_REVISION 1
+#define BNX2X_PMD_VERSION_REVISION 5
 #define BNX2X_PMD_VERSION_PATCH 1
 
 static inline const char *
@@ -121,7 +120,7 @@ static int bnx2x_alloc_mem(struct bnx2x_softc *sc);
 static void bnx2x_free_mem(struct bnx2x_softc *sc);
 static int bnx2x_alloc_fw_stats_mem(struct bnx2x_softc *sc);
 static void bnx2x_free_fw_stats_mem(struct bnx2x_softc *sc);
-static __attribute__ ((noinline))
+static __rte_noinline
 int bnx2x_nic_load(struct bnx2x_softc *sc);
 
 static int bnx2x_handle_sp_tq(struct bnx2x_softc *sc);
@@ -179,7 +178,7 @@ bnx2x_dma_alloc(struct bnx2x_softc *sc, size_t size, struct bnx2x_dma *dma,
 
        /* Caller must take care that strlen(mz_name) < RTE_MEMZONE_NAMESIZE */
        z = rte_memzone_reserve_aligned(mz_name, (uint64_t) (size),
-                                       rte_lcore_to_socket_id(rte_lcore_id()),
+                                       SOCKET_ID_ANY,
                                        0, align);
        if (z == NULL) {
                PMD_DRV_LOG(ERR, "DMA alloc failed for %s", msg);
@@ -888,7 +887,7 @@ storm_memset_eq_prod(struct bnx2x_softc *sc, uint16_t eq_prod, uint16_t pfid)
 /*
  * Post a slowpath command.
  *
- * A slowpath command is used to propogate a configuration change through
+ * A slowpath command is used to propagate a configuration change through
  * the controller in a controlled manner, allowing each STORM processor and
  * other H/W blocks to phase in the change.  The commands sent on the
  * slowpath are referred to as ramrods.  Depending on the ramrod used the
@@ -1398,10 +1397,10 @@ bnx2x_del_all_macs(struct bnx2x_softc *sc, struct ecore_vlan_mac_obj *mac_obj,
        return rc;
 }
 
-int
+static int
 bnx2x_fill_accept_flags(struct bnx2x_softc *sc, uint32_t rx_mode,
-                     unsigned long *rx_accept_flags,
-                     unsigned long *tx_accept_flags)
+                       unsigned long *rx_accept_flags,
+                       unsigned long *tx_accept_flags)
 {
        /* Clear the flags first */
        *rx_accept_flags = 0;
@@ -1439,6 +1438,7 @@ bnx2x_fill_accept_flags(struct bnx2x_softc *sc, uint32_t rx_mode,
 
                break;
 
+       case BNX2X_RX_MODE_ALLMULTI_PROMISC:
        case BNX2X_RX_MODE_PROMISC:
                /*
                 * According to deffinition of SI mode, iface in promisc mode
@@ -1962,7 +1962,7 @@ static void bnx2x_squeeze_objects(struct bnx2x_softc *sc)
 }
 
 /* stop the controller */
-__attribute__ ((noinline))
+__rte_noinline
 int
 bnx2x_nic_unload(struct bnx2x_softc *sc, uint32_t unload_mode, uint8_t keep_link)
 {
@@ -2002,7 +2002,7 @@ bnx2x_nic_unload(struct bnx2x_softc *sc, uint32_t unload_mode, uint8_t keep_link
 
        /*
         * Nothing to do during unload if previous bnx2x_nic_load()
-        * did not completed succesfully - all resourses are released.
+        * did not completed successfully - all resourses are released.
         */
        if ((sc->state == BNX2X_STATE_CLOSED) || (sc->state == BNX2X_STATE_ERROR)) {
                return 0;
@@ -2220,7 +2220,7 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0)
        }
 
        PMD_TX_LOG(DEBUG,
-                  "start bd: nbytes %d flags %x vlan %x\n",
+                  "start bd: nbytes %d flags %x vlan %x",
                   tx_start_bd->nbytes,
                   tx_start_bd->bd_flags.as_bitfield,
                   tx_start_bd->vlan_or_ethertype);
@@ -3931,7 +3931,7 @@ static void bnx2x_attn_int_deasserted2(struct bnx2x_softc *sc, uint32_t attn)
                        mask1 = REG_RD(sc, PXP2_REG_PXP2_INT_MASK_1);
                        val0 = REG_RD(sc, PXP2_REG_PXP2_INT_STS_0);
                        /*
-                        * If the olny PXP2_EOP_ERROR_BIT is set in
+                        * If the only PXP2_EOP_ERROR_BIT is set in
                         * STS0 and STS1 - clear it
                         *
                         * probably we lose additional attentions between
@@ -4508,7 +4508,7 @@ static void bnx2x_handle_fp_tq(struct bnx2x_fastpath *fp, int scan_fp)
        }
 
        bnx2x_ack_sb(sc, fp->igu_sb_id, USTORM_ID,
-                  le16toh(fp->fp_hc_idx), IGU_INT_ENABLE, 1);
+                  le16toh(fp->fp_hc_idx), IGU_INT_DISABLE, 1);
 }
 
 /*
@@ -5910,7 +5910,7 @@ static void bnx2x_set_234_gates(struct bnx2x_softc *sc, uint8_t close)
                               (val | HC_CONFIG_0_REG_BLOCK_DISABLE_0));
 
        } else {
-/* Prevent incomming interrupts in IGU */
+/* Prevent incoming interrupts in IGU */
                val = REG_RD(sc, IGU_REG_BLOCK_CONFIGURATION);
 
                if (close)
@@ -7017,34 +7017,6 @@ static int bnx2x_initial_phy_init(struct bnx2x_softc *sc, int load_mode)
 
        bnx2x_set_requested_fc(sc);
 
-       if (CHIP_REV_IS_SLOW(sc)) {
-               uint32_t bond = CHIP_BOND_ID(sc);
-               uint32_t feat = 0;
-
-               if (CHIP_IS_E2(sc) && CHIP_IS_MODE_4_PORT(sc)) {
-                       feat |= ELINK_FEATURE_CONFIG_EMUL_DISABLE_BMAC;
-               } else if (bond & 0x4) {
-                       if (CHIP_IS_E3(sc)) {
-                               feat |= ELINK_FEATURE_CONFIG_EMUL_DISABLE_XMAC;
-                       } else {
-                               feat |= ELINK_FEATURE_CONFIG_EMUL_DISABLE_BMAC;
-                       }
-               } else if (bond & 0x8) {
-                       if (CHIP_IS_E3(sc)) {
-                               feat |= ELINK_FEATURE_CONFIG_EMUL_DISABLE_UMAC;
-                       } else {
-                               feat |= ELINK_FEATURE_CONFIG_EMUL_DISABLE_EMAC;
-                       }
-               }
-
-/* disable EMAC for E3 and above */
-               if (bond & 0x2) {
-                       feat |= ELINK_FEATURE_CONFIG_EMUL_DISABLE_EMAC;
-               }
-
-               sc->link_params.feature_config_flags |= feat;
-       }
-
        if (load_mode == LOAD_DIAG) {
                lp->loopback_mode = ELINK_LOOPBACK_XGXS;
 /* Prefer doing PHY loopback at 10G speed, if possible */
@@ -7152,7 +7124,7 @@ void bnx2x_periodic_callout(struct bnx2x_softc *sc)
 }
 
 /* start the controller */
-static __attribute__ ((noinline))
+static __rte_noinline
 int bnx2x_nic_load(struct bnx2x_softc *sc)
 {
        uint32_t val;
@@ -8887,7 +8859,7 @@ int bnx2x_alloc_hsi_mem(struct bnx2x_softc *sc)
 /***************************/
 
                if (bnx2x_dma_alloc(sc, FW_BUF_SIZE, &sc->gz_buf_dma,
-                                 "fw_dec_buf", RTE_CACHE_LINE_SIZE) != 0) {
+                                 "fw_buf", RTE_CACHE_LINE_SIZE) != 0) {
                        sc->spq = NULL;
                        sc->sp = NULL;
                        sc->eq = NULL;
@@ -9552,11 +9524,13 @@ static int bnx2x_pci_get_caps(struct bnx2x_softc *sc)
 static void bnx2x_init_rte(struct bnx2x_softc *sc)
 {
        if (IS_VF(sc)) {
-               sc->max_tx_queues = BNX2X_VF_MAX_QUEUES_PER_VF;
-               sc->max_rx_queues = BNX2X_VF_MAX_QUEUES_PER_VF;
+               sc->max_tx_queues = min(BNX2X_VF_MAX_QUEUES_PER_VF,
+                                       sc->igu_sb_cnt);
+               sc->max_rx_queues = min(BNX2X_VF_MAX_QUEUES_PER_VF,
+                                       sc->igu_sb_cnt);
        } else {
-               sc->max_tx_queues = 128;
-               sc->max_rx_queues = 128;
+               sc->max_rx_queues = BNX2X_MAX_RSS_COUNT(sc);
+               sc->max_tx_queues = sc->max_rx_queues;
        }
 }
 
@@ -9570,7 +9544,7 @@ void bnx2x_load_firmware(struct bnx2x_softc *sc)
        int f;
        struct stat st;
 
-       fwname = sc->devinfo.device_id == BNX2X_DEV_ID_57711
+       fwname = sc->devinfo.device_id == CHIP_NUM_57711
                ? FW_NAME_57711 : FW_NAME_57810;
        f = open(fwname, O_RDONLY);
        if (f < 0) {
@@ -9680,9 +9654,6 @@ int bnx2x_attach(struct bnx2x_softc *sc)
 
        sc->state = BNX2X_STATE_CLOSED;
 
-       /* Init RTE stuff */
-       bnx2x_init_rte(sc);
-
        pci_write_long(sc, PCICFG_GRC_ADDRESS, PCICFG_VENDOR_ID_OFFSET);
 
        sc->igu_base_addr = IS_VF(sc) ? PXP_VF_ADDR_IGU_START : BAR_IGU_INTMEM;
@@ -9695,11 +9666,14 @@ int bnx2x_attach(struct bnx2x_softc *sc)
                pci_read(sc,
                         (sc->devinfo.pcie_msix_cap_reg + PCIR_MSIX_CTRL), &val,
                         2);
-               sc->igu_sb_cnt = (val & PCIM_MSIXCTRL_TABLE_SIZE);
+               sc->igu_sb_cnt = (val & PCIM_MSIXCTRL_TABLE_SIZE) + 1;
        } else {
                sc->igu_sb_cnt = 1;
        }
 
+       /* Init RTE stuff */
+       bnx2x_init_rte(sc);
+
        if (IS_PF(sc)) {
 /* get device info and set params */
                if (bnx2x_get_device_info(sc) != 0) {