1. 18 9月, 2020 28 次提交
    • D
      selftests: Set default protocol for raw sockets in nettest · 897217b9
      David Ahern 提交于
      IPPROTO_IP (0) is not valid for raw sockets. Default the protocol for
      raw sockets to IPPROTO_RAW if the protocol has not been set via the -P
      option.
      Signed-off-by: NDavid Ahern <dsahern@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      897217b9
    • Q
    • Q
      net: hsr: Convert to DEFINE_SHOW_ATTRIBUTE · 2170ff08
      Qinglang Miao 提交于
      Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
      Signed-off-by: NQinglang Miao <miaoqinglang@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2170ff08
    • D
      Merge branch 'mlxsw-Support-dcbnl_setbuffer-dcbnl_getbuffer' · 72d61d30
      David S. Miller 提交于
      Ido Schimmel says:
      
      ====================
      mlxsw: Support dcbnl_setbuffer, dcbnl_getbuffer
      
      Petr says:
      
      On Spectrum, port buffers, also called port headroom, is where packets are
      stored while they are parsed and the forwarding decision is being made. For
      lossless traffic flows, in case shared buffer admission is not allowed,
      headroom is also where to put the extra traffic received before the sent
      PAUSE takes effect.
      
      Linux supports two DCB interfaces related to the headroom: dcbnl_setbuffer
      for configuration, and dcbnl_getbuffer for inspection. This patch set
      implements them.
      
      With dcbnl_setbuffer in place, there will be two sources of authority over
      the ingress configuration: the DCB ETS hook, because ETS configuration is
      mirrored to ingress, and the DCB setbuffer hook. mlxsw is in a similar
      situation on the egress side, where there are two sources of the ETS
      configuration: the DCB ETS hook, and the TC qdisc hooks. This is a
      non-intuitive situation, because the way the ASIC ends up being configured
      depends not only on the actual configured bits, but also on the order in
      which they were configured.
      
      To prevent these issues on the ingress side, two configuration modes will
      exist: DCB mode and TC mode. DCB ETS will keep getting projected to ingress
      in the (default) DCB mode. When a qdisc is installed on a port, it will be
      switched to the TC mode, the ingress configuration will be done through the
      dcbnl_setbuffer callback. The reason is that the dcbnl_setbuffer hook is
      not standardized and supported by lldpad. Projecting DCB ETS configuration
      to ingress is a reasonable heuristic to configure ingress especially when
      PFC is in effect.
      
      In patch #1, the toggle between the DCB and TC modes of headroom
      configuration, described above, is introduced.
      
      Patch #2 implements dcbnl_getbuffer and dcbnl_setbuffer. dcbnl_getbuffer
      can be always used to determine the current port headroom configuration.
      dcbnl_setbuffer is only permitted in the TC mode.
      
      In patch #3, make the qdisc module toggle the headroom mode from DCB to TC
      and back, depending on whether there is an offloaded qdisc on the port.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      72d61d30
    • P
      mlxsw: spectrum_qdisc: Disable port buffer autoresize with qdiscs · 509f04ca
      Petr Machata 提交于
      There are two interfaces to configure ETS: qdiscs and DCB. Historically,
      DCB ETS configuration was projected to ingress as well, and configured port
      buffers. Qdisc was not.
      
      Keep qdiscs behaving this way, and if an offloaded qdisc is configured on a
      port, move this port's headroom to a manual mode, thus allowing
      configuration of port buffers through dcbnl_setbuffer.
      Signed-off-by: NPetr Machata <petrm@nvidia.com>
      Reviewed-by: NJiri Pirko <jiri@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      509f04ca
    • P
      mlxsw: spectrum_dcb: Implement dcbnl_setbuffer / getbuffer · 5ebc6031
      Petr Machata 提交于
      Add dcbnl_setbuffer, which bounces requests if a headroom is in DCB mode.
      Implement dcbnl_getbuffer such that it can always be used to determine
      port-buffer configuration, regardless of headroom mode.
      Signed-off-by: NPetr Machata <petrm@nvidia.com>
      Reviewed-by: NJiri Pirko <jiri@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5ebc6031
    • P
      mlxsw: spectrum_buffers: Support two headroom modes · 69e408a2
      Petr Machata 提交于
      There are two interfaces to configure ETS: qdiscs and DCB. Historically,
      DCB ETS configuration was projected to ingress as well, and configured port
      buffers. Qdisc was not.
      
      So as not to break clients that today use DCB ETS and PFC and rely on
      getting a reasonable ingress buffer priomap, keep the ETS mirroring in
      effect.
      
      Since qdiscs have not done this mirroring historically, it is reasonable
      not to introduce it, but rather permit manual ingress configuration through
      dcbnl_setbuffer only in the qdisc mode.
      
      This will require a toggle to indicate whether buffer sizes should be
      autocomputed or taken from dcbnl_setbuffer, and likewise for priomaps.
      Introduce such and initialize it, and guard port buffer size configuration
      as appropriate. The toggle is currently left in the DCB position. In a
      following patch, qdisc code will switch it.
      Signed-off-by: NPetr Machata <petrm@nvidia.com>
      Reviewed-by: NJiri Pirko <jiri@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      69e408a2
    • Y
      netlink: add spaces around '&' in netlink_recv/sendmsg() · 4d11af5d
      Yang Yingliang 提交于
      It's hard to read the code without spaces around '&',
      for better reading, add spaces around '&'.
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4d11af5d
    • Y
      netdev: Remove unused functions · 2492c205
      YueHaibing 提交于
      There is no callers in tree, so can remove it.
      Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
      Reviewed-by: NSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2492c205
    • Y
      mptcp: Fix unsigned 'max_seq' compared with zero in mptcp_data_queue_ofo · c2ec6bc0
      Ye Bin 提交于
      Fixes coccicheck warnig:
      net/mptcp/protocol.c:164:11-18: WARNING: Unsigned expression compared with zero: max_seq > 0
      
      Fixes: ab174ad8 ("mptcp: move ooo skbs into msk out of order queue")
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Signed-off-by: NYe Bin <yebin10@huawei.com>
      Acked-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c2ec6bc0
    • D
      Merge branch... · 3ce406bd
      David S. Miller 提交于
      Merge branch 'net-marvell-prestera-Add-Switchdev-driver-for-Prestera-family-ASIC-device-98DX3255-AC3x'
      
      Vadym Kochan says:
      
      ====================
      net: marvell: prestera: Add Switchdev driver for Prestera family ASIC device 98DX3255 (AC3x)
      
      Marvell Prestera 98DX3255 integrates up to 24 ports of 1GbE with 8
      ports of 10GbE uplinks or 2 ports of 40Gbps stacking for a largely
      wireless SMB deployment.
      
      Prestera Switchdev is a firmware based driver that operates via PCI bus.  The
      current implementation supports only boards designed for the Marvell Switchdev
      solution and requires special firmware.
      
      This driver implementation includes only L1, basic L2 support, and RX/TX.
      
      The core Prestera switching logic is implemented in prestera_main.c, there is
      an intermediate hw layer between core logic and firmware. It is
      implemented in prestera_hw.c, the purpose of it is to encapsulate hw
      related logic, in future there is a plan to support more devices with
      different HW related configurations.
      
      The following Switchdev features are supported:
      
          - VLAN-aware bridge offloading
          - VLAN-unaware bridge offloading
          - FDB offloading (learning, ageing)
          - Switchport configuration
      
      The original firmware image is uploaded to the linux-firmware repository.
      
      PATCH v9:
          1) Replace read_poll_timeout_atomic() by original 'do {} while()' loop
             because it works much better than read_poll_timeout_atomic()
             considering the TX rate. Also it fixes warning reported on v8.
      
          2) Use ENOENT instead of EEXIST when item is not found in few
             places - prestera_hw.c and prestera_rxtx.c
      
          Patches updated:
              [1] net: marvell: prestera: Add driver for Prestera family ASIC devices
      
      PATCH v8:
          1) Put license in one line.
      
          2) Sort includes.
      
          3) Add missing comma for last enum member
      
          4) Return original error code from last called func
             in places where instead other error code was used.
      
          5) Add comma for last member in initialized struct in prestera_hw.c
      
          6) Do not initialize 'int err = 0' where it is not needed.
      
          7) Simplify device-tree "marvell,prestera" node parsing by removing not
             needed checking on 'np == NULL'.
      
          8) Use u32p_replace_bits() instead of open-coded ((word & ~mask) | val)
      
          9) Use dev_warn_ratelimited() instead of pr_warn_ratelimited to indicate the device
              instance in prestera_rxtx.c
      
          10) Simplify circular buffer list creation in prestera_sdma_{rx,tx}_init() by using
              do { } while (prev != tail) construction.
      
          11) Use MSEC_PER_SEC instead of hard-coded 1000.
      
          12) Use traditional error handling pattern:
      
             err = F();
             if (err)
                 return err;
      
          13) Use ether_addr_copy() instead of memcpy() for mac FDB copying in prestera_hw.c
      
          14) Drop swdev->ageing_time member which is not used.
      
          15) Fix ageing macro to be in ms instead of seconds.
      
          Patches updated:
              [1] net: marvell: prestera: Add driver for Prestera family ASIC devices
      	[2] net: marvell: prestera: Add PCI interface support
              [3] net: marvell: prestera: Add basic devlink support
      	[4] net: marvell: prestera: Add ethtool interface support
      	[5] net: marvell: prestera: Add Switchdev driver implementation
      
      PATCH v7:
          1) Use ether_addr_copy() in prestera_main.c:prestera_port_set_mac_address()
             instead of memcpy().
      
          2) Removed not needed device's DMA address range check on
             dma_pool_alloc() in prestera_rxtx.c:prestera_sdma_buf_init(),
             this should be handled by dma_xxx() API considerig device's DMA mask.
      
          3) Removed not needed device's DMA address range check on
             dma_map_single() in prestera_rxtx.c:prestera_sdma_rx_skb_alloc(),
             this should be handled by dma_xxx() API considerig device's DMA mask.
      
          4) Add comment about port mac address limitation in the code where
             it is used and checked - prestera_main.c:
      
                 - prestera_is_valid_mac_addr()
                 - prestera_port_create()
      
          5) Add missing destroy_workqueue(swdev_wq) in prestera_switchdev.c:prestera_switchdev_init()
             on error path handling.
      
          Patches updated:
              [1] net: marvell: prestera: Add driver for Prestera family ASIC devices
              [5] net: marvell: prestera: Add Switchdev driver implementation
      
      PATCH v6:
          1) Use rwlock to protect port list on create/delete stages. The list
             is mostly readable by fw event handler or packets receiver, but
             updated only on create/delete port which are performed on switch init/fini
             stages.
      
          2) Remove not needed variable initialization in prestera_dsa.c:prestera_dsa_parse()
      
          3) Get rid of bounce buffer used by tx handler in prestera_rxtx.c,
             the bounce buffer should be handled by dma_xxx API via swiotlb.
      
          4) Fix PRESTERA_SDMA_RX_DESC_PKT_LEN macro by using correct GENMASK(13, 0) in prestera_rxtx.c
      
          Patches updated:
              [1] net: marvell: prestera: Add driver for Prestera family ASIC devices
      
      PATCH v5:
          0) add Co-developed tags for people who was involved in development.
      
          1) Make SPDX license as separate comment
      
          2) Change 'u8 *' -> 'void *', It allows to avoid not-needed u8* casting.
      
          3) Remove "," in terminated enum's.
      
          4) Use GENMASK(end, start) where it is applicable in.
      
          5) Remove not-needed 'u8 *' casting.
      
          6) Apply common error-check pattern
      
          7) Use ether_addr_copy instead of memcpy
      
          8) Use define for maximum MAC address range (255)
      
          9) Simplify prestera_port_state_set() in prestera_main.c by
             using separate if-blocks for state setting:
      
              if (is_up) {
              ...
              } else {
              ...
              }
      
            which makes logic more understandable.
      
          10) Simplify sdma tx wait logic when checking/updating tx_ring->burst.
      
          11) Remove not-needed packed & aligned attributes
      
          12) Use USEC_PER_MSEC as multiplier when converting ms -> usec on calling
              readl_poll_timeout.
      
          13) Simplified some error path handling by simple return error code in.
      
          14) Remove not-needed err assignment in.
      
          15) Use dev_err() in prestera_devlink_register(...).
      
          Patches updated:
              [1] net: marvell: prestera: Add driver for Prestera family ASIC devices
      	[2] net: marvell: prestera: Add PCI interface support
              [3] net: marvell: prestera: Add basic devlink support
      	[4] net: marvell: prestera: Add ethtool interface support
      	[5] net: marvell: prestera: Add Switchdev driver implementation
      
      PATCH v4:
          1) Use prestera_ prefix in netdev_ops variable.
      
          2) Kconfig: use 'default PRESTERA' build type for CONFIG_PRESTERA_PCI to be
             synced by default with prestera core module.
      
          3) Use memcpy_xxio helpers in prestera_pci.c for IO buffer copying.
      
          4) Generate fw image path via snprintf() instead of macroses.
      
          5) Use pcim_ helpers in prestera_pci.c which simplified the
             probe/remove logic.
      
          6) Removed not needed initializations of variables which are used in
             readl_poll_xxx() helpers.
      
          7) Fixed few grammar mistakes in patch[2] description.
      
          8) Export only prestera_ethtool_ops struct instead of each
             ethtool handler.
      
          9) Add check for prestera_dev_check() in switchdev event handling to
             make sure there is no wrong topology.
      
          Patches updated:
              [1] net: marvell: prestera: Add driver for Prestera family ASIC devices
      	[2] net: marvell: prestera: Add PCI interface support
      	[4] net: marvell: prestera: Add ethtool interface support
      	[5] net: marvell: prestera: Add Switchdev driver implementation
      
      PATCH v3:
          1) Simplify __be32 type casting in prestera_dsa.c
      
          2) Added per-patch changelog under "---" line.
      
      PATCH v2:
          1) Use devlink_port_type_clear()
      
          2) Add _MS prefix to timeout defines.
      
          3) Remove not-needed packed attribute from the firmware ipc structs,
             also the firmware image needs to be uploaded too (will do it soon).
      
          4) Introduce prestera_hw_switch_fini(), to be mirrored with init and
             do simple validation if the event handlers are unregistered.
      
          5) Use kfree_rcu() for event handler unregistering.
      
          6) Get rid of rcu-list usage when dealing with ports, not needed for
             now.
      
          7) Little spelling corrections in the error/info messages.
      
          8) Make pci probe & remove logic mirrored.
      
          9) Get rid of ETH_FCS_LEN in headroom setting, not needed.
      
      PATCH:
          1) Fixed W=1 warnings
      
          2) Renamed PCI driver name to be more generic "Prestera DX" because
             there will be more devices supported.
      
          3) Changed firmware image dir path: marvell/ -> mrvl/prestera/
             to be aligned with location in linux-firmware.git (if such
             will be accepted).
      
      RFC v3:
          1) Fix prestera prefix in prestera_rxtx.c
      
          2) Protect concurrent access from multiple ports on multiple CPU system
             on tx path by spinlock in prestera_rxtx.c
      
          3) Try to get base mac address from device-tree, otherwise use a random generated one.
      
          4) Move ethtool interface support into separate prestera_ethtool.c file.
      
          5) Add basic devlink support and get rid of physical port naming ops.
      
          6) Add STP support in Switchdev driver.
      
          7) Removed MODULE_AUTHOR
      
          8) Renamed prestera.c -> prestera_main.c, and kernel module to
             prestera.ko
      
      RFC v2:
          1) Use "pestera_" prefix in struct's and functions instead of mvsw_pr_
      
          2) Original series split into additional patches for Switchdev ethtool support.
      
          3) Use major and minor firmware version numbers in the firmware image filename.
      
          4) Removed not needed prints.
      
          5) Use iopoll API for waiting on register's value in prestera_pci.c
      
          6) Use standart approach for describing PCI ID matching section instead of using
             custom wrappers in prestera_pci.c
      
          7) Add RX/TX support in prestera_rxtx.c.
      
          8) Rewritten prestera_switchdev.c with following changes:
             - handle netdev events from prestera.c
      
             - use struct prestera_bridge for bridge objects, and get rid of
               struct prestera_bridge_device which may confuse.
      
             - use refcount_t
      
          9) Get rid of macro usage for sending fw requests in prestera_hw.c
      
          10) Add base_mac setting as module parameter. base_mac is required for
              generation default port's mac.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3ce406bd
    • V
      dt-bindings: marvell,prestera: Add description for device-tree bindings · 40acc052
      Vadym Kochan 提交于
      Add brief description how to configure base mac address binding in
      device-tree.
      
      Describe requirement for the PCI port which is connected to the ASIC, to
      allow access to the firmware related registers.
      Signed-off-by: NVadym Kochan <vadym.kochan@plvision.eu>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      40acc052
    • V
      net: marvell: prestera: Add Switchdev driver implementation · e1189d9a
      Vadym Kochan 提交于
      The following features are supported:
      
          - VLAN-aware bridge offloading
          - VLAN-unaware bridge offloading
          - FDB offloading (learning, ageing)
          - Switchport configuration
      
      Currently there are some limitations like:
      
          - Only 1 VLAN-aware bridge instance supported
          - FDB ageing timeout parameter is set globally per device
      Co-developed-by: NSerhiy Boiko <serhiy.boiko@plvision.eu>
      Signed-off-by: NSerhiy Boiko <serhiy.boiko@plvision.eu>
      Co-developed-by: NSerhiy Pshyk <serhiy.pshyk@plvision.eu>
      Signed-off-by: NSerhiy Pshyk <serhiy.pshyk@plvision.eu>
      Co-developed-by: NTaras Chornyi <taras.chornyi@plvision.eu>
      Signed-off-by: NTaras Chornyi <taras.chornyi@plvision.eu>
      Signed-off-by: NVadym Kochan <vadym.kochan@plvision.eu>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e1189d9a
    • V
      net: marvell: prestera: Add ethtool interface support · a97d3c69
      Vadym Kochan 提交于
      The ethtool API provides support for the configuration of the following
      features: speed and duplex, auto-negotiation, MDI-x, forward error
      correction, port media type. The API also provides information about the
      port status, hardware and software statistic. The following limitation
      exists:
      
          - port media type should be configured before speed setting
          - ethtool -m option is not supported
          - ethtool -p option is not supported
          - ethtool -r option is supported for RJ45 port only
          - the following combination of parameters is not supported:
      
                ethtool -s sw1pX port XX autoneg on
      
          - forward error correction feature is supported only on SFP ports, 10G
            speed
      
          - auto-negotiation and MDI-x features are not supported on
            Copper-to-Fiber SFP module
      Co-developed-by: NAndrii Savka <andrii.savka@plvision.eu>
      Signed-off-by: NAndrii Savka <andrii.savka@plvision.eu>
      Co-developed-by: NSerhiy Boiko <serhiy.boiko@plvision.eu>
      Signed-off-by: NSerhiy Boiko <serhiy.boiko@plvision.eu>
      Signed-off-by: NVadym Kochan <vadym.kochan@plvision.eu>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a97d3c69
    • V
      net: marvell: prestera: Add basic devlink support · 34dd1710
      Vadym Kochan 提交于
      Add very basic support for devlink interface:
      
          - driver name
          - fw version
          - devlink ports
      Signed-off-by: NVadym Kochan <vadym.kochan@plvision.eu>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      34dd1710
    • V
      net: marvell: prestera: Add PCI interface support · 4c2703df
      Vadym Kochan 提交于
      Add PCI interface driver for Prestera Switch ASICs family devices, which
      provides:
      
          - Firmware loading mechanism
          - Requests & events handling to/from the firmware
          - Access to the firmware on the bus level
      
      The firmware has to be loaded each time the device is reset. The driver
      is loading it from:
      
          /lib/firmware/mrvl/prestera/mvsw_prestera_fw-v{MAJOR}.{MINOR}.img
      
      The full firmware image version is located within the internal header
      and consists of 3 numbers - MAJOR.MINOR.PATCH. Additionally, driver has
      hard-coded minimum supported firmware version which it can work with:
      
          MAJOR - reflects the support on ABI level between driver and loaded
                  firmware, this number should be the same for driver and loaded
                  firmware.
      
          MINOR - this is the minimum supported version between driver and the
                  firmware.
      
          PATCH - indicates only fixes, firmware ABI is not changed.
      
      Firmware image file name contains only MAJOR and MINOR numbers to make
      driver be compatible with any PATCH version.
      Co-developed-by: NOleksandr Mazur <oleksandr.mazur@plvision.eu>
      Signed-off-by: NOleksandr Mazur <oleksandr.mazur@plvision.eu>
      Signed-off-by: NVadym Kochan <vadym.kochan@plvision.eu>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4c2703df
    • V
      net: marvell: prestera: Add driver for Prestera family ASIC devices · 501ef306
      Vadym Kochan 提交于
      Marvell Prestera 98DX326x integrates up to 24 ports of 1GbE with 8
      ports of 10GbE uplinks or 2 ports of 40Gbps stacking for a largely
      wireless SMB deployment.
      
      The current implementation supports only boards designed for the Marvell
      Switchdev solution and requires special firmware.
      
      The core Prestera switching logic is implemented in prestera_main.c,
      there is an intermediate hw layer between core logic and firmware. It is
      implemented in prestera_hw.c, the purpose of it is to encapsulate hw
      related logic, in future there is a plan to support more devices with
      different HW related configurations.
      
      This patch contains only basic switch initialization and RX/TX support
      over SDMA mechanism.
      
      Currently supported devices have DMA access range <= 32bit and require
      ZONE_DMA to be enabled, for such cases SDMA driver checks if the skb
      allocated in proper range supported by the Prestera device.
      
      Also meanwhile there is no TX interrupt support in current firmware
      version so recycling work is scheduled on each xmit.
      
      Port's mac address is generated from the switch base mac which may be
      provided via device-tree (static one or as nvme cell), or randomly
      generated. This is required by the firmware.
      Co-developed-by: NAndrii Savka <andrii.savka@plvision.eu>
      Signed-off-by: NAndrii Savka <andrii.savka@plvision.eu>
      Co-developed-by: NOleksandr Mazur <oleksandr.mazur@plvision.eu>
      Signed-off-by: NOleksandr Mazur <oleksandr.mazur@plvision.eu>
      Co-developed-by: NSerhiy Boiko <serhiy.boiko@plvision.eu>
      Signed-off-by: NSerhiy Boiko <serhiy.boiko@plvision.eu>
      Co-developed-by: NSerhiy Pshyk <serhiy.pshyk@plvision.eu>
      Signed-off-by: NSerhiy Pshyk <serhiy.pshyk@plvision.eu>
      Co-developed-by: NTaras Chornyi <taras.chornyi@plvision.eu>
      Signed-off-by: NTaras Chornyi <taras.chornyi@plvision.eu>
      Co-developed-by: NVolodymyr Mytnyk <volodymyr.mytnyk@plvision.eu>
      Signed-off-by: NVolodymyr Mytnyk <volodymyr.mytnyk@plvision.eu>
      Signed-off-by: NVadym Kochan <vadym.kochan@plvision.eu>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      501ef306
    • Y
      genetlink: Remove unused function genl_err_attr() · 5114b331
      YueHaibing 提交于
      It is never used, so can remove it.
      Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5114b331
    • Y
      net/sched: Remove unused function qdisc_queue_drop_head() · 2b7ea122
      YueHaibing 提交于
      It is not used since commit a09ceb0e ("sched: remove qdisc->drop")
      Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2b7ea122
    • M
      selftests: mptcp: interpret \n as a new line · 8b974778
      Matthieu Baerts 提交于
      In case of errors, this message was printed:
      
        (...)
        # read: Resource temporarily unavailable
        #  client exit code 0, server 3
        # \nnetns ns1-0-BJlt5D socket stat for 10003:
        (...)
      
      Obviously, the idea was to add a new line before the socket stat and not
      print "\nnetns".
      
      Fixes: b08fbf24 ("selftests: add test-cases for MPTCP MP_JOIN")
      Fixes: 048d19d4 ("mptcp: add basic kselftest for mptcp")
      Signed-off-by: NMatthieu Baerts <matthieu.baerts@tessares.net>
      Acked-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8b974778
    • X
      net/packet: Fix a comment about mac_header · b79a80bd
      Xie He 提交于
      1. Change all "dev->hard_header" to "dev->header_ops"
      
      2. On receiving incoming frames when header_ops == NULL:
      
      The comment only says what is wrong, but doesn't say what is right.
      This patch changes the comment to make it clear what is right.
      
      3. On transmitting and receiving outgoing frames when header_ops == NULL:
      
      The comment explains that the LL header will be later added by the driver.
      
      However, I think it's better to simply say that the LL header is invisible
      to us. This phrasing is better from a software engineering perspective,
      because this makes it clear that what happens in the driver should be
      hidden from us and we should not care about what happens internally in the
      driver.
      
      4. On resuming the LL header (for RAW frames) when header_ops == NULL:
      
      The comment says we are "unlikely" to restore the LL header.
      
      However, we should say that we are "unable" to restore it.
      It's not possible (rather than not likely) to restore it, because:
      
      1) There is no way for us to restore because the LL header internally
      processed by the driver should be invisible to us.
      
      2) In function packet_rcv and tpacket_rcv, the code only tries to restore
      the LL header when header_ops != NULL.
      
      Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
      Signed-off-by: NXie He <xie.he.0141@gmail.com>
      Acked-by: NWillem de Bruijn <willemb@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b79a80bd
    • D
      Merge branch 'net-hns3-updates-for-next' · 31660a97
      David S. Miller 提交于
      Huazhong Tan says:
      
      ====================
      net: hns3: updates for -next
      
      There are some optimizations related to IO path.
      
      Change since V1:
      - fixes a unsuitable handling in hns3_lb_clear_tx_ring() of #6 which
        pointed out by Saeed Mahameed.
      
      previous version:
      V1: https://patchwork.ozlabs.org/project/netdev/cover/1600085217-26245-1-git-send-email-tanhuazhong@huawei.com/
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      31660a97
    • Y
      net: hns3: use napi_consume_skb() when cleaning tx desc · 619ae331
      Yunsheng Lin 提交于
      Use napi_consume_skb() to batch consuming skb when cleaning
      tx desc in NAPI polling.
      Signed-off-by: NYunsheng Lin <linyunsheng@huawei.com>
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      619ae331
    • Y
      net: hns3: use writel() to optimize the barrier operation · 48ee56fd
      Yunsheng Lin 提交于
      writel() can be used to order I/O vs memory by default when
      writing portable drivers. Use writel() to replace wmb() +
      writel_relaxed(), and writel() is dma_wmb() + writel_relaxed()
      for ARM64, so there is an optimization here because dma_wmb()
      is a lighter barrier than wmb().
      Signed-off-by: NYunsheng Lin <linyunsheng@huawei.com>
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      48ee56fd
    • Y
      net: hns3: optimize the rx clean process · 8c30e194
      Yunsheng Lin 提交于
      Currently HNS3_RING_RX_RING_FBDNUM_REG register is read to determine
      how many rx desc can be cleaned. To avoid the register read operation
      in the critical data path, use the valid bit in the rx desc to determine
      if a specific rx desc can be cleaned.
      
      The hns3 driver clear valid bit in the rx desc before notifying the
      rx desc to the hw, and hw will only set the valid bit of the rx desc
      after corresponding buffer is filled with packet data and other field
      in the rx desc is set accordingly.
      
      Add hns3_rx_ring_move_fw() function to clear the valid bit in the rx
      desc before moving rx ring's next_to_clean forward to avoid double
      cleaning a rx desc, also add a dma_rmb() barrier in hns3_handle_rx_bd()
      to make sure valid bit is set before reading other field in the rx desc.
      Signed-off-by: NYunsheng Lin <linyunsheng@huawei.com>
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8c30e194
    • Y
      net: hns3: optimize the tx clean process · 20d06ca2
      Yunsheng Lin 提交于
      Currently HNS3_RING_TX_RING_HEAD_REG register is read to determine
      how many tx desc can be cleaned. To avoid the register read operation
      in the critical data path, use the valid bit in the tx desc to determine
      if a specific tx desc can be cleaned.
      
      The hns3 driver sets valid bit in the tx desc before ringing a doorbell
      to the hw, and hw will only clear the valid bit of the tx desc after
      corresponding packet is sent out to the wire. And because next_to_use
      for tx ring is a changing variable when the driver is filling the tx
      desc, so reuse the pull_len for rx ring to record the tx desc that has
      notified to the hw, so that hns3_nic_reclaim_desc() can decide how many
      tx desc's valid bit need checking when reclaiming tx desc.
      
      And io_err_cnt stat is also removed for it is not used anymore.
      Signed-off-by: NYunsheng Lin <linyunsheng@huawei.com>
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      20d06ca2
    • Y
      net: hns3: batch tx doorbell operation · f6061a05
      Yunsheng Lin 提交于
      Use netdev_xmit_more() to defer the tx doorbell operation when
      the skb is passed to the driver continuously. By doing this we
      can improve the overall xmit performance by avoid some doorbell
      operations.
      
      Also, the tx_err_cnt stat is not used, so rename it to tx_more
      stat.
      Signed-off-by: NYunsheng Lin <linyunsheng@huawei.com>
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f6061a05
    • Y
      net: hns3: batch the page reference count updates · aeda9bf8
      Yunsheng Lin 提交于
      Batch the page reference count updates instead of doing them
      one at a time. By doing this we can improve the overall receive
      performance by avoid some atomic increment operations when the
      rx page is reused.
      Signed-off-by: NYunsheng Lin <linyunsheng@huawei.com>
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aeda9bf8
  2. 17 9月, 2020 12 次提交