Re: [net-next PATCH v5 5/6] octeontx2-pf: Prepare for AF_XDP
From: Simon Horman
Date: Mon Feb 10 2025 - 12:58:19 EST
On Thu, Feb 06, 2025 at 02:20:33PM +0530, Suman Ghosh wrote:
> Implement necessary APIs required for AF_XDP transmit.
>
> Signed-off-by: Hariprasad Kelam <hkelam@xxxxxxxxxxx>
> Signed-off-by: Suman Ghosh <sumang@xxxxxxxxxxx>
...
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
> index 44137160bdf6..b012d8794f18 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
> @@ -22,6 +22,12 @@
> #include "cn10k.h"
>
> #define CQE_ADDR(CQ, idx) ((CQ)->cqe_base + ((CQ)->cqe_size * (idx)))
> +#define READ_FREE_SQE(SQ, free_sqe) \
> + do { \
> + typeof(SQ) _SQ = (SQ); \
> + free_sqe = (((_SQ)->cons_head - (_SQ)->head - 1 + (_SQ)->sqe_cnt) \
> + & ((_SQ)->sqe_cnt - 1)); \
> + } while (0)
It looks like READ_FREE_SQE() could be a function rather than a macro.
And, as an aside, CQE_ADDR could be too.
> #define PTP_PORT 0x13F
> /* PTPv2 header Original Timestamp starts at byte offset 34 and
> * contains 6 byte seconds field and 4 byte nano seconds field.
...