Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4739439pxu; Thu, 10 Dec 2020 04:27:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJxeFfPTqnAprzNT+48ElqeZ9paXcK4m3vA1m5kDJQg9mEhqRHrDuukxhSDFnynUe31kVa0P X-Received: by 2002:a50:85c6:: with SMTP id q6mr6749510edh.126.1607603235286; Thu, 10 Dec 2020 04:27:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607603235; cv=none; d=google.com; s=arc-20160816; b=UGr/fMNeKSOgIzzd9QJLC7w4RMNqTN7vdPgHQejZbEn4ZN+FTBNZ2WCc82aUghDXtm 9mifsszD4VisBWZB4oTSu1joHqks7phqR8Th9UYUI0OkLLiaXtO3iNysJDVYHtmCeloW jks9gUXUm7gfNW9pCjSfx2qEkUMtfmBUoMbVUgzttp6oEtXxqN8jEiYNXu0fI5PiCoTg dxAT1OixzhOGc02RWA768khtzrH3wBBtp/TQ7mAc2tOMVnQ9koE+2onYM2ikyO9cWnmu GnvzgpOFf6Ar/10Pz/NXB+7BtFtbOaDeFZwDW4Od2IEUhs0nsYWBekb0bRUpI7jxcDhn pd2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=3+OKZeWXGDeCNOAFWfHFBXSD4g9GLLSUCmQ68TmKBeg=; b=B03aBfXjsHVS0pvu43mFG65SZx6nfODNXRaqq0Rr9cC+oILL37AAnDUcHFgaSq+ayM LKuohfha0Ze+azXUE1ludsDgC3GbyuEr5veDfcPN/Jo/sl/udB9C4aPMV4qP0w0+MQ1j nD4U7ro7pErwUyk4GEYhD8/ILuEyWT0DFKZ4fp5SJMrO62i/JqtAle9i7z4lP9wbcBcU 5T6UL9steA0zhFt2tNcOrxY5dDlM0jJ9GA/thnSkQk/8SW6j0fsgg5mYdtbDPQlgkEoa YjZgljWL9kdjqDd4ejyyemOJuZGCSj8PomeVq7/FI/3d8MPpPfYkfmsy5dp0pNDBeYp6 0obw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hp33si2486865ejc.250.2020.12.10.04.26.50; Thu, 10 Dec 2020 04:27:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730966AbgLJMZS (ORCPT + 99 others); Thu, 10 Dec 2020 07:25:18 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:9492 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729324AbgLJMZC (ORCPT ); Thu, 10 Dec 2020 07:25:02 -0500 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CsCkq4m5Xzhq7d; Thu, 10 Dec 2020 20:23:47 +0800 (CST) Received: from [127.0.0.1] (10.74.149.191) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Thu, 10 Dec 2020 20:24:12 +0800 Subject: Re: [PATCH net-next 3/7] net: hns3: add support for forwarding packet to queues of specified TC when flow director rule hit To: Saeed Mahameed , CC: , , , , Jian Shen References: <1607571732-24219-1-git-send-email-tanhuazhong@huawei.com> <1607571732-24219-4-git-send-email-tanhuazhong@huawei.com> <5057047d659b337317d1ee8355a2659c78d3315f.camel@kernel.org> From: tanhuazhong Message-ID: Date: Thu, 10 Dec 2020 20:24:12 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <5057047d659b337317d1ee8355a2659c78d3315f.camel@kernel.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.74.149.191] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/12/10 13:40, Saeed Mahameed wrote: > On Thu, 2020-12-10 at 11:42 +0800, Huazhong Tan wrote: >> From: Jian Shen >> >> For some new device, it supports forwarding packet to queues >> of specified TC when flow director rule hit. So extend the >> command handle to support it. >> > > ... > >> static int hclge_config_action(struct hclge_dev *hdev, u8 stage, >> struct hclge_fd_rule *rule) >> { >> + struct hclge_vport *vport = hdev->vport; >> + struct hnae3_knic_private_info *kinfo = &vport->nic.kinfo; >> struct hclge_fd_ad_data ad_data; >> >> + memset(&ad_data, 0, sizeof(struct hclge_fd_ad_data)); >> ad_data.ad_id = rule->location; >> >> if (rule->action == HCLGE_FD_ACTION_DROP_PACKET) { >> ad_data.drop_packet = true; >> - ad_data.forward_to_direct_queue = false; >> - ad_data.queue_id = 0; >> + } else if (rule->action == HCLGE_FD_ACTION_SELECT_TC) { >> + ad_data.override_tc = true; >> + ad_data.queue_id = >> + kinfo->tc_info.tqp_offset[rule->tc]; >> + ad_data.tc_size = >> + ilog2(kinfo->tc_info.tqp_count[rule->tc]); > > In the previous patch you copied this info from mqprio, which is an > egress qdisc feature, this patch is clearly about rx flow director, I > think the patch is missing some context otherwise it doesn't make any > sense. > Since tx and rx are in the same tqp, what we do here is to make tx and rx in the same tc when rule is hit. >> } else { >> - ad_data.drop_packet = false; >> ad_data.forward_to_direct_queue = true; >> ad_data.queue_id = rule->queue_id; >> } >> @@ -5937,7 +5950,7 @@ static int hclge_add_fd_entry(struct >> hnae3_handle *handle, >> return -EINVAL; >> } >> >> - action = HCLGE_FD_ACTION_ACCEPT_PACKET; >> + action = HCLGE_FD_ACTION_SELECT_QUEUE; >> q_index = ring; >> } >> >> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h >> b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h >> index b3c1301..a481064 100644 >> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h >> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h >> @@ -572,8 +572,9 @@ enum HCLGE_FD_PACKET_TYPE { >> }; >> >> enum HCLGE_FD_ACTION { >> - HCLGE_FD_ACTION_ACCEPT_PACKET, >> + HCLGE_FD_ACTION_SELECT_QUEUE, >> HCLGE_FD_ACTION_DROP_PACKET, >> + HCLGE_FD_ACTION_SELECT_TC, > > what is SELECT_TC ? you never actually write this value anywhere in > this patch. > HCLGE_FD_ACTION_SELECT_TC means that the packet will be forwarded into the queue of specified TC when rule is hit. the assignment is in the next patch, maybe these two patch should be merged for making it more readable. Thanks. Huazhong. > > > . >