net/qede/base: upgrade to FW 8.37.7.0
[dpdk.git] / drivers / net / qede / base / ecore_l2.c
index 0883fd3..ec40aac 100644 (file)
@@ -1,9 +1,7 @@
-/*
- * Copyright (c) 2016 QLogic Corporation.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2016 - 2018 Cavium Inc.
  * All rights reserved.
- * www.qlogic.com
- *
- * See LICENSE.qede_pmd for copyright and licensing details.
+ * www.cavium.com
  */
 
 #include "bcm_osal.h"
@@ -610,6 +608,9 @@ ecore_sp_update_accept_mode(struct ecore_hwfn *p_hwfn,
                SET_FIELD(state, ETH_VPORT_RX_MODE_BCAST_ACCEPT_ALL,
                          !!(accept_filter & ECORE_ACCEPT_BCAST));
 
+               SET_FIELD(state, ETH_VPORT_RX_MODE_ACCEPT_ANY_VNI,
+                         !!(accept_filter & ECORE_ACCEPT_ANY_VNI));
+
                p_ramrod->rx_mode.state = OSAL_CPU_TO_LE16(state);
                DP_VERBOSE(p_hwfn, ECORE_MSG_SP,
                           "vport[%02x] p_ramrod->rx_mode.state = 0x%x\n",
@@ -690,7 +691,7 @@ ecore_sp_update_mcast_bin(struct vport_update_ramrod_data *p_ramrod,
 
        p_ramrod->common.update_approx_mcast_flg = 1;
        for (i = 0; i < ETH_MULTICAST_MAC_BINS_IN_REGS; i++) {
-               u32 *p_bins = (u32 *)p_params->bins;
+               u32 *p_bins = p_params->bins;
 
                p_ramrod->approx_mcast.bins[i] = OSAL_CPU_TO_LE32(p_bins[i]);
        }
@@ -1188,11 +1189,20 @@ ecore_eth_pf_tx_queue_start(struct ecore_hwfn *p_hwfn,
                            void OSAL_IOMEM * *pp_doorbell)
 {
        enum _ecore_status_t rc;
+       u16 pq_id;
 
-       /* TODO - set tc in the pq_params for multi-cos */
-       rc = ecore_eth_txq_start_ramrod(p_hwfn, p_cid,
-                                       pbl_addr, pbl_size,
-                                       ecore_get_cm_pq_idx_mcos(p_hwfn, tc));
+       /* TODO - set tc in the pq_params for multi-cos.
+        * If pacing is enabled then select queue according to
+        * rate limiter availability otherwise select queue based
+        * on multi cos.
+        */
+       if (IS_ECORE_PACING(p_hwfn))
+               pq_id = ecore_get_cm_pq_idx_rl(p_hwfn, p_cid->rel.queue_id);
+       else
+               pq_id = ecore_get_cm_pq_idx_mcos(p_hwfn, tc);
+
+       rc = ecore_eth_txq_start_ramrod(p_hwfn, p_cid, pbl_addr,
+                                       pbl_size, pq_id);
        if (rc != ECORE_SUCCESS)
                return rc;
 
@@ -1559,8 +1569,8 @@ ecore_sp_eth_filter_mcast(struct ecore_hwfn *p_hwfn,
                          enum spq_mode comp_mode,
                          struct ecore_spq_comp_cb *p_comp_data)
 {
-       unsigned long bins[ETH_MULTICAST_MAC_BINS_IN_REGS];
        struct vport_update_ramrod_data *p_ramrod = OSAL_NULL;
+       u32 bins[ETH_MULTICAST_MAC_BINS_IN_REGS];
        struct ecore_spq_entry *p_ent = OSAL_NULL;
        struct ecore_sp_init_data init_data;
        u8 abs_vport_id = 0;
@@ -1599,8 +1609,7 @@ ecore_sp_eth_filter_mcast(struct ecore_hwfn *p_hwfn,
        /* explicitly clear out the entire vector */
        OSAL_MEMSET(&p_ramrod->approx_mcast.bins,
                    0, sizeof(p_ramrod->approx_mcast.bins));
-       OSAL_MEMSET(bins, 0, sizeof(unsigned long) *
-                   ETH_MULTICAST_MAC_BINS_IN_REGS);
+       OSAL_MEMSET(bins, 0, sizeof(u32) * ETH_MULTICAST_MAC_BINS_IN_REGS);
        /* filter ADD op is explicit set op and it removes
        *  any existing filters for the vport.
        */
@@ -1609,16 +1618,15 @@ ecore_sp_eth_filter_mcast(struct ecore_hwfn *p_hwfn,
                        u32 bit;
 
                        bit = ecore_mcast_bin_from_mac(p_filter_cmd->mac[i]);
-                       OSAL_SET_BIT(bit, bins);
+                       bins[bit / 32] |= 1 << (bit % 32);
                }
 
                /* Convert to correct endianity */
                for (i = 0; i < ETH_MULTICAST_MAC_BINS_IN_REGS; i++) {
                        struct vport_update_ramrod_mcast *p_ramrod_bins;
-                       u32 *p_bins = (u32 *)bins;
 
                        p_ramrod_bins = &p_ramrod->approx_mcast;
-                       p_ramrod_bins->bins[i] = OSAL_CPU_TO_LE32(p_bins[i]);
+                       p_ramrod_bins->bins[i] = OSAL_CPU_TO_LE32(bins[i]);
                }
        }
 
@@ -2079,6 +2087,24 @@ void ecore_reset_vport_stats(struct ecore_dev *p_dev)
        }
 }
 
+static enum gft_profile_type
+ecore_arfs_mode_to_hsi(enum ecore_filter_config_mode mode)
+{
+       if (mode == ECORE_FILTER_CONFIG_MODE_5_TUPLE)
+               return GFT_PROFILE_TYPE_4_TUPLE;
+
+       if (mode == ECORE_FILTER_CONFIG_MODE_IP_DEST)
+               return GFT_PROFILE_TYPE_IP_DST_ADDR;
+
+       if (mode == ECORE_FILTER_CONFIG_MODE_TUNN_TYPE)
+               return GFT_PROFILE_TYPE_TUNNEL_TYPE;
+
+       if (mode == ECORE_FILTER_CONFIG_MODE_IP_SRC)
+               return GFT_PROFILE_TYPE_IP_SRC_ADDR;
+
+       return GFT_PROFILE_TYPE_L4_DST_PORT;
+}
+
 void ecore_arfs_mode_configure(struct ecore_hwfn *p_hwfn,
                               struct ecore_ptt *p_ptt,
                               struct ecore_arfs_config_params *p_cfg_params)
@@ -2086,13 +2112,13 @@ void ecore_arfs_mode_configure(struct ecore_hwfn *p_hwfn,
        if (OSAL_TEST_BIT(ECORE_MF_DISABLE_ARFS, &p_hwfn->p_dev->mf_bits))
                return;
 
-       if (p_cfg_params->arfs_enable) {
+       if (p_cfg_params->mode != ECORE_FILTER_CONFIG_MODE_DISABLE) {
                ecore_gft_config(p_hwfn, p_ptt, p_hwfn->rel_pf_id,
                                 p_cfg_params->tcp,
                                 p_cfg_params->udp,
                                 p_cfg_params->ipv4,
                                 p_cfg_params->ipv6,
-                                GFT_PROFILE_TYPE_4_TUPLE);
+                                ecore_arfs_mode_to_hsi(p_cfg_params->mode));
                DP_VERBOSE(p_hwfn, ECORE_MSG_SP,
                           "tcp = %s, udp = %s, ipv4 = %s, ipv6 =%s\n",
                           p_cfg_params->tcp ? "Enable" : "Disable",
@@ -2102,8 +2128,8 @@ void ecore_arfs_mode_configure(struct ecore_hwfn *p_hwfn,
        } else {
                ecore_gft_disable(p_hwfn, p_ptt, p_hwfn->rel_pf_id);
        }
-       DP_VERBOSE(p_hwfn, ECORE_MSG_SP, "Configured ARFS mode : %s\n",
-                  p_cfg_params->arfs_enable ? "Enable" : "Disable");
+       DP_VERBOSE(p_hwfn, ECORE_MSG_SP, "Configured ARFS mode : %d\n",
+                  (int)p_cfg_params->mode);
 }
 
 enum _ecore_status_t
@@ -2278,3 +2304,22 @@ out:
 
        return rc;
 }
+
+enum _ecore_status_t
+ecore_eth_tx_queue_maxrate(struct ecore_hwfn *p_hwfn,
+                          struct ecore_ptt *p_ptt,
+                          struct ecore_queue_cid *p_cid, u32 rate)
+{
+       struct ecore_mcp_link_state *p_link;
+       u8 vport;
+
+       vport = (u8)ecore_get_qm_vport_idx_rl(p_hwfn, p_cid->rel.queue_id);
+       p_link = &ECORE_LEADING_HWFN(p_hwfn->p_dev)->mcp_info->link_output;
+
+       DP_VERBOSE(p_hwfn, ECORE_MSG_LINK,
+                  "About to rate limit qm vport %d for queue %d with rate %d\n",
+                  vport, p_cid->rel.queue_id, rate);
+
+       return ecore_init_vport_rl(p_hwfn, p_ptt, vport, rate,
+                                  p_link->speed);
+}