Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Jul 14, 2024
    • Lorenzo Bianconi's avatar
      net: airoha: Introduce ethernet support for EN7581 SoC · 23020f04
      Lorenzo Bianconi authored
      
      Add airoha_eth driver in order to introduce ethernet support for
      Airoha EN7581 SoC available on EN7581 development board (en7581-evb).
      EN7581 mac controller is mainly composed by the Frame Engine (PSE+PPE)
      and QoS-DMA (QDMA) modules. FE is used for traffic offloading (just
      basic functionalities are currently supported) while QDMA is used for
      DMA operations and QOS functionalities between the mac layer and the
      external modules conncted to the FE GDM ports (e.g MT7530 DSA switch
      or external phys).
      A general overview of airoha_eth architecture is reported below:
      
                     ┌───────┐                                     ┌───────┐
                     │ QDMA2 │                                     │ QDMA1 │
                     └───┬───┘                                     └───┬───┘
                         │                                             │
                 ┌───────▼─────────────────────────────────────────────▼────────┐
                 │                                                              │
                 │       P5                                            P0       │
                 │                                                              │
                 │                                                              │
                 │                                                              │    ┌──────┐
                 │                                                           P3 ├────► GDM3 │
                 │                                                              │    └──────┘
                 │                                                              │
                 │                                                              │
      ┌─────┐    │                                                              │
      │ PPE ◄────┤ P4                          PSE                              │
      └─────┘    │                                                              │
                 │                                                              │
                 │                                                              │
                 │                                                              │    ┌──────┐
                 │                                                           P9 ├────► GDM4 │
                 │                                                              │    └──────┘
                 │                                                              │
                 │                                                              │
                 │                                                              │
                 │        P2                                           P1       │
                 └─────────┬───────────────────────────────────────────┬────────┘
                           │                                           │
                       ┌───▼──┐                                     ┌──▼───┐
                       │ GDM2 │                                     │ GDM1 │
                       └──────┘                                     └──┬───┘
                                                                       │
                                                                  ┌────▼─────┐
                                                                  │  MT7530  │
                                                                  └──────────┘
      
      Currently only hw LAN features (QDMA1+GDM1) are available while hw WAN
      (QDMA2+GDM{2,3,4}) ones will be added with subsequent patches introducing
      traffic offloading support.
      
      Tested-by: default avatarBenjamin Larsson <benjamin.larsson@genexis.eu>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://patch.msgid.link/274945d2391c195098ab180a46d0617b18b9e42c.1720818878.git.lorenzo@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      23020f04
    • Lorenzo Bianconi's avatar
      dt-bindings: net: airoha: Add EN7581 ethernet controller · 6bc8719c
      Lorenzo Bianconi authored
      
      Introduce device-tree binding documentation for Airoha EN7581 ethernet
      mac controller.
      
      Reviewed-by: default avatarRob Herring (Arm) <robh@kernel.org>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://patch.msgid.link/7dfecf8aa4e6519562a94455b95c49e1b3c858a0.1720818878.git.lorenzo@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6bc8719c
    • Jakub Kicinski's avatar
      Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue · 861f34e6
      Jakub Kicinski authored
      Tony Nguyen says:
      
      ====================
      ice: Switch API optimizations
      
      Marcin Szycik says:
      
      Optimize the process of creating a recipe in the switch block by removing
      duplicate switch ID words and changing how result indexes are fitted into
      recipes. In many cases this can decrease the number of recipes required to
      add a certain set of rules, potentially allowing a more varied set of rules
      to be created. Total rule count will also increase, since less words will
      be left unused/wasted. There are only 64 rules available in total, so every
      one counts.
      
      After this modification, many fields and some structs became unused or were
      simplified, resulting in overall simpler implementation.
      
      * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
        ice: Add tracepoint for adding and removing switch rules
        ice: Remove unused members from switch API
        ice: Optimize switch recipe creation
        ice: remove unused recipe bookkeeping data
        ice: Simplify bitmap setting in adding recipe
        ice: Remove reading all recipes before adding a new one
        ice: Remove unused struct ice_prot_lkup_ext members
      ====================
      
      Link: https://patch.msgid.link/20240711181312.2019606-1-anthony.l.nguyen@intel.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      861f34e6
  2. Jul 13, 2024
  3. Jul 12, 2024
    • Linus Torvalds's avatar
      Merge tag 'net-6.10-rc8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 528dd46d
      Linus Torvalds authored
      Pull more networking fixes from Jakub Kicinski:
       "A quick follow up to yesterday's pull. We got a regressions report for
        the bnxt patch as soon as it got to your tree. The ethtool fix is also
        good to have, although it's an older regression.
      
        Current release - regressions:
      
         - eth: bnxt_en: fix crash in bnxt_get_max_rss_ctx_ring() on older HW
           when user tries to decrease the ring count
      
        Previous releases - regressions:
      
         - ethtool: fix RSS setting, accept "no change" setting if the driver
           doesn't support the new features
      
         - eth: i40e: remove needless retries of NVM update, don't wait 20min
           when we know the firmware update won't succeed"
      
      * tag 'net-6.10-rc8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net:
        bnxt_en: Fix crash in bnxt_get_max_rss_ctx_ring()
        octeontx2-af: fix issue with IPv4 match for RSS
        octeontx2-af: fix issue with IPv6 ext match for RSS
        octeontx2-af: fix...
      528dd46d
    • Michael Chan's avatar
      bnxt_en: Fix crash in bnxt_get_max_rss_ctx_ring() · f7ce5eb2
      Michael Chan authored
      On older chips not supporting multiple RSS contexts, reducing
      ethtool channels will crash:
      
      BUG: kernel NULL pointer dereference, address: 00000000000000b8
      PGD 0 P4D 0
      Oops: Oops: 0000 [#1] PREEMPT SMP PTI
      CPU: 1 PID: 7032 Comm: ethtool Tainted: G S                 6.10.0-rc4 #1
      Hardware name: Dell Inc. PowerEdge R730/072T6D, BIOS 2.4.3 01/17/2017
      RIP: 0010:bnxt_get_max_rss_ctx_ring+0x4c/0x90 [bnxt_en]
      Code: c3 d3 eb 4c 8b 83 38 01 00 00 48 8d bb 38 01 00 00 4c 39 c7 74 42 41 8d 54 24 ff 31 c0 0f b7 d2 4c 8d 4c 12 02 66 85 ed 74 1d <49> 8b 90 b8 00 00 00 49 8d 34 11 0f b7 0a 66 39 c8 0f 42 c1 48 83
      RSP: 0018:ffffaaa501d23ba8 EFLAGS: 00010202
      RAX: 0000000000000000 RBX: ffff8efdf600c940 RCX: 0000000000000000
      RDX: 000000000000007f RSI: ffffffffacf429c4 RDI: ffff8efdf600ca78
      RBP: 0000000000000080 R08: 0000000000000000 R09: 0000000000000100
      R10: 0000000000000001 R11: ffffaaa501d238c0 R12: 0000000000000080
      R13: 0000000000000000 R14: ffff8efdf600c000 R15: 0000000000000006
      FS:  00007f977a7d2740(0000) GS:ffff8f041f840000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00000000000000b8 CR3: 00000002320aa004 CR4: 00000000003706f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
      <TASK>
      ? __die_body+0x15/0x60
      ? page_fault_oops+0x157/0x440
      ? do_user_addr_fault+0x60/0x770
      ? _raw_spin_lock_irqsave+0x12/0x40
      ? exc_page_fault+0x61/0x120
      ? asm_exc_page_fault+0x22/0x30
      ? bnxt_get_max_rss_ctx_ring+0x4c/0x90 [bnxt_en]
      ? bnxt_get_max_rss_ctx_ring+0x25/0x90 [bnxt_en]
      bnxt_set_channels+0x9d/0x340 [bnxt_en]
      ethtool_set_channels+0x14b/0x210
      __dev_ethtool+0xdf8/0x2890
      ? preempt_count_add+0x6a/0xa0
      ? percpu_counter_add_batch+0x23/0x90
      ? filemap_map_pages+0x417/0x4a0
      ? avc_has_extended_perms+0x185/0x420
      ? __pfx_udp_ioctl+0x10/0x10
      ? sk_ioctl+0x55/0xf0
      ? kmalloc_trace_noprof+0xe0/0x210
      ? dev_ethtool+0x54/0x170
      dev_ethtool+0xa2/0x170
      dev_ioctl+0xbe/0x530
      sock_do_ioctl+0xa3/0xf0
      sock_ioctl+0x20d/0x2e0
      
      bp->rss_ctx_list is not initialized if the chip or firmware does not
      support multiple RSS contexts.  Fix it by adding a check in
      bnxt_get_max_rss_ctx_ring() before proceeding to reference
      bp->rss_ctx_list.
      
      Fixes: 0d1b7d6c
      
       ("bnxt: fix crashes when reducing ring count with active RSS contexts")
      Reported-by: default avatarBreno Leitao <leitao@debian.org>
      Link: https://lore.kernel.org/netdev/ZpFEJeNpwxW1aW9k@gmail.com/
      
      
      Reviewed-by: default avatarAndy Gospodarek <andrew.gospodarek@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Link: https://patch.msgid.link/20240712175318.166811-1-michael.chan@broadcom.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f7ce5eb2
    • Tengda Wu's avatar
      selftests/bpf: Test for null-pointer-deref bugfix in resolve_prog_type() · e435b043
      Tengda Wu authored
      
      This test verifies that resolve_prog_type() works as expected when
      `attach_prog_fd` is not passed in.
      
      `prog->aux->dst_prog` in resolve_prog_type() is assigned by
      `attach_prog_fd`, and would be NULL if `attach_prog_fd` is not provided.
      
      Loading EXT prog with bpf_dynptr_from_skb() kfunc call in this way will
      lead to null-pointer-deref.
      
      Verify that the null-pointer-deref bug in resolve_prog_type() is fixed.
      
      Signed-off-by: default avatarTengda Wu <wutengda@huaweicloud.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20240711145819.254178-3-wutengda@huaweicloud.com
      e435b043
    • Tengda Wu's avatar
      bpf: Fix null pointer dereference in resolve_prog_type() for BPF_PROG_TYPE_EXT · f7866c35
      Tengda Wu authored
      When loading a EXT program without specifying `attr->attach_prog_fd`,
      the `prog->aux->dst_prog` will be null. At this time, calling
      resolve_prog_type() anywhere will result in a null pointer dereference.
      
      Example stack trace:
      
      [    8.107863] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000004
      [    8.108262] Mem abort info:
      [    8.108384]   ESR = 0x0000000096000004
      [    8.108547]   EC = 0x25: DABT (current EL), IL = 32 bits
      [    8.108722]   SET = 0, FnV = 0
      [    8.108827]   EA = 0, S1PTW = 0
      [    8.108939]   FSC = 0x04: level 0 translation fault
      [    8.109102] Data abort info:
      [    8.109203]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
      [    8.109399]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
      [    8.109614]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
      [    8.109836] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000101354000
      [    8.110011] [0000000000000004] pgd=0000000000000000, p4d=0000000000000000
      [    8.112624] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
      [    8.112783] Modules linked in:
      [    8.113120] CPU: 0 PID: 99 Comm: may_access_dire Not tainted 6.10.0-rc3-next-20240613-dirty #1
      [    8.113230] Hardware name: linux,dummy-virt (DT)
      [    8.113390] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      [    8.113429] pc : may_access_direct_pkt_data+0x24/0xa0
      [    8.113746] lr : add_subprog_and_kfunc+0x634/0x8e8
      [    8.113798] sp : ffff80008283b9f0
      [    8.113813] x29: ffff80008283b9f0 x28: ffff800082795048 x27: 0000000000000001
      [    8.113881] x26: ffff0000c0bb2600 x25: 0000000000000000 x24: 0000000000000000
      [    8.113897] x23: ffff0000c1134000 x22: 000000000001864f x21: ffff0000c1138000
      [    8.113912] x20: 0000000000000001 x19: ffff0000c12b8000 x18: ffffffffffffffff
      [    8.113929] x17: 0000000000000000 x16: 0000000000000000 x15: 0720072007200720
      [    8.113944] x14: 0720072007200720 x13: 0720072007200720 x12: 0720072007200720
      [    8.113958] x11: 0720072007200720 x10: 0000000000f9fca4 x9 : ffff80008021f4e4
      [    8.113991] x8 : 0101010101010101 x7 : 746f72705f6d656d x6 : 000000001e0e0f5f
      [    8.114006] x5 : 000000000001864f x4 : ffff0000c12b8000 x3 : 000000000000001c
      [    8.114020] x2 : 0000000000000002 x1 : 0000000000000000 x0 : 0000000000000000
      [    8.114126] Call trace:
      [    8.114159]  may_access_direct_pkt_data+0x24/0xa0
      [    8.114202]  bpf_check+0x3bc/0x28c0
      [    8.114214]  bpf_prog_load+0x658/0xa58
      [    8.114227]  __sys_bpf+0xc50/0x2250
      [    8.114240]  __arm64_sys_bpf+0x28/0x40
      [    8.114254]  invoke_syscall.constprop.0+0x54/0xf0
      [    8.114273]  do_el0_svc+0x4c/0xd8
      [    8.114289]  el0_svc+0x3c/0x140
      [    8.114305]  el0t_64_sync_handler+0x134/0x150
      [    8.114331]  el0t_64_sync+0x168/0x170
      [    8.114477] Code: 7100707f 54000081 f9401c00 f9403800 (b9400403)
      [    8.118672] ---[ end trace 0000000000000000 ]---
      
      One way to fix it is by forcing `attach_prog_fd` non-empty when
      bpf_prog_load(). But this will lead to `libbpf_probe_bpf_prog_type`
      API broken which use verifier log to probe prog type and will log
      nothing if we reject invalid EXT prog before bpf_check().
      
      Another way is by adding null check in resolve_prog_type().
      
      The issue was introduced by commit 4a9c7bbe ("bpf: Resolve to
      prog->aux->dst_prog->type only for BPF_PROG_TYPE_EXT") which wanted
      to correct type resolution for BPF_PROG_TYPE_TRACING programs. Before
      that, the type resolution of BPF_PROG_TYPE_EXT prog actually follows
      the logic below:
      
        prog->aux->dst_prog ? prog->aux->dst_prog->type : prog->type;
      
      It implies that when EXT program is not yet attached to `dst_prog`,
      the prog type should be EXT itself. This code worked fine in the past.
      So just keep using it.
      
      Fix this by returning `prog->type` for BPF_PROG_TYPE_EXT if `dst_prog`
      is not present in resolve_prog_type().
      
      Fixes: 4a9c7bbe
      
       ("bpf: Resolve to prog->aux->dst_prog->type only for BPF_PROG_TYPE_EXT")
      Signed-off-by: default avatarTengda Wu <wutengda@huaweicloud.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Link: https://lore.kernel.org/bpf/20240711145819.254178-2-wutengda@huaweicloud.com
      f7866c35