Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Dec 09, 2021
  2. Dec 08, 2021
    • Louis Amas's avatar
      net: mvpp2: fix XDP rx queues registering · a50e659b
      Louis Amas authored
      The registration of XDP queue information is incorrect because the
      RX queue id we use is invalid. When port->id == 0 it appears to works
      as expected yet it's no longer the case when port->id != 0.
      
      The problem arised while using a recent kernel version on the
      MACCHIATOBin. This board has several ports:
       * eth0 and eth1 are 10Gbps interfaces ; both ports has port->id == 0;
       * eth2 is a 1Gbps interface with port->id != 0.
      
      Code from xdp-tutorial (more specifically advanced03-AF_XDP) was used
      to test packet capture and injection on all these interfaces. The XDP
      kernel was simplified to:
      
      	SEC("xdp_sock")
      	int xdp_sock_prog(struct xdp_md *ctx)
      	{
      		int index = ctx->rx_queue_index;
      
      		/* A set entry here means that the correspnding queue_id
      		* has an active AF_XDP socket bound to it. */
      		if (bpf_map_lookup_elem(&xsks_map, &index))
      			return bpf_redirect_map(&xsks_map, index, 0);
      
      		return XDP_PASS;
      	}
      
      Starting the program using:
      
      	./af_xdp_user -d DEV
      
      Gives the following result:
      
       * eth0 : ok
       * eth1 : ok
       * eth2 : no capture, no injection
      
      Investigating the issue shows that XDP rx queues for eth2 are wrong:
      XDP expects their id to be in the range [0..3] but we found them to be
      in the range [32..35].
      
      Trying to force rx queue ids using:
      
      	./af_xdp_user -d eth2 -Q 32
      
      fails as expected (we shall not have more than 4 queues).
      
      When we register the XDP rx queue information (using
      xdp_rxq_info_reg() in function mvpp2_rxq_init()) we tell it to use
      rxq->id as the queue id. This value is computed as:
      
      	rxq->id = port->id * max_rxq_count + queue_id
      
      where max_rxq_count depends on the device version. In the MACCHIATOBin
      case, this value is 32, meaning that rx queues on eth2 are numbered
      from 32 to 35 - there are four of them.
      
      Clearly, this is not the per-port queue id that XDP is expecting:
      it wants a value in the range [0..3]. It shall directly use queue_id
      which is stored in rxq->logic_rxq -- so let's use that value instead.
      
      rxq->id is left untouched ; its value is indeed valid but it should
      not be used in this context.
      
      This is consistent with the remaining part of the code in
      mvpp2_rxq_init().
      
      With this change, packet capture is working as expected on all the
      MACCHIATOBin ports.
      
      Fixes: b27db227
      
       ("mvpp2: use page_pool allocator")
      Signed-off-by: default avatarLouis Amas <louis.amas@eho.link>
      Signed-off-by: default avatarEmmanuel Deloget <emmanuel.deloget@eho.link>
      Reviewed-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
      Link: https://lore.kernel.org/r/20211207143423.916334-1-louis.amas@eho.link
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a50e659b
    • Ronak Doshi's avatar
      vmxnet3: fix minimum vectors alloc issue · f71ef02f
      Ronak Doshi authored
      'Commit 39f9895a ("vmxnet3: add support for 32 Tx/Rx queues")'
      added support for 32Tx/Rx queues. Within that patch, value of
      VMXNET3_LINUX_MIN_MSIX_VECT was updated.
      
      However, there is a case (numvcpus = 2) which actually requires 3
      intrs which matches VMXNET3_LINUX_MIN_MSIX_VECT which then is
      treated as failure by stack to allocate more vectors. This patch
      fixes this issue.
      
      Fixes: 39f9895a
      
       ("vmxnet3: add support for 32 Tx/Rx queues")
      Signed-off-by: default avatarRonak Doshi <doshir@vmware.com>
      Acked-by: default avatarGuolin Yang <gyang@vmware.com>
      Link: https://lore.kernel.org/r/20211207081737.14000-1-doshir@vmware.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f71ef02f
    • Eric Dumazet's avatar
      net, neigh: clear whole pneigh_entry at alloc time · e195e9b5
      Eric Dumazet authored
      Commit 2c611ad9 ("net, neigh: Extend neigh->flags to 32 bit
      to allow for extensions") enables a new KMSAM warning [1]
      
      I think the bug is actually older, because the following intruction
      only occurred if ndm->ndm_flags had NTF_PROXY set.
      
      	pn->flags = ndm->ndm_flags;
      
      Let's clear all pneigh_entry fields at alloc time.
      
      [1]
      BUG: KMSAN: uninit-value in pneigh_fill_info+0x986/0xb30 net/core/neighbour.c:2593
       pneigh_fill_info+0x986/0xb30 net/core/neighbour.c:2593
       pneigh_dump_table net/core/neighbour.c:2715 [inline]
       neigh_dump_info+0x1e3f/0x2c60 net/core/neighbour.c:2832
       netlink_dump+0xaca/0x16a0 net/netlink/af_netlink.c:2265
       __netlink_dump_start+0xd1c/0xee0 net/netlink/af_netlink.c:2370
       netlink_dump_start include/linux/netlink.h:254 [inline]
       rtnetlink_rcv_msg+0x181b/0x18c0 net/core/rtnetlink.c:5534
       netlink_rcv_skb+0x447/0x800 net/netlink/af_netlink.c:2491
       rtnetlink_rcv+0x50/0x60 net/core/rtnetlink.c:5589
       netlink_unicast_kernel net/netlink/af_netl...
      e195e9b5
    • Jakub Kicinski's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf · fd31cb0c
      Jakub Kicinski authored
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter fixes for net
      
      1) Fix bogus compilter warning in nfnetlink_queue, from Florian Westphal.
      
      2) Don't run conntrack on vrf with !dflt qdisc, from Nicolas Dichtel.
      
      3) Fix nft_pipapo bucket load in AVX2 lookup routine for six 8-bit
         groups, from Stefano Brivio.
      
      4) Break rule evaluation on malformed TCP options.
      
      5) Use socat instead of nc in selftests/netfilter/nft_zones_many.sh,
         also from Florian
      
      6) Fix KCSAN data-race in conntrack timeout updates, from Eric Dumazet.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf:
        netfilter: conntrack: annotate data-races around ct->timeout
        selftests: netfilter: switch zone stress to socat
        netfilter: nft_exthdr: break evaluation if setting TCP option fails
        selftests: netfilter: Add correctness test for mac,net set type
        nft_set_pipapo: Fix bucket load in AVX2 lookup routine for six 8-bit groups
        vrf: don't run conntrack on vrf with ...
      fd31cb0c
    • Jakub Kicinski's avatar
      Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue · b5b6b6ba
      Jakub Kicinski authored
      Tony Nguyen says:
      
      ====================
      Intel Wired LAN Driver Updates 2021-12-08
      
      Yahui adds re-initialization of Flow Director for VF reset.
      
      Paul restores interrupts when enabling VFs.
      
      Dave re-adds bandwidth check for DCBNL and moves DSCP mode check
      earlier in the function.
      
      Jesse prevents reporting of dropped packets that occur during
      initialization and fixes reporting of statistics which could occur with
      frequent reads.
      
      Michal corrects setting of protocol type for UDP header and fixes lack
      of differentiation when adding filters for tunnels.
      
      * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue:
        ice: safer stats processing
        ice: fix adding different tunnels
        ice: fix choosing UDP header type
        ice: ignore dropped packets during init
        ice: Fix problems with DSCP QoS implementation
        ice: rearm other interrupt cause register after enabling VFs
        ice: fix FDIR init missing when reset VF
      ====================
      
      Link: https://lore.kernel.org/r/20211208211144.2629867-1-anthony.l.nguyen@intel.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b5b6b6ba
    • Jakub Kicinski's avatar
      Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf · 6efcdadc
      Jakub Kicinski authored
      Daniel Borkmann says:
      
      ====================
      bpf 2021-12-08
      
      We've added 12 non-merge commits during the last 22 day(s) which contain
      a total of 29 files changed, 659 insertions(+), 80 deletions(-).
      
      The main changes are:
      
      1) Fix an off-by-two error in packet range markings and also add a batch of
         new tests for coverage of these corner cases, from Maxim Mikityanskiy.
      
      2) Fix a compilation issue on MIPS JIT for R10000 CPUs, from Johan Almbladh.
      
      3) Fix two functional regressions and a build warning related to BTF kfunc
         for modules, from Kumar Kartikeya Dwivedi.
      
      4) Fix outdated code and docs regarding BPF's migrate_disable() use on non-
         PREEMPT_RT kernels, from Sebastian Andrzej Siewior.
      
      5) Add missing includes in order to be able to detangle cgroup vs bpf header
         dependencies, from Jakub Kicinski.
      
      6) Fix regression in BPF sockmap tests caused by missing detachment of progs
         from sockets when they are removed from the map, from Joh...
      6efcdadc
    • Russell King (Oracle)'s avatar
      net: dsa: mv88e6xxx: fix "don't use PHY_DETECT on internal PHY's" · 2b29cb9e
      Russell King (Oracle) authored
      This commit fixes a misunderstanding in commit 4a3e0aed ("net: dsa:
      mv88e6xxx: don't use PHY_DETECT on internal PHY's").
      
      For Marvell DSA switches with the PHY_DETECT bit (for non-6250 family
      devices), controls whether the PPU polls the PHY to retrieve the link,
      speed, duplex and pause status to update the port configuration. This
      applies for both internal and external PHYs.
      
      For some switches such as 88E6352 and 88E6390X, PHY_DETECT has an
      additional function of enabling auto-media mode between the internal
      PHY and SERDES blocks depending on which first gains link.
      
      The original intention of commit 5d5b231d (net: dsa: mv88e6xxx: use
      PHY_DETECT in mac_link_up/mac_link_down) was to allow this bit to be
      used to detect when this propagation is enabled, and allow software to
      update the port configuration. This has found to be necessary for some
      switches which do not automatically propagate status from the SERDES to
      the port, which includes the 88E6390. However, commit 4a3e0aed
      ("net: dsa: mv88e6xxx: don't use PHY_DETECT on internal PHY's") breaks
      this assumption.
      
      Maarten Zanders has confirmed that the issue he was addressing was for
      an 88E6250 switch, which does not have a PHY_DETECT bit in bit 12, but
      instead a link status bit. Therefore, mv88e6xxx_port_ppu_updates() does
      not report correctly.
      
      This patch resolves the above issues by reverting Maarten's change and
      instead making mv88e6xxx_port_ppu_updates() indicate whether the port
      is internal for the 88E6250 family of switches.
      
        Yes, you're right, I'm targeting the 6250 family. And yes, your
        suggestion would solve my case and is a better implementation for
        the other devices (as far as I can see).
      
      Fixes: 4a3e0aed
      
       ("net: dsa: mv88e6xxx: don't use PHY_DETECT on internal PHY's")
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Tested-by: default avatarMaarten Zanders <maarten.zanders@mind.be>
      Link: https://lore.kernel.org/r/E1muXm7-00EwJB-7n@rmk-PC.armlinux.org.uk
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2b29cb9e
    • Jesse Brandeburg's avatar
      ice: safer stats processing · 1a0f25a5
      Jesse Brandeburg authored
      The driver was zeroing live stats that could be fetched by
      ndo_get_stats64 at any time. This could result in inconsistent
      statistics, and the telltale sign was when reading stats frequently from
      /proc/net/dev, the stats would go backwards.
      
      Fix by collecting stats into a local, and delaying when we write to the
      structure so it's not incremental.
      
      Fixes: fcea6f3d
      
       ("ice: Add stats and ethtool support")
      Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Tested-by: default avatarGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      1a0f25a5
    • Maxim Mikityanskiy's avatar
      bpf: Add selftests to cover packet access corner cases · b560b21f
      Maxim Mikityanskiy authored
      This commit adds BPF verifier selftests that cover all corner cases by
      packet boundary checks. Specifically, 8-byte packet reads are tested at
      the beginning of data and at the beginning of data_meta, using all kinds
      of boundary checks (all comparison operators: <, >, <=, >=; both
      permutations of operands: data + length compared to end, end compared to
      data + length). For each case there are three tests:
      
      1. Length is just enough for an 8-byte read. Length is either 7 or 8,
         depending on the comparison.
      
      2. Length is increased by 1 - should still pass the verifier. These
         cases are useful, because they failed before commit 2fa7d94a
      
      
         ("bpf: Fix the off-by-two error in range markings").
      
      3. Length is decreased by 1 - should be rejected by the verifier.
      
      Some existing tests are just renamed to avoid duplication.
      
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20211207081521.41923-1-maximmi@nvidia.com
      b560b21f
    • Joakim Zhang's avatar
      net: fec: only clear interrupt of handling queue in fec_enet_rx_queue() · b5bd95d1
      Joakim Zhang authored
      Background:
      We have a customer is running a Profinet stack on the 8MM which receives and
      responds PNIO packets every 4ms and PNIO-CM packets every 40ms. However, from
      time to time the received PNIO-CM package is "stock" and is only handled when
      receiving a new PNIO-CM or DCERPC-Ping packet (tcpdump shows the PNIO-CM and
      the DCERPC-Ping packet at the same time but the PNIO-CM HW timestamp is from
      the expected 40 ms and not the 2s delay of the DCERPC-Ping).
      
      After debugging, we noticed PNIO, PNIO-CM and DCERPC-Ping packets would
      be handled by different RX queues.
      
      The root cause should be driver ack all queues' interrupt when handle a
      specific queue in fec_enet_rx_queue(). The blamed patch is introduced to
      receive as much packets as possible once to avoid interrupt flooding.
      But it's unreasonable to clear other queues'interrupt when handling one
      queue, this patch tries to fix it.
      
      Fixes: ed63f1dc
      
       (net: fec: clear receive interrupts before processing a packet)
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Reported-by: default avatarNicolas Diaz <nicolas.diaz@nxp.com>
      Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Link: https://lore.kernel.org/r/20211206135457.15946-1-qiangqing.zhang@nxp.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b5bd95d1
    • Jakub Kicinski's avatar
      Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue · 65af674a
      Jakub Kicinski authored
      Tony Nguyen says:
      
      ====================
      Intel Wired LAN Driver Updates 2021-12-06
      
      This series contains updates to iavf and i40e drivers.
      
      Mitch adds restoration of MSI state during reset for iavf.
      
      Michal fixes checking and reporting of descriptor count changes to
      communicate changes and/or issues for iavf.
      
      Karen resolves an issue with failed handling of VF requests while a VF
      reset is occurring for i40e.
      
      Mateusz removes clearing of VF requested queue count when configuring
      VF ADQ for i40e.
      
      Norbert fixes a NULL pointer dereference that can occur when getting VSI
      descriptors for i40e.
      ====================
      
      Link: https://lore.kernel.org/r/20211206183519.2733180-1-anthony.l.nguyen@intel.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      65af674a
    • Jakub Kicinski's avatar
      Merge branch 'net-phy-fix-doc-build-warning' · 9e892688
      Jakub Kicinski authored
      Yanteng Si says:
      
      ====================
      net: phy: Fix doc build warnings
      ====================
      
      Link: https://lore.kernel.org/r/cover.1638776933.git.siyanteng@loongson.cn
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9e892688
    • Yanteng Si's avatar
      net: phy: Add the missing blank line in the phylink_suspend comment · c35e8de7
      Yanteng Si authored
      
      Fix warning as:
      
      Documentation/networking/kapi:147: ./drivers/net/phy/phylink.c:1657: WARNING: Unexpected indentation.
      Documentation/networking/kapi:147: ./drivers/net/phy/phylink.c:1658: WARNING: Block quote ends without a blank line; unexpected unindent.
      
      Signed-off-by: default avatarYanteng Si <siyanteng@loongson.cn>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c35e8de7
    • Yanteng Si's avatar
      net: phy: Remove unnecessary indentation in the comments of phy_device · a97770cc
      Yanteng Si authored
      
      Fix warning as:
      
      linux-next/Documentation/networking/kapi:122: ./include/linux/phy.h:543: WARNING: Unexpected indentation.
      linux-next/Documentation/networking/kapi:122: ./include/linux/phy.h:544: WARNING: Block quote ends without a blank line; unexpected unindent.
      linux-next/Documentation/networking/kapi:122: ./include/linux/phy.h:546: WARNING: Unexpected indentation.
      
      Suggested-by: default avatarAkira Yokosawa <akiyks@gmail.com>
      Signed-off-by: default avatarYanteng Si <siyanteng@loongson.cn>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a97770cc
  3. Dec 07, 2021