bnxt: Move generic devlink code to new file
PATCH 1/1 bnxt: Move generic devlink code to new file
Moving generic devlink code (registration) out of VF-R code into new bnxt_devlink file, in preparation for future work to add additional devlink functionality to bnxt.
Signed-off-by Steve Lin <[email protected]>
Acked-by Andy Gospodarek <[email protected]>
--- drivers/net/ethernet/broadcom/bnxt/Makefile | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 65 +++++++++++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h | 39 ++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 53 ++---------------- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.h | 37 ++----------- 6 files changed, 112 insertions(+), 85 deletions(-) create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h
drivers/net/ethernet/broadcom/bnxt/Makefile +1 -1
@@ -1,4 +1,4 @@ obj-$(CONFIG_BNXT) += bnxt_en.o -bnxt_en-y := bnxt.o bnxt_sriov.o bnxt_ethtool.o bnxt_dcb.o bnxt_ulp.o bnxt_xdp.o bnxt_vfr.o +bnxt_en-y := bnxt.o bnxt_sriov.o bnxt_ethtool.o bnxt_dcb.o bnxt_ulp.o bnxt_xdp.o bnxt_vfr.o bnxt_devlink.o bnxt_en-$(CONFIG_BNXT_FLOWER_OFFLOAD) += bnxt_tc.o
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -0
@@ -61,6 +61,7 @@#include "bnxt_xdp.h" #include "bnxt_vfr.h" #include "bnxt_tc.h" +#include "bnxt_devlink.h" #define BNXT_TX_TIMEOUT (5 * HZ)
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c new file +65 -0
65 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h new file +39 -0
@@ -0,0 +1,39 @@ +/* Broadcom NetXtreme-C/E network driver. +* +* Copyright (c) 2017 Broadcom Limited +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation. +*/ + +#ifndef BNXT_DEVLINK_H +#define BNXT_DEVLINK_H + +/* Struct to hold housekeeping info needed by devlink interface */ +struct bnxt_dl { +struct bnxt *bp;/* back ptr to the controlling dev */ +}; + +static inline struct bnxt *bnxt_get_bp_from_dl (struct devlink *dl) +{ +return ((struct bnxt_dl *)devlink_priv (dl))->bp; +} + +/* To clear devlink pointer from bp, pass NULL dl */ +static inline void bnxt_link_bp_to_dl (struct bnxt *bp,struct devlink *dl) +{ + bp->dl = dl; + +/* add a back pointer in dl to bp */ +if (dl) { +struct bnxt_dl *bp_dl =devlink_priv (dl); + + bp_dl->bp = bp; + } +} + +int bnxt_dl_register (struct bnxt *bp); +void bnxt_dl_unregister (struct bnxt *bp); + +#endif /* BNXT_DEVLINK_H */
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c +3 -50
75 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.h +3 -34
@@ -14,31 +14,6 @@#define MAX_CFA_CODE 65536 -/* Struct to hold housekeeping info needed by devlink interface */ -struct bnxt_dl { -struct bnxt *bp;/* back ptr to the controlling dev */ -}; - -static inline struct bnxt *bnxt_get_bp_from_dl (struct devlink *dl) -{ -return ((struct bnxt_dl *)devlink_priv (dl))->bp; -} - -/* To clear devlink pointer from bp, pass NULL dl */ -static inline void bnxt_link_bp_to_dl (struct bnxt *bp,struct devlink *dl) -{ - bp->dl = dl; - -/* add a back pointer in dl to bp */ -if (dl) { -struct bnxt_dl *bp_dl =devlink_priv (dl); - - bp_dl->bp = bp; - } -} - -int bnxt_dl_register (struct bnxt *bp); -void bnxt_dl_unregister (struct bnxt *bp);void bnxt_vf_reps_destroy (struct bnxt *bp);void bnxt_vf_reps_close (struct bnxt *bp);void bnxt_vf_reps_open (struct bnxt *bp);
@@ -53,16 +28,10 @@ static inline u16 bnxt_vf_rep_get_fid(struct net_device *dev) return bp->pf.vf[vf_rep->vf_idx].fw_fid; } -#else - -static inline int bnxt_dl_register (struct bnxt *bp) -{ -return 0 ; -} +int bnxt_dl_eswitch_mode_get (struct devlink *devlink,u16 *mode); +int bnxt_dl_eswitch_mode_set (struct devlink *devlink,u16 mode); -static inline void bnxt_dl_unregister (struct bnxt *bp) -{ -} +#else static inline void bnxt_vf_reps_close (struct bnxt *bp) {
Signature · 1 line
2.7.4
From: Steve Lin <[email protected]>
Date: Thu, 19 Oct 2017 10:45:56 -0400
Quoted 6 lines
Moving generic devlink code (registration) out of VF-R code into new
bnxt_devlinkfile, in preparation for future work to add additional devlink functionality to bnxt.Signed-off-by Steve Lin <[email protected]>Acked-by Andy Gospodarek <[email protected]>
Applied.