162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* Copyright(c) 2013 - 2018 Intel Corporation. */
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#ifndef _FM10K_PF_H_
562306a36Sopenharmony_ci#define _FM10K_PF_H_
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#include "fm10k_type.h"
862306a36Sopenharmony_ci#include "fm10k_common.h"
962306a36Sopenharmony_ci
1062306a36Sopenharmony_cibool fm10k_glort_valid_pf(struct fm10k_hw *hw, u16 glort);
1162306a36Sopenharmony_ciu16 fm10k_queues_per_pool(struct fm10k_hw *hw);
1262306a36Sopenharmony_ciu16 fm10k_vf_queue_index(struct fm10k_hw *hw, u16 vf_idx);
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_cienum fm10k_pf_tlv_msg_id_v1 {
1562306a36Sopenharmony_ci	FM10K_PF_MSG_ID_TEST			= 0x000, /* msg ID reserved */
1662306a36Sopenharmony_ci	FM10K_PF_MSG_ID_XCAST_MODES		= 0x001,
1762306a36Sopenharmony_ci	FM10K_PF_MSG_ID_UPDATE_MAC_FWD_RULE	= 0x002,
1862306a36Sopenharmony_ci	FM10K_PF_MSG_ID_LPORT_MAP		= 0x100,
1962306a36Sopenharmony_ci	FM10K_PF_MSG_ID_LPORT_CREATE		= 0x200,
2062306a36Sopenharmony_ci	FM10K_PF_MSG_ID_LPORT_DELETE		= 0x201,
2162306a36Sopenharmony_ci	FM10K_PF_MSG_ID_CONFIG			= 0x300,
2262306a36Sopenharmony_ci	FM10K_PF_MSG_ID_UPDATE_PVID		= 0x400,
2362306a36Sopenharmony_ci	FM10K_PF_MSG_ID_CREATE_FLOW_TABLE	= 0x501,
2462306a36Sopenharmony_ci	FM10K_PF_MSG_ID_DELETE_FLOW_TABLE	= 0x502,
2562306a36Sopenharmony_ci	FM10K_PF_MSG_ID_UPDATE_FLOW		= 0x503,
2662306a36Sopenharmony_ci	FM10K_PF_MSG_ID_DELETE_FLOW		= 0x504,
2762306a36Sopenharmony_ci	FM10K_PF_MSG_ID_SET_FLOW_STATE		= 0x505,
2862306a36Sopenharmony_ci};
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_cienum fm10k_pf_tlv_attr_id_v1 {
3162306a36Sopenharmony_ci	FM10K_PF_ATTR_ID_ERR			= 0x00,
3262306a36Sopenharmony_ci	FM10K_PF_ATTR_ID_LPORT_MAP		= 0x01,
3362306a36Sopenharmony_ci	FM10K_PF_ATTR_ID_XCAST_MODE		= 0x02,
3462306a36Sopenharmony_ci	FM10K_PF_ATTR_ID_MAC_UPDATE		= 0x03,
3562306a36Sopenharmony_ci	FM10K_PF_ATTR_ID_VLAN_UPDATE		= 0x04,
3662306a36Sopenharmony_ci	FM10K_PF_ATTR_ID_CONFIG			= 0x05,
3762306a36Sopenharmony_ci	FM10K_PF_ATTR_ID_CREATE_FLOW_TABLE	= 0x06,
3862306a36Sopenharmony_ci	FM10K_PF_ATTR_ID_DELETE_FLOW_TABLE	= 0x07,
3962306a36Sopenharmony_ci	FM10K_PF_ATTR_ID_UPDATE_FLOW		= 0x08,
4062306a36Sopenharmony_ci	FM10K_PF_ATTR_ID_FLOW_STATE		= 0x09,
4162306a36Sopenharmony_ci	FM10K_PF_ATTR_ID_FLOW_HANDLE		= 0x0A,
4262306a36Sopenharmony_ci	FM10K_PF_ATTR_ID_DELETE_FLOW		= 0x0B,
4362306a36Sopenharmony_ci	FM10K_PF_ATTR_ID_PORT			= 0x0C,
4462306a36Sopenharmony_ci	FM10K_PF_ATTR_ID_UPDATE_PVID		= 0x0D,
4562306a36Sopenharmony_ci};
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#define FM10K_MSG_LPORT_MAP_GLORT_SHIFT	0
4862306a36Sopenharmony_ci#define FM10K_MSG_LPORT_MAP_GLORT_SIZE	16
4962306a36Sopenharmony_ci#define FM10K_MSG_LPORT_MAP_MASK_SHIFT	16
5062306a36Sopenharmony_ci#define FM10K_MSG_LPORT_MAP_MASK_SIZE	16
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#define FM10K_MSG_UPDATE_PVID_GLORT_SHIFT	0
5362306a36Sopenharmony_ci#define FM10K_MSG_UPDATE_PVID_GLORT_SIZE	16
5462306a36Sopenharmony_ci#define FM10K_MSG_UPDATE_PVID_PVID_SHIFT	16
5562306a36Sopenharmony_ci#define FM10K_MSG_UPDATE_PVID_PVID_SIZE		16
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci#define FM10K_MSG_ERR_PEP_NOT_SCHEDULED	280
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci/* The following data structures are overlayed directly onto TLV mailbox
6062306a36Sopenharmony_ci * messages, and must not break 4 byte alignment. Ensure the structures line
6162306a36Sopenharmony_ci * up correctly as per their TLV definition.
6262306a36Sopenharmony_ci */
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_cistruct fm10k_mac_update {
6562306a36Sopenharmony_ci	__le32	mac_lower;
6662306a36Sopenharmony_ci	__le16	mac_upper;
6762306a36Sopenharmony_ci	__le16	vlan;
6862306a36Sopenharmony_ci	__le16	glort;
6962306a36Sopenharmony_ci	u8	flags;
7062306a36Sopenharmony_ci	u8	action;
7162306a36Sopenharmony_ci} __aligned(4) __packed;
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_cistruct fm10k_global_table_data {
7462306a36Sopenharmony_ci	__le32	used;
7562306a36Sopenharmony_ci	__le32	avail;
7662306a36Sopenharmony_ci} __aligned(4) __packed;
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_cistruct fm10k_swapi_error {
7962306a36Sopenharmony_ci	__le32				status;
8062306a36Sopenharmony_ci	struct fm10k_global_table_data	mac;
8162306a36Sopenharmony_ci	struct fm10k_global_table_data	nexthop;
8262306a36Sopenharmony_ci	struct fm10k_global_table_data	ffu;
8362306a36Sopenharmony_ci} __aligned(4) __packed;
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_cis32 fm10k_msg_lport_map_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
8662306a36Sopenharmony_ciextern const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[];
8762306a36Sopenharmony_ci#define FM10K_PF_MSG_LPORT_MAP_HANDLER(func) \
8862306a36Sopenharmony_ci	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_LPORT_MAP, \
8962306a36Sopenharmony_ci			  fm10k_lport_map_msg_attr, func)
9062306a36Sopenharmony_ciextern const struct fm10k_tlv_attr fm10k_update_pvid_msg_attr[];
9162306a36Sopenharmony_ci#define FM10K_PF_MSG_UPDATE_PVID_HANDLER(func) \
9262306a36Sopenharmony_ci	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_UPDATE_PVID, \
9362306a36Sopenharmony_ci			  fm10k_update_pvid_msg_attr, func)
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_cis32 fm10k_msg_err_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
9662306a36Sopenharmony_ciextern const struct fm10k_tlv_attr fm10k_err_msg_attr[];
9762306a36Sopenharmony_ci#define FM10K_PF_MSG_ERR_HANDLER(msg, func) \
9862306a36Sopenharmony_ci	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_##msg, fm10k_err_msg_attr, func)
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_cis32 fm10k_iov_select_vid(struct fm10k_vf_info *vf_info, u16 vid);
10162306a36Sopenharmony_cis32 fm10k_iov_msg_msix_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
10262306a36Sopenharmony_cis32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *, u32 **,
10362306a36Sopenharmony_ci			      struct fm10k_mbx_info *);
10462306a36Sopenharmony_cis32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *, u32 **,
10562306a36Sopenharmony_ci				 struct fm10k_mbx_info *);
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ciextern const struct fm10k_info fm10k_pf_info;
10862306a36Sopenharmony_ci#endif /* _FM10K_PF_H */
109