net/i40e: refactor VXLAN flow parsing function
[dpdk.git] / drivers / net / bnxt / bnxt_hwrm.c
index 721e652..6d98d5a 100644 (file)
@@ -229,23 +229,29 @@ int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp,
        /* FIXME add multicast flag, when multicast adding options is supported
         * by ethtool.
         */
+       if (vnic->flags & BNXT_VNIC_INFO_BCAST)
+               mask = HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST;
+       if (vnic->flags & BNXT_VNIC_INFO_UNTAGGED)
+               mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLAN_NONVLAN;
        if (vnic->flags & BNXT_VNIC_INFO_PROMISC)
-               mask = HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_PROMISCUOUS;
+               mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_PROMISCUOUS;
        if (vnic->flags & BNXT_VNIC_INFO_ALLMULTI)
                mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST;
+       if (vnic->flags & BNXT_VNIC_INFO_MCAST)
+               mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST;
        if (vnic->mc_addr_cnt) {
                mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST;
                req.num_mc_entries = rte_cpu_to_le_32(vnic->mc_addr_cnt);
                req.mc_tbl_addr = rte_cpu_to_le_64(vnic->mc_list_dma_addr);
        }
-       req.mask = rte_cpu_to_le_32(HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST |
-                                   mask);
        if (vlan_count && vlan_table) {
                mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLANONLY;
                req.vlan_tag_tbl_addr = rte_cpu_to_le_16(
                         rte_mem_virt2phy(vlan_table));
                req.num_vlan_tags = rte_cpu_to_le_32((uint32_t)vlan_count);
        }
+       req.mask = rte_cpu_to_le_32(HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST |
+                                   mask);
 
        rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
 
@@ -2069,6 +2075,27 @@ static void reserve_resources_from_vf(struct bnxt *bp,
        bp->max_ring_grps -= rte_le_to_cpu_16(resp->max_hw_ring_grps);
 }
 
+int bnxt_hwrm_func_qcfg_current_vf_vlan(struct bnxt *bp, int vf)
+{
+       struct hwrm_func_qcfg_input req = {0};
+       struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
+       int rc;
+
+       /* Check for zero MAC address */
+       HWRM_PREP(req, FUNC_QCFG, -1, resp);
+       req.fid = rte_cpu_to_le_16(bp->pf.vf_info[vf].fid);
+       rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+       if (rc) {
+               RTE_LOG(ERR, PMD, "hwrm_func_qcfg failed rc:%d\n", rc);
+               return -1;
+       } else if (resp->error_code) {
+               rc = rte_le_to_cpu_16(resp->error_code);
+               RTE_LOG(ERR, PMD, "hwrm_func_qcfg error %d\n", rc);
+               return -1;
+       }
+       return rte_le_to_cpu_16(resp->vlan);
+}
+
 static int update_pf_resource_max(struct bnxt *bp)
 {
        struct hwrm_func_qcfg_input req = {0};
@@ -2296,6 +2323,18 @@ int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf)
        return rc;
 }
 
+void vf_vnic_set_rxmask_cb(struct bnxt_vnic_info *vnic, void *flagp)
+{
+       uint32_t *flag = flagp;
+
+       vnic->flags = *flag;
+}
+
+int bnxt_set_rx_mask_no_vlan(struct bnxt *bp, struct bnxt_vnic_info *vnic)
+{
+       return bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+}
+
 int bnxt_hwrm_func_buf_rgtr(struct bnxt *bp)
 {
        int rc = 0;
@@ -2423,6 +2462,24 @@ int bnxt_hwrm_func_bw_cfg(struct bnxt *bp, uint16_t vf,
        return rc;
 }
 
+int bnxt_hwrm_set_vf_vlan(struct bnxt *bp, int vf)
+{
+       struct hwrm_func_cfg_input req = {0};
+       struct hwrm_func_cfg_output *resp = bp->hwrm_cmd_resp_addr;
+       int rc = 0;
+
+       HWRM_PREP(req, FUNC_CFG, -1, resp);
+       req.flags = rte_cpu_to_le_32(bp->pf.vf_info[vf].func_cfg_flags);
+       req.fid = rte_cpu_to_le_16(bp->pf.vf_info[vf].fid);
+       req.enables |= rte_cpu_to_le_32(HWRM_FUNC_CFG_INPUT_ENABLES_DFLT_VLAN);
+       req.dflt_vlan = rte_cpu_to_le_16(bp->pf.vf_info[vf].dflt_vlan);
+
+       rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+       HWRM_CHECK_RESULT;
+
+       return rc;
+}
+
 int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id,
                              void *encaped, size_t ec_size)
 {