提交 90f4fd02 编写于 作者: M Michael Chan 提交者: David S. Miller

bnxt_en: Refactor __bnxt_vf_reps_destroy().

Add a new helper function __bnxt_free_one_vf_rep() to free one VF rep.
We also reintialize the VF rep fields to proper initial values so that
the function can be used without freeing the VF rep data structure.  This
will be used in subsequent patches to free and recreate VF reps after
error recovery.
Reviewed-by: NEdwin Peer <edwin.peer@broadcom.com>
Reviewed-by: NSriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: NMichael Chan <michael.chan@broadcom.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ea2d37b2
...@@ -288,6 +288,21 @@ void bnxt_vf_reps_open(struct bnxt *bp) ...@@ -288,6 +288,21 @@ void bnxt_vf_reps_open(struct bnxt *bp)
bnxt_vf_rep_open(bp->vf_reps[i]->dev); bnxt_vf_rep_open(bp->vf_reps[i]->dev);
} }
static void __bnxt_free_one_vf_rep(struct bnxt *bp, struct bnxt_vf_rep *vf_rep)
{
if (!vf_rep)
return;
if (vf_rep->dst) {
dst_release((struct dst_entry *)vf_rep->dst);
vf_rep->dst = NULL;
}
if (vf_rep->tx_cfa_action != CFA_HANDLE_INVALID) {
hwrm_cfa_vfr_free(bp, vf_rep->vf_idx);
vf_rep->tx_cfa_action = CFA_HANDLE_INVALID;
}
}
static void __bnxt_vf_reps_destroy(struct bnxt *bp) static void __bnxt_vf_reps_destroy(struct bnxt *bp)
{ {
u16 num_vfs = pci_num_vf(bp->pdev); u16 num_vfs = pci_num_vf(bp->pdev);
...@@ -297,11 +312,7 @@ static void __bnxt_vf_reps_destroy(struct bnxt *bp) ...@@ -297,11 +312,7 @@ static void __bnxt_vf_reps_destroy(struct bnxt *bp)
for (i = 0; i < num_vfs; i++) { for (i = 0; i < num_vfs; i++) {
vf_rep = bp->vf_reps[i]; vf_rep = bp->vf_reps[i];
if (vf_rep) { if (vf_rep) {
dst_release((struct dst_entry *)vf_rep->dst); __bnxt_free_one_vf_rep(bp, vf_rep);
if (vf_rep->tx_cfa_action != CFA_HANDLE_INVALID)
hwrm_cfa_vfr_free(bp, vf_rep->vf_idx);
if (vf_rep->dev) { if (vf_rep->dev) {
/* if register_netdev failed, then netdev_ops /* if register_netdev failed, then netdev_ops
* would have been set to NULL * would have been set to NULL
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册