10 Nov, 2018

33 commits

  • The phy core provides a handy phy_speed_to_str() helper, so use that
    instead of doing our own formatting of the different known link speeds.
    To do this, increase PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE to 11 so we can fit
    'Unsupported' if necessary.

    Signed-off-by: Kyle Roeschley
    Signed-off-by: David S. Miller

    Kyle Roeschley
     
  • As a heritage from the very early days of phylib member interrupts is
    defined as u32 even though it's just a flag whether interrupts are
    enabled. So we can change it to a bitfield member. In addition change
    the code dealing with this member in a way that it's clear we're
    dealing with a bool value.

    Signed-off-by: Heiner Kallweit
    Reviewed-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Heiner Kallweit
     
  • Ioana Ciornei says:

    ====================
    dpaa2-eth: defer probe on object allocate

    Allocatable objects on the fsl-mc bus may be probed by the fsl_mc_allocator
    after the first attempts of other drivers to use them. Defer the probe when
    this situation happens.

    Changes in v2:
    - proper handling of IS_ERR_OR_NULL
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • The fsl_mc_portal_allocate can fail when the requested MC portals are
    not yet probed by the fsl_mc_allocator. In this situation, the driver
    should defer the probe.

    Signed-off-by: Ioana Ciornei
    Signed-off-by: David S. Miller

    Ioana Ciornei
     
  • The fsl_mc_object_allocate function can fail because not all allocatable
    objects are probed by the fsl_mc_allocator at the call time. Defer the
    dpaa2-eth probe when this happens.

    Signed-off-by: Ioana Ciornei
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Ioana Ciornei
     
  • In the udp6 code path, we needed multiple tests to select the correct
    mib to be updated. Since we touch at least a counter at each iteration,
    it's convenient to use the recently introduced __UDPX_MIB() helper once
    and remove some code duplication.

    Signed-off-by: Paolo Abeni
    Signed-off-by: David S. Miller

    Paolo Abeni
     
  • __netdev_tx_sent_queue() was added in commit e59020abf0f
    ("net: bql: add __netdev_tx_sent_queue()") and allows for
    better GSO performance.

    Signed-off-by: Jakub Kicinski
    Reviewed-by: Dirk van der Merwe
    Reviewed-by: Simon Horman
    Signed-off-by: David S. Miller

    Jakub Kicinski
     
  • Miroslav Lichvar says:

    ====================
    More accurate PHCsystem clock synchronization

    RFC->v1:
    - added new patches
    - separated PHC timestamp from ptp_system_timestamp
    - fixed memory leak in PTP_SYS_OFFSET_EXTENDED
    - changed PTP_SYS_OFFSET_EXTENDED to work with array of arrays
    - fixed PTP_SYS_OFFSET_EXTENDED to break correctly from loop
    - fixed timecounter updates in drivers
    - split gettimex in igb driver
    - fixed ptp_read_* functions to be available without
    CONFIG_PTP_1588_CLOCK

    This series enables a more accurate synchronization between PTP hardware
    clocks and the system clock.

    The first two patches are minor cleanup/bug fixes.

    The third patch adds an extended version of the PTP_SYS_OFFSET ioctl,
    which returns three timestamps for each measurement. The idea is to
    shorten the interval between the system timestamps to contain just the
    reading of the lowest register of the PHC in order to reduce the error
    in the measured offset and get a smaller upper bound on the maximum
    error.

    The fourth patch deprecates the original gettime function.

    The remaining patches update the gettime function in order to support
    the new ioctl in the e1000e, igb, ixgbe, and tg3 drivers.

    Tests with few different NICs in different machines show that:
    - with an I219 (e1000e) the measured delay was reduced from 2500 to 1300
    ns and the error in the measured offset, when compared to the cross
    timestamping supported by the driver, was reduced by a factor of 5
    - with an I210 (igb) the delay was reduced from 5100 to 1700 ns
    - with an I350 (igb) the delay was reduced from 2300 to 750 ns
    - with an X550 (ixgbe) the delay was reduced from 1950 to 650 ns
    - with a BCM5720 (tg3) the delay was reduced from 2400 to 1200 ns
    ====================

    Acked-by: Richard Cochran
    Signed-off-by: David S. Miller

    David S. Miller
     
  • This adds support for the PTP_SYS_OFFSET_EXTENDED ioctl.

    Cc: Richard Cochran
    Cc: Michael Chan
    Signed-off-by: Miroslav Lichvar
    Signed-off-by: David S. Miller

    Miroslav Lichvar
     
  • This adds support for the PTP_SYS_OFFSET_EXTENDED ioctl.

    Cc: Richard Cochran
    Cc: Jacob Keller
    Cc: Jeff Kirsher
    Signed-off-by: Miroslav Lichvar
    Acked-by: Jeff Kirsher
    Signed-off-by: David S. Miller

    Miroslav Lichvar
     
  • This adds support for the PTP_SYS_OFFSET_EXTENDED ioctl.

    Cc: Richard Cochran
    Cc: Jacob Keller
    Cc: Jeff Kirsher
    Signed-off-by: Miroslav Lichvar
    Acked-by: Jeff Kirsher
    Signed-off-by: David S. Miller

    Miroslav Lichvar
     
  • This adds support for the PTP_SYS_OFFSET_EXTENDED ioctl.

    Cc: Richard Cochran
    Cc: Jacob Keller
    Cc: Jeff Kirsher
    Signed-off-by: Miroslav Lichvar
    Acked-by: Jeff Kirsher
    Signed-off-by: David S. Miller

    Miroslav Lichvar
     
  • When a driver provides gettimex64(), use it in the PTP_SYS_OFFSET ioctl
    and POSIX clock's gettime() instead of gettime64(). Drivers should
    provide only one of the functions.

    Cc: Richard Cochran
    Cc: Jacob Keller
    Signed-off-by: Miroslav Lichvar
    Signed-off-by: David S. Miller

    Miroslav Lichvar
     
  • The PTP_SYS_OFFSET ioctl, which can be used to measure the offset
    between a PHC and the system clock, includes the total time that the
    driver needs to read the PHC timestamp.

    This typically involves reading of multiple PCI registers (sometimes in
    multiple iterations) and the register that contains the lowest bits of
    the timestamp is not read in the middle between the two readings of the
    system clock. This asymmetry causes the measured offset to have a
    significant error.

    Introduce a new ioctl, driver function, and helper functions, which
    allow the reading of the lowest register to be isolated from the other
    readings in order to reduce the asymmetry. The ioctl returns three
    timestamps for each measurement:
    - system time right before reading the lowest bits of the PHC timestamp
    - PHC time
    - system time immediately after reading the lowest bits of the PHC
    timestamp

    Cc: Richard Cochran
    Cc: Jacob Keller
    Cc: Marcelo Tosatti
    Signed-off-by: Miroslav Lichvar
    Signed-off-by: David S. Miller

    Miroslav Lichvar
     
  • If a gettime64 call fails, return the error and avoid copying data back
    to user.

    Cc: Richard Cochran
    Cc: Jacob Keller
    Signed-off-by: Miroslav Lichvar
    Signed-off-by: David S. Miller

    Miroslav Lichvar
     
  • Reorder declarations of variables as reversed Christmas tree.

    Cc: Richard Cochran
    Suggested-by: Richard Cochran
    Signed-off-by: Miroslav Lichvar
    Signed-off-by: David S. Miller

    Miroslav Lichvar
     
  • Huazhong Tan says:

    ====================
    hns3: add code optimization for VF reset and some new reset feature

    Currently hardware supports below reset:
    1. VF reset: triggered by sending cmd to IMP(Integrated Management
    Processor). Only reset specific VF function and do not affect
    other PF or VF.
    2. PF reset: triggered by sending cmd to IMP. Only reset specific PF
    and it's VF.
    3. PF FLR: triggered by PCIe subsystem. Only reset specific PF and
    it's VF.
    4. VF FLR: triggered by PCIe subsystem. Only reset specific VF function
    and do not affect other PF or VF.
    5. Core reset: triggered by writing to register. Reset most hardware
    unit, such as SSU, which affects all the PF and VF.
    6. Global reset: triggered by writing to register. Reset all hardware
    unit, which affects all the PF and VF.
    7. IMP reset: triggered by IMU(Intelligent Management Unit) when
    IMP is not longer feeding IMU's watchdog. IMU will reload the IMP
    firmware and IMP will perform global reset after firmware reloading,
    which affects all the PF and VF.

    Current driver only support PF/VF reset, incomplete core and global
    reset(lacking the vf reset handling). So this patchset adds complete
    reset support in hns3 driver.

    Also, this patchset contains some optimization related to reset.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • This patch implements the .reset_prepare and .reset_done
    ops from pci framework to support the VF FLR.

    This patch uses hclgevf_set_def_reset_request() and
    hclgevf_reset_event() to handle FLR, so when
    hdev->default_reset_request is non zero, it means there is
    some reset requseted by hclgevf_set_def_reset_request() need
    to be processed. Also get the hdev from the ae_dev because
    hclgevf_reset_event is called with handle being NULL.

    Signed-off-by: Huazhong Tan
    Signed-off-by: David S. Miller

    Huazhong Tan
     
  • While doing PF FLR, VF's PCIe configuration space will be cleared, so
    the pci and vector of VF should be re-initialized in the VF's reset
    process while PF doing FLR.

    Also, this patch fixes some memory not freed problem when pci
    re-initialization is done during reset process.

    Signed-off-by: Huazhong Tan
    Signed-off-by: David S. Miller

    Huazhong Tan
     
  • This patch implements the .reset_prepare and .reset_done
    ops from pci framework to support the PF FLR.

    Signed-off-by: Huazhong Tan
    Signed-off-by: David S. Miller

    Huazhong Tan
     
  • The current code only print the prompt message after receiving
    the IMP reset interrupt and does not perform the corresponding driver
    reset operation. This patch implements the missing IMP reset handling
    in the driver.
    1. The driver sets the HCLGE_STATE_CMD_DISABLE to stop sending command
    after receiving the IMP reset interrupt.
    2. The driver needs to notify the hardware to reload the IMP firmware.
    3. The IMP firmware reloading makes the reset time of hardware longer,
    so it is necessary to extend the driver's waiting time to wait for
    the hardware reset to complete.
    4. In hclge_check_event_cause, IMP reset event should have higher
    priority than other events.

    Also, after clearing HCLGE_STATE_CMD_DISABLE in the hclge_cmd_init(),
    it needs to check whether there is a pending reset, if so, just set
    the HCLGE_STATE_CMD_DISABLE back and return.

    Signed-off-by: Huazhong Tan
    Signed-off-by: David S. Miller

    Huazhong Tan
     
  • When calling napi_disable during reset down process, if NAPIF_STATE_MISSED
    is set, napi_complete will call __napi_schedule to do the polling again.
    So this patch uses HNS3_NIC_STATE_DOWN to ensure the polling is not
    scheduled again.

    Also, when napi_complete returns true, it means polling is scheduled
    again, it is not neccssary to enable the interrupt.

    Signed-off-by: Huazhong Tan
    Signed-off-by: David S. Miller

    Huazhong Tan
     
  • Since hclgevf_reset() may fail for some reasons, so it needs an error
    handler to deal with it. When VF reset failed, VF can only be restored
    by a higher level reset asserted by PF. So, it needs to reinitialize
    its command queue, then it can respond to higher level reset.

    Also, this patch adds error logging in the hclgevf_notify_client().

    Signed-off-by: Huazhong Tan
    Signed-off-by: David S. Miller

    Huazhong Tan
     
  • According to hardware's description, after the reset occurs, the driver
    needs to re-initialize the command queue before sending and receiving
    any commands. Therefore, the VF's driver needs to identify the command
    queue needs to re-initialize with HCLGEVF_STATE_CMD_DISABLE, and does
    not allow sending or receiving commands before the re-initialization.

    Signed-off-by: Huazhong Tan
    Signed-off-by: David S. Miller

    Huazhong Tan
     
  • When a Core/Global/IMP reset occurs, the hardware sets the reset status
    register of all PF/VF and reports a reset interrupt to all PF/VF and
    firmware.

    When receiving the reset interrupt:
    1. The firmware will wait for 100 ms before resetting the hardware and
    clear the reset status register of all PF when hardware reset is done.
    2. The PF/VF driver needs to down the netdev within 100 ms and then wait
    for hardware reset to finish.
    3. After firmware clearing the reset status register of all PF, the PF
    driver reinitializes the hardware and clear the reset status register
    of it's VF.
    4. After PF driver clearing the reset status register of VF, the VF driver
    reinitializes the hardware.

    This patch mainly add handling for the step 4.

    Signed-off-by: Huazhong Tan
    Signed-off-by: David S. Miller

    Huazhong Tan
     
  • When PF performs a function reset, the hardware will reset both PF
    and all the VF belong to this PF. Hence, both PF's driver and VF's
    driver need to perform corresponding reset operations.

    Before PF driver asserting function reset to hardware, it firstly
    set up VF's hardware reset status, and inform the VF driver with
    HNAE3_VF_PF_FUNC_RESET, then VF driver sets this reset type to
    reset_pending and shechule reset task to stop IO and waits for the
    hardware reset status to clear. When PF driver has reinitialized the
    hardware and is ready to process mailbox from VF, PF driver clears
    VF's hardware reset status for VF to continue its reset process.

    Also, this patch uses readl_poll_timeout to simplify the hardware reset
    status waitting.

    Signed-off-by: Huazhong Tan
    Signed-off-by: Yunsheng Lin
    Signed-off-by: David S. Miller

    Huazhong Tan
     
  • Currently when VF need to reset itself, it will send a cmd to PF,
    after receiving the VF reset requset, PF sends a cmd to inform
    VF to enter the reset process and send a cmd to firmware to do the
    actual reset for the VF, it is possible that firmware has resetted
    the VF, but VF has not entered the reset process, which may cause
    IO not stopped problem when firmware is resetting VF.

    This patch fixes it by adjusting the VF reset process, when VF
    need to reset itself, it will enter the reset process first, and
    it will tell the PF to send cmd to firmware to reset itself.

    Add member reset_pending to struct hclgevf_dev, which indicates that
    there is reset event need to be processed by the VF's reset task, and
    the VF's reset task chooses the highest-level one and clears other
    low-level one when it processes reset_pending.

    hclge_inform_reset_assert_to_vf function is unused now, but it will
    be used to support the PF reset with VF working, so declare it in
    the header file.

    Signed-off-by: Huazhong Tan
    Signed-off-by: Yunsheng Lin
    Signed-off-by: David S. Miller

    Huazhong Tan
     
  • When doing reset, the reset handling function only need to
    reinitialize hardware, it makes sense to add a function to
    do that job. Also the error handling of hclgevf_init_hdev is
    different when it is used in reset process.

    This patch adds reset_hdev to reinitialize hardware when resetting.
    Also, this patch removes the hclgevf_dev_ongoing_full_reset because
    it is unused now.

    Signed-off-by: Huazhong Tan
    Signed-off-by: Yunsheng Lin
    Signed-off-by: David S. Miller

    Huazhong Tan
     
  • The locally maintained list for tracking hash mac table was
    not freed during driver remove.

    Signed-off-by: Arjun Vynipadath
    Signed-off-by: Ganesh Goudar
    Signed-off-by: David S. Miller

    Arjun Vynipadath
     
  • mac_hlist was initialized during adapter_up, which will be called
    every time a vf device is first brought up, or every time when device
    is brought up again after bringing all devices down. This means our
    state of previous list is lost, causing a memleak if entries are
    present in the list. To fix that, move list init to the condition
    that performs initial one time adapter setup.

    Signed-off-by: Arjun Vynipadath
    Signed-off-by: Ganesh Goudar
    Signed-off-by: David S. Miller

    Arjun Vynipadath
     
  • The locally maintained list for tracking hash mac table was
    not freed during driver remove.

    Signed-off-by: Arjun Vynipadath
    Signed-off-by: Ganesh Goudar
    Signed-off-by: David S. Miller

    Arjun Vynipadath
     
  • if skb is NULL pointer, and the following access of skb's
    skb_mstamp_ns will trigger panic, which is same as BUG_ON

    Signed-off-by: Li RongQing
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Li RongQing
     
  • RING_PUSH_REQUESTS_AND_CHECK_NOTIFY is already able to make sure backend sees
    requests before req_prod is updated.

    Signed-off-by: Jacob Wen
    Reviewed-by: Juergen Gross
    Reviewed-by: Wei Liu
    Signed-off-by: David S. Miller

    Jacob Wen
     

