New upstream version 16.11.7
[deb_dpdk.git] / drivers / net / bnx2x / bnx2x.c
index 95fbad8..c2842e3 100644 (file)
@@ -170,15 +170,15 @@ bnx2x_dma_alloc(struct bnx2x_softc *sc, size_t size, struct bnx2x_dma *dma,
 
        dma->sc = sc;
        if (IS_PF(sc))
-               sprintf(mz_name, "bnx2x%d_%s_%" PRIx64, SC_ABS_FUNC(sc), msg,
+               snprintf(mz_name, sizeof(mz_name), "bnx2x%d_%s_%" PRIx64, SC_ABS_FUNC(sc), msg,
                        rte_get_timer_cycles());
        else
-               sprintf(mz_name, "bnx2x%d_%s_%" PRIx64, sc->pcie_device, msg,
+               snprintf(mz_name, sizeof(mz_name), "bnx2x%d_%s_%" PRIx64, sc->pcie_device, msg,
                        rte_get_timer_cycles());
 
        /* 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);
@@ -1397,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;
@@ -1438,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
@@ -4507,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);
 }
 
 /*
@@ -7016,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 */
@@ -8316,16 +8289,6 @@ static int bnx2x_get_device_info(struct bnx2x_softc *sc)
                        REG_WR(sc, PXP2_REG_PGL_ADDR_90_F1, 0);
                        REG_WR(sc, PXP2_REG_PGL_ADDR_94_F1, 0);
                }
-
-/*
- * Enable internal target-read (in case we are probed after PF
- * FLR). Must be done prior to any BAR read access. Only for
- * 57712 and up
- */
-               if (!CHIP_IS_E1x(sc)) {
-                       REG_WR(sc, PGLUE_B_REG_INTERNAL_PFID_ENABLE_TARGET_READ,
-                              1);
-               }
        }
 
        /* get the nvram size */
@@ -8886,7 +8849,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;
@@ -9556,8 +9519,8 @@ static void bnx2x_init_rte(struct bnx2x_softc *sc)
                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;
        }
 }
 
@@ -9702,7 +9665,17 @@ int bnx2x_attach(struct bnx2x_softc *sc)
        bnx2x_init_rte(sc);
 
        if (IS_PF(sc)) {
-/* get device info and set params */
+               /* Enable internal target-read (in case we are probed after PF
+                * FLR). Must be done prior to any BAR read access. Only for
+                * 57712 and up
+                */
+               if (!CHIP_IS_E1x(sc)) {
+                       REG_WR(sc, PGLUE_B_REG_INTERNAL_PFID_ENABLE_TARGET_READ,
+                              1);
+                       DELAY(200000);
+               }
+
+               /* get device info and set params */
                if (bnx2x_get_device_info(sc) != 0) {
                        PMD_DRV_LOG(NOTICE, "getting device info");
                        return -ENXIO;
@@ -9711,7 +9684,7 @@ int bnx2x_attach(struct bnx2x_softc *sc)
 /* get phy settings from shmem and 'and' against admin settings */
                bnx2x_get_phy_info(sc);
        } else {
-/* Left mac of VF unfilled, PF should set it for VF */
+               /* Left mac of VF unfilled, PF should set it for VF */
                memset(sc->link_params.mac_addr, 0, ETHER_ADDR_LEN);
        }