1. 16 10月, 2015 40 次提交
    • M
      i40evf: relax and stagger init timing a bit · 3f7e5c33
      Mitch Williams 提交于
      On some devices, in some systems, in some configurations, the VFs would
      fail to initialize the first time you loaded the driver.
      
      To correct this, increase the delay time for the init task slightly, and
      wait longer before giving up.
      
      If we enable VFs and load the VF driver in the same kernel as the PF
      driver, we can totally overwhelm the PF driver with AQ requests because
      all of the instances try to initialize at the same time.
      
      To help alleviate this, stagger the initial scheduling of the init task
      using the PCIe function as a multiplier. We mask off the function to
      only three bits so no instance has to wait too long.
      
      With these two changes, initializing 128 VFs on a single device goes
      from four minutes to just a few seconds.
      
      Change-ID: If3d8720c1c4e838ab36d8781d9ec295a62380936
      Signed-off-by: NMitch Williams <mitch.a.williams@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      3f7e5c33
    • C
      i40e: Recognize 1000Base_T_Optical phy type when link is up · 48becae6
      Catherine Sullivan 提交于
      1000Base_T_Optical got added to the function that figures out what
      is supported when link is down but not when link is up. Add it in there
      too so that we display the correct information.
      
      Change-ID: I85ebcdfa7c02d898c44c673b1500552a53c8042e
      Signed-off-by: NCatherine Sullivan <catherine.sullivan@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      48becae6
    • M
      i40evf: correctly populate vlan_features · cc7e406c
      Mitch Williams 提交于
      The vlan_features field was correctly being set to the same value as the
      netdev features field. However, this was being done before the features
      were actually being set up, leaving the vlan_features empty.
      
      Also, after a reset, vlan_features will be incorrectly assigned the
      previous netdev feature flags, which can contain VLAN feature bits. This
      makes the VLAN code angry and will cause a stack dump.
      
      To fix these issues, set up the netdev features first, then mask out the
      VLAN feature bits when assigning vlan_features.
      
      Change-ID: Ib0548869dc83cf6a841cb8697dd94c12359ba4d2
      Signed-off-by: NMitch Williams <mitch.a.williams@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      cc7e406c
    • J
      i40e: reset the invalid msg counter in vf when a valid msg is received · 5d38c93e
      Jingjing Wu 提交于
      When the number of invalid messages from a VF is exceeded, the VF
      will be disabled, due to the invalid messages.  This happens if
      other VF drivers (like DPDK) send a message through the driver's
      mailbox (aka virtchannel) interface, but the message is not
      supported by the i40e pf driver, such as CONFIG_PROMISCUOUS_MODE.
      
      This patch changes the num_invalid_msgs in struct i40e_vf to record
      the continuous invalid msgs, and it will be reset when a valid msg
      is received.
      
      Change-ID: Iaec42fd3dcdd281476b3518be23261dd46fc3718
      Signed-off-by: NJingjing Wu <jingjing.wu@intel.com>
      Signed-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      5d38c93e
    • J
      i40e/i40evf: moderate interrupts differently · ac26fc13
      Jesse Brandeburg 提交于
      The XL710 hardware has a different interrupt moderation design
      that can support a limit of total interrupts per second per
      vector, in addition to the "number of interrupts per second"
      controls already established in the driver.  This combination
      of hardware features allows us to set very low default latency
      settings but minimize the total CPU utilization by not
      making too many interrupts, should the user desire.
      
      The current driver implementation is still enabling the dynamic
      moderation in the driver, and only using the rx/tx-usecs
      limit in ethtool to limit the interrupt rate per second, by default.
      
      The new code implemented in this patch
      2) adds init/use of the new "Interrupt Limit" register
      3) adds ethtool knob to control/report the limits above
      
      Usage is ethtool -C ethx rx-usecs-high <value> Where <value> is number
      of microseconds to create a rate of 1/N interrupts per second,
      regardless of rx-usecs or tx-usecs values. Since there is a credit based
      scheme in the hardware, the rx-usecs and tx-usecs can be configured for
      very low latency for short bursts, but once the credit runs out the
      refill rate on the credits is limited by rx-usecs-high.
      
      Change-ID: I3a1075d3296123b0f4f50623c779b027af5b188d
      Signed-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      ac26fc13
    • G
      i40e: Add support for non-willing Apps · 947570e8
      Greg Bowers 提交于
      Adds support for setting a new bit in the Set Local LLDP MIB AQ command
      Type field.  When set to 1, the bit indicates to FW that Apps should be
      treated as non-willing.  When 0, FW behaves as before.
      
      Change-ID: I0d2101c1606c59c7188d3e6a0c7810e0f205233a
      Signed-off-by: NGreg Bowers <gregory.j.bowers@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      947570e8
    • S
      i40e: priv flag for controlling VEB stats · 1cdfd88f
      Shannon Nelson 提交于
      Add an ethtool priv flag to enable and disable printing
      the VEB statistics.
      
      Change-ID: I7654054a3a73b08aa8310d94ee8fce6219107dd8
      Signed-off-by: NShannon Nelson <shannon.nelson@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      1cdfd88f
    • G
      i40e: Removed unused defines · d9d17cf7
      Greg Rose 提交于
      Two defines that are not used are causing customer confusion - remove
      them.
      
      Change-ID: Icef0325aca8e0f4fcdfc519e026bdd375e791200
      Signed-off-by: NGreg Rose <gregory.v.rose@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      d9d17cf7
    • S
      i40e: remove read/write failed messages from nvmupdate · 3c5c4205
      Shannon Nelson 提交于
      Allow the nvmupdate application to decide when a read or write error
      should be exposed to the user.  Since the application needs to use
      write probes to find the ReadOnly sections on a potentially unknown NVM
      version in the HW and read probes to check the status of the last write,
      some error messages are expected, but need not be shown to the users.
      The driver doesn't know which are ignorable from real errors, so needs
      to let the application make the decision.
      
      Change-ID: I78fca8ab672bede11c10c820b83c26adfd536d03
      Signed-off-by: NShannon Nelson <shannon.nelson@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      3c5c4205
    • J
      i40e/i40evf: Fix compile issue related to const string · 4e68adfe
      Jingjing Wu 提交于
      Add const to functions that return strings that aren't going to be
      modified. This addresses some reported compile complaints.
      
      Change-ID: Ic56b1e814ab4d23a50480e7fdec652445f776ee8
      Signed-off-by: NJingjing Wu <jingjing.wu@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      4e68adfe
    • S
      i40e: generate fewer startup messages · 6dec1017
      Shannon Nelson 提交于
      Cut down on the number of startup log entries by putting a couple behind
      debug flags and combining a couple others into a single line.
      
      Change-ID: I708089f086308f84d43f8b6f0e8a634a02d058fb
      Signed-off-by: NShannon Nelson <shannon.nelson@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      6dec1017
    • J
      drivers/net/intel: use napi_complete_done() · 32b3e08f
      Jesse Brandeburg 提交于
      As per Eric Dumazet's previous patches:
      (see commit (24d2e4a5) - tg3: use napi_complete_done())
      
      Quoting verbatim:
      Using napi_complete_done() instead of napi_complete() allows
      us to use /sys/class/net/ethX/gro_flush_timeout
      
      GRO layer can aggregate more packets if the flush is delayed a bit,
      without having to set too big coalescing parameters that impact
      latencies.
      </end quote>
      
      Tested
      configuration: low latency via ethtool -C ethx adaptive-rx off
      				rx-usecs 10 adaptive-tx off tx-usecs 15
      workload: streaming rx using netperf TCP_MAERTS
      
      igb:
      MIGRATED TCP MAERTS TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.0.0.1 () port 0 AF_INET : demo
      ...
      Interim result:  941.48 10^6bits/s over 1.000 seconds ending at 1440193171.589
      
      Alignment      Offset         Bytes    Bytes       Recvs   Bytes    Sends
      Local  Remote  Local  Remote  Xfered   Per                 Per
      Recv   Send    Recv   Send             Recv (avg)          Send (avg)
          8       8      0       0 1176930056  1475.36    797726   16384.00  71905
      
      MIGRATED TCP MAERTS TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.0.0.1 () port 0 AF_INET : demo
      ...
      Interim result:  941.49 10^6bits/s over 0.997 seconds ending at 1440193142.763
      
      Alignment      Offset         Bytes    Bytes       Recvs   Bytes    Sends
      Local  Remote  Local  Remote  Xfered   Per                 Per
      Recv   Send    Recv   Send             Recv (avg)          Send (avg)
          8       8      0       0 1175182320  50476.00     23282   16384.00  71816
      
      i40e:
      Hard to test because the traffic is incoming so fast (24Gb/s) that GRO
      always receives 87kB, even at the highest interrupt rate.
      
      Other drivers were only compile tested.
      Signed-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      32b3e08f
    • A
    • A
      i40e/i40evf: Drop useless "IN_NETPOLL" flag · 8b650359
      Alexander Duyck 提交于
      The code in i40e and i40evf is using an "IN_NETPOLL" flag that has never
      added any value due to the fact that the Rx clean-up is handled in NAPI.
      As such the flag was set, the queue was scheduled via NAPI, and then polled
      from the netpoll controller and if any Rx packets were processed the were
      processed in the wrong context.
      
      In addition the flag itself just added an unneeded conditional to the
      hot-path so it can safely be dropped and save us a few instructions.
      Signed-off-by: NAlexander Duyck <aduyck@mirantis.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      8b650359
    • A
      i40e/i40evf: Fix handling of napi budget · c67caceb
      Alexander Duyck 提交于
      The polling routine for i40e was rounding up the budget for Rx cleanup to
      1.  This is incorrect as the netpoll poll call is expecting no Rx to be
      processed as the budget passed was 0.
      Signed-off-by: NAlexander Duyck <aduyck@mirantis.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      c67caceb
    • D
      net: Fix suspicious RCU usage in fib_rebalance · 51161aa9
      David Ahern 提交于
      This command:
        ip route add 192.168.1.0/24 nexthop via 10.2.1.5 dev eth1 nexthop via 10.2.2.5 dev eth2
      
      generated this suspicious RCU usage message:
      
      [ 63.249262]
      [ 63.249939] ===============================
      [ 63.251571] [ INFO: suspicious RCU usage. ]
      [ 63.253250] 4.3.0-rc3+ #298 Not tainted
      [ 63.254724] -------------------------------
      [ 63.256401] ../include/linux/inetdevice.h:205 suspicious rcu_dereference_check() usage!
      [ 63.259450]
      [ 63.259450] other info that might help us debug this:
      [ 63.259450]
      [ 63.262297]
      [ 63.262297] rcu_scheduler_active = 1, debug_locks = 1
      [ 63.264647] 1 lock held by ip/2870:
      [ 63.265896] #0: (rtnl_mutex){+.+.+.}, at: [<ffffffff813ebfb7>] rtnl_lock+0x12/0x14
      [ 63.268858]
      [ 63.268858] stack backtrace:
      [ 63.270409] CPU: 4 PID: 2870 Comm: ip Not tainted 4.3.0-rc3+ #298
      [ 63.272478] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
      [ 63.275745] 0000000000000001 ffff8800b8c9f8b8 ffffffff8125f73c ffff88013afcf301
      [ 63.278185] ffff8800bab7a380 ffff8800b8c9f8e8 ffffffff8107bf30 ffff8800bb728000
      [ 63.280634] ffff880139fe9a60 0000000000000000 ffff880139fe9a00 ffff8800b8c9f908
      [ 63.283177] Call Trace:
      [ 63.283959] [<ffffffff8125f73c>] dump_stack+0x4c/0x68
      [ 63.285593] [<ffffffff8107bf30>] lockdep_rcu_suspicious+0xfa/0x103
      [ 63.287500] [<ffffffff8144d752>] __in_dev_get_rcu+0x48/0x4f
      [ 63.289169] [<ffffffff8144d797>] fib_rebalance+0x3e/0x127
      [ 63.290753] [<ffffffff8144d986>] ? rcu_read_unlock+0x3e/0x5f
      [ 63.292442] [<ffffffff8144ea45>] fib_create_info+0xaf9/0xdcc
      [ 63.294093] [<ffffffff8106c12f>] ? sched_clock_local+0x12/0x75
      [ 63.295791] [<ffffffff8145236a>] fib_table_insert+0x8c/0x451
      [ 63.297493] [<ffffffff8144bf9c>] ? fib_get_table+0x36/0x43
      [ 63.299109] [<ffffffff8144c3ca>] inet_rtm_newroute+0x43/0x51
      [ 63.300709] [<ffffffff813ef684>] rtnetlink_rcv_msg+0x182/0x195
      [ 63.302334] [<ffffffff8107d04c>] ? trace_hardirqs_on+0xd/0xf
      [ 63.303888] [<ffffffff813ebfb7>] ? rtnl_lock+0x12/0x14
      [ 63.305346] [<ffffffff813ef502>] ? __rtnl_unlock+0x12/0x12
      [ 63.306878] [<ffffffff81407c4c>] netlink_rcv_skb+0x3d/0x90
      [ 63.308437] [<ffffffff813ec00e>] rtnetlink_rcv+0x21/0x28
      [ 63.309916] [<ffffffff81407742>] netlink_unicast+0xfa/0x17f
      [ 63.311447] [<ffffffff81407a5e>] netlink_sendmsg+0x297/0x2dc
      [ 63.313029] [<ffffffff813c6cd4>] sock_sendmsg_nosec+0x12/0x1d
      [ 63.314597] [<ffffffff813c835b>] ___sys_sendmsg+0x196/0x21b
      [ 63.316125] [<ffffffff8100bf9f>] ? native_sched_clock+0x1f/0x3c
      [ 63.317671] [<ffffffff8106c12f>] ? sched_clock_local+0x12/0x75
      [ 63.319185] [<ffffffff8106c397>] ? sched_clock_cpu+0x9d/0xb6
      [ 63.320693] [<ffffffff8107e2d7>] ? __lock_is_held+0x32/0x54
      [ 63.322145] [<ffffffff81159fcb>] ? __fget_light+0x4b/0x77
      [ 63.323541] [<ffffffff813c8726>] __sys_sendmsg+0x3d/0x5b
      [ 63.324947] [<ffffffff813c8751>] SyS_sendmsg+0xd/0x19
      [ 63.326274] [<ffffffff814c8f57>] entry_SYSCALL_64_fastpath+0x12/0x6f
      
      It looks like all of the code paths to fib_rebalance are under rtnl.
      
      Fixes: 0e884c78 ("ipv4: L3 hash-based multipath")
      Cc: Peter Nørlund <pch@ordbogen.com>
      Signed-off-by: NDavid Ahern <dsa@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      51161aa9
    • T
      bpf: Need to call bpf_prog_uncharge_memlock from bpf_prog_put · ac00737f
      Tom Herbert 提交于
      Currently, is only called from __prog_put_rcu in the bpf_prog_release
      path. Need this to call this from bpf_prog_put also to get correct
      accounting.
      
      Fixes: aaac3ba9 ("bpf: charge user for creation of BPF maps and programs")
      Signed-off-by: NTom Herbert <tom@herbertland.com>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ac00737f
    • D
      Merge branch 'robust_listener' · a302afe9
      David S. Miller 提交于
      Eric Dumazet says:
      
      ====================
      tcp/dccp: make our listener code more robust
      
      This patch series addresses request sockets leaks and listener dismantle
      phase. This survives a stress test with listeners being added/removed
      quite randomly.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a302afe9
    • E
      tcp/dccp: fix race at listener dismantle phase · ebb516af
      Eric Dumazet 提交于
      Under stress, a close() on a listener can trigger the
      WARN_ON(sk->sk_ack_backlog) in inet_csk_listen_stop()
      
      We need to test if listener is still active before queueing
      a child in inet_csk_reqsk_queue_add()
      
      Create a common inet_child_forget() helper, and use it
      from inet_csk_reqsk_queue_add() and inet_csk_listen_stop()
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ebb516af
    • E
      tcp/dccp: add inet_csk_reqsk_queue_drop_and_put() helper · f03f2e15
      Eric Dumazet 提交于
      Let's reduce the confusion about inet_csk_reqsk_queue_drop() :
      In many cases we also need to release reference on request socket,
      so add a helper to do this, reducing code size and complexity.
      
      Fixes: 4bdc3d66 ("tcp/dccp: fix behavior of stale SYN_RECV request sockets")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f03f2e15
    • E
      Revert "inet: fix double request socket freeing" · ef84d8ce
      Eric Dumazet 提交于
      This reverts commit c6973669.
      
      At the time of above commit, tcp_req_err() and dccp_req_err()
      were dead code, as SYN_RECV request sockets were not yet in ehash table.
      
      Real bug was fixed later in a different commit.
      
      We need to revert to not leak a refcount on request socket.
      
      inet_csk_reqsk_queue_drop_and_put() will be added
      in following commit to make clean inet_csk_reqsk_queue_drop()
      does not release the reference owned by caller.
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ef84d8ce
    • I
      drivers/net: get rid of unnecessary initializations in .get_drvinfo() · 47ea0325
      Ivan Vecera 提交于
      Many drivers initialize uselessly n_priv_flags, n_stats, testinfo_len,
      eedump_len & regdump_len fields in their .get_drvinfo() ethtool op.
      It's not necessary as these fields is filled in ethtool_get_drvinfo().
      
      v2: removed unused variable
      v3: removed another unused variable
      Signed-off-by: NIvan Vecera <ivecera@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      47ea0325
    • D
      Merge branch 'tipc-link-improvements' · ae230518
      David S. Miller 提交于
      Jon Maloy says:
      
      ====================
      tipc: some link level code improvements
      
      Extensive testing has revealed some weaknesses and non-optimal solutions
      in the link level code.
      
      This commit series addresses those issues.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ae230518
    • J
      tipc: update node FSM when peer RESET message is received · c8199300
      Jon Paul Maloy 提交于
      The change made in the previous commit revealed a small flaw in the way
      the node FSM is updated. When the function tipc_node_link_down() is
      called for the last link to a node, we should check whether this was
      caused by a local reset or by a received RESET message from the peer.
      In the latter case, we can directly issue a PEER_LOST_CONTACT_EVT to
      the node FSM, so that it is ready to re-establish contact. If this is
      not done, the peer node will sometimes have to go through a second
      establish cycle before the link becomes stable.
      
      We fix this in this commit by conditionally issuing the mentioned
      event in the function tipc_node_link_down(). We also move LINK_RESET
      FSM even away from the link_reset() function and into the caller
      function, partially because it is easier to follow the code when state
      changes are gathered at a limited number of locations, partially
      because there will be cases in future commits where we don't want the
      link to go RESET mode when link_reset() is called.
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c8199300
    • J
      tipc: send out RESET immediately when link goes down · 282b3a05
      Jon Paul Maloy 提交于
      When a link is taken down because of a node local event, such as
      disabling of a bearer or an interface, we currently leave it to the
      peer node to discover the broken communication. The default time for
      such failure discovery is 1.5-2 seconds.
      
      If we instead allow the terminating link endpoint to send out a RESET
      message at the moment it is reset, we can achieve the impression that
      both endpoints are going down instantly. Since this is a very common
      scenario, we find it worthwhile to make this small modification.
      
      Apart from letting the link produce the said message, we also have to
      ensure that the interface is able to transmit it before TIPC is
      detached. We do this by performing the disabling of a bearer in three
      steps:
      
      1) Disable reception of TIPC packets from the interface in question.
      2) Take down the links, while allowing them so send out a RESET message.
      3) Disable transmission of TIPC packets on the interface.
      
      Apart from this, we now have to react on the NETDEV_GOING_DOWN event,
      instead of as currently the NEDEV_DOWN event, to ensure that such
      transmission is possible during the teardown phase.
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      282b3a05
    • J
      tipc: delay ESTABLISH state event when link is established · 73f646ce
      Jon Paul Maloy 提交于
      Link establishing, just like link teardown, is a non-atomic action, in
      the sense that discovering that conditions are right to establish a link,
      and the actual adding of the link to one of the node's send slots is done
      in two different lock contexts. The link FSM is designed to help bridging
      the gap between the two contexts in a safe manner.
      
      We have now discovered a weakness in the implementaton of this FSM.
      Because we directly let the link go from state LINK_ESTABLISHING to
      state LINK_ESTABLISHED already in the first lock context, we are unable
      to distinguish between a fully established link, i.e., a link that has
      been added to its slot, and a link that has not yet reached the second
      lock context. It may hence happen that a manual intervention, e.g., when
      disabling an interface, causes the function tipc_node_link_down() to try
      removing the link from the node slots, decrementing its active link
      counter etc, although the link was never added there in the first place.
      
      We solve this by delaying the actual state change until we reach the
      second lock context, inside the function tipc_node_link_up(). This
      makes it possible for potentail callers of __tipc_node_link_down() to
      know if they should proceed or not, and the problem is solved.
      
      Unforunately, the situation described above also has a second problem.
      Since there by necessity is a tipc_node_link_up() call pending once
      the node lock has been released, we must defuse that call by setting
      the link back from LINK_ESTABLISHING to LINK_RESET state. This forces
      us to make a slight modification to the link FSM, which will now look
      as follows.
      
       +------------------------------------+
       |RESET_EVT                           |
       |                                    |
       |                             +--------------+
       |           +-----------------|   SYNCHING   |-----------------+
       |           |FAILURE_EVT      +--------------+   PEER_RESET_EVT|
       |           |                  A            |                  |
       |           |                  |            |                  |
       |           |                  |            |                  |
       |           |                  |SYNCH_      |SYNCH_            |
       |           |                  |BEGIN_EVT   |END_EVT           |
       |           |                  |            |                  |
       |           V                  |            V                  V
       |    +-------------+          +--------------+          +------------+
       |    |  RESETTING  |<---------|  ESTABLISHED |--------->| PEER_RESET |
       |    +-------------+ FAILURE_ +--------------+ PEER_    +------------+
       |           |        EVT        |    A         RESET_EVT       |
       |           |                   |    |                         |
       |           |  +----------------+    |                         |
       |  RESET_EVT|  |RESET_EVT            |                         |
       |           |  |                     |                         |
       |           |  |                     |ESTABLISH_EVT            |
       |           |  |  +-------------+    |                         |
       |           |  |  | RESET_EVT   |    |                         |
       |           |  |  |             |    |                         |
       |           V  V  V             |    |                         |
       |    +-------------+          +--------------+        RESET_EVT|
       +--->|    RESET    |--------->| ESTABLISHING |<----------------+
            +-------------+ PEER_    +--------------+
             |           A  RESET_EVT       |
             |           |                  |
             |           |                  |
             |FAILOVER_  |FAILOVER_         |FAILOVER_
             |BEGIN_EVT  |END_EVT           |BEGIN_EVT
             |           |                  |
             V           |                  |
            +-------------+                 |
            | FAILINGOVER |<----------------+
            +-------------+
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      73f646ce
    • J
      tipc: disallow packet duplicates in link deferred queue · 8306f99a
      Jon Paul Maloy 提交于
      After the previous commits, we are guaranteed that no packets
      of type LINK_PROTOCOL or with illegal sequence numbers will be
      attempted added to the link deferred queue. This makes it possible to
      make some simplifications to the sorting algorithm in the function
      tipc_skb_queue_sorted().
      
      We also alter the function so that it will drop packets if one with
      the same seqeunce number is already present in the queue. This is
      necessary because we have identified weird packet sequences, involving
      duplicate packets, where a legitimate in-sequence packet may advance to
      the head of the queue without being detected and de-queued.
      
      Finally, we make this function outline, since it will now be called only
      in exceptional cases.
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8306f99a
    • J
      tipc: improve sequence number checking · 81204c49
      Jon Paul Maloy 提交于
      The sequence number of an incoming packet is currently only checked
      for less than, equality to, or bigger than the next expected number,
      meaning that the receive window in practice becomes one half sequence
      number cycle, or U16_MAX/2. This does not make sense, and may not even
      be safe if there are extreme delays in the network. Any packet sent by
      the peer during the ongoing cycle must belong inside his current send
      window, or should otherwise be dropped if possible.
      
      Since a link endpoint cannot know its peer's current send window, it
      has to base this sanity check on a worst-case assumption, i.e., that
      the peer is using a maximum sized window of 8191 packets. Using this
      assumption, we now add a check that the sequence number is not bigger
      than next_expected + TIPC_MAX_LINK_WIN. We also re-order the checks
      done, so that the receive window test is performed before the gap test.
      This way, we are guaranteed that no packet with illegal sequence numbers
      are ever added to the deferred queue.
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      81204c49
    • J
      tipc: simplify tipc_link_rcv() reception loop · f9aa358a
      Jon Paul Maloy 提交于
      Currently, all packets received in tipc_link_rcv() are unconditionally
      added to the packet deferred queue, whereafter that queue is walked and
      all its buffers evaluated for delivery. This is both non-optimal and
      and makes the queue sorting function unnecessary complex.
      
      This commit changes the loop so that an arrived packet is evaluated
      first, and added to the deferred queue only when a sequence number gap
      is discovered. A non-empty deferred queue is walked until it is empty
      or until its head's sequence number doesn't fit.
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f9aa358a
    • J
      tipc: limit usage of temporary skb list during packet reception · 9945e804
      Jon Paul Maloy 提交于
      During packet reception, the function tipc_link_rcv() adds its accepted
      packets to a temporary buffer queue, before finally splicing this queue
      into the lock protected input queue that will be delivered up to the
      socket layer. The purpose is to reduce potential contention on the input
      queue lock. However, since the vast majority of packets arrive in
      sequence, they will anyway be added one by one to the input queue, and
      the use of the temporary queue becomes a sub-optimization.
      
      The only case where this queue makes sense is when unpacking buffers
      from a bundle packet; here we want to avoid dozens of small buffers
      to be added individually to the lock-protected input queue in a tight
      loop.
      
      In this commit, we remove the general usage of the temporary queue,
      and keep it only for the packet unbundling case.
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9945e804
    • I
      mlx4: corretly check failed allocation · 175f8d67
      Insu Yun 提交于
      When allocation fails, mlx4_alloc_cmd_mailbox returns -ENOMEM.
      Since there is no case that mlx4_alloc_cmd_mailbox returns NULL,
      it needs to be checked by IS_ERR, not IS_ERR_OR_NULL
      Signed-off-by: NInsu Yun <wuninsu@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      175f8d67
    • E
      bonding: support encapsulated ipv6 TSO · e87eb405
      Eric Dumazet 提交于
      If using a sixtofour device on top of a bonding device,
      skb segmentation of TCP traffic is done right before calling
      bonding xmit, because bonding only enables TSO for IPv4.
      
      This patch improves single flow performance by about 120 % on my hosts,
      because segmentation is deferred right before calling slave xmit.
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e87eb405
    • D
      Merge branch 'mlxsw-cleanups' · 181e4246
      David S. Miller 提交于
      Jiri Pirko says:
      
      ====================
      mlxsw: Driver update, cleanups
      
      This patchset contains various cleanups and improvements in mlxsw driver.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      181e4246
    • I
      mlxsw: cmd: Update CONFIG_PROFILE command documentation · 5cd16d8c
      Ido Schimmel 提交于
      The meaning of certain parameters in the profile passed to the device
      during initialization has changed, so update their documentation
      accordingly.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5cd16d8c
    • I
      mlxsw: Add trap group for control packets · 801bd3de
      Ido Schimmel 提交于
      Previously, we trapped flooded and control packets using the same trap
      group. This can cause flooded packets to overflow the PCI bus and
      prevent control packets (e.g. STP, LACP) from getting to the CPU.
      
      Solve this by splitting the RX trap group to RX and control, which allows
      us to configure a policer on the first, thereby preventing it from
      overflowing the PCI bus.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      801bd3de
    • I
      mlxsw: Simplify traps creation · f24af330
      Ido Schimmel 提交于
      The Host Trap Group Table (HTGT) register configures trap groups, which
      are populated with trap IDs using the Host PacKet Trap (HPKT) register.
      However, a trap ID can only be present inside one trap group (the last
      configured).
      
      Instead of passing both the trap group and ID for the function that
      packs HPKT, pass only the trap ID and derive from it the trap group.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f24af330
    • J
      mlxsw: Introduce mlxsw_reg_spms_vid_pack helper and use it · ebb7963f
      Jiri Pirko 提交于
      Introduce separate helper for packing SPMS VIDs, as it can be used for
      multiple VIDs and not only for one as previous SPMS pack function
      provided.
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ebb7963f
    • I
      mlxsw: reg: Adjust definition of enum mlxsw_reg_sfgc_type · fa6ad058
      Ido Schimmel 提交于
      Define max which would be needed later on.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fa6ad058
    • J
      mlxsw: reg: Remove extra space in SFGC ID define · 36b78e8a
      Jiri Pirko 提交于
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      36b78e8a
    • J
      mlxsw: reg: Uppercase letters in register IDs · 3f0effd1
      Jiri Pirko 提交于
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3f0effd1