Skip to content
  1. Jan 19, 2021
  2. Jan 17, 2021
    • Jakub Kicinski's avatar
      Merge branch 'net-fix-the-features-flag-in-sctp_gso_segment' · 213b97b1
      Jakub Kicinski authored
      Xin Long says:
      
      ====================
      net: fix the features flag in sctp_gso_segment
      
      Patch 1/2 is to improve the code in skb_segment(), and it is needed
      by Patch 2/2.
      ====================
      
      Link: https://lore.kernel.org/r/cover.1610703289.git.lucien.xin@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      213b97b1
    • Xin Long's avatar
      sctp: remove the NETIF_F_SG flag before calling skb_segment · 1fef8544
      Xin Long authored
      
      
      It makes more sense to clear NETIF_F_SG instead of set it when
      calling skb_segment() in sctp_gso_segment(), since SCTP GSO is
      using head_skb's fraglist, of which all frags are linear skbs.
      
      This will make SCTP GSO code more understandable.
      
      Suggested-by: default avatarAlexander Duyck <alexander.duyck@gmail.com>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1fef8544
    • Xin Long's avatar
      net: move the hsize check to the else block in skb_segment · dbd50f23
      Xin Long authored
      After commit 89319d38
      
       ("net: Add frag_list support to skb_segment"),
      it goes to process frag_list when !hsize in skb_segment(). However, when
      using skb frag_list, sg normally should not be set. In this case, hsize
      will be set with len right before !hsize check, then it won't go to
      frag_list processing code.
      
      So the right thing to do is move the hsize check to the else block, so
      that it won't affect the !hsize check for frag_list processing.
      
      v1->v2:
        - change to do "hsize <= 0" check instead of "!hsize", and also move
          "hsize < 0" into else block, to save some cycles, as Alex suggested.
      
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Reviewed-by: default avatarAlexander Duyck <alexanderduyck@fb.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      dbd50f23
    • vulab's avatar
      net: mscc: ocelot: Remove unneeded semicolon · 20efd2c7
      vulab authored
      
      
      fix semicolon.cocci warnings:
      drivers/net/ethernet/mscc/ocelot_net.c:460:2-3: Unneeded semicolon
      
      Signed-off-by: default avatarXu Wang <vulab@iscas.ac.cn>
      Link: https://lore.kernel.org/r/20210115095544.33164-1-vulab@iscas.ac.cn
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      20efd2c7
    • Raju Rangoju's avatar
      cxgb4: enable interrupt based Tx completions for T5 · b660bccb
      Raju Rangoju authored
      
      
      Enable interrupt based Tx completions to improve latency for T5.
      The consumer index (CIDX) will now come via interrupts so that Tx
      SKBs can be freed up sooner in Rx path. Also, enforce CIDX flush
      threshold override (CIDXFTHRESHO) to improve latency for slow
      traffic. This ensures that the interrupt is generated immediately
      whenever hardware catches up with driver (i.e. CIDX == PIDX is
      reached), which is often the case for slow traffic.
      
      Signed-off-by: default avatarRaju Rangoju <rajur@chelsio.com>
      Link: https://lore.kernel.org/r/20210115102059.6846-1-rajur@chelsio.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b660bccb
    • Jakub Kicinski's avatar
      Merge branch 'rid-w-1-warnings-in-ethernet' · c761b2df
      Jakub Kicinski authored
      Lee Jones says:
      
      ====================
      Rid W=1 warnings in Ethernet
      
      This set is part of a larger effort attempting to clean-up W=1
      kernel builds, which are currently overwhelmingly riddled with
      niggly little warnings.
      
      v2:
       - Squashed IBM patches
       - Fixed real issue in SMSC
       - Added Andrew's Reviewed-by tags on remainder
      ====================
      
      Link: https://lore.kernel.org/r/20210115200905.3470941-1-lee.jones@linaro.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c761b2df
    • Lee Jones's avatar
      net: ethernet: toshiba: spider_net: Document a whole bunch of function parameters · e242d598
      Lee Jones authored
      
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/net/ethernet/toshiba/spider_net.c:263: warning: Function parameter or member 'hwdescr' not described in 'spider_net_get_descr_status'
       drivers/net/ethernet/toshiba/spider_net.c:263: warning: Excess function parameter 'descr' description in 'spider_net_get_descr_status'
       drivers/net/ethernet/toshiba/spider_net.c:554: warning: Function parameter or member 'netdev' not described in 'spider_net_get_multicast_hash'
       drivers/net/ethernet/toshiba/spider_net.c:902: warning: Function parameter or member 't' not described in 'spider_net_cleanup_tx_ring'
       drivers/net/ethernet/toshiba/spider_net.c:902: warning: Excess function parameter 'card' description in 'spider_net_cleanup_tx_ring'
       drivers/net/ethernet/toshiba/spider_net.c:1074: warning: Function parameter or member 'card' not described in 'spider_net_resync_head_ptr'
       drivers/net/ethernet/toshiba/spider_net.c:1234: warning: Function parameter or member 'napi' not described in 'spider_net_poll'
       drivers/net/ethernet/toshiba/spider_net.c:1234: warning: Excess function parameter 'netdev' description in 'spider_net_poll'
       drivers/net/ethernet/toshiba/spider_net.c:1278: warning: Function parameter or member 'p' not described in 'spider_net_set_mac'
       drivers/net/ethernet/toshiba/spider_net.c:1278: warning: Excess function parameter 'ptr' description in 'spider_net_set_mac'
       drivers/net/ethernet/toshiba/spider_net.c:1350: warning: Function parameter or member 'error_reg1' not described in 'spider_net_handle_error_irq'
       drivers/net/ethernet/toshiba/spider_net.c:1350: warning: Function parameter or member 'error_reg2' not described in 'spider_net_handle_error_irq'
       drivers/net/ethernet/toshiba/spider_net.c:1968: warning: Function parameter or member 't' not described in 'spider_net_link_phy'
       drivers/net/ethernet/toshiba/spider_net.c:1968: warning: Excess function parameter 'data' description in 'spider_net_link_phy'
       drivers/net/ethernet/toshiba/spider_net.c:2149: warning: Function parameter or member 'work' not described in 'spider_net_tx_timeout_task'
       drivers/net/ethernet/toshiba/spider_net.c:2149: warning: Excess function parameter 'data' description in 'spider_net_tx_timeout_task'
       drivers/net/ethernet/toshiba/spider_net.c:2182: warning: Function parameter or member 'txqueue' not described in 'spider_net_tx_timeout'
      
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e242d598
    • Lee Jones's avatar
      net: ethernet: toshiba: ps3_gelic_net: Fix some kernel-doc misdemeanours · b5103632
      Lee Jones authored
      
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/net/ethernet/toshiba/ps3_gelic_net.c:1107: warning: Function parameter or member 'irq' not described in 'gelic_card_interrupt'
       drivers/net/ethernet/toshiba/ps3_gelic_net.c:1107: warning: Function parameter or member 'ptr' not described in 'gelic_card_interrupt'
       drivers/net/ethernet/toshiba/ps3_gelic_net.c:1407: warning: Function parameter or member 'txqueue' not described in 'gelic_net_tx_timeout'
       drivers/net/ethernet/toshiba/ps3_gelic_net.c:1439: warning: Function parameter or member 'napi' not described in 'gelic_ether_setup_netdev_ops'
       drivers/net/ethernet/toshiba/ps3_gelic_net.c:1639: warning: Function parameter or member 'dev' not described in 'ps3_gelic_driver_probe'
       drivers/net/ethernet/toshiba/ps3_gelic_net.c:1795: warning: Function parameter or member 'dev' not described in 'ps3_gelic_driver_remove'
      
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b5103632
    • Lee Jones's avatar
      net: ethernet: ibm: ibmvnic: Fix some kernel-doc misdemeanours · 80708602
      Lee Jones authored
      
      
      Fixes the following W=1 kernel build warning(s):
      
       from drivers/net/ethernet/ibm/ibmvnic.c:35:
       inlined from ‘handle_vpd_rsp’ at drivers/net/ethernet/ibm/ibmvnic.c:4124:3:
       drivers/net/ethernet/ibm/ibmvnic.c:1362: warning: Function parameter or member 'hdr_field' not described in 'build_hdr_data'
       drivers/net/ethernet/ibm/ibmvnic.c:1362: warning: Function parameter or member 'skb' not described in 'build_hdr_data'
       drivers/net/ethernet/ibm/ibmvnic.c:1362: warning: Function parameter or member 'hdr_len' not described in 'build_hdr_data'
       drivers/net/ethernet/ibm/ibmvnic.c:1362: warning: Function parameter or member 'hdr_data' not described in 'build_hdr_data'
       drivers/net/ethernet/ibm/ibmvnic.c:1423: warning: Function parameter or member 'hdr_field' not described in 'create_hdr_descs'
       drivers/net/ethernet/ibm/ibmvnic.c:1423: warning: Function parameter or member 'hdr_data' not described in 'create_hdr_descs'
       drivers/net/ethernet/ibm/ibmvnic.c:1423: warning: Function parameter or member 'len' not described in 'create_hdr_descs'
       drivers/net/ethernet/ibm/ibmvnic.c:1423: warning: Function parameter or member 'hdr_len' not described in 'create_hdr_descs'
       drivers/net/ethernet/ibm/ibmvnic.c:1423: warning: Function parameter or member 'scrq_arr' not described in 'create_hdr_descs'
       drivers/net/ethernet/ibm/ibmvnic.c:1474: warning: Function parameter or member 'txbuff' not described in 'build_hdr_descs_arr'
       drivers/net/ethernet/ibm/ibmvnic.c:1474: warning: Function parameter or member 'num_entries' not described in 'build_hdr_descs_arr'
       drivers/net/ethernet/ibm/ibmvnic.c:1474: warning: Function parameter or member 'hdr_field' not described in 'build_hdr_descs_arr'
       drivers/net/ethernet/ibm/ibmvnic.c:1832: warning: Function parameter or member 'adapter' not described in 'do_change_param_reset'
       drivers/net/ethernet/ibm/ibmvnic.c:1832: warning: Function parameter or member 'rwi' not described in 'do_change_param_reset'
       drivers/net/ethernet/ibm/ibmvnic.c:1832: warning: Function parameter or member 'reset_state' not described in 'do_change_param_reset'
       drivers/net/ethernet/ibm/ibmvnic.c:1911: warning: Function parameter or member 'adapter' not described in 'do_reset'
       drivers/net/ethernet/ibm/ibmvnic.c:1911: warning: Function parameter or member 'rwi' not described in 'do_reset'
       drivers/net/ethernet/ibm/ibmvnic.c:1911: warning: Function parameter or member 'reset_state' not described in 'do_reset'
      
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      80708602
    • Lee Jones's avatar
      net: ethernet: ti: am65-cpts: Document am65_cpts_rx_enable()'s 'en' parameter · e49e4647
      Lee Jones authored
      
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/net/ethernet/ti/am65-cpts.c:736: warning: Function parameter or member 'en' not described in 'am65_cpts_rx_enable'
       drivers/net/ethernet/ti/am65-cpts.c:736: warning: Excess function parameter 'skb' description in 'am65_cpts_rx_enable'
      
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e49e4647
    • Lee Jones's avatar
      net: ethernet: ti: am65-cpsw-qos: Demote non-conformant function header · 935888cd
      Lee Jones authored
      
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/net/ethernet/ti/am65-cpsw-qos.c:364: warning: Function parameter or member 'ndev' not described in 'am65_cpsw_timer_set'
       drivers/net/ethernet/ti/am65-cpsw-qos.c:364: warning: Function parameter or member 'est_new' not described in 'am65_cpsw_timer_set'
      
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      935888cd
    • Lee Jones's avatar
      net: xen-netback: xenbus: Demote nonconformant kernel-doc headers · 090c7ae8
      Lee Jones authored
      
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/net/xen-netback/xenbus.c:419: warning: Function parameter or member 'dev' not described in 'frontend_changed'
       drivers/net/xen-netback/xenbus.c:419: warning: Function parameter or member 'frontend_state' not described in 'frontend_changed'
       drivers/net/xen-netback/xenbus.c:1001: warning: Function parameter or member 'dev' not described in 'netback_probe'
       drivers/net/xen-netback/xenbus.c:1001: warning: Function parameter or member 'id' not described in 'netback_probe'
      
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      090c7ae8
    • Lee Jones's avatar
      net: ethernet: smsc: smc91x: Fix function name in kernel-doc header · 7d2a9244
      Lee Jones authored
      
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/net/ethernet/smsc/smc91x.c:2200: warning: Function parameter or member 'dev' not described in 'try_toggle_control_gpio'
       drivers/net/ethernet/smsc/smc91x.c:2200: warning: Function parameter or member 'desc' not described in 'try_toggle_control_gpio'
       drivers/net/ethernet/smsc/smc91x.c:2200: warning: Function parameter or member 'name' not described in 'try_toggle_control_gpio'
       drivers/net/ethernet/smsc/smc91x.c:2200: warning: Function parameter or member 'index' not described in 'try_toggle_control_gpio'
       drivers/net/ethernet/smsc/smc91x.c:2200: warning: Function parameter or member 'value' not described in 'try_toggle_control_gpio'
       drivers/net/ethernet/smsc/smc91x.c:2200: warning: Function parameter or member 'nsdelay' not described in 'try_toggle_control_gpio'
      
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7d2a9244
  3. Jan 16, 2021
    • Pravin B Shelar's avatar
      GTP: add support for flow based tunneling API · 9ab7e76a
      Pravin B Shelar authored
      
      
      Following patch add support for flow based tunneling API
      to send and recv GTP tunnel packet over tunnel metadata API.
      This would allow this device integration with OVS or eBPF using
      flow based tunneling APIs.
      
      Signed-off-by: default avatarPravin B Shelar <pbshelar@fb.com>
      Link: https://lore.kernel.org/r/20210110070021.26822-1-pbshelar@fb.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9ab7e76a
    • Yejune Deng's avatar
      tcp_cubic: use memset and offsetof init · f4d133d8
      Yejune Deng authored
      
      
      In bictcp_reset(), use memset and offsetof instead of = 0.
      
      Signed-off-by: default avatarYejune Deng <yejune.deng@gmail.com>
      Link: https://lore.kernel.org/r/1610597696-128610-1-git-send-email-yejune.deng@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f4d133d8
    • Menglong Dong's avatar
      net: tap: check vlan with eth_type_vlan() method · b69df260
      Menglong Dong authored
      
      
      Replace some checks for ETH_P_8021Q and ETH_P_8021AD in
      drivers/net/tap.c with eth_type_vlan.
      
      Signed-off-by: default avatarMenglong Dong <dong.menglong@zte.com.cn>
      Link: https://lore.kernel.org/r/20210115023238.4681-1-dong.menglong@zte.com.cn
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b69df260
    • Geliang Tang's avatar
      nfc: netlink: use &w->w in nfc_genl_rcv_nl_event · 32d91b4a
      Geliang Tang authored
      
      
      Use the struct member w of the struct urelease_work directly instead of
      casting it.
      
      Signed-off-by: default avatarGeliang Tang <geliangtang@gmail.com>
      Link: https://lore.kernel.org/r/f0ed86d6d54ac0834bd2e161d172bf7bb5647cf7.1610683862.git.geliangtang@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      32d91b4a
    • Jakub Kicinski's avatar
      Merge branch 'configuring-congestion-watermarks-on-ocelot-switch-using-devlink-sb' · 58f9f9b5
      Jakub Kicinski authored
      Vladimir Oltean says:
      
      ====================
      Configuring congestion watermarks on ocelot switch using devlink-sb
      
      In some applications, it is important to create resource reservations in
      the Ethernet switches, to prevent background traffic, or deliberate
      attacks, from inducing denial of service into the high-priority traffic.
      
      These patches give the user some knobs to turn. The ocelot switches
      support per-port and per-port-tc reservations, on ingress and on egress.
      The resources that are monitored are packet buffers (in cells of 60
      bytes each) and frame references.
      
      The frames that exceed the reservations can optionally consume from
      sharing watermarks which are not per-port but global across the switch.
      There are 10 sharing watermarks, 8 of them are per traffic class and 2
      are per drop priority.
      
      I am configuring the hardware using the best of my knowledge, and mostly
      through trial and error. Same goes for devlink-sb integration. Feedback
      is welcome.
      ====================
      
      Link: https://lore.kernel.org/r/20210115021120.3055988-1-olteanv@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      58f9f9b5
    • Vladimir Oltean's avatar
      net: mscc: ocelot: configure watermarks using devlink-sb · f59fd9ca
      Vladimir Oltean authored
      
      
      Using devlink-sb, we can configure 12/16 (the important 75%) of the
      switch's controlling watermarks for congestion drops, and we can monitor
      50% of the watermark occupancies (we can monitor the reservation
      watermarks, but not the sharing watermarks, which are exposed as pool
      sizes).
      
      The following definitions can be made:
      
      SB_BUF=0 # The devlink-sb for frame buffers
      SB_REF=1 # The devlink-sb for frame references
      POOL_ING=0 # The pool for ingress traffic. Both devlink-sb instances
                 # have one of these.
      POOL_EGR=1 # The pool for egress traffic. Both devlink-sb instances
                 # have one of these.
      
      Editing the hardware watermarks is done in the following way:
      BUF_xxxx_I is accessed when sb=$SB_BUF and pool=$POOL_ING
      REF_xxxx_I is accessed when sb=$SB_REF and pool=$POOL_ING
      BUF_xxxx_E is accessed when sb=$SB_BUF and pool=$POOL_EGR
      REF_xxxx_E is accessed when sb=$SB_REF and pool=$POOL_EGR
      
      Configuring the sharing watermarks for COL_SHR(dp=0) is done implicitly
      by modifying the corresponding pool size. By default, the pool size has
      maximum size, so this can be skipped.
      
      devlink sb pool set pci/0000:00:00.5 sb $SB_BUF pool $POOL_ING \
      	size 129840 thtype static
      
      Since by default there is no buffer reservation, the above command has
      maxed out BUF_COL_SHR_I(dp=0).
      
      Configuring the per-port reservation watermark (P_RSRV) is done in the
      following way:
      
      devlink sb port pool set pci/0000:00:00.5/0 sb $SB_BUF \
      	pool $POOL_ING th 1000
      
      The above command sets BUF_P_RSRV_I(port 0) to 1000 bytes. After this
      command, the sharing watermarks are internally reconfigured with 1000
      bytes less, i.e. from 129840 bytes to 128840 bytes.
      
      Configuring the per-port-tc reservation watermarks (Q_RSRV) is done in
      the following way:
      
      for tc in {0..7}; do
      	devlink sb tc bind set pci/0000:00:00.5/0 sb 0 tc $tc \
      		type ingress pool $POOL_ING \
      		th 3000
      done
      
      The above command sets BUF_Q_RSRV_I(port 0, tc 0..7) to 3000 bytes.
      The sharing watermarks are again reconfigured with 24000 bytes less.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f59fd9ca
    • Vladimir Oltean's avatar
      net: mscc: ocelot: initialize watermarks to sane defaults · a4ae997a
      Vladimir Oltean authored
      
      
      This is meant to be a gentle introduction into the world of watermarks
      on ocelot. The code is placed in ocelot_devlink.c because it will be
      integrated with devlink, even if it isn't right now.
      
      My first step was intended to be to replicate the default configuration
      of the congestion watermarks programatically, since they are now going
      to be tuned by the user.
      
      But after studying and understanding through trial and error how they
      work, I now believe that the configuration used out of reset does not do
      justice to the word "reservation", since the sum of all reservations
      exceeds the total amount of resources (otherwise said, all reservations
      cannot be fulfilled at the same time, which means that, contrary to the
      reference manual, they don't guarantee anything).
      
      As an example, here's a dump of the reservation watermarks for frame
      buffers, for port 0 (for brevity, the ports 1-6 were omitted, but they
      have the same configuration):
      
      BUF_Q_RSRV_I(port 0, prio 0) = max 3000 bytes
      BUF_Q_RSRV_I(port 0, prio 1) = max 3000 bytes
      BUF_Q_RSRV_I(port 0, prio 2) = max 3000 bytes
      BUF_Q_RSRV_I(port 0, prio 3) = max 3000 bytes
      BUF_Q_RSRV_I(port 0, prio 4) = max 3000 bytes
      BUF_Q_RSRV_I(port 0, prio 5) = max 3000 bytes
      BUF_Q_RSRV_I(port 0, prio 6) = max 3000 bytes
      BUF_Q_RSRV_I(port 0, prio 7) = max 3000 bytes
      
      Otherwise said, every port-tc has an ingress reservation of 3000 bytes,
      and there are 7 ports in VSC9959 Felix (6 user ports and 1 CPU port).
      Concentrating only on the ingress reservations, there are, in total,
      8 [traffic classes] x 7 [ports] x 3000 [bytes] = 168,000 bytes of memory
      reserved on ingress.
      But, surprise, Felix only has 128 KB of packet buffer in total...
      A similar thing happens with Seville, which has a larger packet buffer,
      but also more ports, and the default configuration is also overcommitted.
      
      This patch disables the (apparently) bogus reservations and moves all
      resources to the shared area. This way, real reservations can be set up
      by the user, using devlink-sb.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a4ae997a
    • Vladimir Oltean's avatar
      net: mscc: ocelot: register devlink ports · 6c30384e
      Vladimir Oltean authored
      
      
      Add devlink integration into the mscc_ocelot switchdev driver. All
      physical ports (i.e. the unused ones as well) except the CPU port module
      at ocelot->num_phys_ports are registered with devlink, and that requires
      keeping the devlink_port structure outside struct ocelot_port_private,
      since the latter has a 1:1 mapping with a struct net_device (which does
      not exist for unused ports).
      
      Since we use devlink_port_type_eth_set to link the devlink port to the
      net_device, we can as well remove the .ndo_get_phys_port_name and
      .ndo_get_port_parent_id implementations, since devlink takes care of
      retrieving the port name and number automatically, once
      .ndo_get_devlink_port is implemented.
      
      Note that the felix DSA driver is already integrated with devlink by
      default, since that is a thing that the DSA core takes care of. This is
      the reason why these devlink stubs were put in ocelot_net.c and not in
      the common library. It is also the reason why ocelot::devlink is a
      pointer and not a full structure embedded inside struct ocelot: because
      the mscc_ocelot driver allocates that by itself (as the container of
      struct ocelot, in fact), but in the case of felix, it is DSA who
      allocates the devlink, and felix just propagates the pointer towards
      struct ocelot.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6c30384e
    • Vladimir Oltean's avatar
      net: mscc: ocelot: delete unused ocelot_set_cpu_port prototype · c6c65d47
      Vladimir Oltean authored
      This is a leftover of commit 69df578c
      
       ("net: mscc: ocelot: eliminate
      confusion between CPU and NPI port") which renamed that function.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c6c65d47
    • Vladimir Oltean's avatar
      net: mscc: ocelot: export NUM_TC constant from felix to common switch lib · 70d39a6e
      Vladimir Oltean authored
      
      
      We should be moving anything that isn't DSA-specific or SoC-specific out
      of the felix DSA driver, and into the common mscc_ocelot switch library.
      
      The number of traffic classes is one of the aspects that is common
      between all ocelot switches, so it belongs in the library.
      
      This patch also makes seville use 8 TX queues, and therefore enables
      prioritization via the QOS_CLASS field in the NPI injection header.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      70d39a6e
    • Vladimir Oltean's avatar
      net: dsa: felix: perform teardown in reverse order of setup · d19741b0
      Vladimir Oltean authored
      
      
      In general it is desirable that cleanup is the reverse process of setup.
      In this case I am not seeing any particular issue, but with the
      introduction of devlink-sb for felix, a non-obvious decision had to be
      made as to where to put its cleanup method. When there's a convention in
      place, that decision becomes obvious.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d19741b0
    • Vladimir Oltean's avatar
      net: dsa: felix: reindent struct dsa_switch_ops · a7096915
      Vladimir Oltean authored
      
      
      The devlink function pointer names are super long, and they would break
      the alignment. So reindent the existing ops now by adding one tab.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a7096915
    • Vladimir Oltean's avatar
      net: dsa: add ops for devlink-sb · 2a6ef763
      Vladimir Oltean authored
      
      
      Switches that care about QoS might have hardware support for reserving
      buffer pools for individual ports or traffic classes, and configuring
      their sizes and thresholds. Through devlink-sb (shared buffers), this is
      all configurable, as well as their occupancy being viewable.
      
      Add the plumbing in DSA for these operations.
      
      Individual drivers still need to call devlink_sb_register() with the
      shared buffers they want to expose. A helper was not created in DSA for
      this purpose (unlike, say, dsa_devlink_params_register), since in my
      opinion it does not bring any benefit over plainly calling
      devlink_sb_register() directly.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2a6ef763
    • Vladimir Oltean's avatar
      net: mscc: ocelot: add ops for decoding watermark threshold and occupancy · 703b7621
      Vladimir Oltean authored
      
      
      We'll need to read back the watermark thresholds and occupancy from
      hardware (for devlink-sb integration), not only to write them as we did
      so far in ocelot_port_set_maxlen. So introduce 2 new functions in struct
      ocelot_ops, similar to wm_enc, and implement them for the 3 supported
      mscc_ocelot switches.
      
      Remove the INUSE and MAXUSE unpacking helpers for the QSYS_RES_STAT
      register, because that doesn't scale with the number of switches that
      mscc_ocelot supports now. They have different bit widths for the
      watermarks, and we need function pointers to abstract that difference
      away.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      703b7621
    • Vladimir Oltean's avatar
      net: mscc: ocelot: auto-detect packet buffer size and number of frame references · f6fe01d6
      Vladimir Oltean authored
      
      
      Instead of reading these values from the reference manual and writing
      them down into the driver, it appears that the hardware gives us the
      option of detecting them dynamically.
      
      The number of frame references corresponds to what the reference manual
      notes, however it seems that the frame buffers are reported as slightly
      less than the books would indicate. On VSC9959 (Felix), the books say it
      should have 128KB of packet buffer, but the registers indicate only
      129840 bytes (126.79 KB). Also, the unit of measurement for FREECNT from
      the documentation of all these devices is incorrect (taken from an older
      generation). This was confirmed by Younes Leroul from Microchip support.
      
      Not having anything better to do with these values at the moment* (this
      will change soon), let's just print them.
      
      *The frame buffer size is, in fact, used to calculate the tail dropping
      watermarks.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f6fe01d6
    • Jakub Kicinski's avatar
      Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next · 2d9116be
      Jakub Kicinski authored
      Daniel Borkmann says:
      
      ====================
      pull-request: bpf-next 2021-01-16
      
      1) Extend atomic operations to the BPF instruction set along with x86-64 JIT support,
         that is, atomic{,64}_{xchg,cmpxchg,fetch_{add,and,or,xor}}, from Brendan Jackman.
      
      2) Add support for using kernel module global variables (__ksym externs in BPF
         programs) retrieved via module's BTF, from Andrii Nakryiko.
      
      3) Generalize BPF stackmap's buildid retrieval and add support to have buildid
         stored in mmap2 event for perf, from Jiri Olsa.
      
      4) Various fixes for cross-building BPF sefltests out-of-tree which then will
         unblock wider automated testing on ARM hardware, from Jean-Philippe Brucker.
      
      5) Allow to retrieve SOL_SOCKET opts from sock_addr progs, from Daniel Borkmann.
      
      6) Clean up driver's XDP buffer init and split into two helpers to init per-
         descriptor and non-changing fields during processing, from Lorenzo Bianconi.
      
      7) Minor misc improvements to libbpf & bpftool, from Ian Rogers.
      
      * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (41 commits)
        perf: Add build id data in mmap2 event
        bpf: Add size arg to build_id_parse function
        bpf: Move stack_map_get_build_id into lib
        bpf: Document new atomic instructions
        bpf: Add tests for new BPF atomic operations
        bpf: Add bitwise atomic instructions
        bpf: Pull out a macro for interpreting atomic ALU operations
        bpf: Add instructions for atomic_[cmp]xchg
        bpf: Add BPF_FETCH field / create atomic_fetch_add instruction
        bpf: Move BPF_STX reserved field check into BPF_STX verifier code
        bpf: Rename BPF_XADD and prepare to encode other atomics in .imm
        bpf: x86: Factor out a lookup table for some ALU opcodes
        bpf: x86: Factor out emission of REX byte
        bpf: x86: Factor out emission of ModR/M for *(reg + off)
        tools/bpftool: Add -Wall when building BPF programs
        bpf, libbpf: Avoid unused function warning on bpf_tail_call_static
        selftests/bpf: Install btf_dump test cases
        selftests/bpf: Fix installation of urandom_read
        selftests/bpf: Move generated test files to $(TEST_GEN_FILES)
        selftests/bpf: Fix out-of-tree build
        ...
      ====================
      
      Link: https://lore.kernel.org/r/20210116012922.17823-1-daniel@iogearbox.net
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2d9116be
    • Tom Rix's avatar
      net: ks8851: remove definition of DEBUG · 3ada665b
      Tom Rix authored
      
      
      Defining DEBUG should only be done in development.
      So remove DEBUG.
      
      Signed-off-by: default avatarTom Rix <trix@redhat.com>
      Reviewed-by: default avatarMarek Vasut <marex@denx.de>
      Link: https://lore.kernel.org/r/20210115153128.131026-1-trix@redhat.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      3ada665b