Skip to content

Commit 8496272

Browse files
horiagherbertx
authored andcommitted
soc/qman: export non-programmable FQD fields query
Export qman_query_fq_np() function and related structures. This will be needed in the caam/qi driver, where "queue empty" condition will be decided based on the frm_cnt. Signed-off-by: Horia Geantă <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 329d090 commit 8496272

File tree

3 files changed

+70
-63
lines changed

3 files changed

+70
-63
lines changed

drivers/soc/fsl/qbman/qman.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,8 +2019,7 @@ int qman_query_fq(struct qman_fq *fq, struct qm_fqd *fqd)
20192019
return ret;
20202020
}
20212021

2022-
static int qman_query_fq_np(struct qman_fq *fq,
2023-
struct qm_mcr_queryfq_np *np)
2022+
int qman_query_fq_np(struct qman_fq *fq, struct qm_mcr_queryfq_np *np)
20242023
{
20252024
union qm_mc_command *mcc;
20262025
union qm_mc_result *mcr;
@@ -2046,6 +2045,7 @@ static int qman_query_fq_np(struct qman_fq *fq,
20462045
put_affine_portal();
20472046
return ret;
20482047
}
2048+
EXPORT_SYMBOL(qman_query_fq_np);
20492049

20502050
static int qman_query_cgr(struct qman_cgr *cgr,
20512051
struct qm_mcr_querycgr *cgrd)

drivers/soc/fsl/qbman/qman_priv.h

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -89,67 +89,6 @@ static inline u64 qm_mcr_querycgr_a_get64(const struct qm_mcr_querycgr *q)
8989
return ((u64)q->a_bcnt_hi << 32) | be32_to_cpu(q->a_bcnt_lo);
9090
}
9191

