net/bnx2x: add multicast MAC address filtering
Checks
Commit Message
Add support the set_mc_addr_list device operation in the bnx2xvf PMD.
The configured addresses are stored in the device private area, so
they can be flushed before adding new ones.
Without this v6 multicast packets were properly forwarded to the
Guest VF.
Signed-off-by: "Dey, Souvik" <sodey@rbbn.com>
---
drivers/net/bnx2x/bnx2x.h | 3 ++
drivers/net/bnx2x/bnx2x_ethdev.c | 36 ++++++++++++++++++++++++
drivers/net/bnx2x/bnx2x_vfpf.c | 59 ++++++++++++++++++++++++++++++++++++++++
drivers/net/bnx2x/bnx2x_vfpf.h | 3 ++
4 files changed, 101 insertions(+)
Comments
Hi Souvik,
Could you resend this patch in text format?
When we are doing open source work, the contents of the footer are not compatible with what we are doing. Please remove the footer in patches and mailing list interactions for future.
Thanks!
-Rasesh
From: Dey, Souvik <sodey@rbbn.com>
Sent: Friday, February 28, 2020 12:05 PM
To: Rasesh Mody <rmody@marvell.com>; Shahed Shaikh <shshaikh@marvell.com>; Jerin Jacob Kollanukkaran <jerinj@marvell.com>; ferruh.yigit@intel.com; thomas@monjalon.net
Cc: dev@dpdk.org; stable@dpdk.org; Dey, Souvik <sodey@rbbn.com>
Subject: [EXT] [PATCH] net/bnx2x: add multicast MAC address filtering
External Email
On Wed, Mar 4, 2020 at 4:58 AM Rasesh Mody <rmody@marvell.com> wrote:
>
> Hi Souvik,
>
>
>
> Could you resend this patch in text format?
>
>
>
> When we are doing open source work, the contents of the footer are not compatible with what we are doing. Please remove the footer in patches and mailing list interactions for future.
Please fix the following issue as well.
1) [master][dpdk-next-net-mrvl] $ ./devtools/check-git-log.sh
Wrong tag:
Signed-off-by: "Dey, Souvik" <sodey@rbbn.com>
Rasesh,
I will wait for your ack for merging this patch.
On Fri, 28 Feb 2020 15:04:51 -0500
"Dey, Souvik" <sodey@rbbn.com> wrote:
> + /* Configure the previously stored Multicast address list */
> + if (IS_VF(sc)) {
> + bnx2x_vfpf_set_mcast(sc, sc->mc_addrs, sc->mc_addrs_num);
> + }
Did you run checkpatch on this, the indentation does not match DPDK style.
### [PATCH] net/bnx2x: add multicast MAC address filtering
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#31: FILE: drivers/net/bnx2x/bnx2x.h:1381:
+ uint16_t mc_addrs_num; /* Multicast mac addresses number */$
WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (8, 8)
#44: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:243:
+ if (IS_VF(sc)) {
+ bnx2x_vfpf_set_mcast(sc, sc->mc_addrs, sc->mc_addrs_num);
WARNING:BRACES: braces {} are not necessary for single statement blocks
#44: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:243:
+ if (IS_VF(sc)) {
+ bnx2x_vfpf_set_mcast(sc, sc->mc_addrs, sc->mc_addrs_num);
+ }
ERROR:CODE_INDENT: code indent should use tabs where possible
#45: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:244:
+ bnx2x_vfpf_set_mcast(sc, sc->mc_addrs, sc->mc_addrs_num);$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#45: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:244:
+ bnx2x_vfpf_set_mcast(sc, sc->mc_addrs, sc->mc_addrs_num);$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#46: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:245:
+ }$
WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line
#56: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:275:
+ * Number is set to 0 denoting DEL_CMD */
WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (8, 8)
#57: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:276:
+ if (IS_VF(sc)) {
+ bnx2x_vfpf_set_mcast(sc, NULL, 0);
WARNING:BRACES: braces {} are not necessary for single statement blocks
#57: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:276:
+ if (IS_VF(sc)) {
+ bnx2x_vfpf_set_mcast(sc, NULL, 0);
+ }
ERROR:CODE_INDENT: code indent should use tabs where possible
#58: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:277:
+ bnx2x_vfpf_set_mcast(sc, NULL, 0);$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#58: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:277:
+ bnx2x_vfpf_set_mcast(sc, NULL, 0);$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#59: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:278:
+ }$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#72: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:366:
+ struct bnx2x_softc *sc = dev->data->dev_private;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#73: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:367:
+ int err;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#74: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:368:
+ PMD_INIT_FUNC_TRACE(sc);$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#76: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:370:
+ err = bnx2x_vfpf_set_mcast(sc, NULL, 0);$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#77: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:371:
+ if (err)$
ERROR:CODE_INDENT: code indent should use tabs where possible
#78: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:372:
+ return err;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#78: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:372:
+ return err;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#79: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:373:
+ sc->mc_addrs_num = 0;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#82: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:376:
+ err = bnx2x_vfpf_set_mcast(sc, mc_addrs, mc_addrs_num );$
ERROR:SPACING: space prohibited before that close parenthesis ')'
#82: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:376:
+ err = bnx2x_vfpf_set_mcast(sc, mc_addrs, mc_addrs_num );
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#83: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:377:
+ if (err)$
ERROR:CODE_INDENT: code indent should use tabs where possible
#84: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:378:
+ return err;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#84: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:378:
+ return err;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#86: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:380:
+ sc->mc_addrs_num = mc_addrs_num;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#87: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:381:
+ memcpy(sc->mc_addrs, mc_addrs, mc_addrs_num * sizeof(*mc_addrs));$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#89: FILE: drivers/net/bnx2x/bnx2x_ethdev.c:383:
+ return 0;$
WARNING:LONG_LINE: line over 80 characters
#114: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:709:
+ struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num)
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#116: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:711:
+ struct vf_set_q_filters_tlv *query;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#117: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:712:
+ struct vf_common_reply_tlv *reply = &sc->vf2pf_mbox->resp.common_reply;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#118: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:713:
+ int rc = 0;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#119: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:714:
+ uint32_t i = 0;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#120: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:715:
+ query = &sc->vf2pf_mbox->query[0].set_q_filters;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#121: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:716:
+ bnx2x_vf_prep(sc, &query->first_tlv, BNX2X_VF_TLV_SET_Q_FILTERS,$
ERROR:CODE_INDENT: code indent should use tabs where possible
#122: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:717:
+ sizeof(*query));$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#122: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:717:
+ sizeof(*query));$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#124: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:719:
+ if (mc_addrs_num > VF_MAX_MULTICAST_PER_VF) {$
ERROR:CODE_INDENT: code indent should use tabs where possible
#125: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:720:
+ PMD_DRV_LOG(ERR, sc,$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#125: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:720:
+ PMD_DRV_LOG(ERR, sc,$
ERROR:CODE_INDENT: code indent should use tabs where possible
#129: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:724:
+ rc = -EINVAL;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#129: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:724:
+ rc = -EINVAL;$
ERROR:CODE_INDENT: code indent should use tabs where possible
#130: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:725:
+ goto out;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#130: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:725:
+ goto out;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#131: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:726:
+ }$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#133: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:728:
+ for (i = 0; i < mc_addrs_num; i++) {$
ERROR:CODE_INDENT: code indent should use tabs where possible
#134: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:729:
+ PMD_DRV_LOG(DEBUG, sc, "Adding mcast MAC:%x:%x:%x:%x:%x:%x",$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#134: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:729:
+ PMD_DRV_LOG(DEBUG, sc, "Adding mcast MAC:%x:%x:%x:%x:%x:%x",$
ERROR:CODE_INDENT: code indent should use tabs where possible
#135: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:730:
+ mc_addrs[i].addr_bytes[0],$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#135: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:730:
+ mc_addrs[i].addr_bytes[0],$
ERROR:CODE_INDENT: code indent should use tabs where possible
#136: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:731:
+ mc_addrs[i].addr_bytes[1],$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#136: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:731:
+ mc_addrs[i].addr_bytes[1],$
ERROR:CODE_INDENT: code indent should use tabs where possible
#137: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:732:
+ mc_addrs[i].addr_bytes[2],$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#137: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:732:
+ mc_addrs[i].addr_bytes[2],$
ERROR:CODE_INDENT: code indent should use tabs where possible
#138: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:733:
+ mc_addrs[i].addr_bytes[3],$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#138: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:733:
+ mc_addrs[i].addr_bytes[3],$
ERROR:CODE_INDENT: code indent should use tabs where possible
#139: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:734:
+ mc_addrs[i].addr_bytes[4],$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#139: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:734:
+ mc_addrs[i].addr_bytes[4],$
ERROR:CODE_INDENT: code indent should use tabs where possible
#140: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:735:
+ mc_addrs[i].addr_bytes[5]);$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#140: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:735:
+ mc_addrs[i].addr_bytes[5]);$
ERROR:CODE_INDENT: code indent should use tabs where possible
#141: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:736:
+ memcpy(query->multicast[i], mc_addrs[i].addr_bytes, ETH_ALEN);$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#141: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:736:
+ memcpy(query->multicast[i], mc_addrs[i].addr_bytes, ETH_ALEN);$
ERROR:CODE_INDENT: code indent should use tabs where possible
#142: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:737:
+ i++;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#142: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:737:
+ i++;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#143: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:738:
+ }$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#145: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:740:
+ query->vf_qid = 0;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#146: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:741:
+ query->flags = BNX2X_VF_MULTICAST_CHANGED;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#147: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:742:
+ query->multicast_cnt = i;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#150: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:745:
+ bnx2x_add_tlv(sc, query, query->first_tlv.tl.length,$
ERROR:CODE_INDENT: code indent should use tabs where possible
#151: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:746:
+ BNX2X_VF_TLV_LIST_END,$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#151: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:746:
+ BNX2X_VF_TLV_LIST_END,$
ERROR:CODE_INDENT: code indent should use tabs where possible
#152: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:747:
+ sizeof(struct channel_list_end_tlv));$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#152: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:747:
+ sizeof(struct channel_list_end_tlv));$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#154: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:749:
+ rc = bnx2x_do_req4pf(sc, sc->vf2pf_mbox_mapping.paddr);$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#155: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:750:
+ if (rc)$
ERROR:CODE_INDENT: code indent should use tabs where possible
#156: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:751:
+ goto out;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#156: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:751:
+ goto out;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#158: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:753:
+ if (reply->status != BNX2X_VF_STATUS_SUCCESS) {$
ERROR:CODE_INDENT: code indent should use tabs where possible
#159: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:754:
+ PMD_DRV_LOG(ERR, sc, "Set Rx mode/multicast failed: %d",$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#159: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:754:
+ PMD_DRV_LOG(ERR, sc, "Set Rx mode/multicast failed: %d",$
ERROR:CODE_INDENT: code indent should use tabs where possible
#160: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:755:
+ reply->status);$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#160: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:755:
+ reply->status);$
ERROR:CODE_INDENT: code indent should use tabs where possible
#161: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:756:
+ rc = -EINVAL;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#161: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:756:
+ rc = -EINVAL;$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#162: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:757:
+ }$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#165: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:760:
+ bnx2x_vf_finalize(sc, &query->first_tlv);$
WARNING:LEADING_SPACE: please, no spaces at the start of a line
#167: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:762:
+ return rc;$
CHECK:BRACES: Blank lines aren't necessary before a close brace '}'
#169: FILE: drivers/net/bnx2x/bnx2x_vfpf.c:764:
+
+}
total: 24 errors, 63 warnings, 1 checks, 139 lines checked
0/1 valid patch
Hi All,
Yes I did. I am not getting the below errors.
sodey@SODEY-LMA MINGW64 ~/DPDK_Patch/patch
$ ../dpdk/devtools/checkpatches.sh v2-0001-net-bnx2x-add-multicast-MAC-address-filtering
1/1 valid patch
Also Fixed the Wrong tag issue with check-git-log.sh. Attached the patch in text format too as is asked for.
The Footer is added from the server side for us, I have tried to get that removed for all the mails to dpdk.org, do check and let me know if they are fine now. Do I need to repost the patch again or is the mail with the text format is enough.
--
Regards,
Souvik
From: Jerin Jacob <jerinjacobk@gmail.com>
Sent: Sunday, April 5, 2020 9:10 AM
To: Rasesh Mody <rmody@marvell.com>
Cc: Dey, Souvik <sodey@rbbn.com>; Shahed Shaikh <shshaikh@marvell.com>; Jerin Jacob Kollanukkaran <jerinj@marvell.com>; ferruh.yigit@intel.com; thomas@monjalon.net; dev@dpdk.org; stable@dpdk.org
Subject: Re: [dpdk-dev] [EXT] [PATCH] net/bnx2x: add multicast MAC address filtering
@@ -1376,6 +1376,9 @@ struct bnx2x_softc {
uint8_t prio_to_cos[BNX2X_MAX_PRIORITY];
int panic;
+ /* Array of Multicast addrs */
+ struct rte_ether_addr mc_addrs[VF_MAX_MULTICAST_PER_VF];
+ uint16_t mc_addrs_num; /* Multicast mac addresses number */
}; /* struct bnx2x_softc */
/* IOCTL sub-commands for edebug and firmware upgrade */
@@ -239,6 +239,10 @@ bnx2x_dev_start(struct rte_eth_dev *dev)
if (rte_intr_enable(&sc->pci_dev->intr_handle))
PMD_DRV_LOG(ERR, sc, "rte_intr_enable failed");
}
+ /* Configure the previously stored Multicast address list */
+ if (IS_VF(sc)) {
+ bnx2x_vfpf_set_mcast(sc, sc->mc_addrs, sc->mc_addrs_num);
+ }
bnx2x_dev_rxtx_init(dev);
@@ -266,6 +270,13 @@ bnx2x_dev_stop(struct rte_eth_dev *dev)
bnx2x_periodic_stop(dev);
}
+ /* Remove the configured Multicast list
+ * Sending NULL for the list of address and the
+ * Number is set to 0 denoting DEL_CMD */
+ if (IS_VF(sc)) {
+ bnx2x_vfpf_set_mcast(sc, NULL, 0);
+ }
+
ret = bnx2x_nic_unload(sc, UNLOAD_NORMAL, FALSE);
if (ret) {
PMD_DRV_LOG(DEBUG, sc, "bnx2x_nic_unload failed (%d)", ret);
@@ -349,6 +360,30 @@ bnx2x_dev_allmulticast_disable(struct rte_eth_dev *dev)
}
static int
+bnx2x_dev_set_mc_addr_list(struct rte_eth_dev *dev,
+ struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num)
+{
+ struct bnx2x_softc *sc = dev->data->dev_private;
+ int err;
+ PMD_INIT_FUNC_TRACE(sc);
+ /* flush previous addresses */
+ err = bnx2x_vfpf_set_mcast(sc, NULL, 0);
+ if (err)
+ return err;
+ sc->mc_addrs_num = 0;
+
+ /* Add new ones */
+ err = bnx2x_vfpf_set_mcast(sc, mc_addrs, mc_addrs_num );
+ if (err)
+ return err;
+
+ sc->mc_addrs_num = mc_addrs_num;
+ memcpy(sc->mc_addrs, mc_addrs, mc_addrs_num * sizeof(*mc_addrs));
+
+ return 0;
+}
+
+static int
bnx2x_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete)
{
struct bnx2x_softc *sc = dev->data->dev_private;
@@ -562,6 +597,7 @@ static const struct eth_dev_ops bnx2xvf_eth_dev_ops = {
.promiscuous_disable = bnx2x_promisc_disable,
.allmulticast_enable = bnx2x_dev_allmulticast_enable,
.allmulticast_disable = bnx2x_dev_allmulticast_disable,
+ .set_mc_addr_list = bnx2x_dev_set_mc_addr_list,
.link_update = bnx2xvf_dev_link_update,
.stats_get = bnx2x_dev_stats_get,
.xstats_get = bnx2x_dev_xstats_get,
@@ -703,3 +703,62 @@ bnx2x_vf_set_rx_mode(struct bnx2x_softc *sc)
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:%x:%x:%x:%x:%x:%x",
+ mc_addrs[i].addr_bytes[0],
+ mc_addrs[i].addr_bytes[1],
+ mc_addrs[i].addr_bytes[2],
+ mc_addrs[i].addr_bytes[3],
+ mc_addrs[i].addr_bytes[4],
+ mc_addrs[i].addr_bytes[5]);
+ memcpy(query->multicast[i], mc_addrs[i].addr_bytes, ETH_ALEN);
+ i++;
+ }
+
+ 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;
+
+}
@@ -331,5 +331,8 @@ struct bnx2x_vf_mbx_msg {
int bnx2x_vf_teardown_queue(struct bnx2x_softc *sc, int qid);
int bnx2x_vf_set_mac(struct bnx2x_softc *sc, int set);
int bnx2x_vf_config_rss(struct bnx2x_softc *sc, struct ecore_config_rss_params *params);
+int bnx2x_vfpf_set_mcast(struct bnx2x_softc *sc,
+ struct rte_ether_addr *mc_addrs,
+ uint32_t mc_addrs_num);
#endif /* BNX2X_VFPF_H */