bna: Initialization and Locking Fix
Change details: - Initialize rx_id to 0 for bnad_cleanup_rx - Return -ENOMEM in case if bna_rx_create fails - Count the Rx buffer allocation failures in bnad_alloc_n_post_rxbufs() - Remove unnecessary initialization of using_dac to false in bnad_pci_probe - Release lock if error while doing bna_num_txq_set in bnad_pci_probe Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com> Signed-off-by: Rasesh Mody <rmody@brocade.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
19dbff9fee
commit
3caa1e9556
@@ -99,6 +99,7 @@
|
|||||||
(_bna)->bits.error_status_bits = (__HFN_INT_ERR_MASK); \
|
(_bna)->bits.error_status_bits = (__HFN_INT_ERR_MASK); \
|
||||||
(_bna)->bits.error_mask_bits = (__HFN_INT_ERR_MASK); \
|
(_bna)->bits.error_mask_bits = (__HFN_INT_ERR_MASK); \
|
||||||
(_bna)->bits.halt_status_bits = __HFN_INT_LL_HALT; \
|
(_bna)->bits.halt_status_bits = __HFN_INT_LL_HALT; \
|
||||||
|
(_bna)->bits.halt_mask_bits = __HFN_INT_LL_HALT; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ct2_reg_addr_init(_bna, _pcidev) \
|
#define ct2_reg_addr_init(_bna, _pcidev) \
|
||||||
|
@@ -393,6 +393,7 @@ bnad_alloc_n_post_rxbufs(struct bnad *bnad, struct bna_rcb *rcb)
|
|||||||
rcb->rxq->buffer_size);
|
rcb->rxq->buffer_size);
|
||||||
if (unlikely(!skb)) {
|
if (unlikely(!skb)) {
|
||||||
BNAD_UPDATE_CTR(bnad, rxbuf_alloc_failed);
|
BNAD_UPDATE_CTR(bnad, rxbuf_alloc_failed);
|
||||||
|
rcb->rxq->rxbuf_alloc_failed++;
|
||||||
goto finishing;
|
goto finishing;
|
||||||
}
|
}
|
||||||
unmap_array[unmap_prod].skb = skb;
|
unmap_array[unmap_prod].skb = skb;
|
||||||
@@ -1892,6 +1893,7 @@ bnad_cleanup_rx(struct bnad *bnad, u32 rx_id)
|
|||||||
spin_unlock_irqrestore(&bnad->bna_lock, flags);
|
spin_unlock_irqrestore(&bnad->bna_lock, flags);
|
||||||
|
|
||||||
rx_info->rx = NULL;
|
rx_info->rx = NULL;
|
||||||
|
rx_info->rx_id = 0;
|
||||||
|
|
||||||
bnad_rx_res_free(bnad, res_info);
|
bnad_rx_res_free(bnad, res_info);
|
||||||
}
|
}
|
||||||
@@ -1947,8 +1949,10 @@ bnad_setup_rx(struct bnad *bnad, u32 rx_id)
|
|||||||
rx = bna_rx_create(&bnad->bna, bnad, rx_config, &rx_cbfn, res_info,
|
rx = bna_rx_create(&bnad->bna, bnad, rx_config, &rx_cbfn, res_info,
|
||||||
rx_info);
|
rx_info);
|
||||||
spin_unlock_irqrestore(&bnad->bna_lock, flags);
|
spin_unlock_irqrestore(&bnad->bna_lock, flags);
|
||||||
if (!rx)
|
if (!rx) {
|
||||||
|
err = -ENOMEM;
|
||||||
goto err_return;
|
goto err_return;
|
||||||
|
}
|
||||||
rx_info->rx = rx;
|
rx_info->rx = rx;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3206,7 +3210,7 @@ static int __devinit
|
|||||||
bnad_pci_probe(struct pci_dev *pdev,
|
bnad_pci_probe(struct pci_dev *pdev,
|
||||||
const struct pci_device_id *pcidev_id)
|
const struct pci_device_id *pcidev_id)
|
||||||
{
|
{
|
||||||
bool using_dac = false;
|
bool using_dac;
|
||||||
int err;
|
int err;
|
||||||
struct bnad *bnad;
|
struct bnad *bnad;
|
||||||
struct bna *bna;
|
struct bna *bna;
|
||||||
@@ -3329,6 +3333,11 @@ bnad_pci_probe(struct pci_dev *pdev,
|
|||||||
bna_num_rxp_set(bna, BNAD_NUM_RXP + 1))
|
bna_num_rxp_set(bna, BNAD_NUM_RXP + 1))
|
||||||
err = -EIO;
|
err = -EIO;
|
||||||
}
|
}
|
||||||
|
spin_unlock_irqrestore(&bnad->bna_lock, flags);
|
||||||
|
if (err)
|
||||||
|
goto disable_ioceth;
|
||||||
|
|
||||||
|
spin_lock_irqsave(&bnad->bna_lock, flags);
|
||||||
bna_mod_res_req(&bnad->bna, &bnad->mod_res_info[0]);
|
bna_mod_res_req(&bnad->bna, &bnad->mod_res_info[0]);
|
||||||
spin_unlock_irqrestore(&bnad->bna_lock, flags);
|
spin_unlock_irqrestore(&bnad->bna_lock, flags);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user