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 59A66A04E7; Mon, 2 Nov 2020 15:38:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2FC8FC90E; Mon, 2 Nov 2020 15:38:00 +0100 (CET) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by dpdk.org (Postfix) with ESMTP id 0F3B7C8D2 for ; Mon, 2 Nov 2020 15:37:55 +0100 (CET) Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4CPwW51CwpzhfpH for ; Mon, 2 Nov 2020 22:37:53 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Mon, 2 Nov 2020 22:37:46 +0800 From: Lijun Ou To: CC: , Date: Mon, 2 Nov 2020 22:38:12 +0800 Message-ID: <1604327899-60126-2-git-send-email-oulijun@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1604327899-60126-1-git-send-email-oulijun@huawei.com> References: <1604327899-60126-1-git-send-email-oulijun@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 1/8] net/hns3: add limit promisc mode to VF X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Chengchang Tang For kunpeng920, both tx and rx promisc is set when the promisc mode is open. In the word, all the ingress packets and the packets sent from the PF and other VFs on the same physical port will be copied to the function which set promisc mode on. Kunpeng930 support to turn off the tx unicast promisc. A limit promisc mode is introduced, which means turn off the tx unicast promisc when promisc is set. Signed-off-by: Chengchang Tang Signed-off-by: Lijun Ou --- drivers/net/hns3/hns3_ethdev.h | 21 +++++++++++++++++++++ drivers/net/hns3/hns3_ethdev_vf.c | 3 +++ 2 files changed, 24 insertions(+) diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index dcae154..b23c90e 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -41,6 +41,9 @@ #define HNS3_SW_SHIFT_AND_DISCARD_MODE 0 #define HNS3_HW_SHIFT_AND_DISCARD_MODE 1 +#define HNS3_UNLIMIT_PROMISC_MODE 0 +#define HNS3_LIMIT_PROMISC_MODE 1 + #define HNS3_UC_MACADDR_NUM 128 #define HNS3_VF_UC_MACADDR_NUM 48 #define HNS3_MC_MACADDR_NUM 128 @@ -528,6 +531,24 @@ struct hns3_hw { * is enabled. */ uint8_t vlan_mode; + /* + * promisc mode. + * value range: + * HNS3_UNLIMIT_PROMISC_MODE/HNS3_LIMIT_PROMISC_MODE + * + * - HNS3_UNLIMIT_PROMISC_MODE + * In this mode, TX unicast promisc will be configured when promisc + * is set, driver can receive all the ingress and outgoing traffic. + * In the words, all the ingress packets, all the packets sent from + * the PF and other VFs on the same physical port. + * + * - HNS3_LIMIT_PROMISC_MODE + * In this mode, TX unicast promisc is shutdown when promisc mode + * is set. So, driver will only receive all the ingress traffic. + * The packets sent from the PF and other VFs on the same physical + * port won't be copied to the function which has set promisc mode. + */ + uint8_t promisc_mode; uint8_t max_non_tso_bd_num; /* max BD number of one non-TSO packet */ struct hns3_port_base_vlan_config port_base_vlan_cfg; diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 05a9341..c903e07 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -610,6 +610,7 @@ hns3vf_set_promisc_mode(struct hns3_hw *hw, bool en_bc_pmc, req->msg[1] = en_bc_pmc ? 1 : 0; req->msg[2] = en_uc_pmc ? 1 : 0; req->msg[3] = en_mc_pmc ? 1 : 0; + req->msg[4] = hw->promisc_mode == HNS3_LIMIT_PROMISC_MODE ? 1 : 0; ret = hns3_cmd_send(hw, &desc, 1); if (ret) @@ -1214,6 +1215,7 @@ hns3vf_get_capability(struct hns3_hw *hw) hw->tso_mode = HNS3_TSO_SW_CAL_PSEUDO_H_CSUM; hw->min_tx_pkt_len = HNS3_HIP08_MIN_TX_PKT_LEN; hw->rss_info.ipv6_sctp_offload_supported = false; + hw->promisc_mode = HNS3_UNLIMIT_PROMISC_MODE; return 0; } @@ -1231,6 +1233,7 @@ hns3vf_get_capability(struct hns3_hw *hw) hw->tso_mode = HNS3_TSO_HW_CAL_PSEUDO_H_CSUM; hw->min_tx_pkt_len = HNS3_HIP09_MIN_TX_PKT_LEN; hw->rss_info.ipv6_sctp_offload_supported = true; + hw->promisc_mode = HNS3_LIMIT_PROMISC_MODE; return 0; } -- 2.7.4