Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright (C) 2022, Intel Corporation. */
0003 
0004 #ifndef _ICE_VIRTCHNL_H_
0005 #define _ICE_VIRTCHNL_H_
0006 
0007 #include <linux/types.h>
0008 #include <linux/bitops.h>
0009 #include <linux/if_ether.h>
0010 #include <linux/avf/virtchnl.h>
0011 #include "ice_vf_lib.h"
0012 
0013 /* Restrict number of MAC Addr and VLAN that non-trusted VF can programmed */
0014 #define ICE_MAX_VLAN_PER_VF     8
0015 
0016 /* MAC filters: 1 is reserved for the VF's default/perm_addr/LAA MAC, 1 for
0017  * broadcast, and 16 for additional unicast/multicast filters
0018  */
0019 #define ICE_MAX_MACADDR_PER_VF      18
0020 
0021 struct ice_virtchnl_ops {
0022     int (*get_ver_msg)(struct ice_vf *vf, u8 *msg);
0023     int (*get_vf_res_msg)(struct ice_vf *vf, u8 *msg);
0024     void (*reset_vf)(struct ice_vf *vf);
0025     int (*add_mac_addr_msg)(struct ice_vf *vf, u8 *msg);
0026     int (*del_mac_addr_msg)(struct ice_vf *vf, u8 *msg);
0027     int (*cfg_qs_msg)(struct ice_vf *vf, u8 *msg);
0028     int (*ena_qs_msg)(struct ice_vf *vf, u8 *msg);
0029     int (*dis_qs_msg)(struct ice_vf *vf, u8 *msg);
0030     int (*request_qs_msg)(struct ice_vf *vf, u8 *msg);
0031     int (*cfg_irq_map_msg)(struct ice_vf *vf, u8 *msg);
0032     int (*config_rss_key)(struct ice_vf *vf, u8 *msg);
0033     int (*config_rss_lut)(struct ice_vf *vf, u8 *msg);
0034     int (*get_stats_msg)(struct ice_vf *vf, u8 *msg);
0035     int (*cfg_promiscuous_mode_msg)(struct ice_vf *vf, u8 *msg);
0036     int (*add_vlan_msg)(struct ice_vf *vf, u8 *msg);
0037     int (*remove_vlan_msg)(struct ice_vf *vf, u8 *msg);
0038     int (*ena_vlan_stripping)(struct ice_vf *vf);
0039     int (*dis_vlan_stripping)(struct ice_vf *vf);
0040     int (*handle_rss_cfg_msg)(struct ice_vf *vf, u8 *msg, bool add);
0041     int (*add_fdir_fltr_msg)(struct ice_vf *vf, u8 *msg);
0042     int (*del_fdir_fltr_msg)(struct ice_vf *vf, u8 *msg);
0043     int (*get_offload_vlan_v2_caps)(struct ice_vf *vf);
0044     int (*add_vlan_v2_msg)(struct ice_vf *vf, u8 *msg);
0045     int (*remove_vlan_v2_msg)(struct ice_vf *vf, u8 *msg);
0046     int (*ena_vlan_stripping_v2_msg)(struct ice_vf *vf, u8 *msg);
0047     int (*dis_vlan_stripping_v2_msg)(struct ice_vf *vf, u8 *msg);
0048     int (*ena_vlan_insertion_v2_msg)(struct ice_vf *vf, u8 *msg);
0049     int (*dis_vlan_insertion_v2_msg)(struct ice_vf *vf, u8 *msg);
0050 };
0051 
0052 #ifdef CONFIG_PCI_IOV
0053 void ice_virtchnl_set_dflt_ops(struct ice_vf *vf);
0054 void ice_virtchnl_set_repr_ops(struct ice_vf *vf);
0055 void ice_vc_notify_vf_link_state(struct ice_vf *vf);
0056 void ice_vc_notify_link_state(struct ice_pf *pf);
0057 void ice_vc_notify_reset(struct ice_pf *pf);
0058 int
0059 ice_vc_send_msg_to_vf(struct ice_vf *vf, u32 v_opcode,
0060               enum virtchnl_status_code v_retval, u8 *msg, u16 msglen);
0061 bool ice_vc_isvalid_vsi_id(struct ice_vf *vf, u16 vsi_id);
0062 #else /* CONFIG_PCI_IOV */
0063 static inline void ice_virtchnl_set_dflt_ops(struct ice_vf *vf) { }
0064 static inline void ice_virtchnl_set_repr_ops(struct ice_vf *vf) { }
0065 static inline void ice_vc_notify_vf_link_state(struct ice_vf *vf) { }
0066 static inline void ice_vc_notify_link_state(struct ice_pf *pf) { }
0067 static inline void ice_vc_notify_reset(struct ice_pf *pf) { }
0068 
0069 static inline int
0070 ice_vc_send_msg_to_vf(struct ice_vf *vf, u32 v_opcode,
0071               enum virtchnl_status_code v_retval, u8 *msg, u16 msglen)
0072 {
0073     return -EOPNOTSUPP;
0074 }
0075 
0076 static inline bool ice_vc_isvalid_vsi_id(struct ice_vf *vf, u16 vsi_id)
0077 {
0078     return false;
0079 }
0080 #endif /* !CONFIG_PCI_IOV */
0081 
0082 #endif /* _ICE_VIRTCHNL_H_ */