1. 16 May, 2016 11 commits
    • David S. Miller's avatar
      Merge branch 'cls_u32_hw_sw' · 1ca46734
      David S. Miller authored
      Sridhar Samudrala says:
      
      ====================
      Enable SW only or HW only offloads with u32 classifier
      
      This set of patches export TCA_CLS_FLAGS_SKIP_HW to userspace and also
      introduces another flag TCA_CLS_FLAGS_SKIP_SW. These flags enable offloading
      u32 filters to either SW or HW only.
      
      The default semantics with no flags is to add the filter to HW if possible and
      also into SW.
      With SKIP_HW flag, the filter is only added to SW.
      With SKIP_SW flag, the filter is added to HW and an error is returned
      to user on failure.
      These flags are mutually exclusive.
      There was an earlier discussion on these semantics in the following email
      thread.
      	http://thread.gmane.org/gmane.linux.network/401733
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1ca46734
    • Samudrala, Sridhar's avatar
      net: cls_u32: Add support for skip-sw flag to tc u32 classifier. · d34e3e18
      Samudrala, Sridhar authored
      On devices that support TC U32 offloads, this flag enables a filter to be
      added only to HW. skip-sw and skip-hw are mutually exclusive flags. By
      default without any flags, the filter is added to both HW and SW, but no
      error checks are done in case of failure to add to HW. With skip-sw,
      failure to add to HW is treated as an error.
      
      Here is a sample script that adds 2 filters, one with skip-sw and the other
      with skip-hw flag.
      
         # add ingress qdisc
         tc qdisc add dev p4p1 ingress
      
         # enable hw tc offload.
         ethtool -K p4p1 hw-tc-offload on
      
         # add u32 filter with skip-sw flag.
         tc filter add dev p4p1 parent ffff: protocol ip prio 99 \
            handle 800:0:1 u32 ht 800: flowid 800:1 \
            skip-sw \
            match ip src 192.168.1.0/24 \
            action drop
      
         # add u32 filter with skip-hw flag.
         tc filter add dev p4p1 parent ffff: protocol ip prio 99 \
            handle 800:0:2 u32 ht 800: flowid 800:2 \
            skip-hw \
            match ip src 192.168.2.0/24 \
            action drop
      Signed-off-by: default avatarSridhar Samudrala <sridhar.samudrala@intel.com>
      Acked-by: default avatarJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d34e3e18
    • Samudrala, Sridhar's avatar
    • David S. Miller's avatar
      Merge branch 'hv_netvsc-races' · 860d7ef6
      David S. Miller authored
      Vitaly Kuznetsov says:
      
      ====================
      hv_netvsc: avoid races on mtu change/set channels
      
      Changes since v1:
      - Rebased to net-next [Haiyang Zhang]
      
      Original description:
      
      MTU change and set channels operations are implemented as netvsc device
      re-creation destroying internal structures (struct net_device stays). This
      is really unfortunate but there is no support from Hyper-V host to do it
      in a different way. Such re-creation is unsurprisingly racy, Haiyang
      reported a crash when netvsc_change_mtu() is racing with
      netvsc_link_change() but I was able to identify additional races upon
      investigation. Both netvsc_set_channels() and netvsc_change_mtu() race
      against:
      1) netvsc_link_change()
      2) netvsc_remove()
      3) netvsc_send()
      
      To solve these issues without introducing new locks some refactoring is
      required. We need to get rid of very complex link graph in all the
      internal structures and avoid traveling through structures which are being
      removed.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      860d7ef6
    • Vitaly Kuznetsov's avatar
      hv_netvsc: set nvdev link after populating chn_table · 88098834
      Vitaly Kuznetsov authored
      Crash in netvsc_send() is observed when netvsc device is re-created on
      mtu change/set channels. The crash is caused by dereferencing of NULL
      channel pointer which comes from chn_table. The root cause is a mixture
      of two facts:
      - we set nvdev pointer in net_device_context in alloc_net_device()
        before we populate chn_table.
      - we populate chn_table[0] only.
      
      The issue could be papered over by checking channel != NULL in
      netvsc_send() but populating the whole chn_table and writing the
      nvdev pointer afterwards seems more appropriate.
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      88098834
    • Vitaly Kuznetsov's avatar
      hv_netvsc: synchronize netvsc_change_mtu()/netvsc_set_channels() with netvsc_remove() · 6da7225f
      Vitaly Kuznetsov authored
      When netvsc device is removed during mtu change or channels setup we get
      into troubles as both paths are trying to remove the device. Synchronize
      them with start_remove flag and rtnl lock.
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6da7225f
    • Vitaly Kuznetsov's avatar
      hv_netvsc: get rid of struct net_device pointer in struct netvsc_device · 0a1275ca
      Vitaly Kuznetsov authored
      Simplify netvsvc pointer graph by getting rid of the redundant ndev
      pointer. We can always get a pointer to struct net_device from somewhere
      else.
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0a1275ca
    • Vitaly Kuznetsov's avatar
      hv_netvsc: untangle the pointer mess · 3d541ac5
      Vitaly Kuznetsov authored
      We have the following structures keeping netvsc adapter state:
      - struct net_device
      - struct net_device_context
      - struct netvsc_device
      - struct rndis_device
      - struct hv_device
      and there are pointers/dependencies between them:
      - struct net_device_context is contained in struct net_device
      - struct hv_device has driver_data pointer which points to
        'struct net_device' OR 'struct netvsc_device' depending on driver's
        state (!).
      - struct net_device_context has a pointer to 'struct hv_device'.
      - struct netvsc_device has pointers to 'struct hv_device' and
        'struct net_device_context'.
      - struct rndis_device has a pointer to 'struct netvsc_device'.
      
      Different functions get different structures as parameters and use these
      pointers for traveling. The problem is (in addition to keeping in mind
      this complex graph) that some of these structures (struct netvsc_device
      and struct rndis_device) are being removed and re-created on mtu change
      (as we implement it as re-creation of hyper-v device) so our travel using
      these pointers is dangerous.
      
      Simplify this to a the following:
      - add struct netvsc_device pointer to struct net_device_context (which is
        a part of struct net_device and thus never disappears)
      - remove struct hv_device and struct net_device_context pointers from
        struct netvsc_device
      - replace pointer to 'struct netvsc_device' with pointer to
        'struct net_device'.
      - always keep 'struct net_device' in hv_device driver_data.
      
      We'll end up with the following 'circular' structure:
      
      net_device:
       [net_device_context] -> netvsc_device -> rndis_device -> net_device
                            -> hv_device -> net_device
      
      On MTU change we'll be removing the 'netvsc_device -> rndis_device'
      branch and re-creating it making the synchronization easier.
      
      There is one additional redundant pointer left, it is struct net_device
      link in struct netvsc_device, it is going to be removed in a separate
      commit.
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3d541ac5
    • Vitaly Kuznetsov's avatar
      hv_netvsc: use start_remove flag to protect netvsc_link_change() · 1bdcec8a
      Vitaly Kuznetsov authored
      netvsc_link_change() can race with netvsc_change_mtu() or
      netvsc_set_channels() as these functions destroy struct netvsc_device and
      rndis filter. Use start_remove flag for syncronization. As
      netvsc_change_mtu()/netvsc_set_channels() are called with rtnl lock held
      we need to take it before checking start_remove value in
      netvsc_link_change().
      Reported-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1bdcec8a
    • Vitaly Kuznetsov's avatar
      hv_netvsc: move start_remove flag to net_device_context · f580aec4
      Vitaly Kuznetsov authored
      struct netvsc_device is destroyed on mtu change so keeping the
      protection flag there is not a good idea. Move it to struct
      net_device_context which is preserved.
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f580aec4
    • Uwe Kleine-König's avatar
      phy: add support for a reset-gpio specification · da47b457
      Uwe Kleine-König authored
      The framework only asserts (for now) that the reset gpio is not active.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Reviewed-by: default avatarRoger Quadros <rogerq@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      da47b457
  2. 15 May, 2016 12 commits
  3. 14 May, 2016 17 commits