Netdev List
 help / color / mirror / Atom feed
From: <sukhdeeps@marvell.com>
To: <netdev@vger.kernel.org>
Cc: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<linux-kernel@vger.kernel.org>, <horms@kernel.org>,
	<vadim.fedorenko@linux.dev>,
	Sukhdeep Singh <sukhdeeps@marvell.com>
Subject: [PATCH net-next v3 0/12] net: atlantic: add PTP support for AQC113 (Antigua)
Date: Wed, 20 May 2026 19:40:33 +0530	[thread overview]
Message-ID: <20260520141046.2151-1-sukhdeeps@marvell.com> (raw)

From: Sukhdeep Singh <sukhdeeps@marvell.com>

This series adds IEEE 1588 PTP support for the AQC113 (Antigua) network
controller. AQC113 is the successor to the existing AQC107 (Atlantic)
chip already supported by the atlantic driver.

AQC113 uses a substantially different hardware architecture for PTP
compared to AQC107:

  - Dual on-chip TSG clocks with direct register access instead of
    PHY-based timestamping via firmware
  - TX timestamps via descriptor writeback instead of firmware mailbox
  - Hardware L3/L4 RX filters for PTP multicast steering with both
    IPv4 and IPv6 support
  - Reference-counted shared filter slots managed through an Action
    Resolver Table (ART), allowing multiple rules to share L3/L4
    hardware filters when their match criteria are identical

The series is structured in four parts:

Patches 1-3 prepare the existing L3/L4 filter path:

  Patch 1 corrects flow_type masking and IPv6 address handling in
  aq_set_data_fl3l4(). Patch 2 moves the active_ipv4/ipv6 bitmap
  updates to after the hardware write succeeds. Patch 3 decouples
  the function from driver-internal structures so it can be called
  directly by the AQC113 PTP filter setup code.

Patches 4-5 add the AQC113 hardware infrastructure:

  Patch 4 adds the low-level register definitions and accessor
  functions. Patch 5 adds filter data structures and firmware
  capability query.

Patches 6-7 implement the AQC113 L2/L3/L4 RX filter management:

  Patch 6 fixes the AQC113 HW init path: ART section selection,
  L2 filter slot assignment, and MAC address programming. Patch 7
  implements the complete L3/L4 RX filter ops including reference-
  counted ART sharing and IPv4/IPv6 steering.

Patches 8-12 add the AQC113 PTP feature:

  Patch 8 reserves the dedicated PTP traffic class buffer and
  configures the TX path. Patch 9 extends the hw_ops interface
  with PTP-specific function pointers and updates AQC107 to the
  new signatures. Patches 10-12 implement the full PTP subsystem:
  Patch 10 adds the hw_atl2 register-level PTP clock ops, Patch 11
  adds TX timestamp polling and PTP TX traffic classification, and
  Patch 12 integrates PTP into aq_ptp and the driver core.

The existing AQC107 PTP implementation is not functionally changed
by this series; AQC113-specific code paths are gated on chip
detection throughout.

Tested on AQC113 at 1G, 2.5G, 5G, and 10G link speeds using
ptp4l/phc2sys with hardware timestamping in both L2 and L4
(IPv4/IPv6) modes.

Changes in v3:

Structural (suggested by Paolo Abeni):
- Split old patch 6 into two patches: patch 6 now covers the AQC113
  HW init fixes (ART section selection, L2 filter slot, MAC address),
  and patch 7 covers the L2/L3/L4 RX filter ops
- Split old patch 9 into three patches: patch 10 covers hw_atl2 PTP
  register ops, patch 11 covers TX timestamp polling and PTP TX
  classification, and patch 12 covers aq_ptp and driver core
  integration

Patch 2:
- Fix commit message: remove incorrect claim that bitmap updates are
  removed from aq_nic_reserve_filter() and aq_nic_release_filter();
  the updates are intentionally retained there to support the AQC113
  PTP path which programs filters directly without going through
  aq_add_del_fl3l4()

Patch 5:
- Clamp mac_regs_count loop bound with min_t(ARRAY_SIZE) to prevent
  out-of-bounds reads if firmware reports an inflated count
- Add base_index overflow check for l3_v6_filter_count (was missing,
  already present for l3_v4 and l4 categories)

Patches 6-7 (old patch 6):
- Drop unused hw_get_version op from hw_atl2_ops
- Clamp art_first_sec/art_last_sec to 16 before BIT() to avoid
  shift-past-width UB on section indices >= 32
