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