net: add rte prefix to ether structures
[dpdk.git] / drivers / net / bnx2x / bnx2x.c
index 298bc41..17b6817 100644 (file)
@@ -124,7 +124,7 @@ static __rte_noinline
 int bnx2x_nic_load(struct bnx2x_softc *sc);
 
 static int bnx2x_handle_sp_tq(struct bnx2x_softc *sc);
-static void bnx2x_handle_fp_tq(struct bnx2x_fastpath *fp, int scan_fp);
+static void bnx2x_handle_fp_tq(struct bnx2x_fastpath *fp);
 static void bnx2x_ack_sb(struct bnx2x_softc *sc, uint8_t igu_sb_id,
                         uint8_t storm, uint16_t index, uint8_t op,
                         uint8_t update);
@@ -1114,6 +1114,12 @@ bnx2x_sp_post(struct bnx2x_softc *sc, int command, int cid, uint32_t data_hi,
                    atomic_load_acq_long(&sc->cq_spq_left),
                    atomic_load_acq_long(&sc->eq_spq_left));
 
+       /* RAMROD completion is processed in bnx2x_intr_legacy()
+        * which can run from different contexts.
+        * Ask bnx2x_intr_intr() to process RAMROD
+        * completion whenever it gets scheduled.
+        */
+       rte_atomic32_set(&sc->scan_fp, 1);
        bnx2x_sp_prod_update(sc);
 
        return 0;
@@ -2191,8 +2197,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0)
                        tx_start_bd->vlan_or_ethertype =
                            rte_cpu_to_le_16(pkt_prod);
                else {
-                       struct ether_hdr *eh =
-                           rte_pktmbuf_mtod(m0, struct ether_hdr *);
+                       struct rte_ether_hdr *eh =
+                           rte_pktmbuf_mtod(m0, struct rte_ether_hdr *);
 
                        tx_start_bd->vlan_or_ethertype =
                            rte_cpu_to_le_16(rte_be_to_cpu_16(eh->ether_type));
@@ -2202,8 +2208,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0)
        bd_prod = NEXT_TX_BD(bd_prod);
        if (IS_VF(sc)) {
                struct eth_tx_parse_bd_e2 *tx_parse_bd;
-               const struct ether_hdr *eh =
-                   rte_pktmbuf_mtod(m0, struct ether_hdr *);
+               const struct rte_ether_hdr *eh =
+                   rte_pktmbuf_mtod(m0, struct rte_ether_hdr *);
                uint8_t mac_type = UNICAST_ADDRESS;
 
                tx_parse_bd =
@@ -4539,7 +4545,7 @@ static int bnx2x_handle_sp_tq(struct bnx2x_softc *sc)
        return rc;
 }
 
-static void bnx2x_handle_fp_tq(struct bnx2x_fastpath *fp, int scan_fp)
+static void bnx2x_handle_fp_tq(struct bnx2x_fastpath *fp)
 {
        struct bnx2x_softc *sc = fp->sc;
        uint8_t more_rx = FALSE;
@@ -4554,14 +4560,14 @@ static void bnx2x_handle_fp_tq(struct bnx2x_fastpath *fp, int scan_fp)
        /* update the fastpath index */
        bnx2x_update_fp_sb_idx(fp);
 
-       if (scan_fp) {
+       if (rte_atomic32_read(&sc->scan_fp) == 1) {
                if (bnx2x_has_rx_work(fp)) {
                        more_rx = bnx2x_rxeof(sc, fp);
                }
 
                if (more_rx) {
                        /* still more work to do */
-                       bnx2x_handle_fp_tq(fp, scan_fp);
+                       bnx2x_handle_fp_tq(fp);
                        return;
                }
        }
@@ -4577,7 +4583,7 @@ static void bnx2x_handle_fp_tq(struct bnx2x_fastpath *fp, int scan_fp)
  * then calls a separate routine to handle the various
  * interrupt causes: link, RX, and TX.
  */
-int bnx2x_intr_legacy(struct bnx2x_softc *sc, int scan_fp)
+int bnx2x_intr_legacy(struct bnx2x_softc *sc)
 {
        struct bnx2x_fastpath *fp;
        uint32_t status, mask;
@@ -4609,7 +4615,7 @@ int bnx2x_intr_legacy(struct bnx2x_softc *sc, int scan_fp)
                /* acknowledge and disable further fastpath interrupts */
                        bnx2x_ack_sb(sc, fp->igu_sb_id, USTORM_ID,
                                     0, IGU_INT_DISABLE, 0);
-                       bnx2x_handle_fp_tq(fp, scan_fp);
+                       bnx2x_handle_fp_tq(fp);
                        status &= ~mask;
                }
        }
@@ -8097,6 +8103,27 @@ static int bnx2x_get_shmem_info(struct bnx2x_softc *sc)
                    ~ELINK_FEATURE_CONFIG_OVERRIDE_PREEMPHASIS_ENABLED;
        }
 
+       val = sc->devinfo.bc_ver >> 8;
+       if (val < BNX2X_BC_VER) {
+               /* for now only warn later we might need to enforce this */
+               PMD_DRV_LOG(NOTICE, sc, "This driver needs bc_ver %X but found %X, please upgrade BC\n",
+                           BNX2X_BC_VER, val);
+       }
+       sc->link_params.feature_config_flags |=
+                               (val >= REQ_BC_VER_4_VRFY_FIRST_PHY_OPT_MDL) ?
+                               ELINK_FEATURE_CONFIG_BC_SUPPORTS_OPT_MDL_VRFY :
+                               0;
+
+       sc->link_params.feature_config_flags |=
+               (val >= REQ_BC_VER_4_VRFY_SPECIFIC_PHY_OPT_MDL) ?
+               ELINK_FEATURE_CONFIG_BC_SUPPORTS_DUAL_PHY_OPT_MDL_VRFY : 0;
+       sc->link_params.feature_config_flags |=
+               (val >= REQ_BC_VER_4_VRFY_AFEX_SUPPORTED) ?
+               ELINK_FEATURE_CONFIG_BC_SUPPORTS_AFEX : 0;
+       sc->link_params.feature_config_flags |=
+               (val >= REQ_BC_VER_4_SFP_TX_DISABLE_SUPPORTED) ?
+               ELINK_FEATURE_CONFIG_BC_SUPPORTS_SFP_TX_DISABLED : 0;
+
        /* get the initial value of the link params */
        sc->link_params.multi_phy_config =
            SHMEM_RD(sc, dev_info.port_hw_config[port].multi_phy_config);