- Fix hw_atl2_hw_init() to call hw_atl2_hw_mac_addr_set() instead
  of the A1 function hw_atl_b0_hw_mac_addr_set()
- Fix hw_atl2_hw_init_rx_path() to enable the l2_filters_base_index
  slot rather than a hardcoded slot 0
- Fix L3 filter family-switch undo path: remove cross-family pointer
  aliasing; add a guard that aborts reconfiguration when the address
  family changes and the old slot is still in use

Patch 8 (old patch 7):
- Remove unconditional accept_all_mc enable: per-multicast L2 filter
  handles PTP multicast steering; accept_all caused non-PTP multicast
  traffic to receive false timestamps
- Fix commit message: PCIe extended tag enablement is unconditional
  for AQC113 when firmware has enabled the feature, not gated on PTP

Patches 10-12 (old patch 9):
- Initialize clk_select = -1 in aq_pci_probe() instead of
  aq_nic_hw_prepare() so that the sentinel survives resume and
  hw_atl2_hw_reset() can distinguish uninitialised from active
- Add clk_sel < 0 guard in all TSG clock helpers (hw_atl2_tsg_clock_
  read/add/sub/increment_set) to prevent out-of-range MMIO access
  during the window between ptp_clock_register() and
  hw_atl2_enable_ptp() setting clk_select to 0 or 1
- Use WRITE_ONCE/READ_ONCE for clk_select accesses in
  hw_atl2_enable_ptp() and ring init to prevent compiler tearing
- Add READ_ONCE(txts->ctrl) + dma_rmb() before reading txts->ts in
  hw_ring_tx_ptp_get_ts to prevent speculative load reordering on
  weakly-ordered architectures
- Declare hw_atl2_txts_s::ts as __le64 and use le64_to_cpu() for
  correct big-endian portability
- Fix teardown order in aq_ptp_free(): cancel_delayed_work_sync()
  must precede hw_atl2_enable_ptp(..., 0) to prevent the work item
  from re-arming itself after cancellation
- Add ptp_filter_lock mutex in both aq_ptp_clock_init() and
  aq_ptp_hwtstamp_config_set() to serialise concurrent filter
  enable/disable from link state changes and ioctl
- Gate hw_filter_l2_set on AQ_HW_PTP_L2_ENABLE flag in
  aq_ptp_dpath_enable() to prevent a spurious zero-ethertype L2
  filter being installed when only L4 mode is active
- Fix error path in aq_ptp_ring_alloc() to use aq_ring_hwts_rx_free()
  instead of aq_ring_free() (wrong DMA size)
- Propagate PTP ring init return values from hw_atl2_hw_ring_rx_init()
  and hw_atl2_hw_ring_tx_init()
- Move skb_tx_timestamp() from aq_ndev_start_xmit() to aq_nic_xmit()
  after aq_nic_map_skb(), ensuring the SW timestamp is recorded after
  the DMA mapping is committed
- Remove AQ_HW_FLAG_STARTED flag: it has no reader in this series
- Remove stale references to aq_ptp_tx_ts_timedout/aq_ptp_tx_ts_clear
  (functions that do not exist); describe the actual timeout mechanism
  via ptp_ts_deadline in the commit message
- Document double-unmap prevention: buff->is_mapped and buff->pa are
  cleared before the ts==0 break, preventing a second DMA unmap on
  the next aq_ring_tx_clean() pass
- Update HW_ATL2_RXBUF_MAX comment: 172 is the AQC113 hardware
  maximum for data TCs (not a PTP-specific reduction)

Changes in v2:
- Patch 6: Remove redundant variable initializers for art_mask, h, l
  and err as suggested by Vadim Fedorenko

