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 8418DA04B1; Tue, 25 Aug 2020 13:54:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E4DF91C25A; Tue, 25 Aug 2020 13:53:44 +0200 (CEST) Received: from mail.chinasoftinc.com (unknown [114.113.233.8]) by dpdk.org (Postfix) with ESMTP id 860021C126 for ; Tue, 25 Aug 2020 13:53:41 +0200 (CEST) Received: from localhost.localdomain (65.49.108.226) by INCCAS002.ito.icss (10.168.0.60) with Microsoft SMTP Server id 14.3.487.0; Tue, 25 Aug 2020 19:53:32 +0800 From: "Wei Hu (Xavier)" To: CC: , Date: Tue, 25 Aug 2020 19:53:00 +0800 Message-ID: <20200825115305.58490-7-huwei013@chinasoftinc.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200825115305.58490-1-huwei013@chinasoftinc.com> References: <20200825115305.58490-1-huwei013@chinasoftinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [65.49.108.226] Subject: [dpdk-dev] [PATCH 06/11] net/hns3: support a maximun 256 FDIR counter 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: "Wei Hu (Xavier)" The FDIR counter was used to count the number of FDIR hit, the maximum number of the counter is 128 based on kunpeng 920, and it was 256 based on kunpeng 930. The firmware is responsible to allocate counters for diffent PF devices, so the available counter number of one PF may be bigger than 128. Currently, there are two places using the counter in hns3 PMD driver: 1. Configure the counter. Driver uses the command whose opcode is HNS3_OPC_FD_AD_OP, now we extend one bit to hold the high bit of counter-id in the command format. 2. Query the statistic information of the counter. Driver uses the command whose opcode is HNS3_OPC_FD_COUNTER_OP, now the command already support 16-bit counter-id. Signed-off-by: Chengwen Feng Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_fdir.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c index 6ab439d06..5c3dd05f2 100644 --- a/drivers/net/hns3/hns3_fdir.c +++ b/drivers/net/hns3/hns3_fdir.c @@ -41,6 +41,8 @@ #define HNS3_FD_AD_WR_RULE_ID_B 0 #define HNS3_FD_AD_RULE_ID_S 1 #define HNS3_FD_AD_RULE_ID_M GENMASK(13, 1) +#define HNS3_FD_AD_COUNTER_HIGH_BIT 7 +#define HNS3_FD_AD_COUNTER_HIGH_BIT_B 26 enum HNS3_PORT_TYPE { HOST_PORT, @@ -424,6 +426,9 @@ static int hns3_fd_ad_config(struct hns3_hw *hw, int loc, action->write_rule_id_to_bd); hns3_set_field(ad_data, HNS3_FD_AD_RULE_ID_M, HNS3_FD_AD_RULE_ID_S, action->rule_id); + /* set extend bit if counter_id is in [128 ~ 255] */ + if (action->counter_id & BIT(HNS3_FD_AD_COUNTER_HIGH_BIT)) + hns3_set_bit(ad_data, HNS3_FD_AD_COUNTER_HIGH_BIT_B, 1); ad_data <<= HNS3_FD_AD_DATA_S; hns3_set_bit(ad_data, HNS3_FD_AD_DROP_B, action->drop_packet); hns3_set_bit(ad_data, HNS3_FD_AD_DIRECT_QID_B, -- 2.27.0