Skip to content
  1. Aug 10, 2021
  2. Aug 09, 2021
    • Hangbin Liu's avatar
      net: sched: act_mirred: Reset ct info when mirror/redirect skb · d09c548d
      Hangbin Liu authored
      When mirror/redirect a skb to a different port, the ct info should be reset
      for reclassification. Or the pkts will match unexpected rules. For example,
      with following topology and commands:
      
          -----------
                    |
             veth0 -+-------
                    |
             veth1 -+-------
                    |
         ------------
      
       tc qdisc add dev veth0 clsact
       # The same with "action mirred egress mirror dev veth1" or "action mirred ingress redirect dev veth1"
       tc filter add dev veth0 egress chain 1 protocol ip flower ct_state +trk action mirred ingress mirror dev veth1
       tc filter add dev veth0 egress chain 0 protocol ip flower ct_state -inv action ct commit action goto chain 1
       tc qdisc add dev veth1 clsact
       tc filter add dev veth1 ingress chain 0 protocol ip flower ct_state +trk action drop
      
       ping <remove ip via veth0> &
       tc -s filter show dev veth1 ingress
      
      With command 'tc -s filter show', we can find the pkts were dropped on
      veth1.
      
      Fixes: b57dc7c1
      
       ("net/sched: Introduce action ct")
      Signed-off-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d09c548d
    • David S. Miller's avatar
      Merge branch 'smc-fixes' · 605bb443
      David S. Miller authored
      
      
      Guvenc Gulce says:
      
      ====================
      net/smc: fixes 2021-08-09
      
      please apply the following patch series for smc to netdev's net tree.
      One patch fixes invalid connection counting for links and the other
      one fixes an access to an already cleared link.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      605bb443
    • Guvenc Gulce's avatar
      net/smc: Correct smc link connection counter in case of smc client · 64513d26
      Guvenc Gulce authored
      SMC clients may be assigned to a different link after the initial
      connection between two peers was established. In such a case,
      the connection counter was not correctly set.
      
      Update the connection counter correctly when a smc client connection
      is assigned to a different smc link.
      
      Fixes: 07d51580
      
       ("net/smc: Add connection counters for links")
      Signed-off-by: default avatarGuvenc Gulce <guvenc@linux.ibm.com>
      Tested-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      64513d26
    • Karsten Graul's avatar
      net/smc: fix wait on already cleared link · 8f3d65c1
      Karsten Graul authored
      There can be a race between the waiters for a tx work request buffer
      and the link down processing that finally clears the link. Although
      all waiters are woken up before the link is cleared there might be
      waiters which did not yet get back control and are still waiting.
      This results in an access to a cleared wait queue head.
      
      Fix this by introducing atomic reference counting around the wait calls,
      and wait with the link clear processing until all waiters have finished.
      Move the work request layer related calls into smc_wr.c and set the
      link state to INACTIVE before calling smcr_link_clear() in
      smc_llc_srv_add_link().
      
      Fixes: 15e1b99a
      
       ("net/smc: no WR buffer wait for terminating link group")
      Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
      Signed-off-by: default avatarGuvenc Gulce <guvenc@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8f3d65c1
    • Grygorii Strashko's avatar
      net: ethernet: ti: cpsw: fix min eth packet size for non-switch use-cases · acc68b8d
      Grygorii Strashko authored
      The CPSW switchdev driver inherited fix from commit 9421c901 ("net:
      ethernet: ti: cpsw: fix min eth packet size") which changes min TX packet
      size to 64bytes (VLAN_ETH_ZLEN, excluding ETH_FCS). It was done to fix HW
      packed drop issue when packets are sent from Host to the port with PVID and
      un-tagging enabled. Unfortunately this breaks some other non-switch
      specific use-cases, like:
      - [1] CPSW port as DSA CPU port with DSA-tag applied at the end of the
      packet
      - [2] Some industrial protocols, which expects min TX packet size 60Bytes
      (excluding FCS).
      
      Fix it by configuring min TX packet size depending on driver mode
       - 60Bytes (ETH_ZLEN) for multi mac (dual-mac) mode
       - 64Bytes (VLAN_ETH_ZLEN) for switch mode
      and update it during driver mode change and annotate with
      READ_ONCE()/WRITE_ONCE() as it can be read by napi while writing.
      
      [1] https://lore.kernel.org/netdev/20210531124051.GA15218@cephalopod/
      [2] https://e2e.ti.com/support/arm/sitara_arm/f/791/t/701669
      
      Cc: stable@vger.kernel.org
      Fixes: ed3525ed
      
       ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
      Reported-by: default avatarBen Hutchings <ben.hutchings@essensium.com>
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      acc68b8d
    • Yunsheng Lin's avatar
      page_pool: mask the page->signature before the checking · 0fa32ca4
      Yunsheng Lin authored
      As mentioned in commit c07aea3e ("mm: add a signature in
      struct page"):
      "The page->signature field is aliased to page->lru.next and
      page->compound_head."
      
      And as the comment in page_is_pfmemalloc():
      "lru.next has bit 1 set if the page is allocated from the
      pfmemalloc reserves. Callers may simply overwrite it if they
      do not need to preserve that information."
      
      The page->signature is OR’ed with PP_SIGNATURE when a page is
      allocated in page pool, see __page_pool_alloc_pages_slow(),
      and page->signature is checked directly with PP_SIGNATURE in
      page_pool_return_skb_page(), which might cause resoure leaking
      problem for a page from page pool if bit 1 of lru.next is set
      for a pfmemalloc page. What happens here is that the original
      pp->signature is OR'ed with PP_SIGNATURE after the allocation
      in order to preserve any existing bits(such as the bit 1, used
      to indicate a pfmemalloc page), so when those bits are present,
      those page is not considered to be from page pool and the DMA
      mapping of those pages will be left stale.
      
      As bit 0 is for page->compound_head, So mask both bit 0/1 before
      the checking in page_pool_return_skb_page(). And we will return
      those pfmemalloc pages back to the page allocator after cleaning
      up the DMA mapping.
      
      Fixes: 6a5bcd84
      
       ("page_pool: Allow drivers to hint on SKB recycling")
      Reviewed-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
      Signed-off-by: default avatarYunsheng Lin <linyunsheng@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0fa32ca4
    • Randy Dunlap's avatar
      dccp: add do-while-0 stubs for dccp_pr_debug macros · 86aab09a
      Randy Dunlap authored
      GCC complains about empty macros in an 'if' statement, so convert
      them to 'do {} while (0)' macros.
      
      Fixes these build warnings:
      
      net/dccp/output.c: In function 'dccp_xmit_packet':
      ../net/dccp/output.c:283:71: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
        283 |                 dccp_pr_debug("transmit_skb() returned err=%d\n", err);
      net/dccp/ackvec.c: In function 'dccp_ackvec_update_old':
      ../net/dccp/ackvec.c:163:80: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
        163 |                                               (unsigned long long)seqno, state);
      
      Fixes: dc841e30 ("dccp: Extend CCID packet dequeueing interface")
      Fixes: 38024086
      
       ("dccp ccid-2: Update code for the Ack Vector input/registration routine")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: dccp@vger.kernel.org
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Gerrit Renker <gerrit@erg.abdn.ac.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      86aab09a