1. 03 Nov, 2020 16 commits
    • Vladimir Oltean's avatar
      net: mscc: ocelot: use the pvid of zero when bridged with vlan_filtering=0 · 75e5a554
      Vladimir Oltean authored
      Currently, mscc_ocelot ports configure pvid=0 in standalone mode, and
      inherit the pvid from the bridge when one is present.
      
      When the bridge has vlan_filtering=0, the software semantics are that
      packets should be received regardless of whether there's a pvid
      configured on the ingress port or not. However, ocelot does not observe
      those semantics today.
      
      Moreover, changing the PVID is also a problem with vlan_filtering=0.
      We are privately remapping the VID of FDB, MDB entries to the port's
      PVID when those are VLAN-unaware (i.e. when the VID of these entries
      comes to us as 0). But we have no logic of adjusting that remapping when
      the user changes the pvid and vlan_filtering is 0. So stale entries
      would be left behind, and untagged traffic will stop matching on them.
      
      And even if we were to solve that, there's an even bigger problem. If
      swp0 has pvid 1, and swp1 has pvid 2, and both are under a vlan_filtering=0
      bridge, they should be able to forward traffic between one another.
      However, with ocelot they wouldn't do that.
      
      The simplest way of fixing this is to never configure the pvid based on
      what the bridge is asking for, when vlan_filtering is 0. Only if there
      was a VLAN that the bridge couldn't mangle, that we could use as pvid....
      So, turns out, there's 0 just for that. And for a reason: IEEE
      802.1Q-2018, page 247, Table 9-2-Reserved VID values says:
      
      	The null VID. Indicates that the tag header contains only
      	priority information; no VID is present in the frame.
      	This VID value shall not be configured as a PVID or a member
      	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      	of a VID Set, or configured in any FDB entry, or used in any
      	Management operation.
      
      So, aren't we doing exactly what 802.1Q says not to? Well, in a way, but
      what we're doing here is just driver-level bookkeeping, all for the
      better. The fact that we're using a pvid of 0 is not observable behavior
      from the outside world: the network stack does not see the classified
      VLAN that the switch uses, in vlan_filtering=0 mode. And we're also more
      consistent with the standalone mode now.
      
      And now that we use the pvid of 0 in this mode, there's another advantage:
      we don't need to perform any VID remapping for FDB and MDB entries either,
      we can just use the VID of 0 that the bridge is passing to us.
      
      The only gotcha is that every time we change the vlan_filtering setting,
      we need to reapply the pvid (either to 0, or to the value from the bridge).
      A small side-effect visible in the patch is that ocelot_port_set_pvid
      needs to be moved above ocelot_port_vlan_filtering, so that it can be
      called from there without forward-declarations.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      75e5a554
    • Jakub Kicinski's avatar
      Merge branch 'net-ethernet-ti-am65-cpsw-add-multi-port-support-in-mac-only-mode' · 802dcb43
      Jakub Kicinski authored
      Grygorii Strashko says:
      
      ====================
      net: ethernet: ti: am65-cpsw: add multi port support in mac-only mode
      
      This series adds multi-port support in mac-only mode (multi MAC mode) to TI
      AM65x CPSW driver in preparation for enabling support for multi-port devices,
      like Main CPSW0 on K3 J721E SoC or future CPSW3g on K3 AM64x SoC.
      
      The multi MAC mode is implemented by configuring every enabled port in "mac-only"
      mode (all ingress packets are sent only to the Host port and egress packets
      directed to target Ext. Port) and creating separate net_device for
      every enabled Ext. port.
      
      This series does not affect on existing CPSW2g one Ext. Port devices and xmit
      path changes are done only for multi-port devices by splitting xmit path for
      one-port and multi-port devices.
      
      Patches 1-3: Preparation patches to improve K3 CPSW configuration depending on DT
      Patches 4-5: Fix VLAN offload for multi MAC mode
      Patch 6: Fixes CPTS context lose issue during PM runtime transition
      Patch 7: Fixes TX csum offload for multi MAC mode
      Patches 8-9: add multi-port support to TI AM65x CPSW
      Patch 10: handle deferred probe with new dev_err_probe() API
      
      changes in v3:
       - rebased
       - added Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
       - added Patch 10 which is minor optimization
      
      changes in v2:
      - patch 8: xmit path split for one-port and multi-port devices to avoid
        performance losses
      - patch 9: fixed the case when Port 1 is disabled
      - Patch 7: added fix for TX csum offload
      
      v2: https://lore.kernel.org/patchwork/cover/1321608/
      v1: https://lore.kernel.org/patchwork/cover/1315766/
      ====================
      
      Link: https://lore.kernel.org/r/20201030200707.24294-1-grygorii.strashko@ti.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      802dcb43
    • Grygorii Strashko's avatar
      net: ethernet: ti: am65-cpsw: handle deferred probe with dev_err_probe() · 8fbc2f9e
      Grygorii Strashko authored
      Use new dev_err_probe() API to handle deferred probe properly and simplify
      the code.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8fbc2f9e
    • Grygorii Strashko's avatar
      net: ethernet: ti: am65-cpsw: add multi port support in mac-only mode · 84b4aa49
      Grygorii Strashko authored
      This patch adds final multi-port support to TI AM65x CPSW driver path in
      preparation for adding support for multi-port devices, like Main CPSW0 on
      K3 J721E SoC or future CPSW3g on K3 AM64x SoC.
      - the separate netdev is created for every enabled external Port;
      - DMA channels are common/shared for all external Ports and the RX/TX NAPI
      and DMA processing assigned to first available netdev;
      - external Ports are configured in mac-only mode, which is similar to TI
      "dual-mac" mode for legacy TI CPSW - packets are sent to the Host port only
      in ingress and directly to the Port on egress. No packet switching between
      external ports happens.
      - every port supports the same features as current AM65x CPSW on external
      device.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      84b4aa49
    • Grygorii Strashko's avatar
      net: ethernet: ti: am65-cpsw: prepare xmit/rx path for multi-port devices in mac-only mode · a9e60cf0
      Grygorii Strashko authored
      This patch adds multi-port support to TI AM65x CPSW driver xmit/rx path in
      preparation for adding support for multi-port devices, like Main CPSW0 on
      K3 J721E SoC or future CPSW3g on K3 AM64x SoC.
      Hence DMA channels are common/shared for all ext Ports and the RX/TX NAPI
      and DMA processing going to be assigned to first available netdev this patch:
       - ensures all RX descriptors fields are initialized;
       - adds synchronization for TX DMA push/pop operation (locking) as
      Networking core locks are not enough any more;
       - updates TX bql processing for every packet in
      am65_cpsw_nuss_tx_compl_packets() as every completed TX skb can have
      different ndev assigned (come from different netdevs).
      
      To avoid performance issues for existing one-port CPSW2g devices the above
      changes are done only for multi-port devices by splitting xmit path for
      one-port and multi-port devices.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a9e60cf0
    • Grygorii Strashko's avatar
      net: ethernet: ti: am65-cpsw: fix tx csum offload for multi mac mode · 97067aaf
      Grygorii Strashko authored
      The current implementation uses .ndo_set_features() callback to track
      NETIF_F_HW_CSUM feature changes and update generic
      CPSW_P0_CONTROL_REG.RX_CHECKSUM_EN option accordingly. It's not going to
      work in case of multi-port devices as TX csum offload can be changed per
      netdev.
      
      On K3 CPSWxG devices TX csum offload enabled in the following way:
      
       - the CPSW_P0_CONTROL_REG.RX_CHECKSUM_EN option enables TX csum offload in
      generic and affects all TX DMA channels and packets;
      
       - corresponding fields in TX DMA descriptor have to be filed properly when
      upper layer wants to offload TX csum (skb->ip_summed == CHECKSUM_PARTIAL)
      and it's per-packet option.
      
      The Linux Network core is expected to never request TX csum offload if
      netdev NETIF_F_HW_CSUM feature is disabled, and, as result, TX DMA
      descriptors should not be modified, and per-packet TX csum offload will be
      disabled (or enabled) on per-netdev basis. Which, in turn, makes it safe to
      enable the CPSW_P0_CONTROL_REG.RX_CHECKSUM_EN option unconditionally.
      
      Hence, fix TX csum offload for multi-port devices by:
       - enabling the CPSW_P0_CONTROL_REG.RX_CHECKSUM_EN option in
      am65_cpsw_nuss_common_open() unconditionally
       - and removing .ndo_set_features() callback implementation, which was used
      only NETIF_F_HW_CSUM feature update purposes
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      97067aaf
    • Grygorii Strashko's avatar
      net: ethernet: ti: am65-cpsw: keep active if cpts enabled · a9c74700
      Grygorii Strashko authored
      Some K3 CPSW NUSS instances can lose context after PM runtime ON->OFF->ON
      transition depending on integration (including all submodules: CPTS, MDIO,
      etc), like J721E Main CPSW (CPSW9G).
      
      In case CPTS is enabled it's initialized during probe and does not expect
      to be reset. Hence, keep K3 CPSW active by forbidding PM runtime if CPTS is
      enabled.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a9c74700
    • Grygorii Strashko's avatar
      net: ethernet: ti: am65-cpsw: fix vlan offload for multi mac mode · 2d64a034
      Grygorii Strashko authored
      The VLAN offload for AM65x CPSW2G is implemented using existing ALE APIs,
      which are also used by legacy CPSW drivers.
      So, now it always adds current Ext. Port and Host as VLAN members when VLAN
      is added by 8021Q core (.ndo_vlan_rx_add_vid) and forcibly removes VLAN
      from ALE table in .ndo_vlan_rx_kill_vid(). This works as for AM65x CPSW2G
      (which has only one Ext. Port) as for legacy CPSW devices (which can't
      support same VLAN on more then one Port in multi mac (dual-mac) mode). But
      it doesn't work for the new J721E and AM64x multi port CPSWxG versions
      doesn't have such restrictions and allow to offload the same VLAN on any
      number of ports.
      
      Now the attempt to add same VLAN on two (or more) K3 CPSWxG Ports will
      cause:
       - VLAN members mask overwrite when VLAN is added
       - VLAN removal from ALE table when any Port removes VLAN
      
      This patch fixes an issue by:
       - switching to use cpsw_ale_vlan_add_modify() instead of
         cpsw_ale_add_vlan() when VLAN is added to ALE table, so VLAN members
         mask will not be overwritten;
       - Updates cpsw_ale_del_vlan() as:
           if more than one ext. Port is in VLAN member mask
           then remove only current port from VLAN member mask
           else remove VLAN ALE entry
      
       Example:
        add: P1 | P0 (Host) -> members mask: P1 | P0
        add: P2 | P0        -> members mask: P2 | P1 | P0
        rem: P1 | P0        -> members mask: P2 | P0
        rem: P2 | P0        -> members mask: -
      
      The VLAN is forcibly removed if port_mask=0 passed to cpsw_ale_del_vlan()
      to preserve existing legacy CPSW drivers functionality.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2d64a034
    • Grygorii Strashko's avatar
      net: ethernet: ti: cpsw_ale: add cpsw_ale_vlan_del_modify() · 82882bd5
      Grygorii Strashko authored
      Add/export cpsw_ale_vlan_del_modify() and use it in cpsw_switchdev instead
      of generic cpsw_ale_del_vlan() to avoid mixing 8021Q and switchdev VLAN
      offload. This is preparation patch equired by follow up changes.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      82882bd5
    • Grygorii Strashko's avatar
      net: ethernet: ti: am65-cpsw: use cppi5_desc_is_tdcm() · 6a40e289
      Grygorii Strashko authored
      Use cppi5_desc_is_tdcm() helper for teardown indicator detection instead of
      hard-coded value.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6a40e289
    • Grygorii Strashko's avatar
      net: ethernet: ti: am65-cpsw: move free desc queue mode selection in pdata · c6275c02
      Grygorii Strashko authored
      In preparation of adding more multi-port K3 CPSW versions move free
      descriptor queue mode selection in am65_cpsw_pdata, so it can be selected
      basing on DT compatibility property.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c6275c02
    • Grygorii Strashko's avatar
      net: ethernet: ti: am65-cpsw: move ale selection in pdata · 7747d4b7
      Grygorii Strashko authored
      In preparation of adding more multi-port K3 CPSW versions move ALE
      selection in am65_cpsw_pdata, so it can be selected basing on DT
      compatibility property.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7747d4b7
    • Xin Long's avatar
      net: ipv6: For kerneldoc warnings with W=1 · 2c4de211
      Xin Long authored
      net/ipv6/addrconf.c:2005: warning: Function parameter or member 'dev' not described in 'ipv6_dev_find'
      net/ipv6/ip6_vti.c:138: warning: Function parameter or member 'ip6n' not described in 'vti6_tnl_bucket'
      net/ipv6/ip6_tunnel.c:218: warning: Function parameter or member 'ip6n' not described in 'ip6_tnl_bucket'
      net/ipv6/ip6_tunnel.c:238: warning: Function parameter or member 'ip6n' not described in 'ip6_tnl_link'
      net/ipv6/ip6_tunnel.c:254: warning: Function parameter or member 'ip6n' not described in 'ip6_tnl_unlink'
      net/ipv6/ip6_tunnel.c:427: warning: Function parameter or member 'raw' not described in 'ip6_tnl_parse_tlv_enc_lim'
      net/ipv6/ip6_tunnel.c:499: warning: Function parameter or member 'skb' not described in 'ip6_tnl_err'
      net/ipv6/ip6_tunnel.c:499: warning: Function parameter or member 'ipproto' not described in 'ip6_tnl_err'
      net/ipv6/ip6_tunnel.c:499: warning: Function parameter or member 'opt' not described in 'ip6_tnl_err'
      net/ipv6/ip6_tunnel.c:499: warning: Function parameter or member 'type' not described in 'ip6_tnl_err'
      net/ipv6/ip6_tunnel.c:499: warning: Function parameter or member 'code' not described in 'ip6_tnl_err'
      net/ipv6/ip6_tunnel.c:499: warning: Function parameter or member 'msg' not described in 'ip6_tnl_err'
      net/ipv6/ip6_tunnel.c:499: warning: Function parameter or member 'info' not described in 'ip6_tnl_err'
      net/ipv6/ip6_tunnel.c:499: warning: Function parameter or member 'offset' not described in 'ip6_tnl_err'
      
      ip6_tnl_err() is an internal function, so remove the kerneldoc. For
      the others, add the missing parameters.
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20201031183044.1082193-1-andrew@lunn.chSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2c4de211
    • Andrew Lunn's avatar
      net: driver: hamradio: Fix potential unterminated string · e03d8a37
      Andrew Lunn authored
      With W=1 the following error is reported:
      
      In function ‘strncpy’,
          inlined from ‘hdlcdrv_ioctl’ at drivers/net/hamradio/hdlcdrv.c:600:4:
      ./include/linux/string.h:297:30: warning: ‘__builtin_strncpy’ specified bound 32 equals destination size [-Wstringop-truncation]
        297 | #define __underlying_strncpy __builtin_strncpy
            |                              ^
      ./include/linux/string.h:307:9: note: in expansion of macro ‘__underlying_strncpy’
        307 |  return __underlying_strncpy(p, q, size);
      
      Replace strncpy with strlcpy to guarantee the string is terminated.
      Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20201031181700.1081693-1-andrew@lunn.chSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e03d8a37
    • Andrew Lunn's avatar
      drivers: net: wan: lmc: Fix W=1 set but used variable warnings · a344a1e8
      Andrew Lunn authored
      drivers/net/wan/lmc/lmc_main.c: In function ‘lmc_ioctl’:
      drivers/net/wan/lmc/lmc_main.c:356:25: warning: variable ‘mii’ set but not used [-Wunused-but-set-variable]
        356 |                     u16 mii;
            |                         ^~~
      drivers/net/wan/lmc/lmc_main.c:427:25: warning: variable ‘mii’ set but not used [-Wunused-but-set-variable]
        427 |                     u16 mii;
            |                         ^~~
      drivers/net/wan/lmc/lmc_main.c: In function ‘lmc_interrupt’:
      drivers/net/wan/lmc/lmc_main.c:1188:9: warning: variable ‘firstcsr’ set but not used [-Wunused-but-set-variable]
       1188 |     u32 firstcsr;
      
      This file has funky indentation, and makes little use of tabs. Keep
      with this style in the patch, but that makes checkpatch unhappy.
      Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20201031181417.1081511-1-andrew@lunn.chSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a344a1e8
    • Andrew Lunn's avatar
      drivers: net: xen-netfront: Fixed W=1 set but unused warnings · 8ed7ec13
      Andrew Lunn authored
      drivers/net/xen-netfront.c:2416:16: warning: variable ‘target’ set but not used [-Wunused-but-set-variable]
       2416 |  unsigned long target;
      
      Remove target and just discard the return value from simple_strtoul().
      
      This patch does give a checkpatch warning, but the warning was there
      before anyway, as this file has lots of checkpatch warnings.
      Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20201031180435.1081127-1-andrew@lunn.chSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8ed7ec13
  2. 02 Nov, 2020 11 commits
  3. 01 Nov, 2020 1 commit
  4. 31 Oct, 2020 12 commits