net/bnxt: fix scalar Rx datapath on Thor
[dpdk.git] / drivers / net / bnx2x / bnx2x_vfpf.c
index 8f7559c..0e8a92c 100644 (file)
@@ -703,3 +703,57 @@ out:
 
        return rc;
 }
+
+int
+bnx2x_vfpf_set_mcast(struct bnx2x_softc *sc,
+                                       struct rte_ether_addr *mc_addrs,
+                                       uint32_t mc_addrs_num)
+{
+       struct vf_set_q_filters_tlv *query;
+       struct vf_common_reply_tlv *reply =
+                       &sc->vf2pf_mbox->resp.common_reply;
+       int rc = 0;
+       uint32_t i = 0;
+       query = &sc->vf2pf_mbox->query[0].set_q_filters;
+       bnx2x_vf_prep(sc, &query->first_tlv, BNX2X_VF_TLV_SET_Q_FILTERS,
+                               sizeof(*query));
+       /* We support PFVF_MAX_MULTICAST_PER_VF mcast addresses tops */
+       if (mc_addrs_num > VF_MAX_MULTICAST_PER_VF) {
+               PMD_DRV_LOG(ERR, sc,
+               "VF supports not more than %d multicast MAC addresses",
+               VF_MAX_MULTICAST_PER_VF);
+
+               rc = -EINVAL;
+               goto out;
+       }
+
+       for (i = 0; i < mc_addrs_num; i++) {
+               PMD_DRV_LOG(DEBUG, sc, "Adding mcast MAC:"
+                               RTE_ETHER_ADDR_PRT_FMT,
+                               RTE_ETHER_ADDR_BYTES(&mc_addrs[i]));
+               memcpy(query->multicast[i], mc_addrs[i].addr_bytes, ETH_ALEN);
+       }
+
+       query->vf_qid = 0;
+       query->flags = BNX2X_VF_MULTICAST_CHANGED;
+       query->multicast_cnt = i;
+
+       /* add list termination tlv */
+       bnx2x_add_tlv(sc, query, query->first_tlv.tl.length,
+                               BNX2X_VF_TLV_LIST_END,
+                               sizeof(struct channel_list_end_tlv));
+       rc = bnx2x_do_req4pf(sc, sc->vf2pf_mbox_mapping.paddr);
+       if (rc)
+               goto out;
+
+       if (reply->status != BNX2X_VF_STATUS_SUCCESS) {
+               PMD_DRV_LOG(ERR, sc, "Set Rx mode/multicast failed: %d",
+                               reply->status);
+               rc = -EINVAL;
+       }
+
+out:
+       bnx2x_vf_finalize(sc, &query->first_tlv);
+
+       return rc;
+}