diff mbox series

[net-next,01/10] bnxt_en: Add new TX timestamp completion definitions

Message ID 20240626164307.219568-2-michael.chan@broadcom.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series bnxt_en: PTP updates for net-next | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 842 this patch: 842
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang success Errors and warnings before: 849 this patch: 849
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 853 this patch: 853
netdev/checkpatch warning CHECK: Prefer using the BIT macro WARNING: 'retreive' may be misspelled - perhaps 'retrieve'? WARNING: line length of 81 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-06-27--03-00 (tests: 665)

Commit Message

Michael Chan June 26, 2024, 4:42 p.m. UTC
The new BCM5760X chips will generate this new TX timestamp completion
when a TX packet's timestamp has been taken right before transmission.
The driver logic to retreive the timestamp will be added in the next
few patches.

Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.h | 26 +++++++++++++++++++++++
 1 file changed, 26 insertions(+)

Comments

Przemek Kitszel June 27, 2024, 9 a.m. UTC | #1
On 6/26/24 18:42, Michael Chan wrote:
> The new BCM5760X chips will generate this new TX timestamp completion
> when a TX packet's timestamp has been taken right before transmission.

Tx

> The driver logic to retreive the timestamp will be added in the next

retrieve

> few patches.
> 
> Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
> Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
> Signed-off-by: Michael Chan <michael.chan@broadcom.com>
> ---
>   drivers/net/ethernet/broadcom/bnxt/bnxt.h | 26 +++++++++++++++++++++++
>   1 file changed, 26 insertions(+)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
> index 9cf0acfa04e5..d3ad73d4c00a 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
> @@ -181,6 +181,32 @@ struct tx_cmp {
>   #define TX_CMP_SQ_CONS_IDX(txcmp)					\
>   	(le32_to_cpu((txcmp)->sq_cons_idx) & TX_CMP_SQ_CONS_IDX_MASK)
>   
> +struct tx_ts_cmp {
> +	__le32 tx_ts_cmp_flags_type;
> +	#define TX_TS_CMP_FLAGS_ERROR				(1 << 6)

those should be BIT(6)

> +	#define TX_TS_CMP_FLAGS_TS_TYPE				(1 << 7)
> +	 #define TX_TS_CMP_FLAGS_TS_TYPE_PM			 (0 << 7)

weird way to spell 0

> +	 #define TX_TS_CMP_FLAGS_TS_TYPE_PA			 (1 << 7)
> +	#define TX_TS_CMP_FLAGS_TS_FALLBACK			(1 << 8)
> +	#define TX_TS_CMP_TS_SUB_NS				(0xf << 12)

GENMASK(),
please use through the series, same for BIT()

> +	#define TX_TS_CMP_TS_NS_MID				(0xffff << 16)
> +	#define TX_TS_CMP_TS_NS_MID_SFT				16
> +	u32 tx_ts_cmp_opaque;
> +	__le32 tx_ts_cmp_errors_v;
> +	#define TX_TS_CMP_V					(1 << 0)
> +	#define TX_TS_CMP_TS_INVALID_ERR			(1 << 10)
> +	__le32 tx_ts_cmp_ts_ns_lo;
> +};
> +
> +#define BNXT_GET_TX_TS_48B_NS(tscmp)					\
> +	(le32_to_cpu((tscmp)->tx_ts_cmp_ts_ns_lo) |			\
> +	 ((u64)(le32_to_cpu((tscmp)->tx_ts_cmp_flags_type) &		\
> +	  TX_TS_CMP_TS_NS_MID) << TX_TS_CMP_TS_NS_MID_SFT))
> +
> +#define BNXT_TX_TS_ERR(tscmp)						\
> +	(((tscmp)->tx_ts_cmp_flags_type & cpu_to_le32(TX_TS_CMP_FLAGS_ERROR)) &&\
> +	 ((tscmp)->tx_ts_cmp_errors_v & cpu_to_le32(TX_TS_CMP_TS_INVALID_ERR)))
> +
>   struct rx_cmp {
>   	__le32 rx_cmp_len_flags_type;
>   	#define RX_CMP_CMP_TYPE					(0x3f << 0)
Michael Chan June 27, 2024, 3:54 p.m. UTC | #2
On Thu, Jun 27, 2024 at 2:00 AM Przemek Kitszel
<przemyslaw.kitszel@intel.com> wrote:
>
> On 6/26/24 18:42, Michael Chan wrote:
> > The new BCM5760X chips will generate this new TX timestamp completion
> > when a TX packet's timestamp has been taken right before transmission.
>
> Tx
>
> > The driver logic to retreive the timestamp will be added in the next
>
> retrieve
>
> > few patches.
> >
> > Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
> > Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
> > Signed-off-by: Michael Chan <michael.chan@broadcom.com>
> > ---
> >   drivers/net/ethernet/broadcom/bnxt/bnxt.h | 26 +++++++++++++++++++++++
> >   1 file changed, 26 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
> > index 9cf0acfa04e5..d3ad73d4c00a 100644
> > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
> > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
> > @@ -181,6 +181,32 @@ struct tx_cmp {
> >   #define TX_CMP_SQ_CONS_IDX(txcmp)                                   \
> >       (le32_to_cpu((txcmp)->sq_cons_idx) & TX_CMP_SQ_CONS_IDX_MASK)
> >
> > +struct tx_ts_cmp {
> > +     __le32 tx_ts_cmp_flags_type;
> > +     #define TX_TS_CMP_FLAGS_ERROR                           (1 << 6)
>
> those should be BIT(6)
>
> > +     #define TX_TS_CMP_FLAGS_TS_TYPE                         (1 << 7)
> > +      #define TX_TS_CMP_FLAGS_TS_TYPE_PM                      (0 << 7)
>
> weird way to spell 0

These hardware interface structures are generated internally from
yaml.  All similar structures in this .h file have the same format.  I
think it will be better to convert them all together in the future to
keep everything consistent.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index 9cf0acfa04e5..d3ad73d4c00a 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -181,6 +181,32 @@  struct tx_cmp {
 #define TX_CMP_SQ_CONS_IDX(txcmp)					\
 	(le32_to_cpu((txcmp)->sq_cons_idx) & TX_CMP_SQ_CONS_IDX_MASK)
 
+struct tx_ts_cmp {
+	__le32 tx_ts_cmp_flags_type;
+	#define TX_TS_CMP_FLAGS_ERROR				(1 << 6)
+	#define TX_TS_CMP_FLAGS_TS_TYPE				(1 << 7)
+	 #define TX_TS_CMP_FLAGS_TS_TYPE_PM			 (0 << 7)
+	 #define TX_TS_CMP_FLAGS_TS_TYPE_PA			 (1 << 7)
+	#define TX_TS_CMP_FLAGS_TS_FALLBACK			(1 << 8)
+	#define TX_TS_CMP_TS_SUB_NS				(0xf << 12)
+	#define TX_TS_CMP_TS_NS_MID				(0xffff << 16)
+	#define TX_TS_CMP_TS_NS_MID_SFT				16
+	u32 tx_ts_cmp_opaque;
+	__le32 tx_ts_cmp_errors_v;
+	#define TX_TS_CMP_V					(1 << 0)
+	#define TX_TS_CMP_TS_INVALID_ERR			(1 << 10)
+	__le32 tx_ts_cmp_ts_ns_lo;
+};
+
+#define BNXT_GET_TX_TS_48B_NS(tscmp)					\
+	(le32_to_cpu((tscmp)->tx_ts_cmp_ts_ns_lo) |			\
+	 ((u64)(le32_to_cpu((tscmp)->tx_ts_cmp_flags_type) &		\
+	  TX_TS_CMP_TS_NS_MID) << TX_TS_CMP_TS_NS_MID_SFT))
+
+#define BNXT_TX_TS_ERR(tscmp)						\
+	(((tscmp)->tx_ts_cmp_flags_type & cpu_to_le32(TX_TS_CMP_FLAGS_ERROR)) &&\
+	 ((tscmp)->tx_ts_cmp_errors_v & cpu_to_le32(TX_TS_CMP_TS_INVALID_ERR)))
+
 struct rx_cmp {
 	__le32 rx_cmp_len_flags_type;
 	#define RX_CMP_CMP_TYPE					(0x3f << 0)