162306a36Sopenharmony_ci/* Broadcom NetXtreme-C/E network driver.
262306a36Sopenharmony_ci *
362306a36Sopenharmony_ci * Copyright (c) 2016-2017 Broadcom Limited
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * This program is free software; you can redistribute it and/or modify
662306a36Sopenharmony_ci * it under the terms of the GNU General Public License as published by
762306a36Sopenharmony_ci * the Free Software Foundation.
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#ifndef BNXT_VFR_H
1162306a36Sopenharmony_ci#define BNXT_VFR_H
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#ifdef CONFIG_BNXT_SRIOV
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#define	MAX_CFA_CODE			65536
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ciint bnxt_vf_reps_create(struct bnxt *bp);
1862306a36Sopenharmony_civoid bnxt_vf_reps_destroy(struct bnxt *bp);
1962306a36Sopenharmony_civoid bnxt_vf_reps_close(struct bnxt *bp);
2062306a36Sopenharmony_civoid bnxt_vf_reps_open(struct bnxt *bp);
2162306a36Sopenharmony_civoid bnxt_vf_rep_rx(struct bnxt *bp, struct sk_buff *skb);
2262306a36Sopenharmony_cistruct net_device *bnxt_get_vf_rep(struct bnxt *bp, u16 cfa_code);
2362306a36Sopenharmony_ciint bnxt_vf_reps_alloc(struct bnxt *bp);
2462306a36Sopenharmony_civoid bnxt_vf_reps_free(struct bnxt *bp);
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_cistatic inline u16 bnxt_vf_rep_get_fid(struct net_device *dev)
2762306a36Sopenharmony_ci{
2862306a36Sopenharmony_ci	struct bnxt_vf_rep *vf_rep = netdev_priv(dev);
2962306a36Sopenharmony_ci	struct bnxt *bp = vf_rep->bp;
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci	return bp->pf.vf[vf_rep->vf_idx].fw_fid;
3262306a36Sopenharmony_ci}
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_cibool bnxt_dev_is_vf_rep(struct net_device *dev);
3562306a36Sopenharmony_ciint bnxt_dl_eswitch_mode_get(struct devlink *devlink, u16 *mode);
3662306a36Sopenharmony_ciint bnxt_dl_eswitch_mode_set(struct devlink *devlink, u16 mode,
3762306a36Sopenharmony_ci			     struct netlink_ext_ack *extack);
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci#else
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_cistatic inline int bnxt_vf_reps_create(struct bnxt *bp)
4262306a36Sopenharmony_ci{
4362306a36Sopenharmony_ci	return 0;
4462306a36Sopenharmony_ci}
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_cistatic inline void bnxt_vf_reps_close(struct bnxt *bp)
4762306a36Sopenharmony_ci{
4862306a36Sopenharmony_ci}
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_cistatic inline void bnxt_vf_reps_open(struct bnxt *bp)
5162306a36Sopenharmony_ci{
5262306a36Sopenharmony_ci}
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_cistatic inline void bnxt_vf_rep_rx(struct bnxt *bp, struct sk_buff *skb)
5562306a36Sopenharmony_ci{
5662306a36Sopenharmony_ci}
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_cistatic inline struct net_device *bnxt_get_vf_rep(struct bnxt *bp, u16 cfa_code)
5962306a36Sopenharmony_ci{
6062306a36Sopenharmony_ci	return NULL;
6162306a36Sopenharmony_ci}
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_cistatic inline u16 bnxt_vf_rep_get_fid(struct net_device *dev)
6462306a36Sopenharmony_ci{
6562306a36Sopenharmony_ci	return 0;
6662306a36Sopenharmony_ci}
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_cistatic inline bool bnxt_dev_is_vf_rep(struct net_device *dev)
6962306a36Sopenharmony_ci{
7062306a36Sopenharmony_ci	return false;
7162306a36Sopenharmony_ci}
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_cistatic inline int bnxt_vf_reps_alloc(struct bnxt *bp)
7462306a36Sopenharmony_ci{
7562306a36Sopenharmony_ci	return 0;
7662306a36Sopenharmony_ci}
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_cistatic inline void bnxt_vf_reps_free(struct bnxt *bp)
7962306a36Sopenharmony_ci{
8062306a36Sopenharmony_ci}
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci#endif /* CONFIG_BNXT_SRIOV */
8362306a36Sopenharmony_ci#endif /* BNXT_VFR_H */
84