18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* Copyright(c) 2013 - 2018 Intel Corporation. */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef _FM10K_PF_H_
58c2ecf20Sopenharmony_ci#define _FM10K_PF_H_
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include "fm10k_type.h"
88c2ecf20Sopenharmony_ci#include "fm10k_common.h"
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_cibool fm10k_glort_valid_pf(struct fm10k_hw *hw, u16 glort);
118c2ecf20Sopenharmony_ciu16 fm10k_queues_per_pool(struct fm10k_hw *hw);
128c2ecf20Sopenharmony_ciu16 fm10k_vf_queue_index(struct fm10k_hw *hw, u16 vf_idx);
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_cienum fm10k_pf_tlv_msg_id_v1 {
158c2ecf20Sopenharmony_ci	FM10K_PF_MSG_ID_TEST			= 0x000, /* msg ID reserved */
168c2ecf20Sopenharmony_ci	FM10K_PF_MSG_ID_XCAST_MODES		= 0x001,
178c2ecf20Sopenharmony_ci	FM10K_PF_MSG_ID_UPDATE_MAC_FWD_RULE	= 0x002,
188c2ecf20Sopenharmony_ci	FM10K_PF_MSG_ID_LPORT_MAP		= 0x100,
198c2ecf20Sopenharmony_ci	FM10K_PF_MSG_ID_LPORT_CREATE		= 0x200,
208c2ecf20Sopenharmony_ci	FM10K_PF_MSG_ID_LPORT_DELETE		= 0x201,
218c2ecf20Sopenharmony_ci	FM10K_PF_MSG_ID_CONFIG			= 0x300,
228c2ecf20Sopenharmony_ci	FM10K_PF_MSG_ID_UPDATE_PVID		= 0x400,
238c2ecf20Sopenharmony_ci	FM10K_PF_MSG_ID_CREATE_FLOW_TABLE	= 0x501,
248c2ecf20Sopenharmony_ci	FM10K_PF_MSG_ID_DELETE_FLOW_TABLE	= 0x502,
258c2ecf20Sopenharmony_ci	FM10K_PF_MSG_ID_UPDATE_FLOW		= 0x503,
268c2ecf20Sopenharmony_ci	FM10K_PF_MSG_ID_DELETE_FLOW		= 0x504,
278c2ecf20Sopenharmony_ci	FM10K_PF_MSG_ID_SET_FLOW_STATE		= 0x505,
288c2ecf20Sopenharmony_ci};
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cienum fm10k_pf_tlv_attr_id_v1 {
318c2ecf20Sopenharmony_ci	FM10K_PF_ATTR_ID_ERR			= 0x00,
328c2ecf20Sopenharmony_ci	FM10K_PF_ATTR_ID_LPORT_MAP		= 0x01,
338c2ecf20Sopenharmony_ci	FM10K_PF_ATTR_ID_XCAST_MODE		= 0x02,
348c2ecf20Sopenharmony_ci	FM10K_PF_ATTR_ID_MAC_UPDATE		= 0x03,
358c2ecf20Sopenharmony_ci	FM10K_PF_ATTR_ID_VLAN_UPDATE		= 0x04,
368c2ecf20Sopenharmony_ci	FM10K_PF_ATTR_ID_CONFIG			= 0x05,
378c2ecf20Sopenharmony_ci	FM10K_PF_ATTR_ID_CREATE_FLOW_TABLE	= 0x06,
388c2ecf20Sopenharmony_ci	FM10K_PF_ATTR_ID_DELETE_FLOW_TABLE	= 0x07,
398c2ecf20Sopenharmony_ci	FM10K_PF_ATTR_ID_UPDATE_FLOW		= 0x08,
408c2ecf20Sopenharmony_ci	FM10K_PF_ATTR_ID_FLOW_STATE		= 0x09,
418c2ecf20Sopenharmony_ci	FM10K_PF_ATTR_ID_FLOW_HANDLE		= 0x0A,
428c2ecf20Sopenharmony_ci	FM10K_PF_ATTR_ID_DELETE_FLOW		= 0x0B,
438c2ecf20Sopenharmony_ci	FM10K_PF_ATTR_ID_PORT			= 0x0C,
448c2ecf20Sopenharmony_ci	FM10K_PF_ATTR_ID_UPDATE_PVID		= 0x0D,
458c2ecf20Sopenharmony_ci};
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#define FM10K_MSG_LPORT_MAP_GLORT_SHIFT	0
488c2ecf20Sopenharmony_ci#define FM10K_MSG_LPORT_MAP_GLORT_SIZE	16
498c2ecf20Sopenharmony_ci#define FM10K_MSG_LPORT_MAP_MASK_SHIFT	16
508c2ecf20Sopenharmony_ci#define FM10K_MSG_LPORT_MAP_MASK_SIZE	16
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define FM10K_MSG_UPDATE_PVID_GLORT_SHIFT	0
538c2ecf20Sopenharmony_ci#define FM10K_MSG_UPDATE_PVID_GLORT_SIZE	16
548c2ecf20Sopenharmony_ci#define FM10K_MSG_UPDATE_PVID_PVID_SHIFT	16
558c2ecf20Sopenharmony_ci#define FM10K_MSG_UPDATE_PVID_PVID_SIZE		16
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#define FM10K_MSG_ERR_PEP_NOT_SCHEDULED	280
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/* The following data structures are overlayed directly onto TLV mailbox
608c2ecf20Sopenharmony_ci * messages, and must not break 4 byte alignment. Ensure the structures line
618c2ecf20Sopenharmony_ci * up correctly as per their TLV definition.
628c2ecf20Sopenharmony_ci */
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_cistruct fm10k_mac_update {
658c2ecf20Sopenharmony_ci	__le32	mac_lower;
668c2ecf20Sopenharmony_ci	__le16	mac_upper;
678c2ecf20Sopenharmony_ci	__le16	vlan;
688c2ecf20Sopenharmony_ci	__le16	glort;
698c2ecf20Sopenharmony_ci	u8	flags;
708c2ecf20Sopenharmony_ci	u8	action;
718c2ecf20Sopenharmony_ci} __aligned(4) __packed;
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_cistruct fm10k_global_table_data {
748c2ecf20Sopenharmony_ci	__le32	used;
758c2ecf20Sopenharmony_ci	__le32	avail;
768c2ecf20Sopenharmony_ci} __aligned(4) __packed;
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_cistruct fm10k_swapi_error {
798c2ecf20Sopenharmony_ci	__le32				status;
808c2ecf20Sopenharmony_ci	struct fm10k_global_table_data	mac;
818c2ecf20Sopenharmony_ci	struct fm10k_global_table_data	nexthop;
828c2ecf20Sopenharmony_ci	struct fm10k_global_table_data	ffu;
838c2ecf20Sopenharmony_ci} __aligned(4) __packed;
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_cis32 fm10k_msg_lport_map_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
868c2ecf20Sopenharmony_ciextern const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[];
878c2ecf20Sopenharmony_ci#define FM10K_PF_MSG_LPORT_MAP_HANDLER(func) \
888c2ecf20Sopenharmony_ci	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_LPORT_MAP, \
898c2ecf20Sopenharmony_ci			  fm10k_lport_map_msg_attr, func)
908c2ecf20Sopenharmony_ciextern const struct fm10k_tlv_attr fm10k_update_pvid_msg_attr[];
918c2ecf20Sopenharmony_ci#define FM10K_PF_MSG_UPDATE_PVID_HANDLER(func) \
928c2ecf20Sopenharmony_ci	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_UPDATE_PVID, \
938c2ecf20Sopenharmony_ci			  fm10k_update_pvid_msg_attr, func)
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_cis32 fm10k_msg_err_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
968c2ecf20Sopenharmony_ciextern const struct fm10k_tlv_attr fm10k_err_msg_attr[];
978c2ecf20Sopenharmony_ci#define FM10K_PF_MSG_ERR_HANDLER(msg, func) \
988c2ecf20Sopenharmony_ci	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_##msg, fm10k_err_msg_attr, func)
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_cis32 fm10k_iov_select_vid(struct fm10k_vf_info *vf_info, u16 vid);
1018c2ecf20Sopenharmony_cis32 fm10k_iov_msg_msix_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
1028c2ecf20Sopenharmony_cis32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *, u32 **,
1038c2ecf20Sopenharmony_ci			      struct fm10k_mbx_info *);
1048c2ecf20Sopenharmony_cis32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *, u32 **,
1058c2ecf20Sopenharmony_ci				 struct fm10k_mbx_info *);
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ciextern const struct fm10k_info fm10k_pf_info;
1088c2ecf20Sopenharmony_ci#endif /* _FM10K_PF_H */
109