From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 750F75A06 for ; Fri, 5 Jun 2015 05:24:41 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 04 Jun 2015 20:24:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,555,1427785200"; d="scan'208";a="582470828" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 04 Jun 2015 20:24:40 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t553Oc9m016912; Fri, 5 Jun 2015 11:24:38 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t553OaDn030985; Fri, 5 Jun 2015 11:24:38 +0800 Received: (from heshaope@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t553Oa37030981; Fri, 5 Jun 2015 11:24:36 +0800 From: Shaopeng He To: dev@dpdk.org Date: Fri, 5 Jun 2015 11:24:32 +0800 Message-Id: <1433474672-30951-1-git-send-email-shaopeng.he@intel.com> X-Mailer: git-send-email 1.7.4.1 Cc: Shaopeng He Subject: [dpdk-dev] [PATCH] fm10k: fix PF/VF MAC address register and clean up bug X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Jun 2015 03:24:43 -0000 MAC address with fixed VLAN 0 was removed. VF MAC/VLAN filter was enabled for the default value. Removed all VLAN and MAC address table entries when the system(e.g. testpmd) was closed. Signed-off-by: Shaopeng He --- drivers/net/fm10k/fm10k_ethdev.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 9b198a7..587debc 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -58,6 +58,8 @@ static int fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); static void fm10k_MAC_filter_set(struct rte_eth_dev *dev, const u8 *mac, bool add); +static void +fm10k_MACVLAN_remove_all(struct rte_eth_dev *dev); static void fm10k_mbx_initlock(struct fm10k_hw *hw) @@ -703,6 +705,8 @@ fm10k_dev_close(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); + fm10k_MACVLAN_remove_all(dev); + /* Stop mailbox service first */ fm10k_close_mbx_service(hw); fm10k_dev_stop(dev); @@ -830,10 +834,6 @@ fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private); macvlan = FM10K_DEV_PRIVATE_TO_MACVLAN(dev->data->dev_private); - /* @todo - add support for the VF */ - if (hw->mac.type != fm10k_mac_pf) - return -ENOTSUP; - if (vlan_id > ETH_VLAN_ID_MAX) { PMD_INIT_LOG(ERR, "Invalid vlan_id: must be < 4096"); return (-EINVAL); @@ -916,10 +916,6 @@ fm10k_MAC_filter_set(struct rte_eth_dev *dev, const u8 *mac, bool add) hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private); macvlan = FM10K_DEV_PRIVATE_TO_MACVLAN(dev->data->dev_private); - /* @todo - add support for the VF */ - if (hw->mac.type != fm10k_mac_pf) - return; - fm10k_mbx_lock(hw); i = 0; for (j = 0; j < FM10K_VFTA_SIZE; j++) { @@ -970,6 +966,25 @@ fm10k_macaddr_remove(struct rte_eth_dev *dev, uint32_t index) FALSE); } +/* Remove all VLAN and MAC address table entries */ +static void +fm10k_MACVLAN_remove_all(struct rte_eth_dev *dev) +{ + uint32_t j, k; + struct fm10k_macvlan_filter_info *macvlan; + + macvlan = FM10K_DEV_PRIVATE_TO_MACVLAN(dev->data->dev_private); + for (j = 0; j < FM10K_VFTA_SIZE; j++) { + if (macvlan->vfta[j]) { + for (k = 0; k < FM10K_UINT32_BIT_SIZE; k++) { + if (macvlan->vfta[j] & (1 << k)) + fm10k_vlan_filter_set(dev, + j * FM10K_UINT32_BIT_SIZE + k, false); + } + } + } +} + static inline int check_nb_desc(uint16_t min, uint16_t max, uint16_t mult, uint16_t request) { @@ -1997,13 +2012,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) /* Enable port first */ hw->mac.ops.update_lport_state(hw, hw->mac.dglort_map, 1, 1); - /* - * Add default mac. glort is assigned by SM for PF, while is - * unused for VF. PF will assign correct glort for VF. - */ - hw->mac.ops.update_uc_addr(hw, hw->mac.dglort_map, hw->mac.addr, - 0, 1, 0); - /* Set unicast mode by default. App can change to other mode in other * API func. */ -- 1.9.3