1. 25 May, 2019 7 commits
    • David S. Miller's avatar
      Merge branch 'net-mvpp2-Classifier-updates-RSS' · cecd7582
      David S. Miller authored
      Maxime Chevallier says:
      
      ====================
      net: mvpp2: Classifier updates, RSS
      
      Here is a set of updates for the PPv2 classifier, the main feature being
      the support for steering to RSS contexts, to leverage all the available
      RSS tables in the controller.
      
      The first two patches are non-critical fixes for the classifier, the
      first one prevents us from allocating too much room to store the
      classification rules, the second one configuring the C2 engine as
      suggested by the PPv2 functionnal specs.
      
      Patches 3 to 5 introduce support for RSS contexts in mvpp2, allowing us
      to steer traffic to dedicated RSS tables.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cecd7582
    • Maxime Chevallier's avatar
      net: mvpp2: cls: Support steering to RSS contexts · 14134773
      Maxime Chevallier authored
      When steering to an RXQ, we can perform an extra RSS step to assign a
      queue from an RSS table.
      
      This is done by setting the RSS_EN attribute in the C2 engine. In that
      case, the RXQ that is assigned is the global RSS context id, that is
      then translated to an RSS table using the RXQ2RSS table.
      
      An example using ethtool to steer to RXQ 2 and 3 would be :
      
      ethtool -X eth0 weight 0 0 1 1 context new
      
      (This would print the allocated context id, let's say it's 1)
      
      ethtool -N eth0 flow-type udp4 dst-port 1234 context 1 loc 0
      
      The hash parameters are the ones that are globally configured for RSS :
      
      ethtool -N eth0 rx-flow-hash udp4 sdfn
      
      When an RSS context is removed while there are active classification
      rules using this context, these rules are removed.
      Signed-off-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      14134773
    • Maxime Chevallier's avatar
      net: mvpp2: cls: Extract the RSS context when parsing the ethtool rule · c561da68
      Maxime Chevallier authored
      ethtool_rx_flow_rule_create takes into parameter the ethtool flow spec,
      which doesn't contain the rss context id. We therefore need to extract
      it ourself before parsing the ethtool rule.
      
      The FLOW_RSS flag is only set in info->fs.flow_type, and not
      info->flow_type.
      Signed-off-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c561da68
    • Maxime Chevallier's avatar
      net: mvpp2: cls: Use RSS contexts to handle RSS tables · 895586d5
      Maxime Chevallier authored
      The PPv2 controller has 8 RSS tables that are shared across all ports on
      a given PPv2 instance. The previous implementation allocated one table
      per port, leaving others unused.
      
      By using RSS contexts, we can make use of multiple RSS tables per
      port, one being the default table (always id 0), the other ones being
      used as destinations for flow steering, in the same way as rx rings.
      
      This commit introduces RSS contexts management in the PPv2 driver. We
      always reserve one table per port, allocated when the port is probed.
      
      The global table list is stored in the struct mvpp2, as it's a global
      resource. Each port then maintains a list of indices in that global
      table, that way each port can have it's own numbering scheme starting
      from 0.
      
      One limitation that seems unavoidable is that the hashing parameters are
      shared across all RSS contexts for a given port. Hashing parameters for
      ctx 0 will be applied to all contexts.
      Signed-off-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      895586d5
    • Maxime Chevallier's avatar
      net: mvpp2: cls: Bypass C2 internals FIFOs at init · e8486ca9
      Maxime Chevallier authored
      The C2 TCAM has internal FIFOs that are only useful for the built-in
      self-tests. Disable these FIFOS at init, as recommended in the
      functionnal specs.
      Suggested-by: default avatarAlan Winkowski <walan@marvell.com>
      Signed-off-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e8486ca9
    • Maxime Chevallier's avatar
      net: mvpp2: cls: Use the correct number of rules in various places · ae8e1d5e
      Maxime Chevallier authored
      As of today, the classification offload implementation only supports 4
      different rules to be offloaded. This number has been hardcoded in the
      rule insertion function, and the wrong define is being used elsewhere.
      
      Use the correct #define everywhere to make sure we always check for the
      correct number of rules.
      Signed-off-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ae8e1d5e
    • Gustavo A. R. Silva's avatar
      flow_offload: use struct_size() in kzalloc() · 6dca9360
      Gustavo A. R. Silva authored
      One of the more common cases of allocation size calculations is finding
      the size of a structure that has a zero-sized array at the end, along
      with memory for some number of elements for that array. For example:
      
      struct foo {
         int stuff;
         struct boo entry[];
      };
      
      instance = kzalloc(sizeof(struct foo) + count * sizeof(struct boo), GFP_KERNEL);
      
      Instead of leaving these open-coded and prone to type mistakes, we can
      now use the new struct_size() helper:
      
      instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL);
      
      This code was detected with the help of Coccinelle.
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6dca9360
  2. 24 May, 2019 33 commits
    • David S. Miller's avatar
      Merge branch 'net-stmmac-Improvements-and-Selftests' · 22942498
      David S. Miller authored
      Jose Abreu says:
      
      ====================
      net: stmmac: Improvements and Selftests
      
      [ Thanks to the introducion of selftests this series ended up being a misc
      of improvements and the selftests additions per-se. ]
      
      This introduces selftests support in stmmac driver. We add 9 basic sanity
      checks and MAC loopback support for all cores within the driver. This way
      more tests can easily be added in the future and can be run in virtually
      any MAC/GMAC/QoS/XGMAC platform.
      
      Having this we can find regressions and missing features in the driver
      while at the same time we can check if the IP is correctly working.
      
      We have been using this for some time now and I do have more tests to
      submit in the feature. My experience is that although writing the tests
      adds more development time, the gain results are obvious.
      
      I let this feature optional within the driver under a Kconfig option.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      22942498
    • Jose Abreu's avatar
      net: stmmac: Prevent missing interrupts when running NAPI · a976ca79
      Jose Abreu authored
      When we trigger NAPI we are disabling interrupts but in case we receive
      or send a packet in the meantime, as interrupts are disabled, we will
      miss this event.
      
      Trigger both NAPI instances (RX and TX) when at least one event happens
      so that we don't miss any interrupts.
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a976ca79
    • Jose Abreu's avatar
      net: stmmac: dwmac4/5: Clear unused address entries · 0620ec6c
      Jose Abreu authored
      In case we don't use a given address entry we need to clear it because
      it could contain previous values that are no longer valid.
      
      Found out while running stmmac selftests.
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0620ec6c
    • Jose Abreu's avatar
      net: stmmac: dwxgmac2: Do not disable whole RX in dma_stop_rx() · eaabcd9e
      Jose Abreu authored
      We don't need to disable the whole RX when dma_stop_rx() is called
      because there may be the need of just disabling 1 DMA channel.
      
      This is also needed for stmmac Flow Control selftest.
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      eaabcd9e
    • Jose Abreu's avatar
      net: stmmac: dwmac4/5: Do not disable whole RX in dma_stop_rx() · a8b91b30
      Jose Abreu authored
      We don't need to disable the whole RX when dma_stop_rx() is called
      because there may be the need of just disabling 1 DMA channel.
      
      This is also needed for stmmac Flow Control selftest.
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a8b91b30
    • Jose Abreu's avatar
      net: stmmac: dwmac4/5: Fix Hash Filter · f9c5f7d7
      Jose Abreu authored
      In order for hash filter to work we need to set the HPF bit.
      
      Fout out while running stmmac selftests
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f9c5f7d7
    • Jose Abreu's avatar
      net: stmmac: dwmac1000: Clear unused address entries · 9463c445
      Jose Abreu authored
      In case we don't use a given address entry we need to clear it because
      it could contain previous values that are no longer valid.
      
      Found out while running stmmac selftests.
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9463c445
    • Jose Abreu's avatar
      net: stmmac: dwmac1000: Fix Hash Filter · 09261426
      Jose Abreu authored
      In order for hash filter to work we need to set the HPF bit.
      
      Found out while running stmmac selftests.
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      09261426
    • Jose Abreu's avatar
      net: stmmac: Introduce selftests support · 091810db
      Jose Abreu authored
      We add support for selftests on stmmac driver with 9 basic sanity checks
      for now:
      	- MAC Loopback
      	- PHY Loopback
      	- MMC Counters
      	- EEE
      	- Hash Filter Multicast
      	- Perfect Filter Unicast
      	- Multicast Filter All
      	- Unicast Filter All
      	- Flow Control
      
      This allows for fast tracking of regressions in the driver and helps in
      spotting mis-configuration of HW.
      
      Changes from v1:
      	- Fix build error as module (David)
      	- Check for link status before running tests
      Changes from RFC v2:
      	- Return proper error code in stmmac_test_mmc (Corentin)
      	- Use only 1 MMC counter in stmmac_test_mmc (Alexandre)
      Changes from RFC v1:
      	- Change test_loopback to test_mac_loopback (Andrew)
      	- Change timeout to retries (Andrew)
      	- Add MC/UC filter tests (Andrew)
      	- Only test in offline mode (Andrew)
      	- Do not call phy_loopback twice (Alexandre)
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Cc: Corentin Labbe <clabbe.montjoie@gmail.com>
      Cc: Andrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      091810db
    • Jose Abreu's avatar
      net: stmmac: dwxgmac2: Also pass control frames while in promisc mode · 8c5f48d9
      Jose Abreu authored
      In order for the selftests to run the Flow Control selftest we need to
      also pass pause frames to the stack.
      
      Pass this type of frames while in promiscuous mode.
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8c5f48d9
    • Jose Abreu's avatar
      net: stmmac: dwmac4/5: Also pass control frames while in promisc mode · 2b783e61
      Jose Abreu authored
      In order for the selftests to run the Flow Control selftest we need to
      also pass pause frames to the stack.
      
      Pass this type of frames while in promiscuous mode.
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2b783e61
    • Jose Abreu's avatar
      net: stmmac: dwmac1000: Also pass control frames while in promisc mode · 52ef6d92
      Jose Abreu authored
      In order for the selftests to run the Flow Control selftest we need to
      also pass pause frames to the stack.
      
      Pass this type of frames while in promiscuous mode.
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      52ef6d92
    • Jose Abreu's avatar
      net: stmmac: Switch MMC functions to HWIF callbacks · 3b1dd2c5
      Jose Abreu authored
      XGMAC has a different MMC module. Lets use HWIF callbacks for MMC module
      so that correct callbacks are automatically selected.
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3b1dd2c5
    • Corentin Labbe's avatar
      net: ethernet: stmmac: dwmac-sun8i: Enable control of loopback · 8edb1271
      Corentin Labbe authored
      This patch enable use of set_mac_loopback in dwmac-sun8i
      Signed-off-by: default avatarCorentin Labbe <clabbe@baylibre.com>
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8edb1271
    • Jose Abreu's avatar
      net: stmmac: dwxgmac2: Add MAC loopback support · 84c8df16
      Jose Abreu authored
      In preparation for the addition of stmmac selftests we implement the MAC
      loopback callback in dwxgmac2 core.
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      84c8df16
    • Jose Abreu's avatar
      net: stmmac: dwmac4/5: Add MAC loopback support · 4ce84f4d
      Jose Abreu authored
      In preparation for the addition of stmmac selftests we implement the MAC
      loopback callback in dwmac4/5 cores.
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4ce84f4d
    • Jose Abreu's avatar
      net: stmmac: dwmac1000: Add MAC loopback support · cbc19515
      Jose Abreu authored
      In preparation for the addition of stmmac selftests we implement the MAC
      loopback callback in dwmac1000 core.
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cbc19515
    • Jose Abreu's avatar
      net: stmmac: dwmac100: Add MAC loopback support · 0a05a7a3
      Jose Abreu authored
      In preparation for the addition of stmmac selftests we implement the MAC
      loopback callback in dwmac100 core.
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0a05a7a3
    • Jose Abreu's avatar
      net: stmmac: Add MAC loopback callback to HWIF · 48435bc3
      Jose Abreu authored
      In preparation for the addition of selftests support for stmmac we add a
      new callback to HWIF that can be used to set the controller in loopback
      mode.
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Cc: Corentin Labbe <clabbe.montjoie@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      48435bc3
    • David S. Miller's avatar
      Merge branch 'net-phy-add-interface-mode-PHY_INTERFACE_MODE_USXGMII' · 33a74bf4
      David S. Miller authored
      Heiner Kallweit says:
      
      ====================
      net: phy: add interface mode PHY_INTERFACE_MODE_USXGMII
      
      Add support for interface mode USXGMII.
      
      On Freescale boards LS1043A and LS1046A a warning may pop up now
      because mode xgmii should be changed to usxgmii (as the used
      Aquantia PHY doesn't support XGMII).
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      33a74bf4
    • Heiner Kallweit's avatar
      net: phy: aquantia: add USXGMII support and warn if XGMII mode is set · ce64c1f7
      Heiner Kallweit authored
      So far we didn't support mode USXGMII, and in order to not break few
      boards mode XGMII was accepted for the AQR107 family even though it
      doesn't support XGMII. Add USXGMII support to the Aquantia PHY driver
      and warn if XGMII mode is set.
      
      v2:
      - add warning if XGMII mode is set
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ce64c1f7
    • Heiner Kallweit's avatar
      dt-bindings: net: document new usxgmii phy mode · 79b647a0
      Heiner Kallweit authored
      Add new interface mode USXGMII to binding documentation.
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      79b647a0
    • Heiner Kallweit's avatar
      net: phy: add interface mode PHY_INTERFACE_MODE_USXGMII · 4618d671
      Heiner Kallweit authored
      Add support for interface mode PHY_INTERFACE_MODE_USXGMII.
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4618d671
    • Willem de Bruijn's avatar
      selftests/net: SO_TXTIME with ETF and FQ · af5136f9
      Willem de Bruijn authored
      The SO_TXTIME API enables packet tranmission with delayed delivery.
      This is currently supported by the ETF and FQ packet schedulers.
      
      Evaluate the interface with both schedulers. Install the scheduler
      and send a variety of packets streams: without delay, with one
      delayed packet, with multiple ordered delays and with reordering.
      Verify that packets are released by the scheduler in expected order.
      
      The ETF qdisc requires a timestamp in the future on every packet. It
      needs a delay on the qdisc else the packet is dropped on dequeue for
      having a delivery time in the past. The test value is experimentally
      derived. ETF requires clock_id CLOCK_TAI. It checks this base and
      drops for non-conformance.
      
      The FQ qdisc expects clock_id CLOCK_MONOTONIC, the base used by TCP
      as of commit fb420d5d ("tcp/fq: move back to CLOCK_MONOTONIC").
      Within a flow there is an expecation of ordered delivery, as shown by
      delivery times of test 4. The FQ qdisc does not require all packets to
      have timestamps and does not drop for non-conformance.
      
      The large (msec) delays are chosen to avoid flakiness.
      
      	Output:
      
      	SO_TXTIME ipv6 clock monotonic
      	payload:a delay:28 expected:0 (us)
      
      	SO_TXTIME ipv4 clock monotonic
      	payload:a delay:38 expected:0 (us)
      
      	SO_TXTIME ipv6 clock monotonic
      	payload:a delay:40 expected:0 (us)
      
      	SO_TXTIME ipv4 clock monotonic
      	payload:a delay:33 expected:0 (us)
      
      	SO_TXTIME ipv6 clock monotonic
      	payload:a delay:10120 expected:10000 (us)
      
      	SO_TXTIME ipv4 clock monotonic
      	payload:a delay:10102 expected:10000 (us)
      
      	[.. etc ..]
      
      	OK. All tests passed
      
      Changes v1->v2: update commit message output
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Acked-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarVinicius Costa Gomes <vinicius.gomes@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      af5136f9
    • David S. Miller's avatar
      Merge branch 'ipv6-Move-exceptions-to-fib6_nh-and-make-it-optional-in-a-fib6_info' · a80886e4
      David S. Miller authored
      David Ahern says:
      
      ====================
      ipv6: Move exceptions to fib6_nh and make it optional in a fib6_info
      
      Patches 1 and 4 move pcpu and exception caches from fib6_info to fib6_nh.
      With respect to the current FIB entries this is only a movement from one
      struct to another contained within the first.
      
      Patch 2 refactors the core logic of fib6_drop_pcpu_from into a helper
      that is invoked per fib6_nh.
      
      Patch 3 refactors exception handling in a similar way - creating a bunch
      of helpers that can be invoked per fib6_nh with the goal of making patch
      4 easier to review as well as creating the code needed for nexthop
      objects.
      
      Patch 5 makes a fib6_nh at the end of a fib6_info an array similar to
      IPv4 and its fib_info. For the current fib entry model, all fib6_info
      will have a fib6_nh allocated for it.
      
      Patch 6 refactors ip6_route_del moving the code for deleting an
      exception entry into a new function.
      
      Patch 7 adds tests for redirect route exceptions. The new test was
      written against 5.1 (before any of the nexthop refactoring). It and the
      pmtu.sh selftest exercise the exception code paths - from creating
      exceptions to cleaning them up on device delete. All tests pass without
      any rcu locking or memleak warnings.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a80886e4
    • David Ahern's avatar
      selftests: Add redirect tests · ec810535
      David Ahern authored
      Add test for ICMP redirects and exception processing. Test is setup
      for later addition of tests using nexthop objects for routing.
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ec810535
    • David Ahern's avatar
      ipv6: Refactor ip6_route_del for cached routes · 0fa6efc5
      David Ahern authored
      Move the removal of cached routes to a helper, ip6_del_cached_rt, that
      can be invoked per nexthop. Rename the existig ip6_del_cached_rt to
      __ip6_del_cached_rt since it is called by ip6_del_cached_rt.
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0fa6efc5
    • David Ahern's avatar
      ipv6: Make fib6_nh optional at the end of fib6_info · 1cf844c7
      David Ahern authored
      Move fib6_nh to the end of fib6_info and make it an array of
      size 0. Pass a flag to fib6_info_alloc indicating if the
      allocation needs to add space for a fib6_nh.
      
      The current code path always has a fib6_nh allocated with a
      fib6_info; with nexthop objects they will be separate.
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1cf844c7
    • David Ahern's avatar
      ipv6: Move exception bucket to fib6_nh · cc5c073a
      David Ahern authored
      Similar to the pcpu routes exceptions are really per nexthop, so move
      rt6i_exception_bucket from fib6_info to fib6_nh.
      
      To avoid additional increases to the size of fib6_nh for a 1-bit flag,
      use the lowest bit in the allocated memory pointer for the flushed flag.
      Add helpers for retrieving the bucket pointer to mask off the flag.
      
      The cleanup of the exception bucket is moved to fib6_nh_release.
      
      fib6_nh_flush_exceptions can now be called from 2 contexts:
      1. deleting a fib entry
      2. deleting a fib6_nh
      
      For 1., fib6_nh_flush_exceptions is called for a specific fib6_info that
      is getting deleted. All exceptions in the cache using the entry are
      deleted. For 2, the fib6_nh itself is getting destroyed so
      fib6_nh_flush_exceptions is called for a NULL fib6_info which means
      flush all entries.
      
      The pmtu.sh selftest exercises the affected code paths - from creating
      exceptions to cleaning them up on device delete. All tests pass without
      any rcu locking or memleak warnings.
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cc5c073a
    • David Ahern's avatar
      ipv6: Refactor exception functions · c0b220cf
      David Ahern authored
      Before moving exception bucket from fib6_info to fib6_nh, refactor
      rt6_flush_exceptions, rt6_remove_exception_rt, rt6_mtu_change_route,
      and rt6_update_exception_stamp_rt. In all 3 cases, move the primary
      logic into a new helper that starts with fib6_nh_. The latter 3
      functions still take a fib6_info; this will be changed to fib6_nh
      in the next patch.
      
      In the case of rt6_mtu_change_route, move the fib6_metric_locked
      out as a standalone check - no need to call the new function if
      the fib entry has the mtu locked. Also, add fib6_info to
      rt6_mtu_change_arg as a way of passing the fib entry to the new
      helper.
      
      No functional change intended. The goal here is to make the next
      patch easier to review by moving existing lookup logic for each to
      new helpers.
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c0b220cf
    • David Ahern's avatar
      ipv6: Refactor fib6_drop_pcpu_from · 7d88d8b5
      David Ahern authored
      Move the existing pcpu walk in fib6_drop_pcpu_from to a new
      helper, __fib6_drop_pcpu_from, that can be invoked per fib6_nh with a
      reference to the from entries that need to be evicted. If the passed
      in 'from' is non-NULL then only entries associated with that fib6_info
      are removed (e.g., case where fib entry is deleted); if the 'from' is
      NULL are entries are flushed (e.g., fib6_nh is deleted).
      
      For fib6_info entries with builtin fib6_nh (ie., current code) there
      is no change in behavior.
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7d88d8b5
    • David Ahern's avatar
      ipv6: Move pcpu cached routes to fib6_nh · f40b6ae2
      David Ahern authored
      rt6_info are specific instances of a fib entry and are tied to a
      device and gateway - ie., a nexthop. Before nexthop objects, IPv6 fib
      entries have separate fib6_info for each nexthop in a multipath route,
      so the location of the pcpu cache in the fib6_info struct worked.
      However, with nexthop objects a fib6_info can point to a set of nexthops
      (yet another alignment of ipv6 with ipv4). Accordingly, the pcpu
      cache needs to be moved to the fib6_nh struct so the cached entries
      are local to the nexthop specification used to create the rt6_info.
      
      Initialization and free of the pcpu entries moved to fib6_nh_init and
      fib6_nh_release.
      
      Change in location only, from fib6_info down to fib6_nh; no other
      functional change intended.
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f40b6ae2
    • David S. Miller's avatar
      Merge branch 'ENETC-support-hardware-timestamping' · daeceb2d
      David S. Miller authored
      Y.b. Lu says:
      
      ====================
      ENETC: support hardware timestamping
      
      This patch-set is to support hardware timestamping for ENETC
      and also to add ENETC 1588 timer device tree node for ls1028a.
      
      Because the ENETC RX BD ring dynamic allocation has not been
      supported and it is too expensive to use extended RX BDs
      if timestamping is not used, a Kconfig option is used to
      enable extended RX BDs in order to support hardware
      timestamping. This option will be removed once RX BD
      ring dynamic allocation is implemented.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      daeceb2d