From: David Ahern <dsahern@kernel.org>
To: Sun Shouxin <sunshouxin@chinatelecom.cn>,
j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net,
davem@davemloft.net, kuba@kernel.org, yoshfuji@linux-ipv6.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
huyd12@chinatelecom.cn
Subject: Re: [PATCH 1/3] net:ipv6:Add ndisc_bond_send_na to support sending na by slave directly
Date: Fri, 11 Mar 2022 09:58:46 -0700 [thread overview]
Message-ID: <b0ef55ef-234f-63a4-7cc3-fd4acde2f011@kernel.org> (raw)
In-Reply-To: <20220311024958.7458-2-sunshouxin@chinatelecom.cn>
On 3/10/22 7:49 PM, Sun Shouxin wrote:
> diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
> index fcb288b0ae13..c59a110e9b10 100644
> --- a/net/ipv6/ndisc.c
> +++ b/net/ipv6/ndisc.c
> @@ -572,6 +572,67 @@ void ndisc_send_na(struct net_device *dev, const struct in6_addr *daddr,
> ndisc_send_skb(skb, daddr, src_addr);
> }
>
> +void ndisc_bond_send_na(struct net_device *dev, const struct in6_addr *daddr,
This ipv6 code, not bond code
> + const struct in6_addr *solicited_addr,
> + bool router, bool solicited, bool override,
> + bool inc_opt, unsigned short vlan_id,
> + const void *mac_dst, const void *mac_src)
> +{
> + struct sk_buff *skb;
> + const struct in6_addr *src_addr;
> + struct nd_msg *msg;
> + struct net *net = dev_net(dev);
> + struct sock *sk = net->ipv6.ndisc_sk;
> + int optlen = 0;
> + int ret;
> +
> + src_addr = solicited_addr;
> + if (!dev->addr_len)
> + inc_opt = false;
> + if (inc_opt)
> + optlen += ndisc_opt_addr_space(dev,
> + NDISC_NEIGHBOUR_ADVERTISEMENT);
> +
> + skb = ndisc_alloc_skb(dev, sizeof(*msg) + optlen);
> + if (!skb)
> + return;
> +
> + msg = skb_put(skb, sizeof(*msg));
> + *msg = (struct nd_msg) {
> + .icmph = {
> + .icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT,
> + .icmp6_router = router,
> + .icmp6_solicited = solicited,
> + .icmp6_override = override,
> + },
> + .target = *solicited_addr,
> + };
> +
> + if (inc_opt)
> + ndisc_fill_addr_option(skb, ND_OPT_TARGET_LL_ADDR,
> + dev->dev_addr,
> + NDISC_NEIGHBOUR_ADVERTISEMENT);
> +
> + if (vlan_id)
> + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
> + vlan_id);
> +
> + msg->icmph.icmp6_cksum = csum_ipv6_magic(src_addr, daddr, skb->len,
> + IPPROTO_ICMPV6,
> + csum_partial(&msg->icmph,
> + skb->len, 0));
> +
> + ip6_nd_hdr(skb, src_addr, daddr, inet6_sk(sk)->hop_limit, skb->len);
> +
> + skb->protocol = htons(ETH_P_IPV6);
> + skb->dev = dev;
> + if (dev_hard_header(skb, dev, ETH_P_IPV6, mac_dst, mac_src, skb->len) < 0)
> + return;
> +
> + ret = dev_queue_xmit(skb);
> +}
> +EXPORT_SYMBOL(ndisc_bond_send_na);
It would be better to refactor ndisc_send_na and extract what you think
you need into a new helper that gets exported for bond.
next prev parent reply other threads:[~2022-03-11 16:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-11 2:49 [PATCH 0/3] net:bonding:Add support for IPV6 RLB to balance-alb mode Sun Shouxin
2022-03-11 2:49 ` [PATCH 1/3] net:ipv6:Add ndisc_bond_send_na to support sending na by slave directly Sun Shouxin
2022-03-11 14:44 ` kernel test robot
2022-03-11 16:58 ` David Ahern [this message]
2022-03-11 2:49 ` [PATCH 2/3] net:ipv6:Export inet6_ifa_finish_destroy and ipv6_get_ifaddr Sun Shouxin
2022-03-11 2:49 ` [PATCH 3/3] net:bonding:Add support for IPV6 RLB to balance-alb mode Sun Shouxin
2022-03-11 16:47 ` kernel test robot
2022-03-11 16:58 ` kernel test robot
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=b0ef55ef-234f-63a4-7cc3-fd4acde2f011@kernel.org \
--to=dsahern@kernel.org \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=huyd12@chinatelecom.cn \
--cc=j.vosburgh@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sunshouxin@chinatelecom.cn \
--cc=vfalico@gmail.com \
--cc=yoshfuji@linux-ipv6.org \
/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;
as well as URLs for NNTP newsgroup(s).