Sukhdeep Singh (12):
  net: atlantic: correct L3L4 filter flow_type masking and IPv6 handling
  net: atlantic: move active_ipv4/ipv6 bitmap updates after HW write
  net: atlantic: decouple aq_set_data_fl3l4() from driver internals
  net: atlantic: add AQC113 hardware register definitions and accessors
  net: atlantic: add AQC113 filter data structures and firmware query
  net: atlantic: fix AQC113 HW init: ART sections, L2 filter slot, MAC address
  net: atlantic: implement AQC113 L2/L3/L4 RX filter ops
  net: atlantic: add AQC113 PTP traffic class and TX path setup
  net: atlantic: extend hw_ops and TX descriptor for AQC113 PTP
  net: atlantic: add AQC113 PTP hardware ops in hw_atl2
  net: atlantic: add AQC113 TX timestamp polling and PTP TX classification
  net: atlantic: add AQC113 PTP support in aq_ptp and driver core

 .../net/ethernet/aquantia/atlantic/aq_filters.c    |  98 ++-
 .../net/ethernet/aquantia/atlantic/aq_filters.h    |   3 +
 drivers/net/ethernet/aquantia/atlantic/aq_hw.h     |  35 +-
 drivers/net/ethernet/aquantia/atlantic/aq_main.c   |  30 +-
 drivers/net/ethernet/aquantia/atlantic/aq_nic.c    |  53 +-
 .../net/ethernet/aquantia/atlantic/aq_pci_func.c   |   5 +-
 drivers/net/ethernet/aquantia/atlantic/aq_ptp.c    | 540 ++++++++++---
 drivers/net/ethernet/aquantia/atlantic/aq_ptp.h    |  15 +-
 drivers/net/ethernet/aquantia/atlantic/aq_ring.c   |  22 +-
 drivers/net/ethernet/aquantia/atlantic/aq_ring.h   |   5 +-
 .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c  |  15 +-
 .../ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c   | 834 ++++++++++++++++++++-
 .../ethernet/aquantia/atlantic/hw_atl2/hw_atl2.h   |  12 +
 .../aquantia/atlantic/hw_atl2/hw_atl2_internal.h   |  68 +-
 .../aquantia/atlantic/hw_atl2/hw_atl2_llh.c        | 359 +++++++++
 .../aquantia/atlantic/hw_atl2/hw_atl2_llh.h        | 107 ++-
 .../atlantic/hw_atl2/hw_atl2_llh_internal.h        | 204 ++++-
 .../aquantia/atlantic/hw_atl2/hw_atl2_utils.c      |  33 +
 .../aquantia/atlantic/hw_atl2/hw_atl2_utils.h      |  15 +
 .../aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c   |  52 ++
 20 files changed, 2287 insertions(+), 218 deletions(-)

-- 
2.43.0

             reply	other threads:[~2026-05-20 14:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-20 14:10 sukhdeeps [this message]
2026-05-20 14:10 ` [PATCH net-next v3 1/12] net: atlantic: correct L3L4 filter flow_type masking and IPv6 handling sukhdeeps
2026-05-20 14:10 ` [PATCH net-next v3 2/12] net: atlantic: move active_ipv4/ipv6 bitmap updates after HW write sukhdeeps
2026-05-20 14:10 ` [PATCH net-next v3 3/12] net: atlantic: decouple aq_set_data_fl3l4() from driver internals sukhdeeps
2026-05-20 14:10 ` [PATCH net-next v3 4/12] net: atlantic: add AQC113 hardware register definitions and accessors sukhdeeps
2026-05-20 14:10 ` [PATCH net-next v3 5/12] net: atlantic: add AQC113 filter data structures and firmware query sukhdeeps
2026-05-20 14:10 ` [PATCH net-next v3 6/12] net: atlantic: fix AQC113 HW init: ART sections, L2 filter slot, MAC address sukhdeeps
2026-05-20 14:10 ` [PATCH net-next v3 7/12] net: atlantic: implement AQC113 L2/L3/L4 RX filter ops sukhdeeps
2026-05-20 14:10 ` [PATCH net-next v3 8/12] net: atlantic: add AQC113 PTP traffic class and TX path setup sukhdeeps
2026-05-20 14:10 ` [PATCH net-next v3 9/12] net: atlantic: extend hw_ops and TX descriptor for AQC113 PTP sukhdeeps
2026-05-20 14:10 ` [PATCH net-next v3 10/12] net: atlantic: add AQC113 PTP hardware ops in hw_atl2 sukhdeeps
2026-05-20 14:10 ` [PATCH net-next v3 11/12] net: atlantic: add AQC113 TX timestamp polling and PTP TX classification sukhdeeps
2026-05-20 14:10 ` [PATCH net-next v3 12/12] net: atlantic: add AQC113 PTP support in aq_ptp and driver core sukhdeeps

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260520141046.2151-1-sukhdeeps@marvell.com \
    --to=sukhdeeps@marvell.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vadim.fedorenko@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox