1. 01 Jun, 2020 40 commits
    • Vinay Kumar Yadav's avatar
      crypto/chtls: IPv6 support for inline TLS · 6abde0b2
      Vinay Kumar Yadav authored
      Extends support to IPv6 for Inline TLS server.
      Signed-off-by: default avatarVinay Kumar Yadav <vinay.yadav@chelsio.com>
      
      v1->v2:
      - cc'd tcp folks.
      
      v2->v3:
      - changed EXPORT_SYMBOL() to EXPORT_SYMBOL_GPL()
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6abde0b2
    • David S. Miller's avatar
      Merge branch 'chelsio-crypto-fixes' · a56772dc
      David S. Miller authored
      Ayush Sawal says:
      
      ====================
      Fixing compilation warnings and errors
      
      Patch 1: Fixes the warnings seen when compiling using sparse tool.
      
      Patch 2: Fixes a cocci check error introduced after commit
      567be3a5 ("crypto: chelsio -
      Use multiple txq/rxq per tfm to process the requests").
      
      V1->V2
      
      patch1: Avoid type casting by using get_unaligned_be32() and
          	put_unaligned_be16/32() functions.
      
      patch2: Modified subject of the patch.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a56772dc
    • Ayush Sawal's avatar
      Crypto/chcr: Fixes a coccinile check error · 055be686
      Ayush Sawal authored
      This fixes an error observed after running coccinile check.
      drivers/crypto/chelsio/chcr_algo.c:1462:5-8: Unneeded variable:
      "err". Return "0" on line 1480
      
      This line is missed in the commit 567be3a5 ("crypto:
      chelsio - Use multiple txq/rxq per tfm to process the requests").
      
      Fixes: 567be3a5 ("crypto:
      chelsio - Use multiple txq/rxq per tfm to process the requests").
      
      V1->V2
      -Modified subject.
      Signed-off-by: default avatarAyush Sawal <ayush.sawal@chelsio.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      055be686
    • Ayush Sawal's avatar
      Crypto/chcr: Fixes compilations warnings · f3b140ad
      Ayush Sawal authored
      This patch fixes the compilation warnings displayed by sparse tool for
      chcr driver.
      
      V1->V2
      
      Avoid type casting by using get_unaligned_be32() and
      put_unaligned_be16/32() functions.
      
      The key which comes from stack is an u8 byte stream so we store it in
      an unsigned char array(ablkctx->key). The function get_aes_decrypt_key()
      is a used to calculate  the reverse round key for decryption, for this
      operation the key has to be divided into 4 bytes, so to extract 4 bytes
      from an u8 byte stream and store it in an u32 variable, get_aligned_be32()
      is used. Similarly for copying back the key from u32 variable to the
      original u8 key stream, put_aligned_be32() is used.
      Signed-off-by: default avatarAyush Sawal <ayush.sawal@chelsio.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f3b140ad
    • Rohit Maheshwari's avatar
      crypto/chcr: IPV6 code needs to be in CONFIG_IPV6 · 76d7728d
      Rohit Maheshwari authored
      Error messages seen while building kernel with CONFIG_IPV6
      disabled.
      Signed-off-by: default avatarRohit Maheshwari <rohitm@chelsio.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      76d7728d
    • Rohit Maheshwari's avatar
      cxgb4/chcr: Enable ktls settings at run time · a3ac249a
      Rohit Maheshwari authored
      Current design enables ktls setting from start, which is not
      efficient. Now the feature will be enabled when user demands
      TLS offload on any interface.
      
      v1->v2:
      - taking ULD module refcount till any single connection exists.
      - taking rtnl_lock() before clearing tls_devops.
      
      v2->v3:
      - cxgb4 is now registering to tlsdev_ops.
      - module refcount inc/dec in chcr.
      - refcount is only for connections.
      - removed new code from cxgb_set_feature().
      
      v3->v4:
      - fixed warning message.
      Signed-off-by: default avatarRohit Maheshwari <rohitm@chelsio.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a3ac249a
    • Hangbin Liu's avatar
      ipv6: fix IPV6_ADDRFORM operation logic · 79a1f0cc
      Hangbin Liu authored
      Socket option IPV6_ADDRFORM supports UDP/UDPLITE and TCP at present.
      Previously the checking logic looks like:
      if (sk->sk_protocol == IPPROTO_UDP || sk->sk_protocol == IPPROTO_UDPLITE)
      	do_some_check;
      else if (sk->sk_protocol != IPPROTO_TCP)
      	break;
      
      After commit b6f61189 ("ipv6: restrict IPV6_ADDRFORM operation"), TCP
      was blocked as the logic changed to:
      if (sk->sk_protocol == IPPROTO_UDP || sk->sk_protocol == IPPROTO_UDPLITE)
      	do_some_check;
      else if (sk->sk_protocol == IPPROTO_TCP)
      	do_some_check;
      	break;
      else
      	break;
      
      Then after commit 82c9ae44 ("ipv6: fix restrict IPV6_ADDRFORM operation")
      UDP/UDPLITE were blocked as the logic changed to:
      if (sk->sk_protocol == IPPROTO_UDP || sk->sk_protocol == IPPROTO_UDPLITE)
      	do_some_check;
      if (sk->sk_protocol == IPPROTO_TCP)
      	do_some_check;
      
      if (sk->sk_protocol != IPPROTO_TCP)
      	break;
      
      Fix it by using Eric's code and simply remove the break in TCP check, which
      looks like:
      if (sk->sk_protocol == IPPROTO_UDP || sk->sk_protocol == IPPROTO_UDPLITE)
      	do_some_check;
      else if (sk->sk_protocol == IPPROTO_TCP)
      	do_some_check;
      else
      	break;
      
      Fixes: 82c9ae44 ("ipv6: fix restrict IPV6_ADDRFORM operation")
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      79a1f0cc
    • YueHaibing's avatar
      tipc: Fix NULL pointer dereference in __tipc_sendstream() · 4c21daae
      YueHaibing authored
      tipc_sendstream() may send zero length packet, then tipc_msg_append()
      do not alloc skb, skb_peek_tail() will get NULL, msg_set_ack_required
      will trigger NULL pointer dereference.
      
      Reported-by: syzbot+8eac6d030e7807c21d32@syzkaller.appspotmail.com
      Fixes: 0a3e060f ("tipc: add test for Nagle algorithm effectiveness")
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4c21daae
    • Vladimir Oltean's avatar
      net: dsa: sja1105: suppress -Wmissing-prototypes in sja1105_vl.c · eae9d3c0
      Vladimir Oltean authored
      Newer C compilers are complaining about the fact that there are no
      function prototypes in sja1105_vl.c for the non-static functions.
      Give them what they want.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      eae9d3c0
    • David S. Miller's avatar
      Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue · 2a2e01e7
      David S. Miller authored
      Jeff Kirsher says:
      
      ====================
      100GbE Intel Wired LAN Driver Updates 2020-05-31
      
      This series contains updates to the ice driver only.
      
      Brett modifies the driver to allow users to clear a VF's
      administratively set MAC address on the PF.  Fixes the driver to
      recognize an existing VLAN tag when DMAC/SMAC is enabled in a packet.
      Fixes an issue, so that VF's are reset after any VF port VLAN
      modifications are made on the PF.  Made sure the register QRXFLXP_CNTXT
      is cleared before writing a new value to ensure the previous value is
      not passed forward.  Updates the PF to allow the VF to request a reset
      as soon as it has been initialized.  Fixes an issue to ensure when a VSI
      is created, it uses the current coalesce value, not the default value.
      
      Paul allows untrusted VF's to add 16 filters.
      
      Dan increases the timeout needed after a PFR to allow ample time for
      package download.
      
      Chinh adjust the define value for the number of PHY speeds we currently
      support.  Changes the driver to ignore EMODE error when configuring the
      PHY.
      
      Jesse fixes an issue which was preventing a user from configuring the
      interface before bringing it up.
      
      Henry fixes the logic for adding back perfect flows after flow director
      filter does a deletion.
      
      Bruce fixes line wrappings to make it more consistent.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2a2e01e7
    • Roopa Prabhu's avatar
      vxlan: fix dereference of nexthop group in nexthop update path · 03eaeda7
      Roopa Prabhu authored
      fix dereference of nexthop group in fdb nexthop group
      update validation path.
      
      Fixes: 1274e1cc ("vxlan: ecmp support for mac fdb entries")
      Reported-by: default avatarIdo Schimmel <idosch@idosch.org>
      Suggested-by: default avatarIdo Schimmel <idosch@idosch.org>
      Signed-off-by: default avatarRoopa Prabhu <roopa@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      03eaeda7
    • Al Viro's avatar
      switch cmsghdr_from_user_compat_to_kern() to copy_from_user() · 547ce4cf
      Al Viro authored
      no point getting compat_cmsghdr field-by-field
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      547ce4cf
    • David S. Miller's avatar
      Merge branch 'dpaa2-eth-add-PFC-support' · a477605f
      David S. Miller authored
      Ioana Ciornei says:
      
      ====================
      dpaa2-eth: add PFC support
      
      This patch set adds support for Priority Flow Control in DPAA2 Ethernet
      devices.
      
      The first patch make the necessary changes so that multiple
      traffic classes are configured. The dequeue priority
      of the maximum 8 traffic classes is configured to be equal.
      The second patch adds a static distribution to said traffic
      classes based on the VLAN PCP field. In the future, this could be
      extended through the .setapp() DCB callback for dynamic configuration.
      
      Also, add support for the congestion group taildrop mechanism that
      allows us to control the number of frames that can accumulate on a group
      of Rx frame queues belonging to the same traffic class.
      
      The basic subset of the DCB ops is implemented so that the user can
      query the number of PFC capable traffic classes, their state and
      reconfigure them if necessary.
      
      Changes in v3:
       - add patches 6-7 which add the PFC functionality
       - patch 2/7: revert to explicitly cast mask to u16 * to not get into
         sparse warnings
      Changes in v4:
       - really fix the sparse warnings in 2/7
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a477605f
    • Ioana Ciornei's avatar
      dpaa2-eth: Keep congestion group taildrop enabled when PFC on · 07beb165
      Ioana Ciornei authored
      Leave congestion group taildrop enabled for all traffic classes
      when PFC is enabled. Notification threshold is low enough such
      that it will be hit first and this also ensures that FQs on
      traffic classes which are not PFC enabled won't drain the buffer
      pool.
      
      FQ taildrop threshold is kept disabled as long as any form of
      flow control is on. Since FQ taildrop works with bytes, not number
      of frames, we can't guarantee it will not interfere with the
      congestion notification mechanism for all frame sizes.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      07beb165
    • Ioana Ciornei's avatar
      dpaa2-eth: Add PFC support through DCB ops · f395b69f
      Ioana Ciornei authored
      Add support in dpaa2-eth for PFC (Priority Flow Control)
      through the DCB ops.
      
      Instruct the hardware to respond to received PFC frames.
      Current firmware doesn't allow us to selectively enable PFC
      on the Rx side for some priorities only, so we will react to
      all incoming PFC frames (and stop transmitting on the traffic
      classes specified in the frame).
      
      Also, configure the hardware to generate PFC frames based on Rx
      congestion notifications. When a certain number of frames accumulate in
      the ingress queues corresponding to a traffic class, priority flow
      control frames are generated for that TC.
      
      The number of PFC traffic classes available can be queried through
      lldptool. Also, which of those traffic classes have PFC enabled is also
      controlled through the same dcbnl_rtnl_ops callbacks.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f395b69f
    • Ioana Radulescu's avatar
      dpaa2-eth: Update FQ taildrop threshold and buffer pool count · 3f8b826d
      Ioana Radulescu authored
      Now that we have congestion group taildrop configured at all
      times, we can afford to increase the frame queue taildrop
      threshold; this will ensure a better response when receiving
      bursts of large-sized frames.
      
      Also decouple the buffer pool count from the Rx FQ taildrop
      threshold, as above change would increase it too much. Instead,
      keep the old count as a hardcoded value.
      
      With the new limits, we try to ensure that:
      * we allow enough leeway for large frame bursts (by buffering
      enough of them in queues to avoid heavy dropping in case of
      bursty traffic, but when overall ingress bandwidth is manageable)
      * allow pending frames to be evenly spread between ingress FQs,
      regardless of frame size
      * avoid dropping frames due to the buffer pool being empty; this
      is not a bad behaviour per se, but system overall response is
      more linear and predictable when frames are dropped at frame
      queue/group level.
      Signed-off-by: default avatarIoana Radulescu <ruxandra.radulescu@nxp.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3f8b826d
    • Ioana Radulescu's avatar
      dpaa2-eth: Add congestion group taildrop · 2c8d1c8d
      Ioana Radulescu authored
      The increase in number of ingress frame queues means we now risk
      depleting the buffer pool before the FQ taildrop kicks in.
      
      Congestion group taildrop allows us to control the number of frames that
      can accumulate on a group of Rx frame queues belonging to the same
      traffic class.  This setting coexists with the frame queue based
      taildrop: whichever limit gets hit first triggers the frame drop.
      Signed-off-by: default avatarIoana Radulescu <ruxandra.radulescu@nxp.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2c8d1c8d
    • Ioana Radulescu's avatar
      dpaa2-eth: Add helper functions · ad054f26
      Ioana Radulescu authored
      Add convenient helper functions that determines whether Rx/Tx pause
      frames are enabled based on link state flags received from firmware.
      Signed-off-by: default avatarIoana Radulescu <ruxandra.radulescu@nxp.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ad054f26
    • Ioana Radulescu's avatar
      dpaa2-eth: Distribute ingress frames based on VLAN prio · 6aa90fe2
      Ioana Radulescu authored
      Configure static ingress classification based on VLAN PCP field.
      If the DPNI doesn't have enough traffic classes to accommodate all
      priority levels, the lowest ones end up on TC 0 (default on miss).
      Signed-off-by: default avatarIoana Radulescu <ruxandra.radulescu@nxp.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6aa90fe2
    • Ioana Radulescu's avatar
      dpaa2-eth: Add support for Rx traffic classes · 685e39ea
      Ioana Radulescu authored
      The firmware reserves for each DPNI a number of RX frame queues
      equal to the number of configured flows x number of configured
      traffic classes.
      
      Current driver configuration directs all incoming traffic to
      FQs corresponding to TC0, leaving all other priority levels unused.
      
      Start adding support for multiple ingress traffic classes, by
      configuring the FQs associated with all priority levels, not just
      TC0. All settings that are per-TC, such as those related to
      hashing and flow steering, are also updated.
      Signed-off-by: default avatarIoana Radulescu <ruxandra.radulescu@nxp.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      685e39ea
    • Michael Walle's avatar
      net: phy: broadcom: don't export RDB/legacy access methods · 3190ca3b
      Michael Walle authored
      Don't export __bcm_phy_enable_rdb_access() and
      __bcm_phy_enable_legacy_access() functions. They aren't used outside this
      module and it was forgotten to provide a prototype for these functions.
      Just make them static for now.
      
      Fixes: 11ecf8c5 ("net: phy: broadcom: add cable test support")
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Signed-off-by: default avatarMichael Walle <michael@walle.cc>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3190ca3b
    • Willem de Bruijn's avatar
      tun: correct header offsets in napi frags mode · 96aa1b22
      Willem de Bruijn authored
      Tun in IFF_NAPI_FRAGS mode calls napi_gro_frags. Unlike netif_rx and
      netif_gro_receive, this expects skb->data to point to the mac layer.
      
      But skb_probe_transport_header, __skb_get_hash_symmetric, and
      xdp_do_generic in tun_get_user need skb->data to point to the network
      header. Flow dissection also needs skb->protocol set, so
      eth_type_trans has to be called.
      
      Ensure the link layer header lies in linear as eth_type_trans pulls
      ETH_HLEN. Then take the same code paths for frags as for not frags.
      Push the link layer header back just before calling napi_gro_frags.
      
      By pulling up to ETH_HLEN from frag0 into linear, this disables the
      frag0 optimization in the special case when IFF_NAPI_FRAGS is used
      with zero length iov[0] (and thus empty skb->linear).
      
      Fixes: 90e33d45 ("tun: enable napi_gro_frags() for TUN/TAP driver")
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Acked-by: default avatarPetar Penkov <ppenkov@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      96aa1b22
    • Guillaume Nault's avatar
      cls_flower: remove mpls_opts_policy · 4e4f4ce6
      Guillaume Nault authored
      Compiling with W=1 gives the following warning:
      net/sched/cls_flower.c:731:1: warning: ‘mpls_opts_policy’ defined but not used [-Wunused-const-variable=]
      
      The TCA_FLOWER_KEY_MPLS_OPTS contains a list of
      TCA_FLOWER_KEY_MPLS_OPTS_LSE. Therefore, the attributes all have the
      same type and we can't parse the list with nla_parse*() and have the
      attributes validated automatically using an nla_policy.
      
      fl_set_key_mpls_opts() properly verifies that all attributes in the
      list are TCA_FLOWER_KEY_MPLS_OPTS_LSE. Then fl_set_key_mpls_lse()
      uses nla_parse_nested() on all these attributes, thus verifying that
      they have the NLA_F_NESTED flag. So we can safely drop the
      mpls_opts_policy.
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Signed-off-by: default avatarGuillaume Nault <gnault@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4e4f4ce6
    • David S. Miller's avatar
      Merge branch 'bridge-mrp-Add-support-for-MRA-role' · 2a67ab99
      David S. Miller authored
      Horatiu Vultur says:
      
      ====================
      bridge: mrp: Add support for MRA role
      
      This patch series extends the MRP with the MRA role.
      A node that has the MRA role can behave as a MRM or as a MRC. In case there are
      multiple nodes in the topology that has the MRA role then only one node can
      behave as MRM and all the others need to be have as MRC. The node that has the
      higher priority(lower value) will behave as MRM.
      A node that has the MRA role and behaves as MRC, it just needs to forward the
      MRP_Test frames between the ring ports but also it needs to detect in case it
      stops receiving MRP_Test frames. In that case it would try to behave as MRM.
      
      v2:
       - add new patch that fixes sparse warnings
       - fix parsing of prio attribute
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2a67ab99
    • Horatiu Vultur's avatar
      bridge: mrp: Add support for role MRA · c6676e7d
      Horatiu Vultur authored
      A node that has the MRA role, it can behave as MRM or MRC.
      
      Initially it starts as MRM and sends MRP_Test frames on both ring ports.
      If it detects that there are MRP_Test send by another MRM, then it
      checks if these frames have a lower priority than itself. In this case
      it would send MRP_Nack frames to notify the other node that it needs to
      stop sending MRP_Test frames.
      If it receives a MRP_Nack frame then it stops sending MRP_Test frames
      and starts to behave as a MRC but it would continue to monitor the
      MRP_Test frames send by MRM. If at a point the MRM stops to send
      MRP_Test frames it would get the MRM role and start to send MRP_Test
      frames.
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c6676e7d
    • Horatiu Vultur's avatar
      bridge: mrp: Set the priority of MRP instance · 4b3a61b0
      Horatiu Vultur authored
      Each MRP instance has a priority, a lower value means a higher priority.
      The priority of MRP instance is stored in MRP_Test frame in this way
      all the MRP nodes in the ring can see other nodes priority.
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4b3a61b0
    • Horatiu Vultur's avatar
      bridge: mrp: Update MRP frame type · 7e89ed8a
      Horatiu Vultur authored
      Replace u16/u32 with be16/be32 in the MRP frame types.
      This fixes sparse warnings like:
      warning: cast to restricted __be16
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7e89ed8a
    • Jia-Ju Bai's avatar
      net: vmxnet3: fix possible buffer overflow caused by bad DMA value in vmxnet3_get_rss() · 3e1c6846
      Jia-Ju Bai authored
      The value adapter->rss_conf is stored in DMA memory, and it is assigned
      to rssConf, so rssConf->indTableSize can be modified at anytime by
      malicious hardware. Because rssConf->indTableSize is assigned to n,
      buffer overflow may occur when the code "rssConf->indTable[n]" is
      executed.
      
      To fix this possible bug, n is checked after being used.
      Signed-off-by: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3e1c6846
    • Arnd Bergmann's avatar
      flow_dissector: work around stack frame size warning · 0af413bd
      Arnd Bergmann authored
      The fl_flow_key structure is around 500 bytes, so having two of them
      on the stack in one function now exceeds the warning limit after an
      otherwise correct change:
      
      net/sched/cls_flower.c:298:12: error: stack frame size of 1056 bytes in function 'fl_classify' [-Werror,-Wframe-larger-than=]
      
      I suspect the fl_classify function could be reworked to only have one
      of them on the stack and modify it in place, but I could not work out
      how to do that.
      
      As a somewhat hacky workaround, move one of them into an out-of-line
      function to reduce its scope. This does not necessarily reduce the stack
      usage of the outer function, but at least the second copy is removed
      from the stack during most of it and does not add up to whatever is
      called from there.
      
      I now see 552 bytes of stack usage for fl_classify(), plus 528 bytes
      for fl_mask_lookup().
      
      Fixes: 58cff782 ("flow_dissector: Parse multiple MPLS Label Stack Entries")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Acked-by: default avatarGuillaume Nault <gnault@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0af413bd
    • Roelof Berg's avatar
      lan743x: Added fixed link and RGMII support · 6f197fb6
      Roelof Berg authored
      Microchip lan7431 is frequently connected to a phy. However, it
      can also be directly connected to a MII remote peer without
      any phy in between. For supporting such a phyless hardware setup
      in Linux we utilized phylib, which supports a fixed-link
      configuration via the device tree. And we added support for
      defining the connection type R/GMII in the device tree.
      
      New behavior:
      -------------
      . The automatic speed and duplex detection of the lan743x silicon
        between mac and phy is disabled. Instead phylib is used like in
        other typical Linux drivers. The usage of phylib allows to
        specify fixed-link parameters in the device tree.
      
      . The device tree entry phy-connection-type is supported now with
        the modes RGMII or (G)MII (default).
      
      Development state:
      ------------------
      . Tested with fixed-phy configurations. Not yet tested in normal
        configurations with phy. Microchip kindly offered testing
        as soon as the Corona measures allow this.
      
      . All review findings of Andrew Lunn are included
      
      Example:
      --------
      &pcie {
      	status = "okay";
      
      	host@0 {
      		reg = <0 0 0 0 0>;
      
      		#address-cells = <3>;
      		#size-cells = <2>;
      
      		ethernet@0 {
      			compatible = "weyland-yutani,noscom1", "microchip,lan743x";
      			status = "okay";
      			reg = <0 0 0 0 0>;
      			phy-connection-type = "rgmii";
      
      			fixed-link {
      				speed = <100>;
      				full-duplex;
      			};
      		};
      	};
      };
      Signed-off-by: default avatarRoelof Berg <rberg@berg-solutions.de>
      Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6f197fb6
    • David S. Miller's avatar
      Merge branch 'devlink-Add-support-for-control-packet-traps' · ff0f6383
      David S. Miller authored
      Ido Schimmel says:
      
      ====================
      devlink: Add support for control packet traps
      
      So far device drivers were only able to register drop and exception
      packet traps with devlink. These traps are used for packets that were
      either dropped by the underlying device or encountered an exception
      (e.g., missing neighbour entry) during forwarding.
      
      However, in the steady state, the majority of the packets being trapped
      to the CPU are packets that are required for the correct functioning of
      the control plane. For example, ARP request and IGMP query packets.
      
      This patch set allows device drivers to register such control traps with
      devlink and expose their default control plane policy to user space.
      User space can then tune the packet trap policer settings according to
      its needs, as with existing packet traps.
      
      In a similar fashion to exception traps, the action associated with such
      traps cannot be changed as it can easily break the control plane. Unlike
      drop and exception traps, packets trapped via control traps are not
      reported to the kernel's drop monitor as they are not indicative of any
      problem.
      
      Patch set overview:
      
      Patches #1-#3 break out layer 3 exceptions to a different group to
      provide better granularity. A future patch set will make this completely
      configurable.
      
      Patch #4 adds a new trap action ('mirror') that is used for packets that
      are forwarded by the device and sent to the CPU. Such packets are marked
      by device drivers with 'skb->offload_fwd_mark = 1' in order to prevent
      the kernel from forwarding them again.
      
      Patch #5 adds the new trap type, 'control'.
      
      Patches #6-#8 gradually add various control traps to devlink with proper
      documentation.
      
      Patch #9 adds a few control traps to netdevsim, which are automatically
      exercised by existing devlink-trap selftest.
      
      Patches #10 performs small refactoring in mlxsw.
      
      Patches #11-#13 change mlxsw to register its existing control traps with
      devlink.
      
      Patch #14 adds a selftest over mlxsw that exercises all the registered
      control traps.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ff0f6383
    • Ido Schimmel's avatar
      selftests: mlxsw: Add test for control packets · 9959b389
      Ido Schimmel authored
      Generate packets matching the various control traps and check that the
      traps' stats increase accordingly.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9959b389
    • Ido Schimmel's avatar
      mlxsw: spectrum_trap: Register ACL control traps · 88e27749
      Ido Schimmel authored
      In a similar fashion to other control traps, register ACL control traps
      with devlink.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      88e27749
    • Ido Schimmel's avatar
      mlxsw: spectrum_trap: Register layer 3 control traps · 8110668e
      Ido Schimmel authored
      In a similar fashion to layer 2 control traps, register layer 3 control
      traps with devlink.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8110668e
    • Ido Schimmel's avatar
      mlxsw: spectrum_trap: Register layer 2 control traps · 39c10350
      Ido Schimmel authored
      In a similar fashion to other traps, register layer 2 control traps with
      devlink.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      39c10350
    • Ido Schimmel's avatar
      mlxsw: spectrum_trap: Factor out common Rx listener function · 45b1c873
      Ido Schimmel authored
      We currently have an Rx listener function for exception traps that marks
      received skbs with 'offload_fwd_mark' and injects them to the kernel's
      Rx path. The marking is done because all these exceptions occur during
      L3 forwarding, after the packets were potentially flooded at L2.
      
      A subsequent patch will add support for control traps. Packets received
      via some of these control traps need different handling:
      
      1. Packets might not need to be marked with 'offload_fwd_mark'. For
         example, if packet was trapped before L2 forwarding
      
      2. Packets might not need to be injected to the kernel's Rx path. For
         example, sampled packets are reported to user space via the psample
         module
      
      Factor out a common Rx listener function that only reports trapped
      packets to devlink. Call it from mlxsw_sp_rx_no_mark_listener() and
      mlxsw_sp_rx_mark_listener() that will inject the packets to the kernel's
      Rx path, without and with the marking, respectively.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      45b1c873
    • Ido Schimmel's avatar
      netdevsim: Register control traps · 18979367
      Ido Schimmel authored
      Register two control traps with devlink. The existing selftest at
      tools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh iterates
      over all registered traps and checks that the action of non-drop traps
      cannot be changed. Up until now only exception traps were tested, now
      control traps will be tested as well.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      18979367
    • Ido Schimmel's avatar
      devlink: Add ACL control packet traps · 5eb18a2b
      Ido Schimmel authored
      Add packet traps for packets that are sampled / trapped by ACLs, so that
      capable drivers could register them with devlink. Add documentation for
      every added packet trap and packet trap group.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5eb18a2b
    • Ido Schimmel's avatar
      devlink: Add layer 3 control packet traps · d77cfd16
      Ido Schimmel authored
      Add layer 3 control packet traps such as ARP and DHCP, so that capable
      device drivers could register them with devlink. Add documentation for
      every added packet trap and packet trap group.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d77cfd16
    • Ido Schimmel's avatar
      devlink: Add layer 2 control packet traps · 515eac67
      Ido Schimmel authored
      Add layer 2 control packet traps such as STP and IGMP query, so that
      capable device drivers could register them with devlink. Add
      documentation for every added packet trap and packet trap group.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      515eac67