92-
/* "Query FQ Non-Programmable Fields" */
93-
94-
struct qm_mcr_queryfq_np {
95-
u8 verb;
96-
u8 result;
97-
u8 __reserved1;
98-
u8 state; /* QM_MCR_NP_STATE_*** */
99-
u32 fqd_link; /* 24-bit, _res2[24-31] */
100-
u16 odp_seq; /* 14-bit, _res3[14-15] */
101-
u16 orp_nesn; /* 14-bit, _res4[14-15] */
102-
u16 orp_ea_hseq; /* 15-bit, _res5[15] */
103-
u16 orp_ea_tseq; /* 15-bit, _res6[15] */
104-
u32 orp_ea_hptr; /* 24-bit, _res7[24-31] */
105-
u32 orp_ea_tptr; /* 24-bit, _res8[24-31] */
106-
u32 pfdr_hptr; /* 24-bit, _res9[24-31] */
107-
u32 pfdr_tptr; /* 24-bit, _res10[24-31] */
108-
u8 __reserved2[5];
109-
u8 is; /* 1-bit, _res12[1-7] */
110-
u16 ics_surp;
111-
u32 byte_cnt;
112-
u32 frm_cnt; /* 24-bit, _res13[24-31] */
113-
u32 __reserved3;
114-
u16 ra1_sfdr; /* QM_MCR_NP_RA1_*** */
115-
u16 ra2_sfdr; /* QM_MCR_NP_RA2_*** */
116-
u16 __reserved4;
117-
u16 od1_sfdr; /* QM_MCR_NP_OD1_*** */
118-
u16 od2_sfdr; /* QM_MCR_NP_OD2_*** */
119-
u16 od3_sfdr; /* QM_MCR_NP_OD3_*** */
120-
} __packed;
121-
122-
#define QM_MCR_NP_STATE_FE 0x10
123-
#define QM_MCR_NP_STATE_R 0x08
124-
#define QM_MCR_NP_STATE_MASK 0x07 /* Reads FQD::STATE; */
125-
#define QM_MCR_NP_STATE_OOS 0x00
126-
#define QM_MCR_NP_STATE_RETIRED 0x01
127-
#define QM_MCR_NP_STATE_TEN_SCHED 0x02
128-
#define QM_MCR_NP_STATE_TRU_SCHED 0x03
129-
#define QM_MCR_NP_STATE_PARKED 0x04
130-
#define QM_MCR_NP_STATE_ACTIVE 0x05
131-
#define QM_MCR_NP_PTR_MASK 0x07ff /* for RA[12] & OD[123] */
132-
#define QM_MCR_NP_RA1_NRA(v) (((v) >> 14) & 0x3) /* FQD::NRA */
133-
#define QM_MCR_NP_RA2_IT(v) (((v) >> 14) & 0x1) /* FQD::IT */
134-
#define QM_MCR_NP_OD1_NOD(v) (((v) >> 14) & 0x3) /* FQD::NOD */
135-
#define QM_MCR_NP_OD3_NPC(v) (((v) >> 14) & 0x3) /* FQD::NPC */
136-
137-
enum qm_mcr_queryfq_np_masks {
138-
qm_mcr_fqd_link_mask = BIT(24)-1,
139-
qm_mcr_odp_seq_mask = BIT(14)-1,
140-
qm_mcr_orp_nesn_mask = BIT(14)-1,
141-
qm_mcr_orp_ea_hseq_mask = BIT(15)-1,
142-
qm_mcr_orp_ea_tseq_mask = BIT(15)-1,
143-
qm_mcr_orp_ea_hptr_mask = BIT(24)-1,
144-
qm_mcr_orp_ea_tptr_mask = BIT(24)-1,
145-
qm_mcr_pfdr_hptr_mask = BIT(24)-1,
146-
qm_mcr_pfdr_tptr_mask = BIT(24)-1,
147-
qm_mcr_is_mask = BIT(1)-1,
148-
qm_mcr_frm_cnt_mask = BIT(24)-1,
149-
};
150-
#define qm_mcr_np_get(np, field) \
151-
((np)->field & (qm_mcr_##field##_mask))
152-
15392
/* Congestion Groups */
15493

15594
/*

include/soc/fsl/qman.h

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,67 @@ struct qman_cgr {
811811
#define QMAN_VOLATILE_FLAG_WAIT_INT 0x00000002 /* if wait, interruptible? */
812812
#define QMAN_VOLATILE_FLAG_FINISH 0x00000004 /* wait till VDQCR completes */
813813

814+
/* "Query FQ Non-Programmable Fields" */
815+
struct qm_mcr_queryfq_np {
816+
u8 verb;
817+
u8 result;
818+
u8 __reserved1;
819+
u8 state; /* QM_MCR_NP_STATE_*** */
820+
u32 fqd_link; /* 24-bit, _res2[24-31] */
821+
u16 odp_seq; /* 14-bit, _res3[14-15] */
822+
u16 orp_nesn; /* 14-bit, _res4[14-15] */
823+
u16 orp_ea_hseq; /* 15-bit, _res5[15] */
824+
u16 orp_ea_tseq; /* 15-bit, _res6[15] */
825+
u32 orp_ea_hptr; /* 24-bit, _res7[24-31] */
826+
u32 orp_ea_tptr; /* 24-bit, _res8[24-31] */
827+
u32 pfdr_hptr; /* 24-bit, _res9[24-31] */
828+
u32 pfdr_tptr; /* 24-bit, _res10[24-31] */
829+
u8 __reserved2[5];
830+
u8 is; /* 1-bit, _res12[1-7] */
831+
u16 ics_surp;
832+
u32 byte_cnt;
833+
u32 frm_cnt; /* 24-bit, _res13[24-31] */
834+
u32 __reserved3;
835+
u16 ra1_sfdr; /* QM_MCR_NP_RA1_*** */
836+
u16 ra2_sfdr; /* QM_MCR_NP_RA2_*** */
837+
u16 __reserved4;
838+
u16 od1_sfdr; /* QM_MCR_NP_OD1_*** */
839+
u16 od2_sfdr; /* QM_MCR_NP_OD2_*** */
840+
u16 od3_sfdr; /* QM_MCR_NP_OD3_*** */
841+
} __packed;
842+
843+
#define QM_MCR_NP_STATE_FE 0x10
844+
#define QM_MCR_NP_STATE_R 0x08
845+
#define QM_MCR_NP_STATE_MASK 0x07 /* Reads FQD::STATE; */
846+
#define QM_MCR_NP_STATE_OOS 0x00
847+
#define QM_MCR_NP_STATE_RETIRED 0x01
848+
#define QM_MCR_NP_STATE_TEN_SCHED 0x02
849+
#define QM_MCR_NP_STATE_TRU_SCHED 0x03
850+
#define QM_MCR_NP_STATE_PARKED 0x04
851+
#define QM_MCR_NP_STATE_ACTIVE 0x05
852+
#define QM_MCR_NP_PTR_MASK 0x07ff /* for RA[12] & OD[123] */
853+
#define QM_MCR_NP_RA1_NRA(v) (((v) >> 14) & 0x3) /* FQD::NRA */
854+
#define QM_MCR_NP_RA2_IT(v) (((v) >> 14) & 0x1) /* FQD::IT */
855+
#define QM_MCR_NP_OD1_NOD(v) (((v) >> 14) & 0x3) /* FQD::NOD */
856+
#define QM_MCR_NP_OD3_NPC(v) (((v) >> 14) & 0x3) /* FQD::NPC */
857+
858+
enum qm_mcr_queryfq_np_masks {
859+
qm_mcr_fqd_link_mask = BIT(24) - 1,
860+
qm_mcr_odp_seq_mask = BIT(14) - 1,
861+
qm_mcr_orp_nesn_mask = BIT(14) - 1,
862+
qm_mcr_orp_ea_hseq_mask = BIT(15) - 1,
863+
qm_mcr_orp_ea_tseq_mask = BIT(15) - 1,
864+
qm_mcr_orp_ea_hptr_mask = BIT(24) - 1,
865+
qm_mcr_orp_ea_tptr_mask = BIT(24) - 1,
866+
qm_mcr_pfdr_hptr_mask = BIT(24) - 1,
867+
qm_mcr_pfdr_tptr_mask = BIT(24) - 1,
868+
qm_mcr_is_mask = BIT(1) - 1,
869+
qm_mcr_frm_cnt_mask = BIT(24) - 1,
870+
};
871+
872+
#define qm_mcr_np_get(np, field) \
873+
((np)->field & (qm_mcr_##field##_mask))
874+
814875
/* Portal Management */
815876
/**
816877
* qman_p_irqsource_add - add processing sources to be interrupt-driven
@@ -1033,6 +1094,13 @@ int qman_alloc_fqid_range(u32 *result, u32 count);
10331094
*/
10341095
int qman_release_fqid(u32 fqid);
10351096

1097+
/**
1098+
* qman_query_fq_np - Queries non-programmable FQD fields
1099+
* @fq: the frame queue object to be queried
1100+
* @np: storage for the queried FQD fields
1101+
*/
1102+
int qman_query_fq_np(struct qman_fq *fq, struct qm_mcr_queryfq_np *np);
1103+
10361104
/* Pool-channel management */
10371105
/**
10381106
* qman_alloc_pool_range - Allocate a contiguous range of pool-channel IDs

0 commit comments

Comments
 (0)