1. Apr 24, 2023
  2. Apr 23, 2023
    • Yajun Deng's avatar
      net: sched: Print msecs when transmit queue time out · 2f0f9465
      Yajun Deng authored
      
      
      The kernel will print several warnings in a short period of time
      when it stalls. Like this:
      
      First warning:
      [ 7100.097547] ------------[ cut here ]------------
      [ 7100.097550] NETDEV WATCHDOG: eno2 (xxx): transmit queue 8 timed out
      [ 7100.097571] WARNING: CPU: 8 PID: 0 at net/sched/sch_generic.c:467
                             dev_watchdog+0x260/0x270
      ...
      
      Second warning:
      [ 7147.756952] rcu: INFO: rcu_preempt self-detected stall on CPU
      [ 7147.756958] rcu:   24-....: (59999 ticks this GP) idle=546/1/0x400000000000000
                            softirq=367      3137/3673146 fqs=13844
      [ 7147.756960]        (t=60001 jiffies g=4322709 q=133381)
      [ 7147.756962] NMI backtrace for cpu 24
      ...
      
      We calculate that the transmit queue start stall should occur before
      7095s according to watchdog_timeo, the rcu start stall at 7087s.
      These two times are close together, it is difficult to confirm which
      happened first.
      
      To let users know the exact time the stall started, print msecs when
      the transmit queue time out.
      
      Signed-off-by: default avatarYajun Deng <yajun.deng@linux.dev>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2f0f9465
    • David S. Miller's avatar
      Merge branch 'dsa-skb_mac_header' · 00266b36
      David S. Miller authored
      Vladimir Oltean says:
      
      ====================
      Remove skb_mac_header() dependency in DSA xmit path
      
      Eric started working on removing skb_mac_header() assumptions from the
      networking xmit path, and I offered to help for DSA:
      https://lore.kernel.org/netdev/20230321164519.1286357-1-edumazet@google.com/
      
      The majority of this patch set is a straightforward replacement of
      skb_mac_header() with skb->data (hidden either behind skb_eth_hdr(), or
      behind skb_vlan_eth_hdr()). The only patch which is more "interesting"
      is 9/9.
      
      Another potential caller of __skb_vlan_pop() on xmit (and therefore
      also of skb_mac_header()) is tcf_vlan_act(), but I haven't had the time
      to investigate that (enough to submit changes other than what's here).
      
      v1->v2:
      - 09/09: document the vlan_tci argument of vlan_remove_tag() in the kdoc
      
      v1 at:
      https://lore.kernel.org/netdev/20230322233823.1806736-1-vladimir.oltean@nxp.com/
      
      
      
      Cc: Madalin Bucur <madalin.bucur@nxp.com>
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      00266b36
    • Vladimir Oltean's avatar
      net: dsa: tag_ocelot: call only the relevant portion of __skb_vlan_pop() on TX · 0bcf2e4a
      Vladimir Oltean authored
      ocelot_xmit_get_vlan_info() calls __skb_vlan_pop() as the most
      appropriate helper I could find which strips away a VLAN header.
      That's all I need it to do, but __skb_vlan_pop() has more logic, which
      will become incompatible with the future revert of commit 6d1ccff6
      
      
      ("net: reset mac header in dev_start_xmit()").
      
      Namely, it performs a sanity check on skb_mac_header(), which will stop
      being set after the above revert, so it will return an error instead of
      removing the VLAN tag.
      
      ocelot_xmit_get_vlan_info() gets called in 2 circumstances:
      
      (1) the port is under a VLAN-aware bridge and the bridge sends
          VLAN-tagged packets
      
      (2) the port is under a VLAN-aware bridge and somebody else (an 8021q
          upper) sends VLAN-tagged packets (using a VID that isn't in the
          bridge vlan tables)
      
      In case (1), there is actually no bug to defend against, because
      br_dev_xmit() calls skb_reset_mac_header() and things continue to work.
      
      However, in case (2), illustrated using the commands below, it can be
      seen that our intervention is needed, since __skb_vlan_pop() complains:
      
      $ ip link add br0 type bridge vlan_filtering 1 && ip link set br0 up
      $ ip link set $eth master br0 && ip link set $eth up
      $ ip link add link $eth name $eth.100 type vlan id 100 && ip link set $eth.100 up
      $ ip addr add 192.168.100.1/24 dev $eth.100
      
      I could fend off the checks in __skb_vlan_pop() with some
      skb_mac_header_was_set() calls, but seeing how few callers of
      __skb_vlan_pop() there are from TX paths, that seems rather
      unproductive.
      
      As an alternative solution, extract the bare minimum logic to strip a
      VLAN header, and move it to a new helper named vlan_remove_tag(), close
      to the definition of vlan_insert_tag(). Document it appropriately and
      make ocelot_xmit_get_vlan_info() call this smaller helper instead.
      
      Seeing that it doesn't appear illegal to test skb->protocol in the TX
      path, I guess it would be a good for vlan_remove_tag() to also absorb
      the vlan_set_encap_proto() function call.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0bcf2e4a
    • Vladimir Oltean's avatar
      net: dsa: update TX path comments to not mention skb_mac_header() · f0a9d563
      Vladimir Oltean authored
      Once commit 6d1ccff6
      
       ("net: reset mac header in dev_start_xmit()")
      will be reverted, it will no longer be true that skb->data points at
      skb_mac_header(skb) - since the skb->mac_header will not be set - so
      stop saying that, and just say that it points to the MAC header.
      
      I've reviewed vlan_insert_tag() and it does not *actually* depend on
      skb_mac_header(), so reword that to avoid the confusion.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f0a9d563
    • Vladimir Oltean's avatar
      net: dsa: tag_sja1105: replace skb_mac_header() with vlan_eth_hdr() · b5653b15
      Vladimir Oltean authored
      
      
      This is a cosmetic patch which consolidates the code to use the helper
      function offered by if_vlan.h.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b5653b15