1. 22 Aug, 2022 1 commit
  2. 19 Aug, 2022 28 commits
  3. 18 Aug, 2022 11 commits
    • Jakub Kicinski's avatar
      Merge branch 'add-dt-property-to-disable-hibernation-mode' · aa447a87
      Jakub Kicinski authored
      Wei Fang says:
      
      ====================
      Add DT property to disable hibernation mode
      
      The patches add the ability to disable the hibernation mode of AR803x
      PHYs. Hibernation mode defaults to enabled after hardware reset on
      these PHYs. If the AR803x PHYs enter hibernation mode, they will not
      provide any clock. For some MACs, they might need the clocks which
      provided by the PHYs to support their own hardware logic.
      So, the patches add the support to disable hibernation mode by adding
      a boolean:
      
              qca,disable-hibernation-mode
      
      If one wished to disable hibernation mode to better match with the
      specifical MAC, just add this property in the phy node of DT.
      ====================
      
      Link: https://lore.kernel.org/r/20220818030054.1010660-1-wei.fang@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      aa447a87
    • Wei Fang's avatar
      net: phy: at803x: add disable hibernation mode support · 9ecf0401
      Wei Fang authored
      When the cable is unplugged, the Atheros AR803x PHYs will enter
      hibernation mode after about 10 seconds if the hibernation mode
      is enabled and will not provide any clock to the MAC. But for
      some MACs, this feature might cause unexpected issues due to the
      logic of MACs.
      Taking SYNP MAC (stmmac) as an example, if the cable is unplugged
      and the "eth0" interface is down, the AR803x PHY will enter
      hibernation mode. Then perform the "ifconfig eth0 up" operation,
      the stmmac can't be able to complete the software reset operation
      and fail to init it's own DMA. Therefore, the "eth0" interface is
      failed to ifconfig up. Why does it cause this issue? The truth is
      that the software reset operation of the stmmac is designed to
      depend on the RX_CLK of PHY.
      So, this patch offers an option for the user to determine whether
      to disable the hibernation mode of AR803x PHYs.
      Signed-off-by: default avatarWei Fang <wei.fang@nxp.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9ecf0401
    • Wei Fang's avatar
      dt-bindings: net: ar803x: add disable-hibernation-mode propetry · 2e7f0899
      Wei Fang authored
      The hibernation mode of Atheros AR803x PHYs defaults to be
      enabled after hardware reset. When the cable is unplugged,
      the PHY will enter hibernation mode after about 10 seconds
      and the PHY clocks will be stopped to save power.
      However, some MACs need the phy output clock for proper
      functioning of their logic. For instance, stmmac needs the
      RX_CLK of PHY for software reset to complete.
      Therefore, add a DT property to configure the PHY to disable
      this hardware hibernation mode.
      Signed-off-by: default avatarWei Fang <wei.fang@nxp.com>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2e7f0899
    • Sergei Antonov's avatar
      net: moxa: MAC address reading, generating, validity checking · f4693b81
      Sergei Antonov authored
      This device does not remember its MAC address, so add a possibility
      to get it from the platform. If it fails, generate a random address.
      This will provide a MAC address early during boot without user space
      being involved.
      
      Also remove extra calls to is_valid_ether_addr().
      
      Made after suggestions by Andrew Lunn:
      1) Use eth_hw_addr_random() to assign a random MAC address during probe.
      2) Remove is_valid_ether_addr() from moxart_mac_open()
      3) Add a call to platform_get_ethdev_address() during probe
      4) Remove is_valid_ether_addr() from moxart_set_mac_address(). The core does this
      
      v1 -> v2:
      Handle EPROBE_DEFER returned from platform_get_ethdev_address().
      Move MAC reading code to the beginning of the probe function.
      Signed-off-by: default avatarSergei Antonov <saproj@gmail.com>
      Suggested-by: default avatarAndrew Lunn <andrew@lunn.ch>
      CC: Yang Yingliang <yangyingliang@huawei.com>
      CC: Pavel Skripkin <paskripkin@gmail.com>
      CC: Guobin Huang <huangguobin4@huawei.com>
      CC: Yang Wei <yang.wei9@zte.com.cn>
      CC: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Link: https://lore.kernel.org/r/20220818092317.529557-1-saproj@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f4693b81
    • Jakub Kicinski's avatar
      Merge branch 'tcp-some-bug-fixes-for-tcp_read_skb' · 267ef48e
      Jakub Kicinski authored
      Cong Wang says:
      
      ====================
      tcp: some bug fixes for tcp_read_skb()
      
      This patchset contains 3 bug fixes and 1 minor refactor patch for
      tcp_read_skb(). V1 only had the first patch, as Eric prefers to fix all
      of them together, I have to group them together.
      ====================
      
      Link: https://lore.kernel.org/r/20220817195445.151609-1-xiyou.wangcong@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      267ef48e
    • Cong Wang's avatar
      tcp: handle pure FIN case correctly · 2e23acd9
      Cong Wang authored
      When skb->len==0, the recv_actor() returns 0 too, but we also use 0
      for error conditions. This patch amends this by propagating the errors
      to tcp_read_skb() so that we can distinguish skb->len==0 case from
      error cases.
      
      Fixes: 04919bed ("tcp: Introduce tcp_read_skb()")
      Reported-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: Jakub Sitnicki <jakub@cloudflare.com>
      Signed-off-by: default avatarCong Wang <cong.wang@bytedance.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2e23acd9
    • Cong Wang's avatar
      tcp: refactor tcp_read_skb() a bit · a8688821
      Cong Wang authored
      As tcp_read_skb() only reads one skb at a time, the while loop is
      unnecessary, we can turn it into an if. This also simplifies the
      code logic.
      
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: Jakub Sitnicki <jakub@cloudflare.com>
      Signed-off-by: default avatarCong Wang <cong.wang@bytedance.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a8688821
    • Cong Wang's avatar
      tcp: fix tcp_cleanup_rbuf() for tcp_read_skb() · c457985a
      Cong Wang authored
      tcp_cleanup_rbuf() retrieves the skb from sk_receive_queue, it
      assumes the skb is not yet dequeued. This is no longer true for
      tcp_read_skb() case where we dequeue the skb first.
      
      Fix this by introducing a helper __tcp_cleanup_rbuf() which does
      not require any skb and calling it in tcp_read_skb().
      
      Fixes: 04919bed ("tcp: Introduce tcp_read_skb()")
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: Jakub Sitnicki <jakub@cloudflare.com>
      Signed-off-by: default avatarCong Wang <cong.wang@bytedance.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c457985a
    • Cong Wang's avatar
      tcp: fix sock skb accounting in tcp_read_skb() · e9c6e797
      Cong Wang authored
      Before commit 965b57b4 ("net: Introduce a new proto_ops
      ->read_skb()"), skb was not dequeued from receive queue hence
      when we close TCP socket skb can be just flushed synchronously.
      
      After this commit, we have to uncharge skb immediately after being
      dequeued, otherwise it is still charged in the original sock. And we
      still need to retain skb->sk, as eBPF programs may extract sock
      information from skb->sk. Therefore, we have to call
      skb_set_owner_sk_safe() here.
      
      Fixes: 965b57b4 ("net: Introduce a new proto_ops ->read_skb()")
      Reported-and-tested-by: syzbot+a0e6f8738b58f7654417@syzkaller.appspotmail.com
      Tested-by: default avatarStanislav Fomichev <sdf@google.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: Jakub Sitnicki <jakub@cloudflare.com>
      Signed-off-by: default avatarCong Wang <cong.wang@bytedance.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e9c6e797
    • Lin Ma's avatar
      igb: Add lock to avoid data race · 6faee3d4
      Lin Ma authored
      The commit c23d92b8 ("igb: Teardown SR-IOV before
      unregister_netdev()") places the unregister_netdev() call after the
      igb_disable_sriov() call to avoid functionality issue.
      
      However, it introduces several race conditions when detaching a device.
      For example, when .remove() is called, the below interleaving leads to
      use-after-free.
      
       (FREE from device detaching)      |   (USE from netdev core)
      igb_remove                         |  igb_ndo_get_vf_config
       igb_disable_sriov                 |  vf >= adapter->vfs_allocated_count?
        kfree(adapter->vf_data)          |
        adapter->vfs_allocated_count = 0 |
                                         |    memcpy(... adapter->vf_data[vf]
      
      Moreover, the igb_disable_sriov() also suffers from data race with the
      requests from VF driver.
      
       (FREE from device detaching)      |   (USE from requests)
      igb_remove                         |  igb_msix_other
       igb_disable_sriov                 |   igb_msg_task
        kfree(adapter->vf_data)          |    vf < adapter->vfs_allocated_count
        adapter->vfs_allocated_count = 0 |
      
      To this end, this commit first eliminates the data races from netdev
      core by using rtnl_lock (similar to commit 71947923 ("dpaa2-eth: add
      MAC/PHY support through phylink")). And then adds a spinlock to
      eliminate races from driver requests. (similar to commit 1e53834c
      ("ixgbe: Add locking to prevent panic when setting sriov_numvfs to zero")
      
      Fixes: c23d92b8 ("igb: Teardown SR-IOV before unregister_netdev()")
      Signed-off-by: default avatarLin Ma <linma@zju.edu.cn>
      Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Link: https://lore.kernel.org/r/20220817184921.735244-1-anthony.l.nguyen@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6faee3d4
    • Jakub Kicinski's avatar
      Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue · 138d1862
      Jakub Kicinski authored
      Tony Nguyen says:
      
      ====================
      Intel Wired LAN Driver Updates 2022-08-17 (ice)
      
      This series contains updates to ice driver only.
      
      Grzegorz prevents modifications to VLAN 0 when setting VLAN promiscuous
      as it will already be set. He also ignores -EEXIST error when attempting
      to set promiscuous and ensures promiscuous mode is properly cleared from
      the hardware when being removed.
      
      Benjamin ignores additional -EEXIST errors when setting promiscuous mode
      since the existing mode is the desired mode.
      
      Sylwester fixes VFs to allow sending of tagged traffic when no VLAN filters
      exist.
      
      * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue:
        ice: Fix VF not able to send tagged traffic with no VLAN filters
        ice: Ignore error message when setting same promiscuous mode
        ice: Fix clearing of promisc mode with bridge over bond
        ice: Ignore EEXIST when setting promisc mode
        ice: Fix double VLAN error when entering promisc mode
      ====================
      
      Link: https://lore.kernel.org/r/20220817171329.65285-1-anthony.l.nguyen@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      138d1862