Re: [PATCH net-next v2] net: core: rework basic flow dissection helper

2018-05-04 Thread kbuild test robot
Hi Paolo,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:
https://github.com/0day-ci/linux/commits/Paolo-Abeni/net-core-rework-basic-flow-dissection-helper/20180505-090417
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

   include/net/tipc.h:55:30: sparse: incorrect type in return expression 
(different base types) @@expected unsigned int @@got restriunsigned int 
@@
   include/net/tipc.h:55:30:expected unsigned int
   include/net/tipc.h:55:30:got restricted __be32 
   net/core/flow_dissector.c:840:48: sparse: incorrect type in assignment 
(different base types) @@expected restricted __be32 [usertype] key @@
got  [usertype] key @@
   net/core/flow_dissector.c:840:48:expected restricted __be32 [usertype] 
key
   net/core/flow_dissector.c:840:48:got unsigned int
   net/core/flow_dissector.c:1035:30: sparse: expression using sizeof(void)
   net/core/flow_dissector.c:1035:30: sparse: expression using sizeof(void)
   net/core/flow_dissector.c:1276:25: sparse: expression using sizeof(void)
>> net/core/flow_dissector.c:1319:59: sparse: Using plain integer as NULL 
>> pointer

vim +1319 net/core/flow_dissector.c

  1305  
  1306  /**
  1307   * skb_get_poff - get the offset to the payload
  1308   * @skb: sk_buff to get the payload offset from
  1309   *
  1310   * The function will get the offset to the payload as far as it could
  1311   * be dissected.  The main user is currently BPF, so that we can 
dynamically
  1312   * truncate packets without needing to push actual payload to the user
  1313   * space and can analyze headers only, instead.
  1314   */
  1315  u32 skb_get_poff(const struct sk_buff *skb)
  1316  {
  1317  struct flow_keys_basic keys;
  1318  
> 1319  if (!skb_flow_dissect_flow_keys_basic(skb, , 0, 0, 0, 0, 
> 0))
  1320  return 0;
  1321  
  1322  return __skb_get_poff(skb, skb->data, , skb_headlen(skb));
  1323  }
  1324  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


Re: [PATCH net-next v2] net: core: rework basic flow dissection helper

2018-05-04 Thread David Miller
From: Paolo Abeni 
Date: Fri,  4 May 2018 11:32:59 +0200

> When the core networking needs to detect the transport offset in a given
> packet and parse it explicitly, a full-blown flow_keys struct is used for
> storage.
> This patch introduces a smaller keys store, rework the basic flow dissect
> helper to use it, and apply this new helper where possible - namely in
> skb_probe_transport_header(). The used flow dissector data structures
> are renamed to match more closely the new role.
> 
> The above gives ~50% performance improvement in micro benchmarking around
> skb_probe_transport_header() and ~30% around eth_get_headlen(), mostly due
> to the smaller memset. Small, but measurable improvement is measured also
> in macro benchmarking.
> 
> v1 -> v2: use the new helper in eth_get_headlen() and skb_get_poff(),
>   as per DaveM suggestion
> 
> Suggested-by: David Miller 
> Signed-off-by: Paolo Abeni 

Awesome.  Applied, thanks Paolo.