xref: /OK3568_Linux_fs/kernel/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* Broadcom NetXtreme-C/E network driver.
2*4882a593Smuzhiyun  *
3*4882a593Smuzhiyun  * Copyright (c) 2016-2017 Broadcom Limited
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * This program is free software; you can redistribute it and/or modify
6*4882a593Smuzhiyun  * it under the terms of the GNU General Public License as published by
7*4882a593Smuzhiyun  * the Free Software Foundation.
8*4882a593Smuzhiyun  */
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #ifndef BNXT_VFR_H
11*4882a593Smuzhiyun #define BNXT_VFR_H
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun #ifdef CONFIG_BNXT_SRIOV
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun #define	MAX_CFA_CODE			65536
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun void bnxt_vf_reps_destroy(struct bnxt *bp);
18*4882a593Smuzhiyun void bnxt_vf_reps_close(struct bnxt *bp);
19*4882a593Smuzhiyun void bnxt_vf_reps_open(struct bnxt *bp);
20*4882a593Smuzhiyun void bnxt_vf_rep_rx(struct bnxt *bp, struct sk_buff *skb);
21*4882a593Smuzhiyun struct net_device *bnxt_get_vf_rep(struct bnxt *bp, u16 cfa_code);
22*4882a593Smuzhiyun 
bnxt_vf_rep_get_fid(struct net_device * dev)23*4882a593Smuzhiyun static inline u16 bnxt_vf_rep_get_fid(struct net_device *dev)
24*4882a593Smuzhiyun {
25*4882a593Smuzhiyun 	struct bnxt_vf_rep *vf_rep = netdev_priv(dev);
26*4882a593Smuzhiyun 	struct bnxt *bp = vf_rep->bp;
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun 	return bp->pf.vf[vf_rep->vf_idx].fw_fid;
29*4882a593Smuzhiyun }
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun bool bnxt_dev_is_vf_rep(struct net_device *dev);
32*4882a593Smuzhiyun int bnxt_dl_eswitch_mode_get(struct devlink *devlink, u16 *mode);
33*4882a593Smuzhiyun int bnxt_dl_eswitch_mode_set(struct devlink *devlink, u16 mode,
34*4882a593Smuzhiyun 			     struct netlink_ext_ack *extack);
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun #else
37*4882a593Smuzhiyun 
bnxt_vf_reps_close(struct bnxt * bp)38*4882a593Smuzhiyun static inline void bnxt_vf_reps_close(struct bnxt *bp)
39*4882a593Smuzhiyun {
40*4882a593Smuzhiyun }
41*4882a593Smuzhiyun 
bnxt_vf_reps_open(struct bnxt * bp)42*4882a593Smuzhiyun static inline void bnxt_vf_reps_open(struct bnxt *bp)
43*4882a593Smuzhiyun {
44*4882a593Smuzhiyun }
45*4882a593Smuzhiyun 
bnxt_vf_rep_rx(struct bnxt * bp,struct sk_buff * skb)46*4882a593Smuzhiyun static inline void bnxt_vf_rep_rx(struct bnxt *bp, struct sk_buff *skb)
47*4882a593Smuzhiyun {
48*4882a593Smuzhiyun }
49*4882a593Smuzhiyun 
bnxt_get_vf_rep(struct bnxt * bp,u16 cfa_code)50*4882a593Smuzhiyun static inline struct net_device *bnxt_get_vf_rep(struct bnxt *bp, u16 cfa_code)
51*4882a593Smuzhiyun {
52*4882a593Smuzhiyun 	return NULL;
53*4882a593Smuzhiyun }
54*4882a593Smuzhiyun 
bnxt_vf_rep_get_fid(struct net_device * dev)55*4882a593Smuzhiyun static inline u16 bnxt_vf_rep_get_fid(struct net_device *dev)
56*4882a593Smuzhiyun {
57*4882a593Smuzhiyun 	return 0;
58*4882a593Smuzhiyun }
59*4882a593Smuzhiyun 
bnxt_dev_is_vf_rep(struct net_device * dev)60*4882a593Smuzhiyun static inline bool bnxt_dev_is_vf_rep(struct net_device *dev)
61*4882a593Smuzhiyun {
62*4882a593Smuzhiyun 	return false;
63*4882a593Smuzhiyun }
64*4882a593Smuzhiyun #endif /* CONFIG_BNXT_SRIOV */
65*4882a593Smuzhiyun #endif /* BNXT_VFR_H */
66