1. 19 3月, 2021 19 次提交
    • A
      net: embed nr_ids in the xps maps · 5478fcd0
      Antoine Tenart 提交于
      Embed nr_ids (the number of cpu for the xps cpus map, and the number of
      rxqs for the xps cpus map) in dev_maps. That will help not accessing out
      of bound memory if those values change after dev_maps was allocated.
      Suggested-by: NAlexander Duyck <alexander.duyck@gmail.com>
      Signed-off-by: NAntoine Tenart <atenart@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5478fcd0
    • A
      net: embed num_tc in the xps maps · 255c04a8
      Antoine Tenart 提交于
      The xps cpus/rxqs map is accessed using dev->num_tc, which is used when
      allocating the map. But later updates of dev->num_tc can lead to having
      a mismatch between the maps and how they're accessed. In such cases the
      map values do not make any sense and out of bound accesses can occur
      (that can be easily seen using KASAN).
      
      This patch aims at fixing this by embedding num_tc into the maps, using
      the value at the time the map is created. This brings two improvements:
      - The maps can be accessed using the embedded num_tc, so we know for
        sure we won't have out of bound accesses.
      - Checks can be made before accessing the maps so we know the values
        retrieved will make sense.
      
      We also update __netif_set_xps_queue to conditionally copy old maps from
      dev_maps in the new one only if the number of traffic classes from both
      maps match.
      Signed-off-by: NAntoine Tenart <atenart@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      255c04a8
    • A
      net-sysfs: make xps_cpus_show and xps_rxqs_show consistent · 73f5e52b
      Antoine Tenart 提交于
      Make the implementations of xps_cpus_show and xps_rxqs_show to converge,
      as the two share the same logic but diverted over time. This should not
      modify their behaviour but will help future changes and improve
      maintenance.
      Signed-off-by: NAntoine Tenart <atenart@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      73f5e52b
    • A
      net-sysfs: store the return of get_netdev_queue_index in an unsigned int · d9a063d2
      Antoine Tenart 提交于
      In net-sysfs, get_netdev_queue_index returns an unsigned int. Some of
      its callers use an unsigned long to store the returned value. Update the
      code to be consistent, this should only be cosmetic.
      Signed-off-by: NAntoine Tenart <atenart@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d9a063d2
    • A
      net-sysfs: convert xps_cpus_show to bitmap_zalloc · ea4fe7e8
      Antoine Tenart 提交于
      Use bitmap_zalloc instead of zalloc_cpumask_var in xps_cpus_show to
      align with xps_rxqs_show. This will improve maintenance and allow us to
      factorize the two functions. The function should behave the same.
      Signed-off-by: NAntoine Tenart <atenart@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ea4fe7e8
    • R
      net: dsa: bcm_sf2: fix BCM4908 RGMII reg(s) · 6859d915
      Rafał Miłecki 提交于
      BCM4908 has only 1 RGMII reg for controlling port 7.
      
      Fixes: 73b7a604 ("net: dsa: bcm_sf2: support BCM4908's integrated switch")
      Signed-off-by: NRafał Miłecki <rafal@milecki.pl>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6859d915
    • R
      net: dsa: bcm_sf2: add function finding RGMII register · 55cfeb39
      Rafał Miłecki 提交于
      Simple macro like REG_RGMII_CNTRL_P() is insufficient as:
      1. It doesn't validate port argument
      2. It doesn't support chipsets with non-lineral RGMII regs layout
      
      Missing port validation could result in getting register offset from out
      of array. Random memory -> random offset -> random reads/writes. It
      affected e.g. BCM4908 for REG_RGMII_CNTRL_P(7).
      
      Fixes: a78e86ed ("net: dsa: bcm_sf2: Prepare for different register layouts")
      Signed-off-by: NRafał Miłecki <rafal@milecki.pl>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      55cfeb39
    • Á
      net: dsa: b53: mmap: Add device tree support · a5538a77
      Álvaro Fernández Rojas 提交于
      Add device tree support to b53_mmap.c while keeping platform devices support.
      Signed-off-by: NÁlvaro Fernández Rojas <noltari@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a5538a77
    • D
      Merge branch 'stmmac-EST-interrupts-and-ethtool' · 7b78702e
      David S. Miller 提交于
      Mohammad Athari Bin Ismail says:
      
      ====================
      net: stmmac: EST interrupts and ethtool
      
      This patchset adds support for handling EST interrupts and reporting EST
      errors. Additionally, the errors are added into ethtool statistic.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7b78702e
    • O
      net: stmmac: Add EST errors into ethtool statistic · 9f298959
      Ong Boon Leong 提交于
      Below EST errors are added into ethtool statistic:
      1) Constant Gate Control Error (CGCE):
         The counter "mtl_est_cgce" increases everytime CGCE interrupt is
         triggered.
      
      2) Head-of-Line Blocking due to Scheduling (HLBS):
         The counter "mtl_est_hlbs" increases everytime HLBS interrupt is
         triggered.
      
      3) Head-of-Line Blocking due to Frame Size (HLBF):
         The counter "mtl_est_hlbf" increases everytime HLBF interrupt is
         triggered.
      
      4) Base Time Register error (BTRE):
         The counter "mtl_est_btre" increases everytime BTRE interrupt is
         triggered but BTRL not reaches maximum value of 15.
      
      5) Base Time Register Error Loop Count (BTRL) reaches maximum value:
         The counter "mtl_est_btrlm" increases everytime BTRE interrupt is
         triggered and BTRL value reaches maximum value of 15.
      
      Please refer to MTL_EST_STATUS register in DesignWare Cores Ethernet
      Quality-of-Service Databook for more detail explanation.
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NVoon Weifeng <weifeng.voon@intel.com>
      Co-developed-by: NMohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>
      Signed-off-by: NMohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9f298959
    • V
      net: stmmac: EST interrupts handling and error reporting · e49aa315
      Voon Weifeng 提交于
      Enabled EST related interrupts as below:
      1) Constant Gate Control Error (CGCE)
      2) Head-of-Line Blocking due to Scheduling (HLBS)
      3) Head-of-Line Blocking due to Frame Size (HLBF).
      4) Base Time Register error (BTRE)
      5) Switch to S/W owned list Complete (SWLC)
      
      For HLBS, the user will get the info of all the queues that shows this
      error. For HLBF, the user will get the info of all the queue with the
      latest frame size which causes the error. Frame size 0 indicates no
      error.
      
      The ISR handling takes place when EST feature is enabled by user.
      Signed-off-by: NVoon Weifeng <weifeng.voon@intel.com>
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Co-developed-by: NMohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>
      Signed-off-by: NMohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e49aa315
    • D
      Merge branch 'stmmac-vlan-priority-rx-steering' · 09bef832
      David S. Miller 提交于
      Ong Boon Leong says:
      
      ====================
      stmmac: add VLAN priority based RX steering
      
      The current tc flower implementation in stmmac supports both L3 and L4
      filter offloading. This patch adds the support of VLAN priority based
      RX frame steering into different Rx Queues.
      
      The patches have been tested on both configuration test (include L3/L4)
      and traffic test (multi VLAN ping streams with RX Frame Steering) below:-
      
      > tc qdisc delete dev eth0 ingress
      
      > tc qdisc del dev eth0 parent root 2&> /dev/null
      > tc qdisc del dev eth0 parent ffff: 2&> /dev/null
      
      > tc qdisc add dev eth0 ingress
      
      > tc filter add dev eth0 parent ffff: protocol ip flower dst_ip 192.168.0.1 \
        src_ip 192.168.1.1 ip_proto tcp dst_port 5201 src_port 6201 action drop
      
      > tc filter add dev eth0 parent ffff: protocol ip flower dst_ip 192.168.0.2 \
        src_ip 192.168.1.2 ip_proto tcp dst_port 5202 src_port 6202 action drop
      
      > tc filter show dev eth0 ingress
      filter parent ffff: protocol ip pref 49151 flower chain 0
      filter parent ffff: protocol ip pref 49151 flower chain 0 handle 0x1
        eth_type ipv4
        ip_proto tcp
        dst_ip 192.168.0.2
        src_ip 192.168.1.2
        dst_port 5202
        src_port 6202
        in_hw in_hw_count 1
              action order 1: gact action drop
               random type none pass val 0
               index 2 ref 1 bind 1
      
      filter parent ffff: protocol ip pref 49152 flower chain 0
      filter parent ffff: protocol ip pref 49152 flower chain 0 handle 0x1
        eth_type ipv4
        ip_proto tcp
        dst_ip 192.168.0.1
        src_ip 192.168.1.1
        dst_port 5201
        src_port 6201
        in_hw in_hw_count 1
              action order 1: gact action drop
               random type none pass val 0
               index 1 ref 1 bind 1
      
      > tc qdisc delete dev eth0 ingress
      
      > tc qdisc del dev eth0 parent root 2&> /dev/null
      > tc qdisc del dev eth0 parent ffff: 2&> /dev/null
      
      > tc qdisc add dev eth0 ingress
      
      > tc qdisc add dev eth0 root mqprio num_tc 4 \
        map 0 1 2 3 0 0 0 0 0 0 0 0 0 0 0 0 \
        queues 1@0 1@1 1@2 1@3 hw 0
      
      > tc filter add dev eth0 parent ffff: protocol 802.1Q flower vlan_prio 0 hw_tc 3
      
      > tc filter add dev eth0 parent ffff: protocol 802.1Q flower vlan_prio 1 hw_tc 2
      
      > tc filter add dev eth0 parent ffff: protocol 802.1Q flower vlan_prio 2 hw_tc 1
      
      > tc filter add dev eth0 parent ffff: protocol 802.1Q flower vlan_prio 3 hw_tc 0
      
      > tc filter show dev eth0 ingress
      filter parent ffff: protocol 802.1Q pref 49149 flower chain 0
      filter parent ffff: protocol 802.1Q pref 49149 flower chain 0 handle 0x1 hw_tc 0
        vlan_prio 3
        in_hw in_hw_count 1
      filter parent ffff: protocol 802.1Q pref 49150 flower chain 0
      filter parent ffff: protocol 802.1Q pref 49150 flower chain 0 handle 0x1 hw_tc 1
        vlan_prio 2
        in_hw in_hw_count 1
      filter parent ffff: protocol 802.1Q pref 49151 flower chain 0
      filter parent ffff: protocol 802.1Q pref 49151 flower chain 0 handle 0x1 hw_tc 2
        vlan_prio 1
        in_hw in_hw_count 1
      filter parent ffff: protocol 802.1Q pref 49152 flower chain 0
      filter parent ffff: protocol 802.1Q pref 49152 flower chain 0 handle 0x1 hw_tc 3
        vlan_prio 0
        in_hw in_hw_count 1
      
      > tc qdisc delete dev eth0 ingress
      
      > ip address flush dev eth0
      > ip address add 169.254.1.11/24 dev eth0
      
      > ip link delete dev eth0.vlan1 2> /dev/null
      > ip link add link eth0 name eth0.vlan1 type vlan id 1
      > ip address flush dev eth0.vlan1 2> /dev/null
      > ip address add 169.254.11.11/24 dev eth0.vlan1
      
      > ip link delete dev eth0.vlan2 2> /dev/null
      > ip link add link eth0 name eth0.vlan2 type vlan id 2
      > ip address flush dev eth0.vlan2 2> /dev/null
      > ip address add 169.254.12.11/24 dev eth0.vlan2
      
      > ip link delete dev eth0.vlan3 2> /dev/null
      > ip link add link eth0 name eth0.vlan3 type vlan id 3
      > ip address flush dev eth0.vlan3 2> /dev/null
      > ip address add 169.254.13.11/24 dev eth0.vlan3
      
      > ip link delete dev eth0.vlan4 2> /dev/null
      > ip link add link eth0 name eth0.vlan4 type vlan id 4
      > ip address flush dev eth0.vlan4 2> /dev/null
      > ip address add 169.254.14.11/24 dev eth0.vlan4
      
      > ip address flush dev eth0
      > ip address add 169.254.1.22/24 dev eth0
      
      > ip link delete dev eth0.vlan1 2> /dev/null
      > ip link add link eth0 name eth0.vlan1 type vlan id 1
      > ip address flush dev eth0.vlan1 2> /dev/null
      > ip address add 169.254.11.22/24 dev eth0.vlan1
      
      > ip link delete dev eth0.vlan2 2> /dev/null
      > ip link add link eth0 name eth0.vlan2 type vlan id 2
      > ip address flush dev eth0.vlan2 2> /dev/null
      > ip address add 169.254.12.22/24 dev eth0.vlan2
      
      > ip link delete dev eth0.vlan3 2> /dev/null
      > ip link add link eth0 name eth0.vlan3 type vlan id 3
      > ip address flush dev eth0.vlan3 2> /dev/null
      > ip address add 169.254.13.22/24 dev eth0.vlan3
      
      > ip link delete dev eth0.vlan4 2> /dev/null
      > ip link add link eth0 name eth0.vlan4 type vlan id 4
      > ip address flush dev eth0.vlan4 2> /dev/null
      > ip address add 169.254.14.22/24 dev eth0.vlan4
      
      > mkdir -p /sys/fs/cgroup/net_prio/grp0
      > echo eth0 0 > /sys/fs/cgroup/net_prio/grp0/net_prio.ifpriomap
      > echo eth0.vlan1 0 >  /sys/fs/cgroup/net_prio/grp0/net_prio.ifpriomap
      > mkdir -p /sys/fs/cgroup/net_prio/grp1
      > echo eth0 0 > /sys/fs/cgroup/net_prio/grp1/net_prio.ifpriomap
      > echo eth0.vlan2 1 >  /sys/fs/cgroup/net_prio/grp1/net_prio.ifpriomap
      > mkdir -p /sys/fs/cgroup/net_prio/grp2
      > echo eth0 0 > /sys/fs/cgroup/net_prio/grp2/net_prio.ifpriomap
      > echo eth0.vlan3 2 >  /sys/fs/cgroup/net_prio/grp2/net_prio.ifpriomap
      > mkdir -p /sys/fs/cgroup/net_prio/grp3
      > echo eth0 0 > /sys/fs/cgroup/net_prio/grp3/net_prio.ifpriomap
      > echo eth0.vlan4 3 >  /sys/fs/cgroup/net_prio/grp3/net_prio.ifpriomap
      
      > tc qdisc del dev eth0 parent root 2&> /dev/null
      > tc qdisc del dev eth0 parent ffff: 2&> /dev/null
      
      > tc qdisc add dev eth0 ingress
      > tc qdisc add dev eth0 root mqprio num_tc 4 map 0 1 2 3 0 0 0 0 0 0 0 0 0 0 0 0 queues 1@0 1@1 1@2 1@3 hw 0
      
      > tc filter add dev eth0 parent ffff: protocol 802.1Q flower vlan_prio 0 hw_tc 0
      
      > tc filter add dev eth0 parent ffff: protocol 802.1Q flower vlan_prio 1 hw_tc 1
      
      > tc filter add dev eth0 parent ffff: protocol 802.1Q flower vlan_prio 2 hw_tc 2
      
      > tc filter add dev eth0 parent ffff: protocol 802.1Q flower vlan_prio 3 hw_tc 3
      
      > ip link set eth0.vlan1 type vlan egress-qos-map 0:0
      > ip link set eth0.vlan2 type vlan egress-qos-map 1:1
      > ip link set eth0.vlan3 type vlan egress-qos-map 2:2
      > ip link set eth0.vlan4 type vlan egress-qos-map 3:3
      
      > tc filter show dev eth0 ingress
      filter parent ffff: protocol 802.1Q pref 49149 flower chain 0
      filter parent ffff: protocol 802.1Q pref 49149 flower chain 0 handle 0x1 hw_tc 3
        vlan_prio 3
        in_hw in_hw_count 1
      filter parent ffff: protocol 802.1Q pref 49150 flower chain 0
      filter parent ffff: protocol 802.1Q pref 49150 flower chain 0 handle 0x1 hw_tc 2
        vlan_prio 2
        in_hw in_hw_count 1
      filter parent ffff: protocol 802.1Q pref 49151 flower chain 0
      filter parent ffff: protocol 802.1Q pref 49151 flower chain 0 handle 0x1 hw_tc 1
        vlan_prio 1
        in_hw in_hw_count 1
      filter parent ffff: protocol 802.1Q pref 49152 flower chain 0
      filter parent ffff: protocol 802.1Q pref 49152 flower chain 0 handle 0x1 hw_tc 0
        vlan_prio 0
        in_hw in_hw_count 1
      
      > echo 1 > /proc/irq/131/smp_affinity
      > echo 1 > /proc/irq/132/smp_affinity
      
      > echo 4 > /proc/irq/133/smp_affinity
      > echo 4 > /proc/irq/134/smp_affinity
      
      > echo 4 > /proc/irq/135/smp_affinity
      > echo 4 > /proc/irq/136/smp_affinity
      
      > echo 2 > /proc/irq/137/smp_affinity
      > echo 2 > /proc/irq/138/smp_affinity
      
      > ping -i 0.001 169.254.11.22 2&> /dev/null &
      > PID1="$!"
      > echo $PID1 >  /sys/fs/cgroup/net_prio/grp0/cgroup.procs
      
      > ping -i 0.001 169.254.12.22 2&> /dev/null &
      > PID2="$!"
      > echo $PID2 >  /sys/fs/cgroup/net_prio/grp1/cgroup.procs
      
      > ping -i 0.001 169.254.13.22 2&> /dev/null &
      > PID3="$!"
      > echo $PID3 >  /sys/fs/cgroup/net_prio/grp2/cgroup.procs
      
      > ping -i 0.001 169.254.14.22 2&> /dev/null &
      > PID4="$!"
      > echo $PID4 >  /sys/fs/cgroup/net_prio/grp3/cgroup.procs
      
      > ping -i 0.001 169.254.11.11 2&> /dev/null &
      > PID1="$!"
      > echo $PID1 >  /sys/fs/cgroup/net_prio/grp0/cgroup.procs
      
      > ping -i 0.001 169.254.12.11 2&> /dev/null &
      > PID2="$!"
      > echo $PID2 >  /sys/fs/cgroup/net_prio/grp1/cgroup.procs
      
      > ping -i 0.001 169.254.13.11 2&> /dev/null &
      > PID3="$!"
      > echo $PID3 >  /sys/fs/cgroup/net_prio/grp2/cgroup.procs
      
      > ping -i 0.001 169.254.14.11 2&> /dev/null &
      > PID4="$!"
      > echo $PID4 >  /sys/fs/cgroup/net_prio/grp3/cgroup.procs
      
      > watch -n 0.5 -d "cat /proc/interrupts | grep eth0"
       131:     251918         41          0          0  IR-PCI-MSI 477184-edge      eth0:rx-0
       132:      18969          1          0          0  IR-PCI-MSI 477185-edge      eth0:tx-0
       133:          0          0     295872          0  IR-PCI-MSI 477186-edge      eth0:rx-1
       134:          0          0      16136          0  IR-PCI-MSI 477187-edge      eth0:tx-1
       135:          0          0     288042          0  IR-PCI-MSI 477188-edge      eth0:rx-2
       136:          0          0      16135          0  IR-PCI-MSI 477189-edge      eth0:tx-2
       137:          0     211177          0          0  IR-PCI-MSI 477190-edge      eth0:rx-3
       138:          2      16144          0          0  IR-PCI-MSI 477191-edge      eth0:tx-3
       139:          0          0          0          0  IR-PCI-MSI 477192-edge      eth0:rx-4
       140:          0          0          0          0  IR-PCI-MSI 477193-edge      eth0:tx-4
       141:          0          0          0          0  IR-PCI-MSI 477194-edge      eth0:rx-5
       142:          0          0          0          0  IR-PCI-MSI 477195-edge      eth0:tx-5
       143:          0          0          0          0  IR-PCI-MSI 477196-edge      eth0:rx-6
       144:          0          0          0          0  IR-PCI-MSI 477197-edge      eth0:tx-6
       145:          0          0          0          0  IR-PCI-MSI 477198-edge      eth0:rx-7
       146:          0          0          0          0  IR-PCI-MSI 477199-edge      eth0:tx-7
       157:          0          0          0          0  IR-PCI-MSI 477210-edge      eth0:safety-ue
      
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      09bef832
    • O
      net: stmmac: add RX frame steering based on VLAN priority in tc flower · 0e039f5c
      Ong Boon Leong 提交于
      We extend tc flower to support configuration of VLAN priority-based RX
      frame steering hardware offloading.
      
      To map VLAN <PCP> to Traffic Class <TC>:
        $ tc filter add dev <IFNAME> parent ffff: protocol 802.1Q flower \
             vlan_prio <PCP> hw_tc <TC>
      
        Note: <TC> < N whereby "tc qdisc ... num_tc N ..."
      
      To delete all tc flower configurations:
        $ tc qdisc delete dev <IFNAME> ingress
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0e039f5c
    • O
      net: stmmac: restructure tc implementation for RX VLAN Priority steering · bd0f670e
      Ong Boon Leong 提交于
      The current tc_add_flow() and tc_del_flow() use hardware L3 & L4 filters
      as offloading. The number of L3/L4 filters is read from L3L4FNUM field
      from MAC_HW_Feature1 register and is used to alloc priv->tc_entries[].
      
      For RX frame steering based on VLAN priority offloading, we use
      MAC_RXQ_CTRL2 & MAC_RXQ_CTRL3 registers and all VLAN priority level
      can be configured independent from L3 & L4 filters.
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bd0f670e
    • D
      Merge branch 'octeon-tc-offloads' · 31222162
      David S. Miller 提交于
      Naveen Mamindlapalli says:
      
      ====================
      Add tc hardware offloads
      
      This patch series adds support for tc hardware offloads.
      
      Patch #1 adds support for offloading flows that matches IP tos and IP
               protocol which will be used by tc hw offload support. Also
               added ethtool n-tuple filter to code to offload the flows
               matching the above fields.
      Patch #2 adds tc flower hardware offload support on ingress traffic.
      Patch #3 adds TC flower offload stats.
      Patch #4 adds tc TC_MATCHALL egress ratelimiting offload.
      
      * tc flower hardware offload in PF driver
      
      The driver parses the flow match fields and actions received from the tc
      subsystem and adds/delete MCAM rules for the same. Each flow contains set
      of match and action fields. If the action or fields are not supported,
      the rule cannot be offloaded to hardware. The tc uses same set of MCAM
      rules allocated for ethtool n-tuple filters. So, at a time only one entity
      can offload the flows to hardware, they're made mutually exclusive in the
      driver.
      
      Following match and actions are supported.
      
      Match: Eth dst_mac, EtherType, 802.1Q {vlan_id,vlan_prio}, vlan EtherType,
             IP proto {tcp,udp,sctp,icmp,icmp6}, IPv4 tos, IPv4{dst_ip,src_ip},
             L4 proto {dst_port|src_port number}.
      Actions: drop, accept, vlan pop, redirect to another port on the device.
      
      The Hardware stats are also supported. Currently only packet counter stats
      are updated.
      
      * tc egress rate limiting support
      Added TC-MATCHALL classifier offload with police action applied for all
      egress traffic on the specified interface.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      31222162
    • S
      octeontx2-pf: TC_MATCHALL egress ratelimiting offload · e638a83f
      Sunil Goutham 提交于
      Add TC_MATCHALL egress ratelimiting offload support with POLICE
      action for entire traffic going out of the interface.
      
      Eg: To ratelimit egress traffic to 100Mbps
      
      $ ethtool -K eth0 hw-tc-offload on
      $ tc qdisc add dev eth0 clsact
      $ tc filter add dev eth0 egress matchall skip_sw \
                      action police rate 100Mbit burst 16Kbit
      
      HW supports a max burst size of ~128KB.
      Only one ratelimiting filter can be installed at a time.
      Signed-off-by: NSunil Goutham <sgoutham@marvell.com>
      Signed-off-by: NNaveen Mamindlapalli <naveenm@marvell.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e638a83f
    • N
      octeontx2-pf: add tc flower stats handler for hw offloads · d8ce30e0
      Naveen Mamindlapalli 提交于
      Add support to get the stats for tc flower flows that are
      offloaded to hardware. To support this feature, added a
      new AF mbox handler which returns the MCAM entry stats
      for a flow that has hardware stat counter enabled.
      Signed-off-by: NNaveen Mamindlapalli <naveenm@marvell.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d8ce30e0
    • N
      octeontx2-pf: Add tc flower hardware offload on ingress traffic · 1d4d9e42
      Naveen Mamindlapalli 提交于
      This patch adds support for tc flower hardware offload on ingress
      traffic. Since the tc-flower filter rules use the same set of MCAM
      rules as the n-tuple filters, the n-tuple filters and tc flower
      rules are mutually exclusive. When one of the feature is enabled
      using ethtool, the other feature is disabled in the driver. By default
      the driver enables n-tuple filters during initialization.
      
      The following flow keys are supported.
          -> Ethernet: dst_mac
          -> L2 proto: all protocols
          -> VLAN (802.1q): vlan_id/vlan_prio
          -> IPv4: dst_ip/src_ip/ip_proto{tcp|udp|sctp|icmp}/ip_tos
          -> IPv6: ip_proto{icmpv6}
          -> L4(tcp/udp/sctp): dst_port/src_port
      
      The following flow actions are supported.
          -> drop
          -> accept
          -> redirect
          -> vlan pop
      
      The flow action supports multiple actions when vlan pop is specified
      as the first action. The redirect action supports redirecting to the
      PF/VF of same PCI device. Redirecting to other PCI NIX devices is not
      supported.
      
      Example #1: Add a tc filter rule to drop UDP traffic with dest port 80
          # ethtool -K eth0 hw-tc-offload on
          # tc qdisc add dev eth0 ingress
          # tc filter add dev eth0 protocol ip parent ffff: flower ip_proto \
                udp dst_port 80 action drop
      
      Example #2: Add a tc filter rule to redirect ingress traffic on eth0
      with vlan id 3 to eth6 (ex: eth0 vf0) after stripping the vlan hdr.
          # ethtool -K eth0 hw-tc-offload on
          # tc qdisc add dev eth0 ingress
          # tc filter add dev eth0 parent ffff: protocol 802.1Q flower \
                vlan_id 3 vlan_ethtype ipv4 action vlan pop action mirred \
                ingress redirect dev eth6
      
      Example #3: List the ingress filter rules
          # tc -s filter show dev eth4 ingress
      
      Example #4: Delete tc flower filter rule with handle 0x1
          # tc filter del dev eth0 ingress protocol ip pref 49152 \
            handle 1 flower
      Signed-off-by: NNaveen Mamindlapalli <naveenm@marvell.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1d4d9e42
    • N
      octeontx2-pf: Add ip tos and ip proto icmp/icmpv6 flow offload support · 2b9cef66
      Naveen Mamindlapalli 提交于
      Add support for programming the HW MCAM match key with IP tos, IP(v6)
      proto icmp/icmpv6, allowing flow offload rules to be installed using
      those fields. The NPC HW extracts layer type, which will be used as a
      matching criteria for different IP protocols.
      
      The ethtool n-tuple filter logic has been updated to parse the IP tos
      and l4proto for HW offloading. l4proto tcp/udp/sctp/ah/esp/icmp are
      supported. See example usage below.
      
      Ex: Redirect l4proto icmp to vf 0 queue 0
      ethtool -U eth0 flow-type ip4 l4proto 1 action vf 0 queue 0
      
      Ex: Redirect flow with ip tos 8 to vf 0 queue 0
      ethtool -U eth0 flow-type ip4 tos 8 vf 0 queue 0
      Signed-off-by: NNaveen Mamindlapalli <naveenm@marvell.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2b9cef66
  2. 18 3月, 2021 21 次提交