mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-04 13:48:25 +00:00
ibmvnic: Fixup atomic API usage
Replace a couple of modifications of an atomic followed by a read of the atomic, which is no longer atomic, to use atomic_XX_return variants to avoid race conditions. Signed-off-by: Brian King <brking@linux.vnet.ibm.com> Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
59af56c25b
commit
58c8c0c096
1 changed files with 4 additions and 6 deletions
|
@ -962,9 +962,8 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
atomic_inc(&tx_scrq->used);
|
if (atomic_inc_return(&tx_scrq->used)
|
||||||
|
>= adapter->req_tx_entries_per_subcrq) {
|
||||||
if (atomic_read(&tx_scrq->used) >= adapter->req_tx_entries_per_subcrq) {
|
|
||||||
netdev_info(netdev, "Stopping queue %d\n", queue_num);
|
netdev_info(netdev, "Stopping queue %d\n", queue_num);
|
||||||
netif_stop_subqueue(netdev, queue_num);
|
netif_stop_subqueue(netdev, queue_num);
|
||||||
}
|
}
|
||||||
|
@ -1499,9 +1498,8 @@ restart_loop:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (txbuff->last_frag) {
|
if (txbuff->last_frag) {
|
||||||
atomic_dec(&scrq->used);
|
if (atomic_sub_return(next->tx_comp.num_comps,
|
||||||
|
&scrq->used) <=
|
||||||
if (atomic_read(&scrq->used) <=
|
|
||||||
(adapter->req_tx_entries_per_subcrq / 2) &&
|
(adapter->req_tx_entries_per_subcrq / 2) &&
|
||||||
netif_subqueue_stopped(adapter->netdev,
|
netif_subqueue_stopped(adapter->netdev,
|
||||||
txbuff->skb)) {
|
txbuff->skb)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue