From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9FD10A046B for ; Fri, 26 Jul 2019 07:05:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 78E3A1C3BF; Fri, 26 Jul 2019 07:05:19 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id DC0481C3BF for ; Fri, 26 Jul 2019 07:05:17 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2019 22:05:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,309,1559545200"; d="scan'208";a="194100849" Received: from unknown (HELO npg-dpdk-cvl-yingwang-117d84.sh.intel.com) ([10.67.117.84]) by fmsmga004.fm.intel.com with ESMTP; 25 Jul 2019 22:05:15 -0700 From: Wang Ying A To: qabuild@intel.com Cc: Wang Ying A , stable@dpdk.org Date: Fri, 26 Jul 2019 04:44:54 +0800 Message-Id: <1564087494-69470-1-git-send-email-ying.a.wang@intel.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-stable] [DPDK] net/ice: fix LLDP forward X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" The patch fix the issue that lldp packet can't be forwarded to host. Fixes: 59d151de6673 ("net/ice: stop LLDP by default") Cc: stable@dpdk.org Signed-off-by: Wang Ying A --- drivers/net/ice/ice_ethdev.c | 46 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 08fc9ec..37bea2b 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -1385,6 +1385,44 @@ static int ice_parse_devargs(struct rte_eth_dev *dev) return ret; } +#define ICE_ETHERTYPE_LLDP 0x88CC +/** ice_cfg_sw_lldp - Config switch rules for LLDP packet handling + * @vsi: the VSI being configured + * @tx: bool to determine Tx or Rx rule + * @create: bool to determine create or remove Rule + */ +static enum ice_status +ice_cfg_sw_lldp(struct ice_vsi *vsi, bool tx, bool create) +{ + struct ice_hw *hw = ICE_VSI_TO_HW(vsi); + struct ice_fltr_list_entry *list = NULL; + struct LIST_HEAD_TYPE tmp_add_list; + enum ice_status status; + list = (struct ice_fltr_list_entry *)ice_malloc(hw, sizeof(*list)); + if (!list) + return ICE_ERR_NO_MEMORY; + list->fltr_info.lkup_type = ICE_SW_LKUP_ETHERTYPE; + list->fltr_info.vsi_handle = vsi->idx; + list->fltr_info.l_data.ethertype_mac.ethertype = ICE_ETHERTYPE_LLDP; + if (tx) { + list->fltr_info.fltr_act = ICE_DROP_PACKET; + list->fltr_info.flag = ICE_FLTR_TX; + list->fltr_info.src_id = ICE_SRC_ID_VSI; + } else { + list->fltr_info.fltr_act = ICE_FWD_TO_VSI; + list->fltr_info.flag = ICE_FLTR_RX; + list->fltr_info.src_id = ICE_SRC_ID_LPORT; + } + INIT_LIST_HEAD(&tmp_add_list); + LIST_ADD(&list->list_entry, &tmp_add_list); + if (create) + status = ice_add_eth_mac(hw, &tmp_add_list); + else + status = ice_remove_eth_mac(hw, &tmp_add_list); + ice_free(hw, list); + return status; +} + static int ice_dev_init(struct rte_eth_dev *dev) { @@ -1492,7 +1530,13 @@ static int ice_parse_devargs(struct rte_eth_dev *dev) ret = ice_aq_stop_lldp(hw, TRUE, FALSE, NULL); if (ret != ICE_SUCCESS) PMD_INIT_LOG(DEBUG, "lldp has already stopped\n"); - + ret = ice_init_dcb(hw, true); + if (ret != ICE_SUCCESS) + PMD_INIT_LOG(DEBUG, "Failed to init DCB\n"); + /* Forward LLDP packets to default VSI */ + ret = ice_cfg_sw_lldp(vsi, false, true); + if (ret != ICE_SUCCESS) + PMD_INIT_LOG(DEBUG, "Failed to cfg lldp\n"); /* register callback func to eal lib */ rte_intr_callback_register(intr_handle, ice_interrupt_handler, dev); -- 1.8.3.1