From: 孙守鑫 <sunshouxin@chinatelecom.cn>
To: Jakub Kicinski <kuba@kernel.org>
Cc: j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net,
davem@davemloft.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, jay.vosburgh@canonical.com,
nikolay@nvidia.com, huyd12@chinatelecom.cn
Subject: Re: [PATCH v10] net: bonding: Add support for IPV6 ns/na to balance-alb/balance-tlb mode
Date: Fri, 28 Jan 2022 19:46:05 +0800 [thread overview]
Message-ID: <85c5f9d7-ac78-509e-a1c4-4cb86544f423@chinatelecom.cn> (raw)
In-Reply-To: <20220127184722.60cdb806@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Thanks your comment, I'll adjust it and send out v11 soon.
在 2022/1/28 10:47, Jakub Kicinski 写道:
> On Tue, 25 Jan 2022 09:24:18 -0500 Sun Shouxin wrote:
>> +/* determine if the packet is NA or NS */
>> +static bool __alb_determine_nd(struct icmp6hdr *hdr)
>> +{
>> + if (hdr->icmp6_type == NDISC_NEIGHBOUR_ADVERTISEMENT ||
>> + hdr->icmp6_type == NDISC_NEIGHBOUR_SOLICITATION) {
>> + return true;
>> + }
>> +
>> + return false;
>> +}
>> +
>> +static bool alb_determine_nd(struct sk_buff *skb, struct bonding *bond)
>> +{
>> + struct ipv6hdr *ip6hdr;
>> + struct icmp6hdr *hdr;
>> +
>> + if (!pskb_network_may_pull(skb, sizeof(*ip6hdr)))
>> + return true;
>> +
>> + ip6hdr = ipv6_hdr(skb);
>> + if (ip6hdr->nexthdr == IPPROTO_ICMPV6) {
> if (ip6hdr->nexthdr != IPPROTO_ICMPV6)
> return false;
>
> This way there's no need to indent the rest of the function.
>
>> + if (!pskb_may_pull(skb, sizeof(*ip6hdr) + sizeof(*hdr)))
> What happened to the _network part? pskb_network_may_pull(), right?
>
>> + return true;
>> +
>> + hdr = icmp6_hdr(skb);
>> + return __alb_determine_nd(hdr);
> Why create a full helper for this condition? Why not just:
>
> return hdr->icmp6_type == NDISC_NEIGHBOUR_ADVERTISEMENT ||
> hdr->icmp6_type == NDISC_NEIGHBOUR_SOLICITATION;
>
>
>> + }
>> +
>> + return false;
>> +}
next prev parent reply other threads:[~2022-01-28 11:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-25 14:24 Sun Shouxin
2022-01-28 2:47 ` Jakub Kicinski
2022-01-28 11:46 ` 孙守鑫 [this message]
2022-01-28 2:39 Sun Shouxin
2022-01-28 2:45 ` 孙守鑫
2022-01-28 2:51 ` Jakub Kicinski
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=85c5f9d7-ac78-509e-a1c4-4cb86544f423@chinatelecom.cn \
--to=sunshouxin@chinatelecom.cn \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=huyd12@chinatelecom.cn \
--cc=j.vosburgh@gmail.com \
--cc=jay.vosburgh@canonical.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nikolay@nvidia.com \
--cc=vfalico@gmail.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®