[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <201712170335.Ics3cHPd%fengguang.wu@intel.com>
Date: Sun, 17 Dec 2017 04:04:28 +0800
From: kbuild test robot <lkp@...el.com>
To: Shannon Nelson <shannon.nelson@...cle.com>
Cc: kbuild-all@...org, steffen.klassert@...unet.com,
netdev@...r.kernel.org
Subject: Re: [PATCH v2 ipsec-next 3/3] xfrm: wrap xfrmdev_ops with offload
config
Hi Shannon,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on ipsec-next/master]
url: https://github.com/0day-ci/linux/commits/Shannon-Nelson/xfrm-check-for-xdo_dev_state_free/20171217-022754
base: https://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git master
config: i386-randconfig-x004-201751 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
In file included from include/linux/kernel.h:10:0,
from include/linux/list.h:9,
from include/linux/module.h:9,
from net/xfrm/xfrm_device.c:16:
net/xfrm/xfrm_device.c: In function 'xfrm_dev_feat_change':
>> net/xfrm/xfrm_device.c:172:48: error: 'struct net_device' has no member named 'xfrmdev_ops'; did you mean 'netdev_ops'?
if ((dev->features & NETIF_F_HW_ESP) && !dev->xfrmdev_ops)
^
include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
net/xfrm/xfrm_device.c:172:2: note: in expansion of macro 'if'
if ((dev->features & NETIF_F_HW_ESP) && !dev->xfrmdev_ops)
^~
>> net/xfrm/xfrm_device.c:172:48: error: 'struct net_device' has no member named 'xfrmdev_ops'; did you mean 'netdev_ops'?
if ((dev->features & NETIF_F_HW_ESP) && !dev->xfrmdev_ops)
^
include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
net/xfrm/xfrm_device.c:172:2: note: in expansion of macro 'if'
if ((dev->features & NETIF_F_HW_ESP) && !dev->xfrmdev_ops)
^~
>> net/xfrm/xfrm_device.c:172:48: error: 'struct net_device' has no member named 'xfrmdev_ops'; did you mean 'netdev_ops'?
if ((dev->features & NETIF_F_HW_ESP) && !dev->xfrmdev_ops)
^
include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
______r = !!(cond); \
^~~~
net/xfrm/xfrm_device.c:172:2: note: in expansion of macro 'if'
if ((dev->features & NETIF_F_HW_ESP) && !dev->xfrmdev_ops)
^~
net/xfrm/xfrm_device.c:175:8: error: 'struct net_device' has no member named 'xfrmdev_ops'; did you mean 'netdev_ops'?
dev->xfrmdev_ops = NULL;
^~~~~~~~~~~
netdev_ops
In file included from include/linux/kernel.h:10:0,
from include/linux/list.h:9,
from include/linux/module.h:9,
from net/xfrm/xfrm_device.c:16:
net/xfrm/xfrm_device.c: At top level:
include/linux/compiler.h:64:4: warning: '______f' is static but declared in inline function 'strcpy' which is not static
______f = { \
^
include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:422:2: note: in expansion of macro 'if'
if (p_size == (size_t)-1 && q_size == (size_t)-1)
^~
include/linux/compiler.h:64:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
______f = { \
^
include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:412:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:64:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
______f = { \
^
include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:410:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:64:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
______f = { \
^
include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:401:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:64:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
______f = { \
^
include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:399:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:64:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
______f = { \
^
include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:390:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:64:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
______f = { \
^
include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:388:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:64:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
______f = { \
^
include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:380:2: note: in expansion of macro 'if'
if (p_size < size || q_size < size)
^~
include/linux/compiler.h:64:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
______f = { \
^
include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:377:3: note: in expansion of macro 'if'
if (q_size < size)
^~
include/linux/compiler.h:64:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
______f = { \
vim +172 net/xfrm/xfrm_device.c
21f42cc9 Steffen Klassert 2017-04-14 @16 #include <linux/module.h>
21f42cc9 Steffen Klassert 2017-04-14 17 #include <linux/netdevice.h>
21f42cc9 Steffen Klassert 2017-04-14 18 #include <linux/skbuff.h>
21f42cc9 Steffen Klassert 2017-04-14 19 #include <linux/slab.h>
21f42cc9 Steffen Klassert 2017-04-14 20 #include <linux/spinlock.h>
21f42cc9 Steffen Klassert 2017-04-14 21 #include <net/dst.h>
21f42cc9 Steffen Klassert 2017-04-14 22 #include <net/xfrm.h>
21f42cc9 Steffen Klassert 2017-04-14 23 #include <linux/notifier.h>
21f42cc9 Steffen Klassert 2017-04-14 24
b81f884a Hangbin Liu 2017-06-01 25 #ifdef CONFIG_XFRM_OFFLOAD
f6e27114 Steffen Klassert 2017-04-14 26 int validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t features)
f6e27114 Steffen Klassert 2017-04-14 27 {
f6e27114 Steffen Klassert 2017-04-14 28 int err;
f6e27114 Steffen Klassert 2017-04-14 29 struct xfrm_state *x;
f6e27114 Steffen Klassert 2017-04-14 30 struct xfrm_offload *xo = xfrm_offload(skb);
f6e27114 Steffen Klassert 2017-04-14 31
f6e27114 Steffen Klassert 2017-04-14 32 if (skb_is_gso(skb))
f6e27114 Steffen Klassert 2017-04-14 33 return 0;
f6e27114 Steffen Klassert 2017-04-14 34
f6e27114 Steffen Klassert 2017-04-14 35 if (xo) {
f6e27114 Steffen Klassert 2017-04-14 36 x = skb->sp->xvec[skb->sp->len - 1];
f6e27114 Steffen Klassert 2017-04-14 37 if (xo->flags & XFRM_GRO || x->xso.flags & XFRM_OFFLOAD_INBOUND)
f6e27114 Steffen Klassert 2017-04-14 38 return 0;
f6e27114 Steffen Klassert 2017-04-14 39
f6e27114 Steffen Klassert 2017-04-14 40 x->outer_mode->xmit(x, skb);
f6e27114 Steffen Klassert 2017-04-14 41
f6e27114 Steffen Klassert 2017-04-14 42 err = x->type_offload->xmit(x, skb, features);
f6e27114 Steffen Klassert 2017-04-14 43 if (err) {
f6e27114 Steffen Klassert 2017-04-14 44 XFRM_INC_STATS(xs_net(x), LINUX_MIB_XFRMOUTSTATEPROTOERROR);
f6e27114 Steffen Klassert 2017-04-14 45 return err;
f6e27114 Steffen Klassert 2017-04-14 46 }
f6e27114 Steffen Klassert 2017-04-14 47
f6e27114 Steffen Klassert 2017-04-14 48 skb_push(skb, skb->data - skb_mac_header(skb));
f6e27114 Steffen Klassert 2017-04-14 49 }
f6e27114 Steffen Klassert 2017-04-14 50
f6e27114 Steffen Klassert 2017-04-14 51 return 0;
f6e27114 Steffen Klassert 2017-04-14 52 }
f6e27114 Steffen Klassert 2017-04-14 53 EXPORT_SYMBOL_GPL(validate_xmit_xfrm);
f6e27114 Steffen Klassert 2017-04-14 54
d77e38e6 Steffen Klassert 2017-04-14 55 int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
d77e38e6 Steffen Klassert 2017-04-14 56 struct xfrm_user_offload *xuo)
d77e38e6 Steffen Klassert 2017-04-14 57 {
d77e38e6 Steffen Klassert 2017-04-14 58 int err;
d77e38e6 Steffen Klassert 2017-04-14 59 struct dst_entry *dst;
d77e38e6 Steffen Klassert 2017-04-14 60 struct net_device *dev;
d77e38e6 Steffen Klassert 2017-04-14 61 struct xfrm_state_offload *xso = &x->xso;
d77e38e6 Steffen Klassert 2017-04-14 62 xfrm_address_t *saddr;
d77e38e6 Steffen Klassert 2017-04-14 63 xfrm_address_t *daddr;
d77e38e6 Steffen Klassert 2017-04-14 64
d77e38e6 Steffen Klassert 2017-04-14 65 if (!x->type_offload)
ffdb5211 Ilan Tayari 2017-08-01 66 return -EINVAL;
d77e38e6 Steffen Klassert 2017-04-14 67
d77e38e6 Steffen Klassert 2017-04-14 68 /* We don't yet support UDP encapsulation, TFC padding and ESN. */
d77e38e6 Steffen Klassert 2017-04-14 69 if (x->encap || x->tfcpad || (x->props.flags & XFRM_STATE_ESN))
43024b9c Yossef Efraim 2017-11-28 70 return -EINVAL;
d77e38e6 Steffen Klassert 2017-04-14 71
d77e38e6 Steffen Klassert 2017-04-14 72 dev = dev_get_by_index(net, xuo->ifindex);
d77e38e6 Steffen Klassert 2017-04-14 73 if (!dev) {
d77e38e6 Steffen Klassert 2017-04-14 74 if (!(xuo->flags & XFRM_OFFLOAD_INBOUND)) {
d77e38e6 Steffen Klassert 2017-04-14 75 saddr = &x->props.saddr;
d77e38e6 Steffen Klassert 2017-04-14 76 daddr = &x->id.daddr;
d77e38e6 Steffen Klassert 2017-04-14 77 } else {
d77e38e6 Steffen Klassert 2017-04-14 78 saddr = &x->id.daddr;
d77e38e6 Steffen Klassert 2017-04-14 79 daddr = &x->props.saddr;
d77e38e6 Steffen Klassert 2017-04-14 80 }
d77e38e6 Steffen Klassert 2017-04-14 81
077fbac4 Lorenzo Colitti 2017-08-11 82 dst = __xfrm_dst_lookup(net, 0, 0, saddr, daddr,
077fbac4 Lorenzo Colitti 2017-08-11 83 x->props.family, x->props.output_mark);
d77e38e6 Steffen Klassert 2017-04-14 84 if (IS_ERR(dst))
d77e38e6 Steffen Klassert 2017-04-14 85 return 0;
d77e38e6 Steffen Klassert 2017-04-14 86
d77e38e6 Steffen Klassert 2017-04-14 87 dev = dst->dev;
d77e38e6 Steffen Klassert 2017-04-14 88
d77e38e6 Steffen Klassert 2017-04-14 89 dev_hold(dev);
d77e38e6 Steffen Klassert 2017-04-14 90 dst_release(dst);
d77e38e6 Steffen Klassert 2017-04-14 91 }
d77e38e6 Steffen Klassert 2017-04-14 92
d77e38e6 Steffen Klassert 2017-04-14 93 if (!dev->xfrmdev_ops || !dev->xfrmdev_ops->xdo_dev_state_add) {
67a63387 Steffen Klassert 2017-09-04 94 xso->dev = NULL;
d77e38e6 Steffen Klassert 2017-04-14 95 dev_put(dev);
d77e38e6 Steffen Klassert 2017-04-14 96 return 0;
d77e38e6 Steffen Klassert 2017-04-14 97 }
d77e38e6 Steffen Klassert 2017-04-14 98
d77e38e6 Steffen Klassert 2017-04-14 99 xso->dev = dev;
d77e38e6 Steffen Klassert 2017-04-14 100 xso->num_exthdrs = 1;
d77e38e6 Steffen Klassert 2017-04-14 101 xso->flags = xuo->flags;
d77e38e6 Steffen Klassert 2017-04-14 102
d77e38e6 Steffen Klassert 2017-04-14 103 err = dev->xfrmdev_ops->xdo_dev_state_add(x);
d77e38e6 Steffen Klassert 2017-04-14 104 if (err) {
d77e38e6 Steffen Klassert 2017-04-14 105 dev_put(dev);
d77e38e6 Steffen Klassert 2017-04-14 106 return err;
d77e38e6 Steffen Klassert 2017-04-14 107 }
d77e38e6 Steffen Klassert 2017-04-14 108
d77e38e6 Steffen Klassert 2017-04-14 109 return 0;
d77e38e6 Steffen Klassert 2017-04-14 110 }
d77e38e6 Steffen Klassert 2017-04-14 111 EXPORT_SYMBOL_GPL(xfrm_dev_state_add);
d77e38e6 Steffen Klassert 2017-04-14 112
d77e38e6 Steffen Klassert 2017-04-14 113 bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x)
d77e38e6 Steffen Klassert 2017-04-14 114 {
d77e38e6 Steffen Klassert 2017-04-14 115 int mtu;
d77e38e6 Steffen Klassert 2017-04-14 116 struct dst_entry *dst = skb_dst(skb);
d77e38e6 Steffen Klassert 2017-04-14 117 struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
d77e38e6 Steffen Klassert 2017-04-14 118 struct net_device *dev = x->xso.dev;
d77e38e6 Steffen Klassert 2017-04-14 119
d77e38e6 Steffen Klassert 2017-04-14 120 if (!x->type_offload || x->encap)
d77e38e6 Steffen Klassert 2017-04-14 121 return false;
d77e38e6 Steffen Klassert 2017-04-14 122
d77e38e6 Steffen Klassert 2017-04-14 123 if ((x->xso.offload_handle && (dev == dst->path->dev)) &&
d77e38e6 Steffen Klassert 2017-04-14 124 !dst->child->xfrm && x->type->get_mtu) {
d77e38e6 Steffen Klassert 2017-04-14 125 mtu = x->type->get_mtu(x, xdst->child_mtu_cached);
d77e38e6 Steffen Klassert 2017-04-14 126
d77e38e6 Steffen Klassert 2017-04-14 127 if (skb->len <= mtu)
d77e38e6 Steffen Klassert 2017-04-14 128 goto ok;
d77e38e6 Steffen Klassert 2017-04-14 129
d77e38e6 Steffen Klassert 2017-04-14 130 if (skb_is_gso(skb) && skb_gso_validate_mtu(skb, mtu))
d77e38e6 Steffen Klassert 2017-04-14 131 goto ok;
d77e38e6 Steffen Klassert 2017-04-14 132 }
d77e38e6 Steffen Klassert 2017-04-14 133
d77e38e6 Steffen Klassert 2017-04-14 134 return false;
d77e38e6 Steffen Klassert 2017-04-14 135
d77e38e6 Steffen Klassert 2017-04-14 136 ok:
d77e38e6 Steffen Klassert 2017-04-14 137 if (dev && dev->xfrmdev_ops && dev->xfrmdev_ops->xdo_dev_offload_ok)
d77e38e6 Steffen Klassert 2017-04-14 138 return x->xso.dev->xfrmdev_ops->xdo_dev_offload_ok(skb, x);
d77e38e6 Steffen Klassert 2017-04-14 139
d77e38e6 Steffen Klassert 2017-04-14 140 return true;
d77e38e6 Steffen Klassert 2017-04-14 141 }
d77e38e6 Steffen Klassert 2017-04-14 142 EXPORT_SYMBOL_GPL(xfrm_dev_offload_ok);
b81f884a Hangbin Liu 2017-06-01 143 #endif
d77e38e6 Steffen Klassert 2017-04-14 144
24d472e4 Wei Yongjun 2017-05-18 145 static int xfrm_dev_register(struct net_device *dev)
d77e38e6 Steffen Klassert 2017-04-14 146 {
d8cb41eb Shannon Nelson 2017-12-14 147 if (!(dev->features & NETIF_F_HW_ESP)) {
d8cb41eb Shannon Nelson 2017-12-14 148 if (dev->features & NETIF_F_HW_ESP_TX_CSUM)
d77e38e6 Steffen Klassert 2017-04-14 149 return NOTIFY_BAD;
d8cb41eb Shannon Nelson 2017-12-14 150 else
d8cb41eb Shannon Nelson 2017-12-14 151 return NOTIFY_DONE;
d8cb41eb Shannon Nelson 2017-12-14 152 }
d8cb41eb Shannon Nelson 2017-12-14 153
d8cb41eb Shannon Nelson 2017-12-14 154 #ifdef CONFIG_XFRM_OFFLOAD
d8cb41eb Shannon Nelson 2017-12-14 155 if (!(dev->xfrmdev_ops &&
d8cb41eb Shannon Nelson 2017-12-14 156 dev->xfrmdev_ops->xdo_dev_state_add &&
d8cb41eb Shannon Nelson 2017-12-14 157 dev->xfrmdev_ops->xdo_dev_state_delete))
d77e38e6 Steffen Klassert 2017-04-14 158 return NOTIFY_BAD;
d8cb41eb Shannon Nelson 2017-12-14 159 #endif
d77e38e6 Steffen Klassert 2017-04-14 160
d77e38e6 Steffen Klassert 2017-04-14 161 return NOTIFY_DONE;
d77e38e6 Steffen Klassert 2017-04-14 162 }
d77e38e6 Steffen Klassert 2017-04-14 163
d77e38e6 Steffen Klassert 2017-04-14 164 static int xfrm_dev_unregister(struct net_device *dev)
d77e38e6 Steffen Klassert 2017-04-14 165 {
ec30d78c Florian Westphal 2017-07-17 166 xfrm_policy_cache_flush();
d77e38e6 Steffen Klassert 2017-04-14 167 return NOTIFY_DONE;
d77e38e6 Steffen Klassert 2017-04-14 168 }
d77e38e6 Steffen Klassert 2017-04-14 169
d77e38e6 Steffen Klassert 2017-04-14 170 static int xfrm_dev_feat_change(struct net_device *dev)
d77e38e6 Steffen Klassert 2017-04-14 171 {
d77e38e6 Steffen Klassert 2017-04-14 @172 if ((dev->features & NETIF_F_HW_ESP) && !dev->xfrmdev_ops)
d77e38e6 Steffen Klassert 2017-04-14 173 return NOTIFY_BAD;
d77e38e6 Steffen Klassert 2017-04-14 174 else if (!(dev->features & NETIF_F_HW_ESP))
d77e38e6 Steffen Klassert 2017-04-14 175 dev->xfrmdev_ops = NULL;
d77e38e6 Steffen Klassert 2017-04-14 176
d77e38e6 Steffen Klassert 2017-04-14 177 if ((dev->features & NETIF_F_HW_ESP_TX_CSUM) &&
d77e38e6 Steffen Klassert 2017-04-14 178 !(dev->features & NETIF_F_HW_ESP))
d77e38e6 Steffen Klassert 2017-04-14 179 return NOTIFY_BAD;
d77e38e6 Steffen Klassert 2017-04-14 180
d77e38e6 Steffen Klassert 2017-04-14 181 return NOTIFY_DONE;
d77e38e6 Steffen Klassert 2017-04-14 182 }
d77e38e6 Steffen Klassert 2017-04-14 183
:::::: The code at line 172 was first introduced by commit
:::::: d77e38e612a017480157fe6d2c1422f42cb5b7e3 xfrm: Add an IPsec hardware offloading API
:::::: TO: Steffen Klassert <steffen.klassert@...unet.com>
:::::: CC: Steffen Klassert <steffen.klassert@...unet.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Download attachment ".config.gz" of type "application/gzip" (31669 bytes)
Powered by blists - more mailing lists