1. 05 2月, 2015 1 次提交
    • E
      xps: fix xps for stacked devices · 2bd82484
      Eric Dumazet 提交于
      A typical qdisc setup is the following :
      
      bond0 : bonding device, using HTB hierarchy
      eth1/eth2 : slaves, multiqueue NIC, using MQ + FQ qdisc
      
      XPS allows to spread packets on specific tx queues, based on the cpu
      doing the send.
      
      Problem is that dequeues from bond0 qdisc can happen on random cpus,
      due to the fact that qdisc_run() can dequeue a batch of packets.
      
      CPUA -> queue packet P1 on bond0 qdisc, P1->ooo_okay=1
      CPUA -> queue packet P2 on bond0 qdisc, P2->ooo_okay=0
      
      CPUB -> dequeue packet P1 from bond0
              enqueue packet on eth1/eth2
      CPUC -> dequeue packet P2 from bond0
              enqueue packet on eth1/eth2 using sk cache (ooo_okay is 0)
      
      get_xps_queue() then might select wrong queue for P1, since current cpu
      might be different than CPUA.
      
      P2 might be sent on the old queue (stored in sk->sk_tx_queue_mapping),
      if CPUC runs a bit faster (or CPUB spins a bit on qdisc lock)
      
      Effect of this bug is TCP reorders, and more generally not optimal
      TX queue placement. (A victim bulk flow can be migrated to the wrong TX
      queue for a while)
      
      To fix this, we have to record sender cpu number the first time
      dev_queue_xmit() is called for one tx skb.
      
      We can union napi_id (used on receive path) and sender_cpu,
      granted we clear sender_cpu in skb_scrub_packet() (credit to Willem for
      this union idea)
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Cc: Willem de Bruijn <willemb@google.com>
      Cc: Nandita Dukkipati <nanditad@google.com>
      Cc: Yuchung Cheng <ycheng@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2bd82484
  2. 04 2月, 2015 5 次提交
  3. 03 2月, 2015 16 次提交
  4. 02 2月, 2015 18 次提交
    • D
      net: rocker: Add support for retrieving port level statistics · 9766e97a
      David Ahern 提交于
      Add support for retrieving port level statistics from device.
      Hook is added for ethtool's stats functionality. For example,
      
      $ ethtool -S eth3
      NIC statistics:
           rx_packets: 12
           rx_bytes: 2790
           rx_dropped: 0
           rx_errors: 0
           tx_packets: 8
           tx_bytes: 728
           tx_dropped: 0
           tx_errors: 0
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Acked-by: NScott Feldman <sfeldma@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9766e97a
    • D
      Merge branch 'switchdev_offload_flags' · fe3ef616
      David S. Miller 提交于
      Roopa Prabhu says:
      
      ====================
      switchdev offload flags
      
      This patch series introduces new offload flags for switchdev.
      Kernel network subsystems can use this flag to accelerate
      network functions by offloading to hw.
      
      I expect that there will be need for subsystem specific feature
      flag in the future.
      
      This patch series currently only addresses bridge driver link
      attribute offloads to hardware.
      
      Looking at the current state of bridge l2 offload in the kernel,
          - flag 'self' is the way to directly manage the bridge device in hw via
            the ndo_bridge_setlink/ndo_bridge_getlink calls
      
          - flag 'master' is always used to manage the in kernel bridge devices
            via the same ndo_bridge_setlink/ndo_bridge_getlink calls
      
      Today these are used separately. The nic offloads use hwmode "vepa/veb" to go
      directly to hw with the "self" flag.
      
      At this point i am trying not to introduce any new user facing flags/attributes.
      In the model where we want the kernel bridging to be accelerated with
      hardware, we very much want the bridge driver to be involved.
      
      In this proposal,
      - The offload flag/bit helps switch asic drivers to indicate that they
        accelerate the kernel networking objects/functions
      - The user does not have to specify a new flag to do so. A bridge created with
        switch asic ports will be accelerated if the switch driver supports it.
      - The user can continue to directly manage l2 in nics (ixgbe) using the
        existing hwmode/self flags
      - It also does not stop users from using the 'self' flag to talk to the
        switch asic driver directly
      - Involving the bridge driver makes sure the add/del notifications to user
        space go out after both kernel and hardware are programmed
      
      (To selectively offload bridge port attributes,
      example learning in hw only etc, we can introduce offload bits for
      per bridge port flag attribute as in my previous patch
      https://patchwork.ozlabs.org/patch/413211/. I have not included that in this
      series)
      
      v2
         - try a different name for the offload flag/bit
         - tries to solve the stacked netdev case by traversing the lowerdev
           list to reach the switch port
      
      v3 -
          - Tested with bond as bridge port for the stacked device case.
            Includes a bond_fix_features change to not ignore the
            NETIF_F_HW_NETFUNC_OFFLOAD flag
          - Some checkpatch fixes
      
      v4 -
          - rename flag to NETIF_F_HW_SWITCH_OFFLOAD
          - add ndo_bridge_setlink/dellink handlers in bond and team drivers as
            suggested by jiri.
          - introduce default ndo_dflt_netdev_switch_port_bridge_setlink/dellink
          handlers that masters can use to call offload api on lowerdevs.
      ====================
      Signed-off-by: NRoopa Prabhu <roopa@cumulusnetworks.com>
      fe3ef616
    • R
      team: handle NETIF_F_HW_SWITCH_OFFLOAD flag and add ndo_bridge_setlink/dellink handlers · a16a8ee7
      Roopa Prabhu 提交于
      Currently ndo_bridge_setlink and ndo_bridge_dellink handlers point
      to the default switchdev handlers
      
      This follows my bonding driver changes.
      
      I have only compile tested this patch. However similar
      bonding code has been tested.
      Signed-off-by: NRoopa Prabhu <roopa@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a16a8ee7
    • R
      bonding: handle NETIF_F_HW_SWITCH_OFFLOAD flag and add ndo_bridge_setlink/dellink handlers · c158cba3
      Roopa Prabhu 提交于
      We want bond to pick up the offload flag if any of its slaves have it.
      
      NETIF_F_HW_SWITCH_OFFLOAD flag is added to the mask, so that
      netdev_increment_features does not ignore it.
      
      This also adds ndo_bridge_setlink and ndo_bridge_dellink handlers.
      These currently point to the default handlers provided by the
      switchdev api.
      Signed-off-by: NRoopa Prabhu <roopa@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c158cba3
    • R
      rocker: set feature NETIF_F_HW_SWITCH_OFFLOAD · eb0ac420
      Roopa Prabhu 提交于
      This patch sets the NETIF_F_HW_SWITCH_OFFLOAD feature flag on rocker ports
      Signed-off-by: NRoopa Prabhu <roopa@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      eb0ac420
    • R
      bridge: offload bridge port attributes to switch asic if feature flag set · 68e331c7
      Roopa Prabhu 提交于
      This patch adds support to set/del bridge port attributes in hardware from
      the bridge driver.
      
      With this, when the user sends a bridge setlink message with no flags or
      master flags set,
         - the bridge driver ndo_bridge_setlink handler sets settings in the kernel
         - calls the swicthdev api to propagate the attrs to the switchdev
      	hardware
      
         You can still use the self flag to go to the switch hw or switch port
         driver directly.
      
      With this, it also makes sure a notification goes out only after the
      attributes are set both in the kernel and hw.
      
      The patch calls switchdev api only if BRIDGE_FLAGS_SELF is not set.
      This is because the offload cases with BRIDGE_FLAGS_SELF are handled in
      the caller (in rtnetlink.c).
      Signed-off-by: NRoopa Prabhu <roopa@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      68e331c7
    • R
      swdevice: add new apis to set and del bridge port attributes · 8a44dbb2
      Roopa Prabhu 提交于
      This patch adds two new api's netdev_switch_port_bridge_setlink
      and netdev_switch_port_bridge_dellink to offload bridge port attributes
      to switch port
      
      (The names of the apis look odd with 'switch_port_bridge',
      but am more inclined to change the prefix of the api to something else.
      Will take any suggestions).
      
      The api's look at the NETIF_F_HW_SWITCH_OFFLOAD feature flag to
      pass bridge port attributes to the port device.
      Signed-off-by: NRoopa Prabhu <roopa@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8a44dbb2
    • R
      bridge: add flags argument to ndo_bridge_setlink and ndo_bridge_dellink · add511b3
      Roopa Prabhu 提交于
      bridge flags are needed inside ndo_bridge_setlink/dellink handlers to
      avoid another call to parse IFLA_AF_SPEC inside these handlers
      
      This is used later in this series
      Signed-off-by: NRoopa Prabhu <roopa@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      add511b3
    • R
      netdev: introduce new NETIF_F_HW_SWITCH_OFFLOAD feature flag for switch device offloads · aafb3e98
      Roopa Prabhu 提交于
      This is a high level feature flag for all switch asic offloads
      
      switch drivers set this flag on switch ports. Logical devices like
      bridge, bonds, vxlans can inherit this flag from their slaves/ports.
      
      The patch also adds the flag to NETIF_F_ONE_FOR_ALL, so that it gets
      propagated to the upperdevices (bridges and bonds).
      Signed-off-by: NRoopa Prabhu <roopa@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aafb3e98
    • S
      stmmac: DMA threshold mode or SF mode can be different among multiple device instance · b2dec116
      Sonic Zhang 提交于
      - In tx_hard_error_bump_tc interrupt, tc should be bumped only when current
      device instance is in DMA threshold mode. Check per device xstats.threshold
      other than global tc.
      
      - Set per device xstats.threshold to SF_DMA_MODE when current device
      instance is set to SF mode.
      
      v2-changes:
      - fix ident style
      Signed-off-by: NSonic Zhang <sonic.zhang@analog.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b2dec116
    • H
      cxgb4: Remove preprocessor check for CONFIG_CXGB4_DCB · 3051fa61
      Hariprasad Shenai 提交于
      In commit dc9daab2 ("cxgb4: Added support in debugfs to dump
      sge_qinfo") a preprocessor check for CONFIG_CXGB4_DCB got added, which should
      have been CONFIG_CHELSIO_T4_DCB. After adding the right preprocessor, build
      fails due to missing function ethqset2pinfo. Fixing that as well.
      
      V2: Updated description since the patch also fixes build failure
      Reported-by: NPaul Bolle <pebolle@tiscal.nl>
      Signed-off-by: NHariprasad Shenai <hariprasad@chelsio.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3051fa61
    • D
      Merge branch 'hso-next' · 2caabb3d
      David S. Miller 提交于
      Olivier Sobrie says:
      
      ====================
      hso: fix some problems in the disconnect path
      
      These patches attempt to fix some problems I observed when the hso
      device is disconnected.
      Several patches of this serie are fixing crashes or memleaks when a
      hso device is disconnected.
      This serie of patches is based on v3.18.
      
      changes in v2:
       - Last patch of the serie dropped since another patch fix the issue.
         See http://marc.info/?l=linux-usb&m=142186699418489 for more info.
      
       - Added an extra patch avoiding name conflicts for the rfkill interface.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2caabb3d
    • O
      hso: fix rfkill name conflicts · 38121067
      Olivier Sobrie 提交于
      By using only the usb interface number for the rfkill name, we might
      have a name conflicts in case two similar hso devices are connected.
      
      In this patch, the name of the hso rfkill interface embed the value
      of a counter that is incremented each time a new rfkill interface is
      added.
      Suggested-by: NDan Williams <dcbw@redhat.com>
      Signed-off-by: NOlivier Sobrie <olivier@sobrie.be>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      38121067
    • O
      hso: add missing cancel_work_sync in disconnect() · cc491970
      Olivier Sobrie 提交于
      For hso serial devices, two cancel_work_sync were missing in the
      disconnect method.
      Signed-off-by: NOlivier Sobrie <olivier@sobrie.be>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cc491970
    • O
      hso: update serial_table in usb disconnect method · 301d3b7e
      Olivier Sobrie 提交于
      The serial_table is used to map the minor number of the usb serial device
      to its associated context. The table is updated in the probe method and
      in hso_serial_ref_free() which is called either from the tty cleanup
      method or from the usb disconnect method.
      This patch ensures that the serial_table is updated in the disconnect
      method and no more from the cleanup method to avoid the following
      potential race condition.
      
       - hso_disconnect() is called for usb interface "x". Because the serial
         port was open and because the cleanup method of the tty_port hasn't
         been called yet, hso_serial_ref_free() is not run.
       - hso_probe() is called and fails for a new hso serial usb interface
         "y". The function hso_free_interface() is called and iterates
         over the element of serial_table to find the device associated to
         the usb interface context.
         If the usb interface context of usb interface "y" has been created
         at the same place as for usb interface "x", then the cleanup
         functions are called for usb interfaces "x" and "y" and
         hso_serial_ref_free() is called for both interfaces.
       - release_tty() is called for serial port linked to usb interface "x"
         and possibly crash because the tty_port structure contained in the
         hso_device structure has been freed.
      Signed-off-by: NOlivier Sobrie <olivier@sobrie.be>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      301d3b7e
    • O
      hso: move tty_unregister outside hso_serial_common_free() · 69b377b3
      Olivier Sobrie 提交于
      The function hso_serial_common_free() is called either by the cleanup
      method of the tty or by the usb disconnect method.
      In the former case, the usb_disconnect() has been already called
      and the sysfs group associated to the device has been removed.
      By calling tty_unregister directly from the usb_disconnect() method,
      we avoid a warning due to the removal of the sysfs group of the usb
      device.
      
      Example of warning:
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 778 at fs/sysfs/group.c:225 sysfs_remove_group+0x50/0x94()
      sysfs group c0645a88 not found for kobject 'ttyHS5'
      Modules linked in:
      CPU: 0 PID: 778 Comm: kworker/0:3 Tainted: G        W      3.18.0+ #105
      Workqueue: events release_one_tty
      [<c000dfe4>] (unwind_backtrace) from [<c000c014>] (show_stack+0x14/0x1c)
      [<c000c014>] (show_stack) from [<c0016bac>] (warn_slowpath_common+0x5c/0x7c)
      [<c0016bac>] (warn_slowpath_common) from [<c0016c60>] (warn_slowpath_fmt+0x30/0x40)
      [<c0016c60>] (warn_slowpath_fmt) from [<c00ddd14>] (sysfs_remove_group+0x50/0x94)
      [<c00ddd14>] (sysfs_remove_group) from [<c0221e44>] (device_del+0x30/0x190)
      [<c0221e44>] (device_del) from [<c0221fb0>] (device_unregister+0xc/0x18)
      [<c0221fb0>] (device_unregister) from [<c0221fec>] (device_destroy+0x30/0x3c)
      [<c0221fec>] (device_destroy) from [<c01fe1dc>] (tty_unregister_device+0x2c/0x5c)
      [<c01fe1dc>] (tty_unregister_device) from [<c029a428>] (hso_serial_common_free+0x2c/0x88)
      [<c029a428>] (hso_serial_common_free) from [<c029a4c0>] (hso_serial_ref_free+0x3c/0xb8)
      [<c029a4c0>] (hso_serial_ref_free) from [<c01ff430>] (release_one_tty+0x30/0x84)
      [<c01ff430>] (release_one_tty) from [<c00271d4>] (process_one_work+0x21c/0x3c8)
      [<c00271d4>] (process_one_work) from [<c0027758>] (worker_thread+0x3d8/0x560)
      [<c0027758>] (worker_thread) from [<c002be4c>] (kthread+0xc0/0xcc)
      [<c002be4c>] (kthread) from [<c0009630>] (ret_from_fork+0x14/0x24)
      ---[ end trace cb88537fdc8fa208 ]---
      Signed-off-by: NOlivier Sobrie <olivier@sobrie.be>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      69b377b3
    • O
      hso: replace reset_device work by usb_queue_reset_device() · 26c1f1f5
      Olivier Sobrie 提交于
      There is no need for a dedicated reset work in the hso driver since
      there is already a reset work foreseen in usb_interface that does
      the same.
      Signed-off-by: NOlivier Sobrie <olivier@sobrie.be>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      26c1f1f5
    • O
      hso: rename hso_dev into serial in hso_free_interface() · f6516b69
      Olivier Sobrie 提交于
      In other functions of the driver, variables of type "struct hso_serial"
      are denoted by "serial" and variables of type "struct hso_device" are
      denoted by "hso_dev". This patch makes the hso_free_interface()
      consistent with these notations.
      Signed-off-by: NOlivier Sobrie <olivier@sobrie.be>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f6516b69