From 92717a8e9b02124e3ca982400bbe97bd4cb73979 Mon Sep 17 00:00:00 2001 From: Wenzhuo Lu Date: Thu, 16 Mar 2017 11:09:45 +0800 Subject: [PATCH] net/i40e: fix broadcast promiscuous mode setting When setting up the VSIs, MAC filter is used for receiving MAC broadcast packets. We should follow it to implement the broadcast promiscuous mode setting. Fixes: 61fff9b4c68b ("net/i40e: set VF broadcast mode from PF") Cc: stable@dpdk.org Signed-off-by: Wenzhuo Lu --- drivers/net/i40e/i40e_ethdev.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index a128e7c495..a43242ebf5 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -10971,6 +10971,9 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id, struct i40e_pf *pf; struct i40e_vsi *vsi; struct i40e_hw *hw; + struct i40e_mac_filter_info filter; + struct ether_addr broadcast = { + .addr_bytes = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} }; int ret; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); @@ -11009,12 +11012,19 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id, return -EINVAL; } - hw = I40E_VSI_TO_HW(vsi); + if (on) { + (void)rte_memcpy(&filter.mac_addr, &broadcast, ETHER_ADDR_LEN); + filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; + ret = i40e_vsi_add_mac(vsi, &filter); + } else { + ret = i40e_vsi_delete_mac(vsi, &broadcast); + } - ret = i40e_aq_set_vsi_broadcast(hw, vsi->seid, on, NULL); - if (ret != I40E_SUCCESS) { + if (ret != I40E_SUCCESS && ret != I40E_ERR_PARAM) { ret = -ENOTSUP; PMD_DRV_LOG(ERR, "Failed to set VSI broadcast"); + } else { + ret = 0; } return ret; -- 2.20.1