1. 25 4月, 2017 1 次提交
    • F
      ipvlan: use pernet operations and restrict l3s hooks to master netns · 3133822f
      Florian Westphal 提交于
      commit 4fbae7d8 ("ipvlan: Introduce l3s mode") added
      registration of netfilter hooks via nf_register_hooks().
      
      This API provides the illusion of 'global' netfilter hooks by placing the
      hooks in all current and future network namespaces.
      
      In case of ipvlan the hook appears to be only needed in the namespace
      that contains the ipvlan master device (i.e., usually init_net), so
      placing them in all namespaces is not needed.
      
      This switches ipvlan driver to pernet operations, and then only registers
      hooks in namespaces where a ipvlan master device is set to l3s mode.
      
      Extra care has to be taken when the master device is moved to another
      namespace, as we might have to 'move' the netfilter hooks too.
      
      This is done by storing the namespace the ipvlan port was created in.
      On REGISTER event, do (un)register operations in the old/new namespaces.
      
      This will also allow removal of the nf_register_hooks() in a future patch.
      
      Cc: Mahesh Bandewar <maheshb@google.com>
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3133822f
  2. 12 2月, 2017 1 次提交
  3. 21 1月, 2017 1 次提交
  4. 17 1月, 2017 1 次提交
    • M
      ipvlan: fix dev_id creation corner case. · 019ec003
      Mahesh Bandewar 提交于
      In the last patch da36e13c ("ipvlan: improvise dev_id generation
      logic in IPvlan") I missed some part of Dave's suggestion and because
      of that the dev_id creation could fail in a corner case scenario. This
      would happen when more or less 64k devices have been already created and
      several have been deleted. If the devices that are still sticking around
      are the last n bits from the bitmap. So in this scenario even if lower
      bits are available, the dev_id search is so narrow that it always fails.
      
      Fixes: da36e13c ("ipvlan: improvise dev_id generation logic in IPvlan")
      CC: David Miller <davem@davemloft.org>
      CC: Eric Dumazet <edumazet@google.com>
      Signed-off-by: NMahesh Bandewar <maheshb@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      019ec003
  5. 11 1月, 2017 1 次提交
    • M
      ipvlan: improvise dev_id generation logic in IPvlan · da36e13c
      Mahesh Bandewar 提交于
      The patch 009146d1 ("ipvlan: assign unique dev-id for each slave
      device.") used ida_simple_get() to generate dev_ids assigned to the
      slave devices. However (Eric has pointed out that) there is a shortcoming
      with that approach as it always uses the first available ID. This
      becomes a problem when a slave gets deleted and a new slave gets added.
      The ID gets reassigned causing the new slave to get the same link-local
      address. This side-effect is undesirable.
      
      This patch adds a per-port variable that keeps track of the IDs
      assigned and used as the stat-base for the IDR api. This base will be
      wrapped around when it reaches the MAX (0xFFFE) value possibly on a
      busy system where slaves are added and deleted routinely.
      
      Fixes: 009146d1 ("ipvlan: assign unique dev-id for each slave device.")
      Signed-off-by: NMahesh Bandewar <maheshb@google.com>
      CC: Eric Dumazet <edumazet@google.com>
      CC: David Miller <davem@davemloft.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      da36e13c
  6. 09 1月, 2017 1 次提交
  7. 05 1月, 2017 1 次提交
  8. 29 12月, 2016 1 次提交
  9. 24 12月, 2016 1 次提交
  10. 09 12月, 2016 1 次提交
  11. 08 12月, 2016 1 次提交
  12. 01 12月, 2016 1 次提交
  13. 28 11月, 2016 1 次提交
  14. 16 10月, 2016 1 次提交
    • J
      ipvlan: constify l3mdev_ops structure · ab530f63
      Julia Lawall 提交于
      This l3mdev_ops structure is only stored in the l3mdev_ops field of a
      net_device structure.  This field is declared const, so the l3mdev_ops
      structure can be declared as const also.  Additionally drop the
      __read_mostly annotation.
      
      The semantic patch that adds const is as follows:
      (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @r disable optional_qualifier@
      identifier i;
      position p;
      @@
      static struct l3mdev_ops i@p = { ... };
      
      @ok@
      identifier r.i;
      struct net_device *e;
      position p;
      @@
      e->l3mdev_ops = &i@p;
      
      @bad@
      position p != {r.p,ok.p};
      identifier r.i;
      struct l3mdev_ops e;
      @@
      e@i@p
      
      @depends on !bad disable optional_qualifier@
      identifier r.i;
      @@
      static
      +const
       struct l3mdev_ops i = { ... };
      // </smpl>
      
      The effect on the layout of the .o file is shown by the following output
      of the size command, first before then after the transformation:
      
         text    data     bss     dec     hex filename
         7364     466      52    7882    1eca drivers/net/ipvlan/ipvlan_main.o
         7412     434      52    7898    1eda drivers/net/ipvlan/ipvlan_main.o
      Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ab530f63
  15. 19 9月, 2016 1 次提交
    • M
      ipvlan: Introduce l3s mode · 4fbae7d8
      Mahesh Bandewar 提交于
      In a typical IPvlan L3 setup where master is in default-ns and
      each slave is into different (slave) ns. In this setup egress
      packet processing for traffic originating from slave-ns will
      hit all NF_HOOKs in slave-ns as well as default-ns. However same
      is not true for ingress processing. All these NF_HOOKs are
      hit only in the slave-ns skipping them in the default-ns.
      IPvlan in L3 mode is restrictive and if admins want to deploy
      iptables rules in default-ns, this asymmetric data path makes it
      impossible to do so.
      
      This patch makes use of the l3_rcv() (added as part of l3mdev
      enhancements) to perform input route lookup on RX packets without
      changing the skb->dev and then uses nf_hook at NF_INET_LOCAL_IN
      to change the skb->dev just before handing over skb to L4.
      Signed-off-by: NMahesh Bandewar <maheshb@google.com>
      CC: David Ahern <dsa@cumulusnetworks.com>
      Reviewed-by: NDavid Ahern <dsa@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4fbae7d8
  16. 10 6月, 2016 1 次提交
  17. 29 4月, 2016 1 次提交
  18. 18 3月, 2016 1 次提交
  19. 26 2月, 2016 1 次提交
  20. 22 2月, 2016 2 次提交
  21. 05 2月, 2016 1 次提交
    • M
      ipvlan: inherit MTU from master device · 296d4856
      Mahesh Bandewar 提交于
      When we create IPvlan slave; we use ether_setup() and that
      sets up default MTU to 1500 while the master device may have
      lower / different MTU. Any subsequent changes to the masters'
      MTU are reflected into the slaves' MTU setting. However if those
      don't happen (most likely scenario), the slaves' MTU stays at
      1500 which could be bad.
      
      This change adds code to inherit MTU from the master device
      instead of using the default value during the link initialization
      phase.
      Signed-off-by: NMahesh Bandewar <maheshb@google.com>
      CC: Eric Dumazet <eric.dumazet@gmail.com>
      CC: Tim Hockins <thockins@google.com>
      Acked-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      296d4856
  22. 16 12月, 2015 1 次提交
    • T
      net: Rename NETIF_F_ALL_CSUM to NETIF_F_CSUM_MASK · a188222b
      Tom Herbert 提交于
      The name NETIF_F_ALL_CSUM is a misnomer. This does not correspond to the
      set of features for offloading all checksums. This is a mask of the
      checksum offload related features bits. It is incorrect to set both
      NETIF_F_HW_CSUM and NETIF_F_IP_CSUM or NETIF_F_IPV6 at the same time for
      features of a device.
      
      This patch:
        - Changes instances of NETIF_F_ALL_CSUM to NETIF_F_CSUM_MASK (where
          NETIF_F_ALL_CSUM is being used as a mask).
        - Changes bonding, sfc/efx, ipvlan, macvlan, vlan, and team drivers to
          use NEITF_F_HW_CSUM in features list instead of NETIF_F_ALL_CSUM.
      Signed-off-by: NTom Herbert <tom@herbertland.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a188222b
  23. 19 8月, 2015 1 次提交
  24. 16 7月, 2015 4 次提交
  25. 06 5月, 2015 2 次提交
    • M
      ipvlan: Always set broadcast bit in multicast filter · f631c44b
      Mahesh Bandewar 提交于
      Earlier tricks of setting broadcast bit only when IPv4 address is added
      onto interface are not good enough especially when autoconf comes in play.
      Setting them on always is performance drag but now that multicast /
      broadcast is not processed in fast-path; enabling broadcast will let
      autoconf work correctly without affecting performance characteristics of
      the device.
      Signed-off-by: NMahesh Bandewar <maheshb@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f631c44b
    • M
      ipvlan: Defer multicast / broadcast processing to a work-queue · ba35f858
      Mahesh Bandewar 提交于
      Processing multicast / broadcast in fast path is performance draining
      and having more links means more cloning and bringing performance
      down further.
      
      Broadcast; in particular, need to be given to all the virtual links.
      Earlier tricks of enabling broadcast bit for IPv4 only interfaces are not
      really working since it fails autoconf. Which means enabling broadcast
      for all the links if protocol specific hacks do not have to be added into
      the driver.
      
      This patch defers all (incoming as well as outgoing) multicast traffic to
      a work-queue leaving only the unicast traffic in the fast-path. Now if we
      need to apply any additional tricks to further reduce the impact of this
      (multicast / broadcast) type of traffic, it can be implemented while
      processing this work without affecting the fast-path.
      Signed-off-by: NMahesh Bandewar <maheshb@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ba35f858
  26. 03 4月, 2015 1 次提交
  27. 01 4月, 2015 3 次提交
  28. 03 3月, 2015 1 次提交
  29. 10 12月, 2014 2 次提交
  30. 06 12月, 2014 1 次提交
  31. 27 11月, 2014 1 次提交
    • M
      ipvlan: fix sparse warnings · 92c7b0de
      Mahesh Bandewar 提交于
      Fix sparse warnings reported by kbuild robot
      
      drivers/net/ipvlan/ipvlan_main.c:172:13: warning: symbol 'ipvlan_start_xmit' was not declared. Should it be static?
      drivers/net/ipvlan/ipvlan_main.c:256:33: warning: incorrect type in initializer (different address spaces)
      drivers/net/ipvlan/ipvlan_main.c:256:33:    expected void const [noderef] <asn:3>*__vpp_verify
      drivers/net/ipvlan/ipvlan_main.c:256:33:    got struct ipvl_pcpu_stats *<noident>
      drivers/net/ipvlan/ipvlan_main.c:544:5: warning: symbol 'ipvlan_link_register' was not declared. Should it be static
      Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NMahesh Bandewar <maheshb@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      92c7b0de
  32. 25 11月, 2014 1 次提交
    • M
      ipvlan: Initial check-in of the IPVLAN driver. · 2ad7bf36
      Mahesh Bandewar 提交于
      This driver is very similar to the macvlan driver except that it
      uses L3 on the frame to determine the logical interface while
      functioning as packet dispatcher. It inherits L2 of the master
      device hence the packets on wire will have the same L2 for all
      the packets originating from all virtual devices off of the same
      master device.
      
      This driver was developed keeping the namespace use-case in
      mind. Hence most of the examples given here take that as the
      base setup where main-device belongs to the default-ns and
      virtual devices are assigned to the additional namespaces.
      
      The device operates in two different modes and the difference
      in these two modes in primarily in the TX side.
      
      (a) L2 mode : In this mode, the device behaves as a L2 device.
      TX processing upto L2 happens on the stack of the virtual device
      associated with (namespace). Packets are switched after that
      into the main device (default-ns) and queued for xmit.
      
      RX processing is simple and all multicast, broadcast (if
      applicable), and unicast belonging to the address(es) are
      delivered to the virtual devices.
      
      (b) L3 mode : In this mode, the device behaves like a L3 device.
      TX processing upto L3 happens on the stack of the virtual device
      associated with (namespace). Packets are switched to the
      main-device (default-ns) for the L2 processing. Hence the routing
      table of the default-ns will be used in this mode.
      
      RX processins is somewhat similar to the L2 mode except that in
      this mode only Unicast packets are delivered to the virtual device
      while main-dev will handle all other packets.
      
      The devices can be added using the "ip" command from the iproute2
      package -
      
      	ip link add link <master> <virtual> type ipvlan mode [ l2 | l3 ]
      Signed-off-by: NMahesh Bandewar <maheshb@google.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Maciej Żenczykowski <maze@google.com>
      Cc: Laurent Chavey <chavey@google.com>
      Cc: Tim Hockin <thockin@google.com>
      Cc: Brandon Philips <brandon.philips@coreos.com>
      Cc: Pavel Emelianov <xemul@parallels.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2ad7bf36