]> Git Repo - linux.git/blob - drivers/net/ethernet/intel/ice/ice_virtchnl.h
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[linux.git] / drivers / net / ethernet / intel / ice / ice_virtchnl.h
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             8
15
16 /* MAC filters: 1 is reserved for the VF's default/perm_addr/LAA MAC, 1 for
17  * broadcast, and 16 for additional unicast/multicast filters
18  */
19 #define ICE_MAX_MACADDR_PER_VF          18
20 #define ICE_FLEX_DESC_RXDID_MAX_NUM     64
21
22 struct ice_virtchnl_ops {
23         int (*get_ver_msg)(struct ice_vf *vf, u8 *msg);
24         int (*get_vf_res_msg)(struct ice_vf *vf, u8 *msg);
25         void (*reset_vf)(struct ice_vf *vf);
26         int (*add_mac_addr_msg)(struct ice_vf *vf, u8 *msg);
27         int (*del_mac_addr_msg)(struct ice_vf *vf, u8 *msg);
28         int (*cfg_qs_msg)(struct ice_vf *vf, u8 *msg);
29         int (*ena_qs_msg)(struct ice_vf *vf, u8 *msg);
30         int (*dis_qs_msg)(struct ice_vf *vf, u8 *msg);
31         int (*request_qs_msg)(struct ice_vf *vf, u8 *msg);
32         int (*cfg_irq_map_msg)(struct ice_vf *vf, u8 *msg);
33         int (*config_rss_key)(struct ice_vf *vf, u8 *msg);
34         int (*config_rss_lut)(struct ice_vf *vf, u8 *msg);
35         int (*get_stats_msg)(struct ice_vf *vf, u8 *msg);
36         int (*cfg_promiscuous_mode_msg)(struct ice_vf *vf, u8 *msg);
37         int (*add_vlan_msg)(struct ice_vf *vf, u8 *msg);
38         int (*remove_vlan_msg)(struct ice_vf *vf, u8 *msg);
39         int (*query_rxdid)(struct ice_vf *vf);
40         int (*get_rss_hena)(struct ice_vf *vf);
41         int (*set_rss_hena_msg)(struct ice_vf *vf, u8 *msg);
42         int (*ena_vlan_stripping)(struct ice_vf *vf);
43         int (*dis_vlan_stripping)(struct ice_vf *vf);
44         int (*handle_rss_cfg_msg)(struct ice_vf *vf, u8 *msg, bool add);
45         int (*add_fdir_fltr_msg)(struct ice_vf *vf, u8 *msg);
46         int (*del_fdir_fltr_msg)(struct ice_vf *vf, u8 *msg);
47         int (*get_offload_vlan_v2_caps)(struct ice_vf *vf);
48         int (*add_vlan_v2_msg)(struct ice_vf *vf, u8 *msg);
49         int (*remove_vlan_v2_msg)(struct ice_vf *vf, u8 *msg);
50         int (*ena_vlan_stripping_v2_msg)(struct ice_vf *vf, u8 *msg);
51         int (*dis_vlan_stripping_v2_msg)(struct ice_vf *vf, u8 *msg);
52         int (*ena_vlan_insertion_v2_msg)(struct ice_vf *vf, u8 *msg);
53         int (*dis_vlan_insertion_v2_msg)(struct ice_vf *vf, u8 *msg);
54 };
55
56 #ifdef CONFIG_PCI_IOV
57 void ice_virtchnl_set_dflt_ops(struct ice_vf *vf);
58 void ice_virtchnl_set_repr_ops(struct ice_vf *vf);
59 void ice_vc_notify_vf_link_state(struct ice_vf *vf);
60 void ice_vc_notify_link_state(struct ice_pf *pf);
61 void ice_vc_notify_reset(struct ice_pf *pf);
62 int
63 ice_vc_send_msg_to_vf(struct ice_vf *vf, u32 v_opcode,
64                       enum virtchnl_status_code v_retval, u8 *msg, u16 msglen);
65 bool ice_vc_isvalid_vsi_id(struct ice_vf *vf, u16 vsi_id);
66 void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event,
67                            struct ice_mbx_data *mbxdata);
68 #else /* CONFIG_PCI_IOV */
69 static inline void ice_virtchnl_set_dflt_ops(struct ice_vf *vf) { }
70 static inline void ice_virtchnl_set_repr_ops(struct ice_vf *vf) { }
71 static inline void ice_vc_notify_vf_link_state(struct ice_vf *vf) { }
72 static inline void ice_vc_notify_link_state(struct ice_pf *pf) { }
73 static inline void ice_vc_notify_reset(struct ice_pf *pf) { }
74
75 static inline int
76 ice_vc_send_msg_to_vf(struct ice_vf *vf, u32 v_opcode,
77                       enum virtchnl_status_code v_retval, u8 *msg, u16 msglen)
78 {
79         return -EOPNOTSUPP;
80 }
81
82 static inline bool ice_vc_isvalid_vsi_id(struct ice_vf *vf, u16 vsi_id)
83 {
84         return false;
85 }
86
87 static inline void
88 ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event,
89                       struct ice_mbx_data *mbxdata)
90 {
91 }
92 #endif /* !CONFIG_PCI_IOV */
93
94 #endif /* _ICE_VIRTCHNL_H_ */
This page took 0.038182 seconds and 4 git commands to generate.