1. 09 1月, 2021 1 次提交
  2. 06 1月, 2021 5 次提交
  3. 22 12月, 2020 3 次提交
    • R
      ethernet: ucc_geth: fix use-after-free in ucc_geth_remove() · e925e0cd
      Rasmus Villemoes 提交于
      ugeth is the netdiv_priv() part of the netdevice. Accessing the memory
      pointed to by ugeth (such as done by ucc_geth_memclean() and the two
      of_node_puts) after free_netdev() is thus use-after-free.
      
      Fixes: 80a9fad8 ("ucc_geth: fix module removal")
      Signed-off-by: NRasmus Villemoes <rasmus.villemoes@prevas.dk>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      e925e0cd
    • R
      ethernet: ucc_geth: fix definition and size of ucc_geth_tx_global_pram · 887078de
      Rasmus Villemoes 提交于
      Table 8-53 in the QUICC Engine Reference manual shows definitions of
      fields up to a size of 192 bytes, not just 128. But in table 8-111,
      one does find the text
      
        Base Address of the Global Transmitter Parameter RAM Page. [...]
        The user needs to allocate 128 bytes for this page. The address must
        be aligned to the page size.
      
      I've checked both rev. 7 (11/2015) and rev. 9 (05/2018) of the manual;
      they both have this inconsistency (and the table numbers are the
      same).
      
      Adding a bit of debug printing, on my board the struct
      ucc_geth_tx_global_pram is allocated at offset 0x880, while
      the (opaque) ucc_geth_thread_data_tx gets allocated immediately
      afterwards, at 0x900. So whatever the engine writes into the thread
      data overlaps with the tail of the global tx pram (and devmem says
      that something does get written during a simple ping).
      
      I haven't observed any failure that could be attributed to this, but
      it seems to be the kind of thing that would be extremely hard to
      debug. So extend the struct definition so that we do allocate 192
      bytes.
      Signed-off-by: NRasmus Villemoes <rasmus.villemoes@prevas.dk>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      887078de
    • R
      ethernet: ucc_geth: set dev->max_mtu to 1518 · 1385ae5c
      Rasmus Villemoes 提交于
      All the buffers and registers are already set up appropriately for an
      MTU slightly above 1500, so we just need to expose this to the
      networking stack. AFAICT, there's no need to implement .ndo_change_mtu
      when the receive buffers are always set up to support the max_mtu.
      
      This fixes several warnings during boot on our mpc8309-board with an
      embedded mv88e6250 switch:
      
      mv88e6085 mdio@e0102120:10: nonfatal error -34 setting MTU 1500 on port 0
      ...
      mv88e6085 mdio@e0102120:10: nonfatal error -34 setting MTU 1500 on port 4
      ucc_geth e0102000.ethernet eth1: error -22 setting MTU to 1504 to include DSA overhead
      
      The last line explains what the DSA stack tries to do: achieving an MTU
      of 1500 on-the-wire requires that the master netdevice connected to
      the CPU port supports an MTU of 1500+the tagging overhead.
      
      Fixes: bfcb8132 ("net: dsa: configure the MTU for switch ports")
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NRasmus Villemoes <rasmus.villemoes@prevas.dk>
      Reviewed-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      1385ae5c
  4. 17 12月, 2020 1 次提交
    • I
      dpaa2-eth: fix the size of the mapped SGT buffer · 54a57d1c
      Ioana Ciornei 提交于
      This patch fixes an error condition triggered when the code path which
      transmits a S/G frame descriptor when the skb's headroom is not enough
      for DPAA2's needs.
      
      We are greated with a splat like the one below when a SGT structure is
      recycled and that is because even though a dma_unmap is performed on the
      Tx confirmation path, the unmap is not done with the proper size.
      
      [  714.464927] WARNING: CPU: 13 PID: 0 at drivers/iommu/io-pgtable-arm.c:281 __arm_lpae_map+0x2d4/0x30c
      (...)
      [  714.465343] Call trace:
      [  714.465348]  __arm_lpae_map+0x2d4/0x30c
      [  714.465353]  __arm_lpae_map+0x114/0x30c
      [  714.465357]  __arm_lpae_map+0x114/0x30c
      [  714.465362]  __arm_lpae_map+0x114/0x30c
      [  714.465366]  arm_lpae_map+0xf4/0x180
      [  714.465373]  arm_smmu_map+0x4c/0xc0
      [  714.465379]  __iommu_map+0x100/0x2bc
      [  714.465385]  iommu_map_atomic+0x20/0x30
      [  714.465391]  __iommu_dma_map+0xb0/0x110
      [  714.465397]  iommu_dma_map_page+0xb8/0x120
      [  714.465404]  dma_map_page_attrs+0x1a8/0x210
      [  714.465413]  __dpaa2_eth_tx+0x384/0xbd0 [fsl_dpaa2_eth]
      [  714.465421]  dpaa2_eth_tx+0x84/0x134 [fsl_dpaa2_eth]
      [  714.465427]  dev_hard_start_xmit+0x10c/0x2b0
      [  714.465433]  sch_direct_xmit+0x1a0/0x550
      (...)
      
      The dpaa2-eth driver uses an area of software annotations to transmit
      necessary information from the Tx path to the Tx confirmation one. This
      SWA structure has a different layout for each kind of frame that we are
      dealing with: linear, S/G or XDP.
      
      The commit referenced was incorrectly setting up the 'sgt_size' field
      for the S/G type of SWA even though we are dealing with a linear skb
      here.
      
      Fixes: d70446ee ("dpaa2-eth: send a scatter-gather FD instead of realloc-ing")
      Reported-by: NDaniel Thompson <daniel.thompson@linaro.org>
      Tested-by: NDaniel Thompson <daniel.thompson@linaro.org>
      Signed-off-by: NIoana Ciornei <ioana.ciornei@nxp.com>
      Link: https://lore.kernel.org/r/20201211171607.108034-1-ciorneiioana@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      54a57d1c
  5. 10 12月, 2020 2 次提交
  6. 08 12月, 2020 2 次提交
  7. 06 12月, 2020 1 次提交
  8. 05 12月, 2020 2 次提交
    • A
      ethernet: select CONFIG_CRC32 as needed · 0b32e91f
      Arnd Bergmann 提交于
      A number of ethernet drivers require crc32 functionality to be
      avaialable in the kernel, causing a link error otherwise:
      
      arm-linux-gnueabi-ld: drivers/net/ethernet/agere/et131x.o: in function `et1310_setup_device_for_multicast':
      et131x.c:(.text+0x5918): undefined reference to `crc32_le'
      arm-linux-gnueabi-ld: drivers/net/ethernet/cadence/macb_main.o: in function `macb_start_xmit':
      macb_main.c:(.text+0x4b88): undefined reference to `crc32_le'
      arm-linux-gnueabi-ld: drivers/net/ethernet/faraday/ftgmac100.o: in function `ftgmac100_set_rx_mode':
      ftgmac100.c:(.text+0x2b38): undefined reference to `crc32_le'
      arm-linux-gnueabi-ld: drivers/net/ethernet/freescale/fec_main.o: in function `set_multicast_list':
      fec_main.c:(.text+0x6120): undefined reference to `crc32_le'
      arm-linux-gnueabi-ld: drivers/net/ethernet/freescale/fman/fman_dtsec.o: in function `dtsec_add_hash_mac_address':
      fman_dtsec.c:(.text+0x830): undefined reference to `crc32_le'
      arm-linux-gnueabi-ld: drivers/net/ethernet/freescale/fman/fman_dtsec.o:fman_dtsec.c:(.text+0xb68): more undefined references to `crc32_le' follow
      arm-linux-gnueabi-ld: drivers/net/ethernet/netronome/nfp/nfpcore/nfp_hwinfo.o: in function `nfp_hwinfo_read':
      nfp_hwinfo.c:(.text+0x250): undefined reference to `crc32_be'
      arm-linux-gnueabi-ld: nfp_hwinfo.c:(.text+0x288): undefined reference to `crc32_be'
      arm-linux-gnueabi-ld: drivers/net/ethernet/netronome/nfp/nfpcore/nfp_resource.o: in function `nfp_resource_acquire':
      nfp_resource.c:(.text+0x144): undefined reference to `crc32_be'
      arm-linux-gnueabi-ld: nfp_resource.c:(.text+0x158): undefined reference to `crc32_be'
      arm-linux-gnueabi-ld: drivers/net/ethernet/nxp/lpc_eth.o: in function `lpc_eth_set_multicast_list':
      lpc_eth.c:(.text+0x1934): undefined reference to `crc32_le'
      arm-linux-gnueabi-ld: drivers/net/ethernet/rocker/rocker_ofdpa.o: in function `ofdpa_flow_tbl_do':
      rocker_ofdpa.c:(.text+0x2e08): undefined reference to `crc32_le'
      arm-linux-gnueabi-ld: drivers/net/ethernet/rocker/rocker_ofdpa.o: in function `ofdpa_flow_tbl_del':
      rocker_ofdpa.c:(.text+0x3074): undefined reference to `crc32_le'
      arm-linux-gnueabi-ld: drivers/net/ethernet/rocker/rocker_ofdpa.o: in function `ofdpa_port_fdb':
      arm-linux-gnueabi-ld: drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.o: in function `mlx5dr_ste_calc_hash_index':
      dr_ste.c:(.text+0x354): undefined reference to `crc32_le'
      arm-linux-gnueabi-ld: drivers/net/ethernet/microchip/lan743x_main.o: in function `lan743x_netdev_set_multicast':
      lan743x_main.c:(.text+0x5dc4): undefined reference to `crc32_le'
      
      Add the missing 'select CRC32' entries in Kconfig for each of them.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NNicolas Ferre <nicolas.ferre@microchip.com>
      Acked-by: NMadalin Bucur <madalin.bucur@oss.nxp.com>
      Acked-by: NMark Einon <mark.einon@gmail.com>
      Acked-by: NSimon Horman <simon.horman@netronome.com>
      Link: https://lore.kernel.org/r/20201203232114.1485603-1-arnd@kernel.orgSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      0b32e91f
    • A
      dpaa_eth: fix build errorr in dpaa_fq_init · fdd8b824
      Anders Roxell 提交于
      When building FSL_DPAA_ETH the following build error shows up:
      
      /tmp/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c: In function ‘dpaa_fq_init’:
      /tmp/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c:1135:9: error: too few arguments to function ‘xdp_rxq_info_reg’
       1135 |   err = xdp_rxq_info_reg(&dpaa_fq->xdp_rxq, dpaa_fq->net_dev,
            |         ^~~~~~~~~~~~~~~~
      
      Commit b02e5a0e ("xsk: Propagate napi_id to XDP socket Rx path")
      added an extra argument to function xdp_rxq_info_reg and commit
      d57e57d0 ("dpaa_eth: add XDP_TX support") didn't know about that
      extra argument.
      Signed-off-by: NAnders Roxell <anders.roxell@linaro.org>
      Acked-by: NBjörn Töpel <bjorn.topel@intel.com>
      Link: https://lore.kernel.org/r/20201203144343.790719-1-anders.roxell@linaro.orgSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      fdd8b824
  9. 03 12月, 2020 1 次提交
  10. 02 12月, 2020 1 次提交
  11. 01 12月, 2020 8 次提交
  12. 26 11月, 2020 1 次提交
    • V
      enetc: Let the hardware auto-advance the taprio base-time of 0 · 90cf87d1
      Vladimir Oltean 提交于
      The tc-taprio base time indicates the beginning of the tc-taprio
      schedule, which is cyclic by definition (where the length of the cycle
      in nanoseconds is called the cycle time). The base time is a 64-bit PTP
      time in the TAI domain.
      
      Logically, the base-time should be a future time. But that imposes some
      restrictions to user space, which has to retrieve the current PTP time
      from the NIC first, then calculate a base time that will still be larger
      than the base time by the time the kernel driver programs this value
      into the hardware. Actually ensuring that the programmed base time is in
      the future is still a problem even if the kernel alone deals with this.
      
      Luckily, the enetc hardware already advances a base-time that is in the
      past into a congruent time in the immediate future, according to the
      same formula that can be found in the software implementation of taprio
      (in taprio_get_start_time):
      
      	/* Schedule the start time for the beginning of the next
      	 * cycle.
      	 */
      	n = div64_s64(ktime_sub_ns(now, base), cycle);
      	*start = ktime_add_ns(base, (n + 1) * cycle);
      
      There's only one problem: the driver doesn't let the hardware do that.
      It interferes with the base-time passed from user space, by special-casing
      the situation when the base-time is zero, and replaces that with the
      current PTP time. This changes the intended effective base-time of the
      schedule, which will in the end have a different phase offset than if
      the base-time of 0.000000000 was to be advanced by an integer multiple
      of the cycle-time.
      
      Fixes: 34c6adf1 ("enetc: Configure the Time-Aware Scheduler via tc-taprio offload")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Link: https://lore.kernel.org/r/20201124220259.3027991-1-vladimir.oltean@nxp.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      90cf87d1
  13. 25 11月, 2020 1 次提交
  14. 24 11月, 2020 1 次提交
  15. 21 11月, 2020 1 次提交
  16. 20 11月, 2020 2 次提交
  17. 18 11月, 2020 1 次提交
  18. 17 11月, 2020 1 次提交
    • Z
      net: fec: Fix reference count leak in fec series ops · da875fa5
      Zhang Qilong 提交于
      pm_runtime_get_sync() will increment pm usage at first and it will
      resume the device later. If runtime of the device has error or
      device is in inaccessible state(or other error state), resume
      operation will fail. If we do not call put operation to decrease
      the reference, it will result in reference count leak. Moreover,
      this device cannot enter the idle state and always stay busy or other
      non-idle state later. So we fixed it by replacing it with
      pm_runtime_resume_and_get.
      
      Fixes: 8fff755e ("net: fec: Ensure clocks are enabled while using mdio bus")
      Signed-off-by: NZhang Qilong <zhangqilong3@huawei.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      da875fa5
  19. 05 11月, 2020 2 次提交
  20. 04 11月, 2020 2 次提交
    • S
      net: dpaa: Replace in_irq() usage. · abba4b16
      Sebastian Andrzej Siewior 提交于
      The driver uses in_irq() + in_serving_softirq() magic to decide if NAPI
      scheduling is required or packet processing.
      
      The usage of in_*() in drivers is phased out and Linus clearly requested
      that code which changes behaviour depending on context should either be
      separated or the context be conveyed in an argument passed by the caller,
      which usually knows the context.
      
      Use the `sched_napi' argument passed by the callback. It is set true if
      called from the interrupt handler and NAPI should be scheduled.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Li Yang <leoyang.li@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      Reviewed-by: NMadalin Bucur <madalin.bucur@oss.nxp.com>
      Tested-by: NCamelia Groza <camelia.groza@nxp.com>
      abba4b16
    • S
      soc/fsl/qbman: Add an argument to signal if NAPI processing is required. · f84754db
      Sebastian Andrzej Siewior 提交于
      dpaa_eth_napi_schedule() and caam_qi_napi_schedule() schedule NAPI if
      invoked from:
      
       - Hard interrupt context
       - Any context which is not serving soft interrupts
      
      Any context which is not serving soft interrupts includes hard interrupts
      so the in_irq() check is redundant. caam_qi_napi_schedule() has a comment
      about this:
      
              /*
               * In case of threaded ISR, for RT kernels in_irq() does not return
               * appropriate value, so use in_serving_softirq to distinguish between
               * softirq and irq contexts.
               */
               if (in_irq() || !in_serving_softirq())
      
      This has nothing to do with RT. Even on a non RT kernel force threaded
      interrupts run obviously in thread context and therefore in_irq() returns
      false when invoked from the handler.
      
      The extension of the in_irq() check with !in_serving_softirq() was there
      when the drivers were added, but in the out of tree FSL BSP the original
      condition was in_irq() which got extended due to failures on RT.
      
      The usage of in_xxx() in drivers is phased out and Linus clearly requested
      that code which changes behaviour depending on context should either be
      separated or the context be conveyed in an argument passed by the caller,
      which usually knows the context. Right he is, the above construct is
      clearly showing why.
      
      The following callchains have been analyzed to end up in
      dpaa_eth_napi_schedule():
      
      qman_p_poll_dqrr()
        __poll_portal_fast()
          fq->cb.dqrr()
             dpaa_eth_napi_schedule()
      
      portal_isr()
        __poll_portal_fast()
          fq->cb.dqrr()
             dpaa_eth_napi_schedule()
      
      Both need to schedule NAPI.
      The crypto part has another code path leading up to this:
        kill_fq()
           empty_retired_fq()
             qman_p_poll_dqrr()
               __poll_portal_fast()
                  fq->cb.dqrr()
                     dpaa_eth_napi_schedule()
      
      kill_fq() is called from task context and ends up scheduling NAPI, but
      that's pointless and an unintended side effect of the !in_serving_softirq()
      check.
      
      The code path:
        caam_qi_poll() -> qman_p_poll_dqrr()
      
      is invoked from NAPI and I *assume* from crypto's NAPI device and not
      from qbman's NAPI device. I *guess* it is okay to skip scheduling NAPI
      (because this is what happens now) but could be changed if it is wrong
      due to `budget' handling.
      
      Add an argument to __poll_portal_fast() which is true if NAPI needs to be
      scheduled. This requires propagating the value to the caller including
      `qman_cb_dqrr' typedef which is used by the dpaa and the crypto driver.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
      Cc: Herbert XS <herbert@gondor.apana.org.au>
      Cc: Li Yang <leoyang.li@nxp.com>
      Reviewed-by: NHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      Reviewed-by: NMadalin Bucur <madalin.bucur@oss.nxp.com>
      Tested-by: NCamelia Groza <camelia.groza@nxp.com>
      f84754db
  21. 03 11月, 2020 1 次提交