mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Jijie Shao <shaojijie@huawei.com>, Simon Horman <horms@kernel.org>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	andrew+netdev@lunn.ch, shenjian15@huawei.com,
	liuyonglong@huawei.com, chenhao418@huawei.com,
	huangdonghua3@h-partners.com, yangshuaisong@h-partners.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2 net-next 0/6] net: hns3: enhance tc flow offload support
Date: Fri, 29 May 2026 12:53:18 +0200	[thread overview]
Message-ID: <a5c4c3c3-4c2e-4a04-9d38-8d9490e81404@redhat.com> (raw)
In-Reply-To: <83f34836-c848-469a-9c1c-7f28bf3035fc@huawei.com>

On 5/28/26 1:24 PM, Jijie Shao wrote:
> on 2026/5/28 17:06, Paolo Abeni wrote:
>> This one:
>>
>> ---
>>> +		if (is_zero_ether_addr(match.key->dst))
>>> +			rule->unused_tuple |= BIT(INNER_DST_MAC);
>>> +		if (is_zero_ether_addr(match.key->src))
>>> +			rule->unused_tuple |= BIT(INNER_SRC_MAC);
>> Should the "is this tuple unused" decision be driven by the mask
>> rather than the key?
>> A tc-flower rule that explicitly matches an all-zero address, for
>> example:
>>      tc filter add ... flower dst_mac 00:00:00:00:00:00 ...
>>      tc filter add ... flower src_ip 0.0.0.0 ...
>>      tc filter add ... flower src_ip :: ...
>> produces match.key->{src,dst} == 0 with match.mask->{src,dst} set to
>> all-ones. With the new checks above, those rules now have
>> INNER_{SRC,DST}_MAC / INNER_{SRC,DST}_IP added to rule->unused_tuple
>> even though the user asked to match exactly that address.
>> Downstream, hclge_fd_convert_tuple() short-circuits on unused_tuple:
>>      if (rule->unused_tuple & BIT(tuple_bit))
>>          return true;
>> so the tuple is not programmed into the TCAM key and the field is
>> effectively wildcarded in hardware, with no -EINVAL or extack returned
>> to the user.
>> Real-world patterns that rely on all-zero addresses include DHCPv4
>> DISCOVER (src 0.0.0.0), IPv6 DAD/NUD probes and DHCPv6 (src ::), and
>> deliberate matches on the all-zero MAC.
>> ---
>>
>> and similar later ones look real/relevant to me, and IMHO should be
>> addressed.
> 
> Yes, I saw this issue. There is similar logic in the existing function hclge_fd_check_ether_tuple():
> 
> static int hclge_fd_check_ether_tuple(struct ethhdr *spec, u32 *unused_tuple)
> {
> 	if (!spec || !unused_tuple)
> 		return -EINVAL;
> 
> 	*unused_tuple |= BIT(INNER_SRC_IP) | BIT(INNER_DST_IP) |
> 		BIT(INNER_SRC_PORT) | BIT(INNER_DST_PORT) |
> 		BIT(INNER_IP_TOS) | BIT(INNER_IP_PROTO);
> 
> 	if (is_zero_ether_addr(spec->h_source))
> 		*unused_tuple |= BIT(INNER_SRC_MAC);
> 
> 	if (is_zero_ether_addr(spec->h_dest))
> 		*unused_tuple |= BIT(INNER_DST_MAC);
> 
> 	if (!spec->h_proto)
> 		*unused_tuple |= BIT(INNER_ETH_TYPE);
> 
> 	return 0;
> }
> 
> This looks like a common problem for hns3. My original idea was to send 
> a separate bugfix later to fix all the all-zero MAC or IP addresses.>
The current tc flow implementation logic is consistent with ethtool -U.
> 
> Alternatively, I can first fix the tc flow issue in v4, and then submit
> a bugfix later to fix the potential issues in ethtool -U.

I think the latter option (v4 using `mask` and follow-up patch for
existing code) is the better one (to avoid introducing new code with a
known issues).

Thanks,

Paolo


      parent reply	other threads:[~2026-05-29 10:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-23 10:54 Jijie Shao
2026-05-23 10:54 ` [PATCH V2 net-next 1/6] net: hns3: adjust add_cls_flower() for support more action Jijie Shao
2026-05-23 10:54 ` [PATCH V2 net-next 2/6] net: hns3: improve the unused_tuple parameter setting Jijie Shao
2026-05-23 10:54 ` [PATCH V2 net-next 3/6] net: hns3: support two more actions for tc flow Jijie Shao
2026-05-23 10:54 ` [PATCH V2 net-next 4/6] net: hns3: support IP and tunnel VNI dissectors " Jijie Shao
2026-05-23 10:54 ` [PATCH V2 net-next 5/6] net: hns3: debugfs support for dumping fd rules Jijie Shao
2026-05-23 10:54 ` [PATCH V2 net-next 6/6] net: hns3: move fd code to a separate file Jijie Shao
2026-05-27  9:59 ` [PATCH V2 net-next 0/6] net: hns3: enhance tc flow offload support Simon Horman
2026-05-27 13:12   ` Jijie Shao
2026-05-28  9:06     ` Paolo Abeni
2026-05-28 11:24       ` Jijie Shao
2026-05-29  9:34         ` Simon Horman
2026-06-02 12:23           ` Jijie Shao
2026-05-29 10:53         ` Paolo Abeni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5c4c3c3-4c2e-4a04-9d38-8d9490e81404@redhat.com \
    --to=pabeni@redhat.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=chenhao418@huawei.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=huangdonghua3@h-partners.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuyonglong@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=shaojijie@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=yangshuaisong@h-partners.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®