26 May, 2023

1 commit


22 Mar, 2023

1 commit


08 Mar, 2023

13 commits

  • Add disabled parameter to support disable the preemption configuration
    on stmmac.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • Add disabled parameter to support disable the preemption configuration
    on ENETC.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • Add disabled parameter to disable preemption on VSC9959.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • The FPE parameters should be configured once the fpe_configure() is
    called. FPE will not enabled before preemption verification.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • The preemption verification is not working when enabled lldp
    verification. Make fpe_cfg->enable always enabled after configure the
    preemption can fix this issue.

    Another issue is that preemption status can't be inactive after link
    down. Disable the preemption once link is down.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • The preemption will not be disabled when link down, this patch fix that
    issue.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • The preemption status may not equal to active status when preemption
    verification enabled. This patch enable the status once preemption is
    enabled even if it's not active.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • When not specified in device tree, rx phy-mac delay compensation value should be 0.

    fixes: 9d00b3fe64f2c3774779860a84f06fd6631ff0e3

    Signed-off-by: Marouen Ghodhbane

    Marouen Ghodhbane
     
  • Reducing the RX and TX ring size was introduced to improve CPU load with avb module
    loaded. But, this affects the best effort bandwidth when the module is not inserted
    (especially TX bandwidth)

    iperf results with current ring sizes:

    root@imx8mp-lpddr4-evk:~# iperf3 -c 192.168.1.60
    Connecting to host 192.168.1.60, port 5201
    [ 5] local 192.168.1.100 port 34108 connected to 192.168.1.60 port 5201
    [ ID] Interval Transfer Bitrate Retr Cwnd
    [ 5] 0.00-1.00 sec 14.7 MBytes 123 Mbits/sec 0 119 KBytes
    [ 5] 1.00-2.00 sec 14.4 MBytes 121 Mbits/sec 0 119 KBytes

    iperf results with new parameters:

    TX bandwidth:

    root@imx8mp-lpddr4-evk:~# iperf3 -c 192.164.1.102 -t 5
    Connecting to host 192.164.1.102, port 5201
    [ 5] local 192.164.1.162 port 42646 connected to 192.164.1.102 port 5201
    [ ID] Interval Transfer Bitrate Retr Cwnd
    [ 5] 0.00-1.00 sec 112 MBytes 940 Mbits/sec 0 576 KBytes
    [ 5] 1.00-2.00 sec 109 MBytes 914 Mbits/sec 0 576 KBytes
    [ 5] 2.00-3.00 sec 110 MBytes 919 Mbits/sec 0 576 KBytes
    [ 5] 3.00-4.00 sec 109 MBytes 919 Mbits/sec 0 576 KBytes

    RX bandwidth:

    root@imx8mp-lpddr4-evk:~# iperf3 -c 192.164.1.102 -t 5 -R
    Connecting to host 192.164.1.102, port 5201
    Reverse mode, remote host 192.164.1.102 is sending
    [ 5] local 192.164.1.162 port 44888 connected to 192.164.1.102 port 5201
    [ ID] Interval Transfer Bitrate
    [ 5] 0.00-1.00 sec 112 MBytes 941 Mbits/sec
    [ 5] 1.00-2.00 sec 112 MBytes 941 Mbits/sec
    [ 5] 2.00-3.00 sec 112 MBytes 942 Mbits/sec
    [ 5] 3.00-4.00 sec 112 MBytes 941 Mbits/sec
    [ 5] 4.00-5.00 sec 112 MBytes 941 Mbits/sec

    Also, the default coalescing settings were not adjusted to the new ring size: use
    custom values for AVB_SUPPORT.

    fixes: "75267d9e net: fec: avb: Improve CPU load under heavy AVB network load"

    Signed-off-by: Marouen Ghodhbane

    Marouen Ghodhbane
     
  • Prior to the Fixes: commit, the initialization code went through the
    same fec_enet_set_coalesce() function as used by ethtool, and that
    function correctly checks whether the current variant has support for
    irq coalescing.

    Now that the initialization code instead calls fec_enet_itr_coal_set()
    directly, that call needs to be guarded by a check for the
    FEC_QUIRK_HAS_COALESCE bit.

    Fixes: df727d4547de (net: fec: don't reset irq coalesce settings to defaults on "ip link up")
    Reported-by: Greg Ungerer
    Signed-off-by: Rasmus Villemoes
    Reviewed-by: Florian Fainelli
    Link: https://lore.kernel.org/r/20221205204604.869853-1-linux@rasmusvillemoes.dk
    Signed-off-by: Jakub Kicinski

    Rasmus Villemoes
     
  • Currently, when a FEC device is brought up, the irq coalesce settings
    are reset to their default values (1000us, 200 frames). That's
    unexpected, and breaks for example use of an appropriate .link file to
    make systemd-udev apply the desired
    settings (https://www.freedesktop.org/software/systemd/man/systemd.link.html),
    or any other method that would do a one-time setup during early boot.

    Refactor the code so that fec_restart() instead uses
    fec_enet_itr_coal_set(), which simply applies the settings that are
    stored in the private data, and initialize that private data with the
    default values.

    Signed-off-by: Rasmus Villemoes
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller
    (cherry picked from commit df727d4547de568302b0ed15b0d4e8a469bdb456)

    Rasmus Villemoes
     
  • fec_main.c:3942:25: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
    3942 | if (skb)
    | ^~
    fec_main.c:3947:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
    3947 | txq->tx_skbuff[i] = NULL;
    |

    Signed-off-by: Marouen Ghodhbane

    Marouen Ghodhbane
     
  • Alternative short title: don't instruct the hardware to match on
    EtherType with "protocol 802.1Q" flower filters. It doesn't work for the
    reasons detailed below.

    With a command such as the following:

    tc filter add dev $swp1 ingress chain $(IS1 2) pref 3 \
    protocol 802.1Q flower skip_sw vlan_id 200 src_mac $h1_mac \
    action vlan modify id 300 \
    action goto chain $(IS2 0 0)

    the created filter is set by ocelot_flower_parse_key() to be of type
    OCELOT_VCAP_KEY_ETYPE, and etype is set to {value=0x8100, mask=0xffff}.
    This gets propagated all the way to is1_entry_set() which commits it to
    hardware (the VCAP_IS1_HK_ETYPE field of the key). Compare this to the
    case where src_mac isn't specified - the key type is OCELOT_VCAP_KEY_ANY,
    and is1_entry_set() doesn't populate VCAP_IS1_HK_ETYPE.

    The problem is that for VLAN-tagged frames, the hardware interprets the
    ETYPE field as holding the encapsulated VLAN protocol. So the above
    filter will only match those packets which have an encapsulated protocol
    of 0x8100, rather than all packets with VLAN ID 200 and the given src_mac.

    The reason why this is allowed to occur is because, although we have a
    block of code in ocelot_flower_parse_key() which sets "match_protocol"
    to false when VLAN keys are present, that code executes too late.
    There is another block of code, which executes for Ethernet addresses,
    and has a "goto finished_key_parsing" and skips the VLAN header parsing.
    By skipping it, "match_protocol" remains with the value it was
    initialized with, i.e. "true", and "proto" is set to f->common.protocol,
    or 0x8100.

    The concept of ignoring some keys rather than erroring out when they are
    present but can't be offloaded is dubious in itself, but is present
    since the initial commit fe3490e6107e ("net: mscc: ocelot: Hardware
    ofload for tc flower filter"), and it's outside of the scope of this
    patch to change that.

    The problem was introduced when the driver started to interpret the
    flower filter's protocol, and populate the VCAP filter's ETYPE field
    based on it.

    To fix this, it is sufficient to move the code that parses the VLAN keys
    earlier than the "goto finished_key_parsing" instruction. This will
    ensure that if we have a flower filter with both VLAN and Ethernet
    address keys, it won't match on ETYPE 0x8100, because the VLAN key
    parsing sets "match_protocol = false".

    Fixes: 86b956de119c ("net: mscc: ocelot: support matching on EtherType")
    Signed-off-by: Vladimir Oltean
    Signed-off-by: Xiaoliang Yang

    Vladimir Oltean
     

08 Feb, 2023

25 commits

  • The queue 0 is always preemption when preemption is enabled. This patch
    modify the stmmac_get_preempt() function to display queue 0 as
    preemption to ethtool application.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • This patch doesn't enable the mac merge layer until the lldp application
    verify the remote port supports preemption. The lldp verify feature can
    be enabled or disabled by ethtool application.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • Fix the issue that preemption reset not working.

    Fixes: 40ed69f78("net: enetc: add lldp verify support")
    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • This patch doesn't enable the mac merge layer until the lldp application
    verify the remote port supports preemption. The lldp verify feature can
    be enabled or disabled by ethtool application.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • Based on "99.4.2 Determining that the link partner supports preemption"
    of IEEE 802.3-2018, the felix driver need to support lldp verify
    feature.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • This feature can be test in the following case:
    TX-tool -----> swp0 -----> swp1 -----> RX-tool

    Test steps:
    1.
    ip link add dev br0 type bridge
    ip link set dev swp0 master br0
    ip link set dev swp1 master br0
    2.
    ip link set br0 type bridge vlan_filtering 1
    bridge vlan add dev swp0 vid 222
    bridge vlan add dev swp1 vid 222

    tc qdisc add dev swp1 clsact

    tc filter add dev swp1 egress \
    protocol 802.1Q flower skip_sw \
    vlan_id 222 vlan_prio 2 \
    action vlan push id 200 priority 1 protocol 802.1AD \
    vlan push id 300 priority 3

    Result:
    TX(tpid:8100 vid:222 pri:2) -> swp0 -> swp1 -> RX(STAG tpid:88A8 vid:200 \
    pri:1, CTAG tpid:8100 vid:300 pri:3)

    Signed-off-by: hongbo.wang
    Signed-off-by: Xiaoliang Yang

    hongbo.wang
     
  • The driver should ensure that same priority is not mapped to multiple
    rx queues. Currently dwmac4_rx_queue_priority function is adding
    priorities for a queue without clearing them from others.

    From DesignWare Cores Ethernet Quality-of-Service
    Databook, section 17.1.29 MAC_RxQ_Ctrl2:
    "[...]The software must ensure that the content of this field is
    mutually exclusive to the PSRQ fields for other queues, that is,
    the same priority is not mapped to multiple Rx queues[...]"

    After this patch, dwmac4_rx_queue_priority function will:
    1. assign desired priorities to a queue, while keeping the other preconfigured priorities.
    2. remove those priorities from all other queues
    The write sequence of CTRL2 and CTRL3 registers is done in the way to
    ensure this order.

    Also, the PSRQn field contains the mask of priorities and not only one
    priority. Rename "prio" argument to "prio_mask".

    Signed-off-by: Piotr Wejman
    Signed-off-by: Marouen Ghodhbane

    Piotr Wejman
     
  • Preemption should be disabled by default and activated after enabled or
    link partner verification.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • To support preemption MAC should have more than 1 TX queue with at least
    1 queue designated as Express Queue. This patch add the limitation of
    configuring preemption queues to ensure that there is at least one express
    queue.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • felix_vsc9959.c calls taprio_offload_get() and taprio_offload_free(),
    symbols exported by net/sched/sch_taprio.c. As such, we must disallow
    building the Felix driver as built-in when the symbol exported by
    tc-taprio isn't present in the kernel image.

    Fixes: 1c9017e44af2 ("net: dsa: felix: keep reference on entire tc-taprio config")
    Signed-off-by: Vladimir Oltean
    Link: https://lore.kernel.org/r/20220704190241.1288847-2-vladimir.oltean@nxp.com
    Signed-off-by: Jakub Kicinski

    Vladimir Oltean
     
  • The tas_min_gate_lengths() function caculate a wrong min gate length.
    This patch update the algorithm to correct it.

    Fixes: 582647cd("net: dsa: felix: drop oversized frames with tc-taprio instead of hanging the port")
    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • The qbv_set of tsntool uses different structure with tc-taprio config.
    Convert the tsntool shaper config to tc-taprio config and store it in
    ocelot_port->taprio.

    Fixes: 01881915("net: dsa: felix: keep reference on entire tc-taprio config")
    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • Time-sensitive networking code needs to work with PTP times expressed in
    nanoseconds, and with packet transmission times expressed in
    picoseconds, since those would be fractional at higher than gigabit
    speed when expressed in nanoseconds.

    Convert the existing uses in tc-taprio and the ocelot/felix DSA driver
    to a PSEC_PER_NSEC macro. This macro is placed in include/linux/time64.h
    as opposed to its relatives (PSEC_PER_SEC etc) from include/vdso/time64.h
    because the vDSO library does not (yet) need/use it.

    Cc: Andy Lutomirski
    Cc: Thomas Gleixner
    Signed-off-by: Vladimir Oltean
    Reviewed-by: Vincenzo Frascino # for the vDSO parts
    Signed-off-by: Jakub Kicinski

    Vladimir Oltean
     
  • Currently, sending a packet into a time gate too small for it (or always
    closed) causes the queue system to hold the frame forever. Even worse,
    this frame isn't subject to aging either, because for that to happen, it
    needs to be scheduled for transmission in the first place. But the frame
    will consume buffer memory and frame references while it is forever held
    in the queue system.

    Before commit a4ae997adcbd ("net: mscc: ocelot: initialize watermarks to
    sane defaults"), this behavior was somewhat subtle, as the switch had a
    more intricately tuned default watermark configuration out of reset,
    which did not allow any single port and tc to consume the entire switch
    buffer space. Nonetheless, the held frames are still there, and they
    reduce the total backplane capacity of the switch.

    However, after the aforementioned commit, the behavior can be very
    clearly seen, since we deliberately allow each {port, tc} to consume the
    entire shared buffer of the switch minus the reservations (and we
    disable all reservations by default). That is to say, we allow a
    permanently closed tc-taprio gate to hang the entire switch.

    A careful inspection of the documentation shows that the QSYS:Q_MAX_SDU
    per-port-tc registers serve 2 purposes: one is for guard band calculation
    (when zero, this falls back to QSYS:PORT_MAX_SDU), and the other is to
    enable oversized frame dropping (when non-zero).

    Currently the QSYS:Q_MAX_SDU registers are all zero, so oversized frame
    dropping is disabled. The goal of the change is to enable it seamlessly.
    For that, we need to hook into the MTU change, tc-taprio change, and
    port link speed change procedures, since we depend on these variables.

    Frames are not dropped on egress due to a queue system oversize
    condition, instead that egress port is simply excluded from the mask of
    valid destination ports for the packet. If there are no destination
    ports at all, the ingress counter that increments is the generic
    "drop_tail" in ethtool -S.

    The issue exists in various forms since the tc-taprio offload was introduced.

    Fixes: de143c0e274b ("net: dsa: felix: Configure Time-Aware Scheduler via taprio offload")
    Reported-by: Richie Pearn
    Signed-off-by: Vladimir Oltean
    Signed-off-by: Jakub Kicinski

    Vladimir Oltean
     
  • In vsc9959_tas_clock_adjust(), the INIT_GATE_STATE field is not changed,
    only the ENABLE field. Similarly for the disabling of the time-aware
    shaper in vsc9959_qos_port_tas_set().

    To reflect this, keep the QSYS_TAG_CONFIG_INIT_GATE_STATE_M mask out of
    the read-modify-write procedure to make it clearer what is the intention
    of the code.

    Signed-off-by: Vladimir Oltean
    Signed-off-by: Jakub Kicinski

    Vladimir Oltean
     
  • In a future change we will need to remember the entire tc-taprio config
    on all ports rather than just the base time, so use the
    taprio_offload_get() helper function to replace ocelot_port->base_time
    with ocelot_port->taprio.

    Signed-off-by: Vladimir Oltean
    Signed-off-by: Jakub Kicinski

    Vladimir Oltean
     
  • This reverts commit 942bc1616024d2b3b83a09cddd597bb6a5353c2a

    The function that trap PTP rule is already been added in following
    commit:
    26c48de1("net: mscc: ocelot: set up traps for PTP packets")

    This patch is no needed, and it will cause Kernel call trace:
    [ 6.349587] Workqueue: events_unbound deferred_probe_work_func
    [ 6.361104] pstate: a0000005 (NzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [ 6.368088] pc : ocelot_vcap_filter_add+0xa0/0x430
    [ 6.372893] lr : ocelot_vcap_filter_add+0x1b4/0x430
    [ 6.377783] sp : ffff8000080c38a0
    [ 6.381102] x29: ffff8000080c38a0 x28: ffff3088803e5e80 x27: ffff308880146200
    [ 6.388262] x26: 0000000000000200 x25: 0000000000000006 x24: 00000000ffffffff
    [ 6.395422] x23: ffffa549fade6f88 x22: ffff308881843810 x21: 0000000000000000
    [ 6.402581] x20: ffff308881843b78 x19: 0000000000000002 x18: ffffffffffffffff
    [ 6.409740] x17: 00000000ddcfaee3 x16: 0000000095d90135 x15: ffffa549fae7a82f
    [ 6.416899] x14: 0000000000000000 x13: 00000000000001d8 x12: 0000000000000000
    [ 6.424058] x11: 0000000000000000 x10: 0000000000000001 x9 : 0000000000000000
    [ 6.431216] x8 : 00000000ffffffff x7 : 0000000000000002 x6 : 0000000000000000
    [ 6.438375] x5 : 000000000000003a x4 : 00000000000000ff x3 : 00000000000086dd
    [ 6.445533] x2 : 0000000000000000 x1 : 0000000000000001 x0 : ffff308881843840
    [ 6.452692] Call trace:
    [ 6.455139] ocelot_vcap_filter_add+0xa0/0x430
    [ 6.459595] ocelot_init+0x80/0x990
    [ 6.463090] felix_setup+0x35c/0x7b0
    [ 6.466674] dsa_register_switch+0x864/0x1060
    [ 6.471042] felix_pci_probe+0x124/0x210
    [ 6.474974] local_pci_probe+0x40/0xb0
    [ 6.478732] pci_device_probe+0x114/0x1b0
    [ 6.482749] really_probe+0xb8/0x320
    [ 6.486331] __driver_probe_device+0x78/0xe0
    [ 6.490612] driver_probe_device+0x80/0x110
    [ 6.494804] __device_attach_driver+0x90/0xe0
    [ 6.499172] bus_for_each_drv+0x78/0xd0
    [ 6.503016] __device_attach+0x108/0x1a0
    [ 6.506947] device_initial_probe+0x14/0x20
    [ 6.511140] bus_probe_device+0x9c/0xb0
    [ 6.514984] deferred_probe_work_func+0x80/0xc0
    [ 6.519526] process_one_work+0x1a4/0x330
    [ 6.523545] worker_thread+0x1f8/0x420
    [ 6.527301] kthread+0x188/0x1a0
    [ 6.530536] ret_from_fork+0x10/0x20
    [ 6.534120] Code: 14000004 f9400042 eb02029f 54000080 (79404440)
    [ 6.540230] ---[ end trace 0000000000000002 ]---
    [ 3707.996108] ------------[ cut here ]------------

    So revert it in this patch.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • Use fp_enabled to enable/disable the preemption verification.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • Use fp_enabled to enable/disable the preemption verify, and reset mac
    preemption to restart verification process.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • When link up/down, the preemption verify status of remote MAC maybe
    changes. But the verification process will not restart to send SMD-v
    frame to verify remote MAC. Reset the mac preemption to restart the
    verification process and update the verify status.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • There is no assignment to preemption enable value. This patch use
    preemption enable status to set fp_enabled. This can be used for LLDP
    preemption status get.

    Fixes: 66128ac9f ("net: stmmac: add ethtool preempt support")
    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • ethtool need to get preemption active status on a port. This patch uses
    fp_enabled to indicate if preemption is active on that port. If the port
    is active, that means preemption capabilities have been verified or
    preemption verification has been disabled on that port.

    Signed-off-by: Xiaoliang Yang

    Xiaoliang Yang
     
  • - Some SoCs (like i.mx8mp) have multiple network interfaces attached to different controllers: eqos and fec
    Here make sure to return only device structure related to fec driver.

    Signed-off-by: Marouen Ghodhbane

    Marouen Ghodhbane
     
  • Increase generic phy driver status update rate (from 1Hz to 10Hz).

    Signed-off-by: Marouen Ghodhbane

    Marouen Ghodhbane
     
  • Also, do not include descriptor ts in burst read to avoid timestamp value glitches:
    On i.MX6Quad/QuadPlus, reading the RX descriptor timestamp field in burst
    can cause a wrong timestamp value (observed difference, on long hours
    runs, between the cached value in local_edpb and DDR after read).

    The fix is to read only the first 16 bytes in burst and then
    read the ts value from DDR when needed.
    Despite not detecting any issues on tx descriptor timestamps, the same code
    is used in both cases for simplicity.

    Signed-off-by: Marouen Ghodhbane

    Marouen Ghodhbane