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/TC-refactor-act_mirred-packets-re-injection/20180729-102154
config: x86_64-randconfig-u0-07291027 (attached as .config)
compiler: gcc-5 (Debian 5.5.0-3) 5.4.1 20171010
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/current.h:5:0,
                    from include/linux/sched.h:12,
                    from include/linux/uaccess.h:5,
                    from net/core/dev.c:75:
   net/core/dev.c: In function 'netif_receive_generic_xdp':
   net/core/dev.c:4255:28: error: 'struct sk_buff' has no member named 
'tc_redirected'
     if (skb_cloned(skb) || skb->tc_redirected)
                               ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^
>> net/core/dev.c:4255:2: note: in expansion of macro 'if'
     if (skb_cloned(skb) || skb->tc_redirected)
     ^
   net/core/dev.c:4255:28: error: 'struct sk_buff' has no member named 
'tc_redirected'
     if (skb_cloned(skb) || skb->tc_redirected)
                               ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^
>> net/core/dev.c:4255:2: note: in expansion of macro 'if'
     if (skb_cloned(skb) || skb->tc_redirected)
     ^
   net/core/dev.c:4255:28: error: 'struct sk_buff' has no member named 
'tc_redirected'
     if (skb_cloned(skb) || skb->tc_redirected)
                               ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^
>> net/core/dev.c:4255:2: note: in expansion of macro 'if'
     if (skb_cloned(skb) || skb->tc_redirected)
     ^

vim +/if +4255 net/core/dev.c

  4241  
  4242  static u32 netif_receive_generic_xdp(struct sk_buff *skb,
  4243                                       struct xdp_buff *xdp,
  4244                                       struct bpf_prog *xdp_prog)
  4245  {
  4246          struct netdev_rx_queue *rxqueue;
  4247          void *orig_data, *orig_data_end;
  4248          u32 metalen, act = XDP_DROP;
  4249          int hlen, off;
  4250          u32 mac_len;
  4251  
  4252          /* Reinjected packets coming from act_mirred or similar should
  4253           * not get XDP generic processing.
  4254           */
> 4255          if (skb_cloned(skb) || skb->tc_redirected)
  4256                  return XDP_PASS;
  4257  
  4258          /* XDP packets must be linear and must have sufficient headroom
  4259           * of XDP_PACKET_HEADROOM bytes. This is the guarantee that also
  4260           * native XDP provides, thus we need to do it here as well.
  4261           */
  4262          if (skb_is_nonlinear(skb) ||
  4263              skb_headroom(skb) < XDP_PACKET_HEADROOM) {
  4264                  int hroom = XDP_PACKET_HEADROOM - skb_headroom(skb);
  4265                  int troom = skb->tail + skb->data_len - skb->end;
  4266  
  4267                  /* In case we have to go down the path and also 
linearize,
  4268                   * then lets do the pskb_expand_head() work just once 
here.
  4269                   */
  4270                  if (pskb_expand_head(skb,
  4271                                       hroom > 0 ? ALIGN(hroom, 
NET_SKB_PAD) : 0,
  4272                                       troom > 0 ? troom + 128 : 0, 
GFP_ATOMIC))
  4273                          goto do_drop;
  4274                  if (skb_linearize(skb))
  4275                          goto do_drop;
  4276          }
  4277  
  4278          /* The XDP program wants to see the packet starting at the MAC
  4279           * header.
  4280           */
  4281          mac_len = skb->data - skb_mac_header(skb);
  4282          hlen = skb_headlen(skb) + mac_len;
  4283          xdp->data = skb->data - mac_len;
  4284          xdp->data_meta = xdp->data;
  4285          xdp->data_end = xdp->data + hlen;
  4286          xdp->data_hard_start = skb->data - skb_headroom(skb);
  4287          orig_data_end = xdp->data_end;
  4288          orig_data = xdp->data;
  4289  
  4290          rxqueue = netif_get_rxqueue(skb);
  4291          xdp->rxq = &rxqueue->xdp_rxq;
  4292  
  4293          act = bpf_prog_run_xdp(xdp_prog, xdp);
  4294  
  4295          off = xdp->data - orig_data;
  4296          if (off > 0)
  4297                  __skb_pull(skb, off);
  4298          else if (off < 0)
  4299                  __skb_push(skb, -off);
  4300          skb->mac_header += off;
  4301  
  4302          /* check if bpf_xdp_adjust_tail was used. it can only "shrink"
  4303           * pckt.
  4304           */
  4305          off = orig_data_end - xdp->data_end;
  4306          if (off != 0) {
  4307                  skb_set_tail_pointer(skb, xdp->data_end - xdp->data);
  4308                  skb->len -= off;
  4309  
  4310          }
  4311  
  4312          switch (act) {
  4313          case XDP_REDIRECT:
  4314          case XDP_TX:
  4315                  __skb_push(skb, mac_len);
  4316                  break;
  4317          case XDP_PASS:
  4318                  metalen = xdp->data - xdp->data_meta;
  4319                  if (metalen)
  4320                          skb_metadata_set(skb, metalen);
  4321                  break;
  4322          default:
  4323                  bpf_warn_invalid_xdp_action(act);
  4324                  /* fall through */
  4325          case XDP_ABORTED:
  4326                  trace_xdp_exception(skb->dev, xdp_prog, act);
  4327                  /* fall through */
  4328          case XDP_DROP:
  4329          do_drop:
  4330                  kfree_skb(skb);
  4331                  break;
  4332          }
  4333  
  4334          return act;
  4335  }
  4336  

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

Attachment: .config.gz
Description: application/gzip

Reply via email to