brintos

brintos / linux-shallow public Read only

0
0
Text · 4.0 KiB · 3a41158 Raw
105 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2/* Copyright (C) 2022, Intel Corporation. */3 4#ifndef _ICE_VIRTCHNL_H_5#define _ICE_VIRTCHNL_H_6 7#include <linux/types.h>8#include <linux/bitops.h>9#include <linux/if_ether.h>10#include <linux/avf/virtchnl.h>11#include "ice_vf_lib.h"12 13/* Restrict number of MAC Addr and VLAN that non-trusted VF can programmed */14#define ICE_MAX_VLAN_PER_VF		815 16/* MAC filters: 1 is reserved for the VF's default/perm_addr/LAA MAC, 1 for17 * broadcast, and 16 for additional unicast/multicast filters18 */19#define ICE_MAX_MACADDR_PER_VF		1820#define ICE_FLEX_DESC_RXDID_MAX_NUM	6421 22/* VFs only get a single VSI. For ice hardware, the VF does not need to know23 * its VSI index. However, the virtchnl interface requires a VSI number,24 * mainly due to legacy hardware.25 *26 * Since the VF doesn't need this information, report a static value to the VF27 * instead of leaking any information about the PF or hardware setup.28 */29#define ICE_VF_VSI_ID	130 31struct ice_virtchnl_ops {32	int (*get_ver_msg)(struct ice_vf *vf, u8 *msg);33	int (*get_vf_res_msg)(struct ice_vf *vf, u8 *msg);34	void (*reset_vf)(struct ice_vf *vf);35	int (*add_mac_addr_msg)(struct ice_vf *vf, u8 *msg);36	int (*del_mac_addr_msg)(struct ice_vf *vf, u8 *msg);37	int (*cfg_qs_msg)(struct ice_vf *vf, u8 *msg);38	int (*ena_qs_msg)(struct ice_vf *vf, u8 *msg);39	int (*dis_qs_msg)(struct ice_vf *vf, u8 *msg);40	int (*request_qs_msg)(struct ice_vf *vf, u8 *msg);41	int (*cfg_irq_map_msg)(struct ice_vf *vf, u8 *msg);42	int (*config_rss_key)(struct ice_vf *vf, u8 *msg);43	int (*config_rss_lut)(struct ice_vf *vf, u8 *msg);44	int (*config_rss_hfunc)(struct ice_vf *vf, u8 *msg);45	int (*get_stats_msg)(struct ice_vf *vf, u8 *msg);46	int (*cfg_promiscuous_mode_msg)(struct ice_vf *vf, u8 *msg);47	int (*add_vlan_msg)(struct ice_vf *vf, u8 *msg);48	int (*remove_vlan_msg)(struct ice_vf *vf, u8 *msg);49	int (*query_rxdid)(struct ice_vf *vf);50	int (*get_rss_hena)(struct ice_vf *vf);51	int (*set_rss_hena_msg)(struct ice_vf *vf, u8 *msg);52	int (*ena_vlan_stripping)(struct ice_vf *vf);53	int (*dis_vlan_stripping)(struct ice_vf *vf);54	int (*handle_rss_cfg_msg)(struct ice_vf *vf, u8 *msg, bool add);55	int (*add_fdir_fltr_msg)(struct ice_vf *vf, u8 *msg);56	int (*del_fdir_fltr_msg)(struct ice_vf *vf, u8 *msg);57	int (*get_offload_vlan_v2_caps)(struct ice_vf *vf);58	int (*add_vlan_v2_msg)(struct ice_vf *vf, u8 *msg);59	int (*remove_vlan_v2_msg)(struct ice_vf *vf, u8 *msg);60	int (*ena_vlan_stripping_v2_msg)(struct ice_vf *vf, u8 *msg);61	int (*dis_vlan_stripping_v2_msg)(struct ice_vf *vf, u8 *msg);62	int (*ena_vlan_insertion_v2_msg)(struct ice_vf *vf, u8 *msg);63	int (*dis_vlan_insertion_v2_msg)(struct ice_vf *vf, u8 *msg);64};65 66#ifdef CONFIG_PCI_IOV67void ice_virtchnl_set_dflt_ops(struct ice_vf *vf);68void ice_virtchnl_set_repr_ops(struct ice_vf *vf);69void ice_vc_notify_vf_link_state(struct ice_vf *vf);70void ice_vc_notify_link_state(struct ice_pf *pf);71void ice_vc_notify_reset(struct ice_pf *pf);72int73ice_vc_send_msg_to_vf(struct ice_vf *vf, u32 v_opcode,74		      enum virtchnl_status_code v_retval, u8 *msg, u16 msglen);75bool ice_vc_isvalid_vsi_id(struct ice_vf *vf, u16 vsi_id);76void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event,77			   struct ice_mbx_data *mbxdata);78#else /* CONFIG_PCI_IOV */79static inline void ice_virtchnl_set_dflt_ops(struct ice_vf *vf) { }80static inline void ice_virtchnl_set_repr_ops(struct ice_vf *vf) { }81static inline void ice_vc_notify_vf_link_state(struct ice_vf *vf) { }82static inline void ice_vc_notify_link_state(struct ice_pf *pf) { }83static inline void ice_vc_notify_reset(struct ice_pf *pf) { }84 85static inline int86ice_vc_send_msg_to_vf(struct ice_vf *vf, u32 v_opcode,87		      enum virtchnl_status_code v_retval, u8 *msg, u16 msglen)88{89	return -EOPNOTSUPP;90}91 92static inline bool ice_vc_isvalid_vsi_id(struct ice_vf *vf, u16 vsi_id)93{94	return false;95}96 97static inline void98ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event,99		      struct ice_mbx_data *mbxdata)100{101}102#endif /* !CONFIG_PCI_IOV */103 104#endif /* _ICE_VIRTCHNL_H_ */105