12 Nov, 2018

9 commits

  • Use new macros for PHYID matching to avoid boilerplate code.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: David S. Miller

    Heiner Kallweit
     
  • Add macros for PHYID matching to be used in PHY driver configs.
    By using these macros some boilerplate code can be avoided.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: David S. Miller

    Heiner Kallweit
     
  • Heiner Kallweit says:

    ====================
    net: phy: further phylib simplifications after recent changes to the state machine

    After the recent changes to the state machine phylib can be further
    simplified (w/o having to make any assumptions).
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Now that phy_mac_interrupt() doesn't call phy_change() any longer it's
    called from phy_interrupt() only. Therefore phy_interrupt_is_valid()
    returns true always and the check can be removed.
    In case of PHY_HALTED phy_interrupt() bails out immediately,
    therefore the second check for PHY_HALTED including the call to
    phy_disable_interrupts() can be removed.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: David S. Miller

    Heiner Kallweit
     
  • When using phy_mac_interrupt() the irq number is set to
    PHY_IGNORE_INTERRUPT, therefore phy_interrupt_is_valid() returns false.
    As a result phy_change() effectively just calls phy_trigger_machine()
    when called from phy_mac_interrupt() via phy_change_work(). So we can
    call phy_trigger_machine() from phy_mac_interrupt() directly and
    remove some now unneeded code.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: David S. Miller

    Heiner Kallweit
     
  • State PHY_CHANGELINK isn't needed here, we can call the state machine
    directly. We just have to remove the check for phy_polling_mode() to
    make this work also in interrupt mode. Removing this check doesn't
    cause any overhead because when not polling the state machine is
    called only if required by some event.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: David S. Miller

    Heiner Kallweit
     
  • Heiner Kallweit says:

    ====================
    net: phy: replace PHY_HAS_INTERRUPT with a check for config_intr and ack_interrupt

    Flag PHY_HAS_INTERRUPT is used only here for this small check. I think
    using interrupts isn't possible if a driver defines neither
    config_intr nor ack_interrupts callback. So we can replace checking
    flag PHY_HAS_INTERRUPT with checking for these callbacks.
    This allows to remove this flag from all driver configs.

    v2:
    - add helper for check in patch 1
    - remove PHY_HAS_INTERRUPT from all drivers, not only Realtek
    - remove flag PHY_HAS_INTERRUPT completely

    v3:
    - rebase patch 2
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Now that flag PHY_HAS_INTERRUPT has been replaced with a check for
    callbacks config_intr and ack_interrupt, we can remove setting this
    flag from all driver configs.
    Last but not least remove flag PHY_HAS_INTERRUPT completely.

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

    Heiner Kallweit
     
  • Flag PHY_HAS_INTERRUPT is used only here for this small check. I think
    using interrupts isn't possible if a driver defines neither
    config_intr nor ack_interrupts callback. So we can replace checking
    flag PHY_HAS_INTERRUPT with checking for these callbacks.

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

    Heiner Kallweit
     

11 Nov, 2018

5 commits

  • Same change as made to sctp_intl_store_reasm().

    To be fully correct, an iterator has an undefined value when something
    like skb_queue_walk() naturally terminates.

    This will actually matter when SKB queues are converted over to
    list_head.

    Formalize what this code ends up doing with the current
    implementation.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • To be fully correct, an iterator has an undefined value when something
    like skb_queue_walk() naturally terminates.

    This will actually matter when SKB queues are converted over to
    list_head.

    Formalize what this code ends up doing with the current
    implementation.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Eliminate the assumption that SKBs and SKB list heads can
    be cast to eachother in SKB list handling code.

    This change also appears to fix a bug since the list->next pointer is
    sampled outside of holding the SKB queue lock.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Instead of direct SKB list pointer accesses.

    The loops in this function had to be rewritten to accommodate this
    more easily.

    The first loop iterates now over the target list in the outer loop,
    and triggers an mmc data operation when the per-operation limits are
    hit.

    Then after the loops, if we have any residue, we trigger the last
    and final operation.

    For the page aligned workaround, where we have to copy the read data
    back into the original list of SKBs, we use a two-tiered loop. The
    outer loop stays the same and iterates over pktlist, and then we have
    an inner loop which uses skb_peek_next(). The break logic has been
    simplified because we know that the aggregate length of the SKBs in
    the source and destination lists are the same.

    This change also ends up fixing a bug, having to do with the
    maintainance of the seg_sz variable and how it drove the outermost
    loop. It begins as:

    seg_sz = target_list->qlen;

    ie. the number of packets in the target_list queue. The loop
    structure was then:

    while (seq_sz) {
    ...
    while (not at end of target_list) {
    ...
    sg_cnt++
    ...
    }
    ...
    seg_sz -= sg_cnt;

    The assumption built into that last statement is that sg_cnt counts
    how many packets from target_list have been fully processed by the
    inner loop. But this not true.

    If we hit one of the limits, such as the max segment size or the max
    request size, we will break and copy a partial packet then contine
    back up to the top of the outermost loop.

    With the new loops we don't have this problem as we don't guard the
    loop exit with a packet count, but instead use the progression of the
    pkt_next SKB through the list to the end. The general structure is:

    sg_cnt = 0;
    skb_queue_walk(target_list, pkt_next) {
    pkt_offset = 0;
    ...
    sg_cnt++;
    ...
    while (pkt_offset < pkt_next->len) {
    pkt_offset += sg_data_size;
    if (queued up max per request)
    mmc_submit_one();
    }
    }
    if (sg_cnt)
    mmc_submit_one();

    The variables that maintain where we are in the MMC command state such
    as req_sz, sg_cnt, and sgl are reset when we emit one of these full
    sized requests.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • It turns out I missed one VLAN_TAG_PRESENT in OVS code while rebasing.
    This fixes it.

    Fixes: 9df46aefafa6 ("OVS: remove use of VLAN_TAG_PRESENT")
    Signed-off-by: Michał Mirosław
    Signed-off-by: David S. Miller

    Michał Mirosław
     

10 Nov, 2018

26 commits

  • The following:

    skb = skb->next;
    ...
    if (skb == (struct sk_buff *)queue)

    is transformed into:

    skb = skb_peek_next(skb, queue);
    ...
    if (!skb)

    Signed-off-by: David S. Miller

    David S. Miller
     
  • 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