09 Nov, 2018

7 commits

  • Jakub Kicinski says:

    ====================
    nfp: abm: move code and improve parameter validation

    This set starts by separating Qdisc handling code into a new file.
    Next two patches allow early access to TLV-based capabilities during
    probe, previously the capabilities were parsed just before netdevs
    were registered, but its cleaner to do some basic validation earlier
    and avoid cleanup work.

    Next three patches improve RED's parameter validation. First we provide
    a more precise message about why offload failed (and move the parameter
    validation to a helper). Next we make sure we don't set the top bit
    in the 32 bit max RED threshold value. Because FW is treating the value
    as signed it reportedly causes slow downs (unnecessary queuing and
    marking) when top bit is set with recent firmwares. Last (and perhaps
    least importantly) we offload the harddrop parameter of the Qdisc.
    We don't plan to offload harddrop RED, but it seems prudent to make
    sure user didn't set that flag as device behaviour would have differed.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • RED Qdisc will now inform the drivers about the state of the harddrop
    flag. Refuse to offload in case harddrop is set.

    Signed-off-by: Jakub Kicinski
    Reviewed-by: John Hurley
    Reviewed-by: Quentin Monnet
    Signed-off-by: David S. Miller

    Jakub Kicinski
     
  • To mirror software behaviour on offload more precisely inform
    the drivers about the state of the harddrop flag.

    Signed-off-by: Jakub Kicinski
    Reviewed-by: John Hurley
    Reviewed-by: Quentin Monnet
    Signed-off-by: David S. Miller

    Jakub Kicinski
     
  • Turns out the threshold value is used in signed compares in the FW,
    so we should avoid setting the top bit.

    Signed-off-by: Jakub Kicinski
    Reviewed-by: John Hurley
    Reviewed-by: Quentin Monnet
    Signed-off-by: David S. Miller

    Jakub Kicinski
     
  • Improve log messages printed when RED can't be offloaded because
    of Qdisc parameters.

    Signed-off-by: Jakub Kicinski
    Reviewed-by: John Hurley
    Reviewed-by: Quentin Monnet
    Signed-off-by: David S. Miller

    Jakub Kicinski
     
  • In certain cases initialization logic which follows allocation of
    the vNIC structure may want to validate the capabilities of that vNIC.
    This is easy before vNIC is initialized for normal capabilities which
    are at fixed offsets in control memory, easy to locate and read, but
    poses a challenge if the capabilities are in form of TLVs. Parse
    the TLVs early on so other code can just access parsed info, instead
    of having to do the parsing by itself.

    Signed-off-by: Jakub Kicinski
    Reviewed-by: John Hurley
    Reviewed-by: Quentin Monnet
    Signed-off-by: David S. Miller

    Jakub Kicinski
     
  • Move setting ctrl_bar pointer to the nfp_net_alloc function,
    to make sure we can parse capabilities early in the following
    patch.

    Signed-off-by: Jakub Kicinski
    Reviewed-by: John Hurley
    Reviewed-by: Quentin Monnet
    Signed-off-by: David S. Miller

    Jakub Kicinski