linux/drivers/net/ethernet/freescale/enetc/ntmp_private.h
Wei Fang 664bf117a3 net: enetc: fix implicit declaration of function FIELD_PREP
The kernel test robot reported the following error:

drivers/net/ethernet/freescale/enetc/ntmp.c: In function 'ntmp_fill_request_hdr':
drivers/net/ethernet/freescale/enetc/ntmp.c:203:38: error: implicit
declaration of function 'FIELD_PREP' [-Wimplicit-function-declaration]
203 |         cbd->req_hdr.access_method = FIELD_PREP(NTMP_ACCESS_METHOD,
    |                                      ^~~~~~~~~~

Therefore, add "bitfield.h" to ntmp_private.h to fix this issue.

Fixes: 4701073c3d ("net: enetc: add initial netc-lib driver to support NTMP")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202505101047.NTMcerZE-lkp@intel.com/
Signed-off-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2025-05-14 09:48:49 +01:00

104 lines
2.3 KiB
C

/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
/*
* NTMP table request and response data buffer formats
* Copyright 2025 NXP
*/
#ifndef __NTMP_PRIVATE_H
#define __NTMP_PRIVATE_H
#include <linux/bitfield.h>
#include <linux/fsl/ntmp.h>
#define NTMP_EID_REQ_LEN 8
#define NETC_CBDR_BD_NUM 256
union netc_cbd {
struct {
__le64 addr;
__le32 len;
#define NTMP_RESP_LEN GENMASK(19, 0)
#define NTMP_REQ_LEN GENMASK(31, 20)
#define NTMP_LEN(req, resp) (FIELD_PREP(NTMP_REQ_LEN, (req)) | \
((resp) & NTMP_RESP_LEN))
u8 cmd;
#define NTMP_CMD_DELETE BIT(0)
#define NTMP_CMD_UPDATE BIT(1)
#define NTMP_CMD_QUERY BIT(2)
#define NTMP_CMD_ADD BIT(3)
#define NTMP_CMD_QU (NTMP_CMD_QUERY | NTMP_CMD_UPDATE)
u8 access_method;
#define NTMP_ACCESS_METHOD GENMASK(7, 4)
#define NTMP_AM_ENTRY_ID 0
#define NTMP_AM_EXACT_KEY 1
#define NTMP_AM_SEARCH 2
#define NTMP_AM_TERNARY_KEY 3
u8 table_id;
u8 ver_cci_rr;
#define NTMP_HDR_VERSION GENMASK(5, 0)
#define NTMP_HDR_VER2 2
#define NTMP_CCI BIT(6)
#define NTMP_RR BIT(7)
__le32 resv[3];
__le32 npf;
#define NTMP_NPF BIT(15)
} req_hdr; /* NTMP Request Message Header Format */
struct {
__le32 resv0[3];
__le16 num_matched;
__le16 error_rr;
#define NTMP_RESP_ERROR GENMASK(11, 0)
#define NTMP_RESP_RR BIT(15)
__le32 resv1[4];
} resp_hdr; /* NTMP Response Message Header Format */
};
struct ntmp_dma_buf {
struct device *dev;
size_t size;
void *buf;
dma_addr_t dma;
};
struct ntmp_cmn_req_data {
__le16 update_act;
u8 dbg_opt;
u8 tblv_qact;
#define NTMP_QUERY_ACT GENMASK(3, 0)
#define NTMP_TBL_VER GENMASK(7, 4)
#define NTMP_TBLV_QACT(v, a) (FIELD_PREP(NTMP_TBL_VER, (v)) | \
((a) & NTMP_QUERY_ACT))
};
struct ntmp_cmn_resp_query {
__le32 entry_id;
};
/* Generic structure for request data by entry ID */
struct ntmp_req_by_eid {
struct ntmp_cmn_req_data crd;
__le32 entry_id;
};
/* MAC Address Filter Table Request Data Buffer Format of Add action */
struct maft_req_add {
struct ntmp_req_by_eid rbe;
struct maft_keye_data keye;
struct maft_cfge_data cfge;
};
/* MAC Address Filter Table Response Data Buffer Format of Query action */
struct maft_resp_query {
__le32 entry_id;
struct maft_keye_data keye;
struct maft_cfge_data cfge;
};
/* RSS Table Request Data Buffer Format of Update action */
struct rsst_req_update {
struct ntmp_req_by_eid rbe;
u8 groups[];
};
#endif