1. 19 Jul, 2022 31 commits
  2. 18 Jul, 2022 9 commits
    • Sieng-Piaw Liew's avatar
      atl1c: use netif_napi_add_tx() for Tx NAPI · 6e693a10
      Sieng-Piaw Liew authored
      Use netif_napi_add_tx() for NAPI in Tx direction instead of the regular
      netif_napi_add() function.
      Signed-off-by: default avatarSieng-Piaw Liew <liew.s.piaw@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6e693a10
    • Arun Ramadoss's avatar
      net: dsa: microchip: fix Clang -Wunused-const-variable warning on 'ksz_dt_ids' · da53af8c
      Arun Ramadoss authored
      This patch removes the of_match_ptr() pointer when dereferencing the
      ksz_dt_ids which produce the unused variable warning.
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Suggested-by: default avatarArnd Bergmann <arnd@kernel.org>
      Signed-off-by: default avatarArun Ramadoss <arun.ramadoss@microchip.com>
      Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      da53af8c
    • David S. Miller's avatar
      Merge branch 'tls-rx-avoid-skb_cow_data' · fd18d5f1
      David S. Miller authored
      Jakub Kicinski says:
      
      ====================
      tls: rx: avoid skb_cow_data()
      
      TLS calls skb_cow_data() on the skb it received from strparser
      whenever it needs to hold onto the skb with the decrypted data.
      (The alternative being decrypting directly to a user space buffer
      in whic case the input skb doesn't get modified or used after.)
      TLS needs the decrypted skb:
       - almost always with TLS 1.3 (unless the new NoPad is enabled);
       - when user space buffer is too small to fit the record;
       - when BPF sockmap is enabled.
      
      Most of the time the skb we get out of strparser is a clone of
      a 64kB data unit coalsced by GRO. To make things worse skb_cow_data()
      tries to output a linear skb and allocates it with GFP_ATOMIC.
      This occasionally fails even under moderate memory pressure.
      
      This patch set rejigs the TLS Rx so that we don't expect decryption
      in place. The decryption handlers return an skb which may or may not
      be the skb from strparser. For TLS 1.3 this results in a 20-30%
      performance improvement without NoPad enabled.
      
      v2: rebase after 3d8c51b2 ("net/tls: Check for errors in tls_device_init")
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fd18d5f1
    • Jakub Kicinski's avatar
      tls: rx: decrypt into a fresh skb · fd31f399
      Jakub Kicinski authored
      We currently CoW Rx skbs whenever we can't decrypt to a user
      space buffer. The skbs can be enormous (64kB) and CoW does
      a linear alloc which has a strong chance of failing under
      memory pressure. Or even without, skb_cow_data() assumes
      GFP_ATOMIC.
      
      Allocate a new frag'd skb and decrypt into it. We finally
      take advantage of the decrypted skb getting returned via
      darg.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fd31f399
    • Jakub Kicinski's avatar
      tls: rx: async: don't put async zc on the list · cbbdee99
      Jakub Kicinski authored
      The "zero-copy" path in SW TLS will engage either for no skbs or
      for all but last. If the recvmsg parameters are right and the
      socket can do ZC we'll ZC until the iterator can't fit a full
      record at which point we'll decrypt one more record and copy
      over the necessary bits to fill up the request.
      
      The only reason we hold onto the ZC skbs which went thru the async
      path until the end of recvmsg() is to count bytes. We need an accurate
      count of zc'ed bytes so that we can calculate how much of the non-zc'd
      data to copy. To allow freeing input skbs on the ZC path count only
      how much of the list we'll need to consume.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cbbdee99
    • Jakub Kicinski's avatar
      tls: rx: async: hold onto the input skb · c618db2a
      Jakub Kicinski authored
      Async crypto currently benefits from the fact that we decrypt
      in place. When we allow input and output to be different skbs
      we will have to hang onto the input while we move to the next
      record. Clone the inputs and keep them on a list.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c618db2a
    • Jakub Kicinski's avatar
      tls: rx: async: adjust record geometry immediately · 6ececdc5
      Jakub Kicinski authored
      Async crypto TLS Rx currently waits for crypto to be done
      in order to strip the TLS header and tailer. Simplify
      the code by moving the pointers immediately, since only
      TLS 1.2 is supported here there is no message padding.
      
      This simplifies the decryption into a new skb in the next
      patch as we don't have to worry about input vs output
      skb in the decrypt_done() handler any more.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6ececdc5
    • Jakub Kicinski's avatar
      tls: rx: return the decrypted skb via darg · 6bd116c8
      Jakub Kicinski authored
      Instead of using ctx->recv_pkt after decryption read the skb
      from darg.skb. This moves the decision of what the "output skb"
      is to the decrypt handlers. For now after decrypt handler returns
      successfully ctx->recv_pkt is simply moved to darg.skb, but it
      will change soon.
      
      Note that tls_decrypt_sg() cannot clear the ctx->recv_pkt
      because it gets called to re-encrypt (i.e. by the device offload).
      So we need an awkward temporary if() in tls_rx_one_record().
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6bd116c8
    • Jakub Kicinski's avatar
      tls: rx: read the input skb from ctx->recv_pkt · 541cc48b
      Jakub Kicinski authored
      Callers always pass ctx->recv_pkt into decrypt_skb_update(),
      and it propagates it to its callees. This may give someone
      the false impression that those functions can accept any valid
      skb containing a TLS record. That's not the case, the record
      sequence number is read from the context, and they can only
      take the next record coming out of the strp.
      
      Let the functions get the skb from the context instead of
      passing it in. This will also make it cleaner to return
      a different skb than ctx->recv_pkt as the decrypted one
      later on.
      
      Since we're touching the definition of decrypt_skb_update()
      use this as an opportunity to rename it.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      541cc48b