Skip to content

Commit e9e1e97

Browse files
tlfalcondavem330
authored andcommitted
ibmvnic: Update TX pool cleaning routine
Update routine that cleans up any outstanding transmits that have not received completions when the device needs to close. Introduces a helper function that cleans one TX pool to make code more readable. Signed-off-by: Thomas Falcon <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 86b61a5 commit e9e1e97

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

drivers/net/ethernet/ibm/ibmvnic.c

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,34 +1128,42 @@ static void clean_rx_pools(struct ibmvnic_adapter *adapter)
11281128
}
11291129
}
11301130

1131-
static void clean_tx_pools(struct ibmvnic_adapter *adapter)
1131+
static void clean_one_tx_pool(struct ibmvnic_adapter *adapter,
1132+
struct ibmvnic_tx_pool *tx_pool)
11321133
{
1133-
struct ibmvnic_tx_pool *tx_pool;
11341134
struct ibmvnic_tx_buff *tx_buff;
11351135
u64 tx_entries;
1136+
int i;
1137+
1138+
if (!tx_pool && !tx_pool->tx_buff)
1139+
return;
1140+
1141+
tx_entries = tx_pool->num_buffers;
1142+
1143+
for (i = 0; i < tx_entries; i++) {
1144+
tx_buff = &tx_pool->tx_buff[i];
1145+
if (tx_buff && tx_buff->skb) {
1146+
dev_kfree_skb_any(tx_buff->skb);
1147+
tx_buff->skb = NULL;
1148+
}
1149+
}
1150+
}
1151+
1152+
static void clean_tx_pools(struct ibmvnic_adapter *adapter)
1153+
{
11361154
int tx_scrqs;
1137-
int i, j;
1155+
int i;
11381156

1139-
if (!adapter->tx_pool)
1157+
if (!adapter->tx_pool || !adapter->tso_pool)
11401158
return;
11411159

11421160
tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs);
1143-
tx_entries = adapter->req_tx_entries_per_subcrq;
11441161

11451162
/* Free any remaining skbs in the tx buffer pools */
11461163
for (i = 0; i < tx_scrqs; i++) {
1147-
tx_pool = &adapter->tx_pool[i];
1148-
if (!tx_pool && !tx_pool->tx_buff)
1149-
continue;
1150-
11511164
netdev_dbg(adapter->netdev, "Cleaning tx_pool[%d]\n", i);
1152-
for (j = 0; j < tx_entries; j++) {
1153-
tx_buff = &tx_pool->tx_buff[j];
1154-
if (tx_buff && tx_buff->skb) {
1155-
dev_kfree_skb_any(tx_buff->skb);
1156-
tx_buff->skb = NULL;
1157-
}
1158-
}
1165+
clean_one_tx_pool(adapter, &adapter->tx_pool[i]);
1166+
clean_one_tx_pool(adapter, &adapter->tso_pool[i]);
11591167
}
11601168
}
11611169

0 commit comments

Comments
 (0)