xref: /OK3568_Linux_fs/kernel/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* Broadcom NetXtreme-C/E network driver.
2*4882a593Smuzhiyun  *
3*4882a593Smuzhiyun  * Copyright (c) 2014-2016 Broadcom Corporation
4*4882a593Smuzhiyun  * Copyright (c) 2016-2018 Broadcom Limited
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * This program is free software; you can redistribute it and/or modify
7*4882a593Smuzhiyun  * it under the terms of the GNU General Public License as published by
8*4882a593Smuzhiyun  * the Free Software Foundation.
9*4882a593Smuzhiyun  */
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #ifndef BNXT_SRIOV_H
12*4882a593Smuzhiyun #define BNXT_SRIOV_H
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun #define BNXT_FWD_RESP_SIZE_ERR(n)					\
15*4882a593Smuzhiyun 	((offsetof(struct hwrm_fwd_resp_input, encap_resp) + n) >	\
16*4882a593Smuzhiyun 	 sizeof(struct hwrm_fwd_resp_input))
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun #define BNXT_EXEC_FWD_RESP_SIZE_ERR(n)					\
19*4882a593Smuzhiyun 	((offsetof(struct hwrm_exec_fwd_resp_input, encap_request) + n) >\
20*4882a593Smuzhiyun 	 offsetof(struct hwrm_exec_fwd_resp_input, encap_resp_target_id))
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun #define BNXT_REJ_FWD_RESP_SIZE_ERR(n)					\
23*4882a593Smuzhiyun 	((offsetof(struct hwrm_reject_fwd_resp_input, encap_request) + n) >\
24*4882a593Smuzhiyun 	 offsetof(struct hwrm_reject_fwd_resp_input, encap_resp_target_id))
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun #define BNXT_VF_MIN_RSS_CTX	1
27*4882a593Smuzhiyun #define BNXT_VF_MAX_RSS_CTX	1
28*4882a593Smuzhiyun #define BNXT_VF_MIN_L2_CTX	1
29*4882a593Smuzhiyun #define BNXT_VF_MAX_L2_CTX	4
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun int bnxt_get_vf_config(struct net_device *, int, struct ifla_vf_info *);
32*4882a593Smuzhiyun int bnxt_set_vf_mac(struct net_device *, int, u8 *);
33*4882a593Smuzhiyun int bnxt_set_vf_vlan(struct net_device *, int, u16, u8, __be16);
34*4882a593Smuzhiyun int bnxt_set_vf_bw(struct net_device *, int, int, int);
35*4882a593Smuzhiyun int bnxt_set_vf_link_state(struct net_device *, int, int);
36*4882a593Smuzhiyun int bnxt_set_vf_spoofchk(struct net_device *, int, bool);
37*4882a593Smuzhiyun int bnxt_set_vf_trust(struct net_device *dev, int vf_id, bool trust);
38*4882a593Smuzhiyun int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs);
39*4882a593Smuzhiyun int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs, bool reset);
40*4882a593Smuzhiyun void bnxt_sriov_disable(struct bnxt *);
41*4882a593Smuzhiyun void bnxt_hwrm_exec_fwd_req(struct bnxt *);
42*4882a593Smuzhiyun void bnxt_update_vf_mac(struct bnxt *);
43*4882a593Smuzhiyun int bnxt_approve_mac(struct bnxt *, u8 *, bool);
44*4882a593Smuzhiyun #endif
45