Message ID | 20220311024958.7458-2-sunshouxin@chinatelecom.cn (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net:bonding:Add support for IPV6 RLB to balance-alb mode | expand |
Hi Sun, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on 2a9eef868a997ec575c2e6ae885e91313f635d59] url: https://github.com/0day-ci/linux/commits/Sun-Shouxin/net-bonding-Add-support-for-IPV6-RLB-to-balance-alb-mode/20220311-110221 base: 2a9eef868a997ec575c2e6ae885e91313f635d59 config: mips-bmips_be_defconfig (https://download.01.org/0day-ci/archive/20220311/202203112242.Gjf5MZjs-lkp@intel.com/config) compiler: mips-linux-gcc (GCC) 11.2.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/9bd4966a283f758f100bd97d09967edc92903c76 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Sun-Shouxin/net-bonding-Add-support-for-IPV6-RLB-to-balance-alb-mode/20220311-110221 git checkout 9bd4966a283f758f100bd97d09967edc92903c76 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash net/ipv6/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): net/ipv6/ndisc.c: In function 'ndisc_bond_send_na': >> net/ipv6/ndisc.c:587:13: warning: variable 'ret' set but not used [-Wunused-but-set-variable] 587 | int ret; | ^~~ vim +/ret +587 net/ipv6/ndisc.c 574 575 void ndisc_bond_send_na(struct net_device *dev, const struct in6_addr *daddr, 576 const struct in6_addr *solicited_addr, 577 bool router, bool solicited, bool override, 578 bool inc_opt, unsigned short vlan_id, 579 const void *mac_dst, const void *mac_src) 580 { 581 struct sk_buff *skb; 582 const struct in6_addr *src_addr; 583 struct nd_msg *msg; 584 struct net *net = dev_net(dev); 585 struct sock *sk = net->ipv6.ndisc_sk; 586 int optlen = 0; > 587 int ret; 588 589 src_addr = solicited_addr; 590 if (!dev->addr_len) 591 inc_opt = false; 592 if (inc_opt) 593 optlen += ndisc_opt_addr_space(dev, 594 NDISC_NEIGHBOUR_ADVERTISEMENT); 595 596 skb = ndisc_alloc_skb(dev, sizeof(*msg) + optlen); 597 if (!skb) 598 return; 599 600 msg = skb_put(skb, sizeof(*msg)); 601 *msg = (struct nd_msg) { 602 .icmph = { 603 .icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT, 604 .icmp6_router = router, 605 .icmp6_solicited = solicited, 606 .icmp6_override = override, 607 }, 608 .target = *solicited_addr, 609 }; 610 611 if (inc_opt) 612 ndisc_fill_addr_option(skb, ND_OPT_TARGET_LL_ADDR, 613 dev->dev_addr, 614 NDISC_NEIGHBOUR_ADVERTISEMENT); 615 616 if (vlan_id) 617 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), 618 vlan_id); 619 620 msg->icmph.icmp6_cksum = csum_ipv6_magic(src_addr, daddr, skb->len, 621 IPPROTO_ICMPV6, 622 csum_partial(&msg->icmph, 623 skb->len, 0)); 624 625 ip6_nd_hdr(skb, src_addr, daddr, inet6_sk(sk)->hop_limit, skb->len); 626 627 skb->protocol = htons(ETH_P_IPV6); 628 skb->dev = dev; 629 if (dev_hard_header(skb, dev, ETH_P_IPV6, mac_dst, mac_src, skb->len) < 0) 630 return; 631 632 ret = dev_queue_xmit(skb); 633 } 634 EXPORT_SYMBOL(ndisc_bond_send_na); 635 --- 0-DAY CI Kernel Test Service https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
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.
diff --git a/include/net/ndisc.h b/include/net/ndisc.h index da7eec8669ec..317bcb29c795 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h @@ -471,6 +471,12 @@ void ndisc_update(const struct net_device *dev, struct neighbour *neigh, const u8 *lladdr, u8 new, u32 flags, u8 icmp6_type, struct ndisc_options *ndopts); +void ndisc_bond_send_na(struct net_device *dev, const struct in6_addr *daddr, + 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); + /* * IGMP */ 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, + 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); + static void ndisc_send_unsol_na(struct net_device *dev) { struct inet6_dev *idev;
Add ndisc_bond_send_na to support sending na by slave directly and export it for bonding usage. Suggested-by: Hu Yadi <huyd12@chinatelecom.cn> Signed-off-by: Sun Shouxin <sunshouxin@chinatelecom.cn> --- include/net/ndisc.h | 6 +++++ net/ipv6/ndisc.c | 61 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+)