1. 04 Apr, 2023 5 commits
    • Jakub Kicinski's avatar
      Merge branch 'sfc-support-unicast-ptp' · b3803399
      Jakub Kicinski authored
      Íñigo Huguet says:
      
      ====================
      sfc: support unicast PTP
      
      Unicast PTP was not working with sfc NICs.
      
      The reason was that these NICs don't timestamp all incoming packets,
      but instead they only timestamp packets of the queues that are selected
      for that. Currently, only one RX queue is configured for timestamp: the
      RX queue of the PTP channel. The packets that are put in the PTP RX
      queue are selected according to firmware filters configured from the
      driver.
      
      Multicast PTP was already working because the needed filters are known
      in advance, so they're inserted when PTP is enabled. This patches
      add the ability to dynamically add filters for unicast addresses,
      extracted from the TX PTP-event packets.
      
      Since we don't know in advance how many filters we'll need, some info
      about the filters need to be saved. This will allow to check if a filter
      already exists or if a filter is too old and should be removed.
      
      Note that the previous point is unnecessary for multicast filters, but
      I've opted to change how they're handled to match the new unicast's
      filters to avoid having duplicate insert/remove_filters functions,
      once for each type of filter.
      
      Tested: With ptp4l, all combinations of IPv4/IPv6, master/slave and
      unicast/multicast
      Reported-by: default avatarYalin Li <yalli@redhat.com>
      ====================
      
      Link: https://lore.kernel.org/r/20230331111404.17256-1-ihuguet@redhat.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b3803399
    • Íñigo Huguet's avatar
      sfc: remove expired unicast PTP filters · ad47655e
      Íñigo Huguet authored
      Filters inserted to support unicast PTP mode might become unused after
      some time, so we need to remove them to avoid accumulating many of them.
      
      Refresh the expiration time of a filter each time it's used. Then check
      periodically if any filter hasn't been used for a long time (30s) and
      remove it.
      Reported-by: default avatarYalin Li <yalli@redhat.com>
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Reviewed-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ad47655e
    • Íñigo Huguet's avatar
      sfc: support unicast PTP · 49ed35a0
      Íñigo Huguet authored
      When sending a PTP event packet, add the correct filters that will make
      that future incoming unicast PTP event packets will be timestamped.
      The unicast address for the filter is gotten from the outgoing skb
      before sending it.
      
      Until now they were not timestamped because only filters that match with
      the PTP multicast addressed were being configured into the NIC for the
      PTP special channel. Packets received through different channels are not
      timestamped, getting "received SYNC without timestamp" error in ptp4l.
      
      Note that the inserted filters are never removed unless the NIC is stopped
      or reconfigured, so efx_ptp_stop is called. Removal of old filters will
      be handled by the next patch.
      
      Additionally, cleanup a bit efx_ptp_xmit_skb_mc to use the reverse xmas
      tree convention and remove an unnecessary assignment to rc variable in
      void function.
      Reported-by: default avatarYalin Li <yalli@redhat.com>
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Reviewed-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      49ed35a0
    • Íñigo Huguet's avatar
      sfc: allow insertion of filters for unicast PTP · 75687cd0
      Íñigo Huguet authored
      Add a second list for unicast filters and generalize the
      efx_ptp_insert/remove_filters functions to allow acting in any of the 2
      lists.
      
      No filters for unicast are inserted yet. That will be done in the next
      patch.
      
      The reason to use 2 different lists instead of a single one is that, in
      next patches, we will want to check if unicast filters are already added
      and if they're expired. We don't need that for multicast filters.
      Reported-by: default avatarYalin Li <yalli@redhat.com>
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Reviewed-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      75687cd0
    • Íñigo Huguet's avatar
      sfc: store PTP filters in a list · e790fc15
      Íñigo Huguet authored
      Instead of using a fixed sized array for the PTP filters, use a list.
      
      This is not actually necessary at this point because the filters for
      multicast PTP are a fixed number, but this is a preparation for the
      following patches adding support for unicast PTP.
      
      To avoid confusion with the new struct type efx_ptp_rxfilter, change the
      name of some local variables from rxfilter to spec, given they're of the
      type efx_filter_spec.
      Reported-by: default avatarYalin Li <yalli@redhat.com>
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Reviewed-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e790fc15
  2. 03 Apr, 2023 31 commits
  3. 02 Apr, 2023 4 commits