1. 21 12月, 2018 2 次提交
  2. 20 12月, 2018 38 次提交
    • D
      neighbor: Use nda_policy for validating attributes in adds and dump requests · a9cd3439
      David Ahern 提交于
      Add NDA_PROTOCOL to nda_policy and use the policy for attribute parsing and
      validation for adding neighbors and in dump requests. Remove the now duplicate
      checks on nla_len.
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a9cd3439
    • D
      Merge branch 'hns3-next' · d129a45b
      David S. Miller 提交于
      Peng Li says:
      
      ====================
      net: hns3: code optimizations & bugfixes for HNS3 driver
      
      This patchset includes bugfixes and code optimizations for the HNS3
      ethernet controller driver
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d129a45b
    • P
      net: hns3: remove redundant variable initialization · 1154bb26
      Peng Li 提交于
      This patch removes the redundant variable initialization,
      as driver will devm_kzalloc to set value to hdev soon.
      Signed-off-by: NPeng Li <lipeng321@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1154bb26
    • P
      net: hns3: fix the descriptor index when get rss type · 31a16f99
      Peng Li 提交于
      Driver gets rss information from the last descriptor of the packet.
      When driver handle the rss type, ring->next_to_clean indicates the
      first descriptor of next packet.
      
      This patch fix the descriptor index with "ring->next_to_clean - 1".
      
      Fixes: 232fc64b ("net: hns3: Add HW RSS hash information to RX skb")
      Signed-off-by: NPeng Li <lipeng321@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      31a16f99
    • J
      net: hns3: don't restore rules when flow director is disabled · 8edc2285
      Jian Shen 提交于
      When user disables flow director, all the rules will be disabled. But
      when reset happens, it will restore all the rules again. It's not
      reasonable. This patch fixes it by add flow director status check before
      restore fules.
      
      Fixes: 6871af29 ("net: hns3: Add reset handle for flow director")
      Fixes: c17852a8 ("net: hns3: Add support for enable/disable flow director")
      Signed-off-by: NJian Shen <shenjian15@huawei.com>
      Signed-off-by: NPeng Li <lipeng321@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8edc2285
    • J
      net: hns3: fix vf id check issue when add flow director rule · 0285dbae
      Jian Shen 提交于
      When add flow director fule for vf, the vf id is used as array
      subscript before valid checking, which may cause memory overflow.
      
      Fixes: dd74f815 ("net: hns3: Add support for rule add/delete for flow director")
      Signed-off-by: NJian Shen <shenjian15@huawei.com>
      Signed-off-by: NPeng Li <lipeng321@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0285dbae
    • H
      net: hns3: reset tqp while doing DOWN operation · 39cfbc9c
      Huazhong Tan 提交于
      While doing DOWN operation, the driver will reclaim the memory which has
      already used for TX. If the hardware is processing this memory, it will
      cause a RCB error to the hardware. According the hardware's description,
      the driver should reset the tqp before reclaim the memory during DOWN.
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NPeng Li <lipeng321@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      39cfbc9c
    • J
      net: hns3: add max vector number check for pf · 75edb610
      Jian Shen 提交于
      Each pf supports max 64 vectors and 128 tqps. For 2p/4p core scenario,
      there may be more than 64 cpus online. So the result of min_t(u16,
      num_Online_cpus(), tqp_num) may be more than 64. This patch adds check
      for the vector number.
      
      Fixes: dd38c726 ("net: hns3: fix for coalesce configuration lost during reset")
      Signed-off-by: NJian Shen <shenjian15@huawei.com>
      Signed-off-by: NPeng Li <lipeng321@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      75edb610
    • P
      net: hns3: fix a bug caused by udelay · 1b7d7b05
      Peng Li 提交于
      udelay() in driver may always occupancy processor. If there is only
      one cpu in system, the VF driver may initialize fail when insmod
      PF and VF driver in the same system. This patch use msleep() to free
      cpu when VF wait PF message.
      Signed-off-by: NPeng Li <lipeng321@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1b7d7b05
    • J
      net: hns3: change default tc state to close · a2987975
      Jian Shen 提交于
      In original codes, default tc value is set to the max tc. It's more
      reasonable to close tc by changing default tc value to 1. Users can
      enable it with lldp tool when they want to use tc.
      Signed-off-by: NJian Shen <shenjian15@huawei.com>
      Signed-off-by: NPeng Li <lipeng321@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a2987975
    • J
      net: hns3: refine the handle for hns3_nic_net_open/stop() · 8cdb992f
      Jian Shen 提交于
      When triggering nic down, there is a time window between bringing down
      the protocol stack and stopping the work task. If the net is up in the
      time window, it may bring up the protocol stack again.
      
      This patch fixes it by stop the work task at the beginning of
      hns3_nic_net_stop(). To keep symmetrical, start the work task at the
      end of hns3_nic_net_open().
      Signed-off-by: NJian Shen <shenjian15@huawei.com>
      Signed-off-by: NPeng Li <lipeng321@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8cdb992f
    • D
      neighbor: Initialize protocol when new pneigh_entry are created · 754d5da6
      David Ahern 提交于
      pneigh_lookup uses kmalloc versus kzalloc when new entries are allocated.
      Given that the newly added protocol field needs to be initialized.
      
      Fixes: df9b0e30 ("neighbor: Add protocol attribute")
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      754d5da6
    • P
      selftests: net: refactor reuseport_addr_any test · 3f2eadb1
      Peter Oskolkov 提交于
      This patch refactors reuseport_add_any selftest a bit:
      - makes it more modular (eliminates several copy/pasted blocks);
      - skips DCCP tests if DCCP is not supported
      
      V2: added "Signed-off-by" tag.
      Signed-off-by: NPeter Oskolkov <posk@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3f2eadb1
    • A
      net: dsa: mv88e6xxx: Add missing watchdog ops for 6320 family · 9c7f37e5
      Andrew Lunn 提交于
      The 6320 family of switches uses the same watchdog registers as the
      6390.
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: NVivien Didelot <vivien.didelot@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9c7f37e5
    • D
      Merge branch 'mt2712' · dac95976
      David S. Miller 提交于
      Biao Huang says:
      
      ====================
      add ethernet binding and modify ethernet driver for mt2712
      
      changes in v3:
      resend this series base on the latest net-next tree.
      
      changes in v2 as comments from Sean:
      1. fix typo.
      2. use capital letters for RMII/MII/RGMII in driver and bindings.
      
      v1:
      This new series is the result of discussion in:
      http://lkml.org/lkml/2018/12/13/1007
      http://lkml.org/lkml/2018/12/14/53
      
      1. ethernet binding file move to this series.
      2. remove fine tune property in device tree
      3. remove fine tune flow in ethernet driver
      4. set rgmii timing according to the value in device tree,
      and don't care whether phy insert internal delay  or not.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dac95976
    • B
      net-next: stmmac: dwmac-mediatek: remove fine-tune property · 22a3a540
      Biao Huang 提交于
      1. remove fine-tune property and related setting to simplify
      the timing adjustment flow.
      2. set timing value according to the value from device tree,
      and will not care whether PHY insert internal delay.
      Signed-off-by: NBiao Huang <biao.huang@mediatek.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      22a3a540
    • B
      net-next: dt-binding: dwmac-mediatek: remove fine-tune property · a32ed90b
      Biao Huang 提交于
      remove fine-tune property in device tree, modify
      the corresponding description in dt-binding.
      Signed-off-by: NBiao Huang <biao.huang@mediatek.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a32ed90b
    • D
      Merge branch 'neigh-get-support' · 24894bc6
      David S. Miller 提交于
      Roopa Prabhu says:
      
      ====================
      neigh get support
      
      This series adds support for neigh get similar
      to route and recently added fdb get.
      
      v2: fix key len check. and some other fixes
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      24894bc6
    • R
    • R
      neighbour: register rtnl doit handler · 82cbb5c6
      Roopa Prabhu 提交于
      this patch registers neigh doit handler. The doit handler
      returns a neigh entry given dst and dev. This is similar
      to route and fdb doit (get) handlers. Also moves nda_policy
      declaration from rtnetlink.c to neighbour.c
      Signed-off-by: NRoopa Prabhu <roopa@cumulusnetworks.com>
      Reviewed-by: NDavid Ahern <dsa@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      82cbb5c6
    • D
      Merge branch 'mlxsw-Make-driver-more-robust' · 4ab0edec
      David S. Miller 提交于
      Ido Schimmel says:
      
      ====================
      mlxsw: Make driver more robust
      
      In recent months we fixed several bugs in the driver that could have
      been avoided by re-evaluating some of the involved code paths and by
      introducing relevant and comprehensive test cases.
      
      This patchset tries to do that by introducing a set of small and mostly
      non-functional changes in addition to a new test. I have further
      improvements in mind, but they can be done in a different set.
      
      Patch #1 makes sure we correctly sanitize upper devices of a VLAN
      interface.
      
      Patch #2 removes an unexpected behavior from the driver, in which routes
      configured on a VLAN interface will cease being offloaded after certain
      operations.
      
      Patch #3 is a small cleanup.
      
      Patch #4 simplifies the driver by removing reference counting from VLAN
      entries configured on a port.
      
      Patches #5-#6 simplify linking/unlinking from a bridge, especially when
      LAG and VLAN devices are involved. They make both operations symmetric
      even when ports are unlinked from a bridged LAG device.
      
      Patch #7-#9 make router interface (RIF) deletion more robust by removing
      reliance on device chain to indicate whether a NETDEV_DOWN event in the
      inet{,6}addr notification chains should be processed. This is due to the
      fact that IP addresses can be flushed from a netdev after it was
      unlinked from its lower device.
      
      Patch #10 adds a new test to for valid and invalid configurations over
      mlxsw ports. Some of the test cases are derived from recent fixes. I
      expect that more test cases will be added over time.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4ab0edec
    • I
      selftests: mlxsw: Add rtnetlink tests · 489c25f9
      Ido Schimmel 提交于
      Add a new test that is focused on rtnetlink configuration. Its purpose
      is to test valid and invalid (as deemed by mlxsw) configurations and
      make sure that they succeed / fail without producing a trace.
      
      Some of the test cases are derived from recent fixes in order to make
      sure that the fixed bugs are not introduced again.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      489c25f9
    • I
      mlxsw: spectrum_router: Hold a reference on RIF's netdev · b61cd7c6
      Ido Schimmel 提交于
      Previous patches tried to make RIF deletion more robust and avoid
      use-after-free situations.
      
      As another precaution, hold a reference on a RIF's netdev and release it
      when the RIF is deleted.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b61cd7c6
    • I
      mlxsw: spectrum_router: Make RIF deletion more robust · 965fa8e6
      Ido Schimmel 提交于
      In the past we had multiple instances where RIFs were not properly
      deleted.
      
      One of the reasons for leaking a RIF was that at the time when IP
      addresses were flushed from the respective netdev (prompting the
      destruction of the RIF), the netdev was no longer a mlxsw upper. This
      caused the inet{,6}addr notification blocks to ignore the NETDEV_DOWN
      event and leak the RIF.
      
      Instead of checking whether the netdev is our upper when an IP address
      is removed, we can instead check if the netdev has a RIF configured.
      
      To look up a RIF we need to access mlxsw private data, so the patch
      stores the notification blocks inside a mlxsw struct. This then allows
      us to use container_of() and extract the required private data.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      965fa8e6
    • I
      mlxsw: spectrum_router: Propagate 'struct mlxsw_sp' further · 21ffedb6
      Ido Schimmel 提交于
      Next patch is going to make RIF deletion more robust by removing
      reliance on fragile mlxsw_sp_lower_get(). This is because a netdev is
      not necessarily our upper anymore when its IP addresses are flushed.
      
      The inet{,6}addr notification blocks are going to resolve 'struct
      mlxsw_sp' using container_of(), but the functions they call still use
      mlxsw_sp_lower_get().
      
      As a preparation for the next patch, propagate 'struct mlxsw_sp' down to
      the functions called from the notification blocks and remove reliance on
      mlxsw_sp_lower_get().
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      21ffedb6
    • I
      mlxsw: spectrum: Properly cleanup LAG uppers when removing port from LAG · be2d6f42
      Ido Schimmel 提交于
      When a LAG device or a VLAN device on top of it is enslaved to a bridge,
      the driver propagates the CHANGEUPPER event to the LAG's slaves.
      
      This causes each physical port to increase the reference count of the
      internal representation of the bridge port by calling
      mlxsw_sp_port_bridge_join().
      
      However, when a port is removed from a LAG, the corresponding leave()
      function is not called and the reference count is not decremented. This
      leads to ugly hacks such as mlxsw_sp_bridge_port_should_destroy() that
      try to understand if the bridge port should be destroyed even when its
      reference count is not 0.
      
      Instead, make sure that when a port is unlinked from a LAG it would see
      the same events as if the LAG (or its uppers) were unlinked from a
      bridge.
      
      The above is achieved by walking the LAG's uppers when a port is
      unlinked and calling mlxsw_sp_port_bridge_leave() for each upper that is
      enslaved to a bridge.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      be2d6f42
    • I
      mlxsw: spectrum: Remove reference count from VLAN entries · 635c8c8b
      Ido Schimmel 提交于
      Commit b3529af6 ("spectrum: Reference count VLAN entries") started
      reference counting port-VLAN entries in a similar fashion to the 8021q
      driver.
      
      However, this is not actually needed and only complicates things.
      Instead, the driver should forbid the creation of a VLAN on a port if
      this VLAN already exists. This would also solve the issue fixed by the
      mentioned commit.
      
      Therefore, remove the get()/put() API and use create()/destroy()
      instead.
      
      One place that needs special attention is VLAN addition in a VLAN-aware
      bridge via switchdev operations. In case the VLAN flags (e.g., 'pvid')
      are toggled, then the VLAN entry already exists. To prevent the driver
      from wrongly returning EEXIST, the driver is changed to check in the
      prepare phase whether the entry already exists and only returns an error
      in case it is not associated with the correct bridge port.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      635c8c8b
    • I
      mlxsw: spectrum: Handle VLAN device unlinking · e149113a
      Ido Schimmel 提交于
      In commit 993107fe ("mlxsw: spectrum_switchdev: Fix VLAN device
      deletion via ioctl") I fixed a bug caused by the fact that the driver
      views differently the deletion of a VLAN device when it is deleted via
      an ioctl and netlink.
      
      Instead of relying on a specific order of events (device being
      unregistered vs. VLAN filter being updated), simply make sure that the
      driver performs the necessary cleanup when the VLAN device is unlinked,
      which always happens before the other two events.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e149113a
    • I
      mlxsw: spectrum_fid: Remove unused function · f1d7c33d
      Ido Schimmel 提交于
      This function is no longer used. Remove it.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f1d7c33d
    • I
      mlxsw: spectrum_router: Do not destroy RIFs based on FID's reference count · 32fd4b49
      Ido Schimmel 提交于
      Currently, when a RIF is constructed on top of a FID, the RIF increments
      the FID's reference count and the RIF is destroyed when the FID's
      reference count drops to 1. This effectively means that when no local
      ports are member in the FID, the FID is destroyed regardless if the
      router port is a member in the FID or not.
      
      The above can lead to the unexpected behavior in which routes using a
      VLAN interface as their nexthop device are no longer offloaded after the
      last local port leaves the corresponding VLAN (FID).
      
      Example:
      # ip -4 route show dev br0.10
      192.0.2.0/24 proto kernel scope link src 192.0.2.1 offload
      # bridge vlan del vid 10 dev swp3
      # ip -4 route show dev br0.10
      192.0.2.0/24 proto kernel scope link src 192.0.2.1
      
      After the patch, the route is offloaded before and after the VLAN is
      removed from local port 'swp3', as the RIF corresponding to 'br0.10'
      continues to exists.
      
      In order to remove RIFs' reliance on the underlying FID's reference
      count, we need to add a reference count to sub-port RIFs, which are RIFs
      that correspond to physical ports and their uppers (e.g., LAG devices).
      
      In this case, each {Port, VID} ('struct mlxsw_sp_port_vlan') needs to
      hold a reference on the RIF. For example:
      
                             bond0.10
                                |
                              bond0
                                |
                            +-------+
                            |       |
                          swp1    swp2
      
      Both {Port 1, VID 10} and {Port 2, VID 10} will hold a reference on the
      RIF corresponding to 'bond0.10'. When the last reference is dropped, the
      RIF will be destroyed.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      32fd4b49
    • I
      mlxsw: spectrum: Sanitize VLAN interface's uppers · 927d0ef1
      Ido Schimmel 提交于
      Currently, only VRF and macvlan uppers are supported on top of VLAN
      device configured over a bridge, so make sure the driver forbids other
      uppers.
      
      Note that enslavement to a VRF is handled earlier in the notification
      block, so there is no need to check for a VRF upper here.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      927d0ef1
    • H
      tipc: fix uninitialized value for broadcast retransmission · 05572271
      Hoang Le 提交于
      When sending broadcast message on high load system, there are a lot of
      unnecessary packets restranmission. That issue was caused by missing in
      initial criteria for retransmission.
      
      To prevent this happen, just initialize this criteria for retransmission
      in next 10 milliseconds.
      
      Fixes: 31c4f4cc ("tipc: improve broadcast retransmission algorithm")
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Acked-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NHoang Le <hoang.h.le@dektech.com.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      05572271
    • D
      Merge branch 'tipc-tracepoints' · 013dc9d5
      David S. Miller 提交于
      Tuong Lien says:
      
      ====================
      tipc: tracepoints and trace_events in TIPC
      
      The patch series is the first step of introducing a tracing framework in
      TIPC, which will assist in collecting complete & plentiful data for post
      analysis, even in the case of a single failure occurrence e.g. when the
      failure is unreproducible.
      
      The tracing code in TIPC utilizes the powerful kernel tracepoints, trace
      events features along with particular dump functions to trace the TIPC
      object data and events (incl. bearer, link, socket, node, etc.).
      
      The tracing code should generate zero-load to TIPC when the trace events
      are not enabled.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      013dc9d5
    • T
      tipc: add trace_events for tipc bearer · cf5f55f7
      Tuong Lien 提交于
      The commit adds the new trace_event for TIPC bearer, L2 device event:
      
      trace_tipc_l2_device_event()
      
      Also, it puts the trace at the tipc_l2_device_event() function, then
      the device/bearer events and related info can be traced out during
      runtime when needed.
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Tested-by: NYing Xue <ying.xue@windriver.com>
      Acked-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NTuong Lien <tuong.t.lien@dektech.com.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cf5f55f7
    • T
      tipc: add trace_events for tipc node · eb18a510
      Tuong Lien 提交于
      The commit adds the new trace_events for TIPC node object:
      
      trace_tipc_node_create()
      trace_tipc_node_delete()
      trace_tipc_node_lost_contact()
      trace_tipc_node_timeout()
      trace_tipc_node_link_up()
      trace_tipc_node_link_down()
      trace_tipc_node_reset_links()
      trace_tipc_node_fsm_evt()
      trace_tipc_node_check_state()
      
      Also, enables the traces for the following cases:
      - When a node is created/deleted;
      - When a node contact is lost;
      - When a node timer is timed out;
      - When a node link is up/down;
      - When all node links are reset;
      - When node state is changed;
      - When a skb comes and node state needs to be checked/updated.
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Tested-by: NYing Xue <ying.xue@windriver.com>
      Acked-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NTuong Lien <tuong.t.lien@dektech.com.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      eb18a510
    • T
      tipc: add trace_events for tipc socket · 01e661eb
      Tuong Lien 提交于
      The commit adds the new trace_events for TIPC socket object:
      
      trace_tipc_sk_create()
      trace_tipc_sk_poll()
      trace_tipc_sk_sendmsg()
      trace_tipc_sk_sendmcast()
      trace_tipc_sk_sendstream()
      trace_tipc_sk_filter_rcv()
      trace_tipc_sk_advance_rx()
      trace_tipc_sk_rej_msg()
      trace_tipc_sk_drop_msg()
      trace_tipc_sk_release()
      trace_tipc_sk_shutdown()
      trace_tipc_sk_overlimit1()
      trace_tipc_sk_overlimit2()
      
      Also, enables the traces for the following cases:
      - When user creates a TIPC socket;
      - When user calls poll() on TIPC socket;
      - When user sends a dgram/mcast/stream message.
      - When a message is put into the socket 'sk_receive_queue';
      - When a message is released from the socket 'sk_receive_queue';
      - When a message is rejected (e.g. due to no port, invalid, etc.);
      - When a message is dropped (e.g. due to wrong message type);
      - When socket is released;
      - When socket is shutdown;
      - When socket rcvq's allocation is overlimit (> 90%);
      - When socket rcvq + bklq's allocation is overlimit (> 90%);
      - When the 'TIPC_ERR_OVERLOAD/2' issue happens;
      
      Note:
      a) All the socket traces are designed to be able to trace on a specific
      socket by either using the 'event filtering' feature on a known socket
      'portid' value or the sysctl file:
      
      /proc/sys/net/tipc/sk_filter
      
      The file determines a 'tuple' for what socket should be traced:
      
      (portid, sock type, name type, name lower, name upper)
      
      where:
      + 'portid' is the socket portid generated at socket creating, can be
      found in the trace outputs or the 'tipc socket list' command printouts;
      + 'sock type' is the socket type (1 = SOCK_TREAM, ...);
      + 'name type', 'name lower' and 'name upper' are the service name being
      connected to or published by the socket.
      
      Value '0' means 'ANY', the default tuple value is (0, 0, 0, 0, 0) i.e.
      the traces happen for every sockets with no filter.
      
      b) The 'tipc_sk_overlimit1/2' event is also a conditional trace_event
      which happens when the socket receive queue (and backlog queue) is
      about to be overloaded, when the queue allocation is > 90%. Then, when
      the trace is enabled, the last skbs leading to the TIPC_ERR_OVERLOAD/2
      issue can be traced.
      
      The trace event is designed as an 'upper watermark' notification that
      the other traces (e.g. 'tipc_sk_advance_rx' vs 'tipc_sk_filter_rcv') or
      actions can be triggerred in the meanwhile to see what is going on with
      the socket queue.
      
      In addition, the 'trace_tipc_sk_dump()' is also placed at the
      'TIPC_ERR_OVERLOAD/2' case, so the socket and last skb can be dumped
      for post-analysis.
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Tested-by: NYing Xue <ying.xue@windriver.com>
      Acked-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NTuong Lien <tuong.t.lien@dektech.com.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      01e661eb
    • T
      tipc: add trace_events for tipc link · 26574db0
      Tuong Lien 提交于
      The commit adds the new trace_events for TIPC link object:
      
      trace_tipc_link_timeout()
      trace_tipc_link_fsm()
      trace_tipc_link_reset()
      trace_tipc_link_too_silent()
      trace_tipc_link_retrans()
      trace_tipc_link_bc_ack()
      trace_tipc_link_conges()
      
      And the traces for PROTOCOL messages at building and receiving:
      
      trace_tipc_proto_build()
      trace_tipc_proto_rcv()
      
      Note:
      a) The 'tipc_link_too_silent' event will only happen when the
      'silent_intv_cnt' is about to reach the 'abort_limit' value (and the
      event is enabled). The benefit for this kind of event is that we can
      get an early indication about TIPC link loss issue due to timeout, then
      can do some necessary actions for troubleshooting.
      
      For example: To trigger the 'tipc_proto_rcv' when the 'too_silent'
      event occurs:
      
      echo 'enable_event:tipc:tipc_proto_rcv' > \
            events/tipc/tipc_link_too_silent/trigger
      
      And disable it when TIPC link is reset:
      
      echo 'disable_event:tipc:tipc_proto_rcv' > \
            events/tipc/tipc_link_reset/trigger
      
      b) The 'tipc_link_retrans' or 'tipc_link_bc_ack' event is useful to
      trace TIPC retransmission issues.
      
      In addition, the commit adds the 'trace_tipc_list/link_dump()' at the
      'retransmission failure' case. Then, if the issue occurs, the link
      'transmq' along with the link data can be dumped for post-analysis.
      These dump events should be enabled by default since it will only take
      effect when the failure happens.
      
      The same approach is also applied for the faulty case that the
      validation of protocol message is failed.
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Tested-by: NYing Xue <ying.xue@windriver.com>
      Acked-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NTuong Lien <tuong.t.lien@dektech.com.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      26574db0
    • T
      tipc: enable tracepoints in tipc · b4b9771b
      Tuong Lien 提交于
      As for the sake of debugging/tracing, the commit enables tracepoints in
      TIPC along with some general trace_events as shown below. It also
      defines some 'tipc_*_dump()' functions that allow to dump TIPC object
      data whenever needed, that is, for general debug purposes, ie. not just
      for the trace_events.
      
      The following trace_events are now available:
      
      - trace_tipc_skb_dump(): allows to trace and dump TIPC msg & skb data,
        e.g. message type, user, droppable, skb truesize, cloned skb, etc.
      
      - trace_tipc_list_dump(): allows to trace and dump any TIPC buffers or
        queues, e.g. TIPC link transmq, socket receive queue, etc.
      
      - trace_tipc_sk_dump(): allows to trace and dump TIPC socket data, e.g.
        sk state, sk type, connection type, rmem_alloc, socket queues, etc.
      
      - trace_tipc_link_dump(): allows to trace and dump TIPC link data, e.g.
        link state, silent_intv_cnt, gap, bc_gap, link queues, etc.
      
      - trace_tipc_node_dump(): allows to trace and dump TIPC node data, e.g.
        node state, active links, capabilities, link entries, etc.
      
      How to use:
      Put the trace functions at any places where we want to dump TIPC data
      or events.
      
      Note:
      a) The dump functions will generate raw data only, that is, to offload
      the trace event's processing, it can require a tool or script to parse
      the data but this should be simple.
      
      b) The trace_tipc_*_dump() should be reserved for a failure cases only
      (e.g. the retransmission failure case) or where we do not expect to
      happen too often, then we can consider enabling these events by default
      since they will almost not take any effects under normal conditions,
      but once the rare condition or failure occurs, we get the dumped data
      fully for post-analysis.
      
      For other trace purposes, we can reuse these trace classes as template
      but different events.
      
      c) A trace_event is only effective when we enable it. To enable the
      TIPC trace_events, echo 1 to 'enable' files in the events/tipc/
      directory in the 'debugfs' file system. Normally, they are located at:
      
      /sys/kernel/debug/tracing/events/tipc/
      
      For example:
      
      To enable the tipc_link_dump event:
      
      echo 1 > /sys/kernel/debug/tracing/events/tipc/tipc_link_dump/enable
      
      To enable all the TIPC trace_events:
      
      echo 1 > /sys/kernel/debug/tracing/events/tipc/enable
      
      To collect the trace data:
      
      cat trace
      
      or
      
      cat trace_pipe > /trace.out &
      
      To disable all the TIPC trace_events:
      
      echo 0 > /sys/kernel/debug/tracing/events/tipc/enable
      
      To clear the trace buffer:
      
      echo > trace
      
      d) Like the other trace_events, the feature like 'filter' or 'trigger'
      is also usable for the tipc trace_events.
      For more details, have a look at:
      
      Documentation/trace/ftrace.txt
      
      MAINTAINERS | add two new files 'trace.h' & 'trace.c' in tipc
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Tested-by: NYing Xue <ying.xue@windriver.com>
      Acked-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NTuong Lien <tuong.t.lien@dektech.com.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b4b9771b