Commit eb36bedf authored by Lino Sanfilippo's avatar Lino Sanfilippo Committed by David S. Miller

net: aquantia: remove function aq_ring_tx_deinit

Both functions aq_ring_rx_deinit() and aq_ring_tx_clean() are almost
identical aside from an additional check in the latter.
Move that check from the function into its caller and replace
aq_ring_rx_deinit() with aq_ring_rx_deinit().

By doing this also adjust the functions return value from int to void
since it can never fail.
Signed-off-by: default avatarLino Sanfilippo <LinoSanfilippo@gmx.de>
Tested-by: default avatarPavel Belous <pavel.belous@aquantia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 90a6c997
...@@ -123,7 +123,7 @@ void aq_ring_tx_append_buffs(struct aq_ring_s *self, ...@@ -123,7 +123,7 @@ void aq_ring_tx_append_buffs(struct aq_ring_s *self,
} }
} }
int aq_ring_tx_clean(struct aq_ring_s *self) void aq_ring_tx_clean(struct aq_ring_s *self)
{ {
struct device *dev = aq_nic_get_dev(self->aq_nic); struct device *dev = aq_nic_get_dev(self->aq_nic);
...@@ -143,11 +143,6 @@ int aq_ring_tx_clean(struct aq_ring_s *self) ...@@ -143,11 +143,6 @@ int aq_ring_tx_clean(struct aq_ring_s *self)
if (unlikely(buff->is_eop)) if (unlikely(buff->is_eop))
dev_kfree_skb_any(buff->skb); dev_kfree_skb_any(buff->skb);
} }
if (aq_ring_avail_dx(self) > AQ_CFG_SKB_FRAGS_MAX)
aq_nic_ndev_queue_start(self->aq_nic, self->idx);
return 0;
} }
static inline unsigned int aq_ring_dx_in_range(unsigned int h, unsigned int i, static inline unsigned int aq_ring_dx_in_range(unsigned int h, unsigned int i,
...@@ -333,32 +328,6 @@ void aq_ring_rx_deinit(struct aq_ring_s *self) ...@@ -333,32 +328,6 @@ void aq_ring_rx_deinit(struct aq_ring_s *self)
err_exit:; err_exit:;
} }
void aq_ring_tx_deinit(struct aq_ring_s *self)
{
if (!self)
goto err_exit;
for (; self->sw_head != self->sw_tail;
self->sw_head = aq_ring_next_dx(self, self->sw_head)) {
struct aq_ring_buff_s *buff = &self->buff_ring[self->sw_head];
struct device *ndev = aq_nic_get_dev(self->aq_nic);
if (likely(buff->is_mapped)) {
if (unlikely(buff->is_sop)) {
dma_unmap_single(ndev, buff->pa, buff->len,
DMA_TO_DEVICE);
} else {
dma_unmap_page(ndev, buff->pa, buff->len,
DMA_TO_DEVICE);
}
}
if (unlikely(buff->is_eop))
dev_kfree_skb_any(buff->skb);
}
err_exit:;
}
void aq_ring_free(struct aq_ring_s *self) void aq_ring_free(struct aq_ring_s *self)
{ {
if (!self) if (!self)
......
...@@ -144,13 +144,12 @@ struct aq_ring_s *aq_ring_rx_alloc(struct aq_ring_s *self, ...@@ -144,13 +144,12 @@ struct aq_ring_s *aq_ring_rx_alloc(struct aq_ring_s *self,
unsigned int idx, unsigned int idx,
struct aq_nic_cfg_s *aq_nic_cfg); struct aq_nic_cfg_s *aq_nic_cfg);
int aq_ring_init(struct aq_ring_s *self); int aq_ring_init(struct aq_ring_s *self);
void aq_ring_tx_deinit(struct aq_ring_s *self);
void aq_ring_rx_deinit(struct aq_ring_s *self); void aq_ring_rx_deinit(struct aq_ring_s *self);
void aq_ring_free(struct aq_ring_s *self); void aq_ring_free(struct aq_ring_s *self);
void aq_ring_tx_append_buffs(struct aq_ring_s *ring, void aq_ring_tx_append_buffs(struct aq_ring_s *ring,
struct aq_ring_buff_s *buffer, struct aq_ring_buff_s *buffer,
unsigned int buffers); unsigned int buffers);
int aq_ring_tx_clean(struct aq_ring_s *self); void aq_ring_tx_clean(struct aq_ring_s *self);
int aq_ring_rx_clean(struct aq_ring_s *self, int *work_done, int budget); int aq_ring_rx_clean(struct aq_ring_s *self, int *work_done, int budget);
int aq_ring_rx_fill(struct aq_ring_s *self); int aq_ring_rx_fill(struct aq_ring_s *self);
......
...@@ -59,10 +59,14 @@ __acquires(&self->lock) ...@@ -59,10 +59,14 @@ __acquires(&self->lock)
} }
if (ring[AQ_VEC_TX_ID].sw_head != if (ring[AQ_VEC_TX_ID].sw_head !=
ring[AQ_VEC_TX_ID].hw_head) { ring[AQ_VEC_TX_ID].hw_head) {
err = aq_ring_tx_clean(&ring[AQ_VEC_TX_ID]); aq_ring_tx_clean(&ring[AQ_VEC_TX_ID]);
if (err < 0)
goto err_exit; if (aq_ring_avail_dx(&ring[AQ_VEC_TX_ID]) >
AQ_CFG_SKB_FRAGS_MAX) {
aq_nic_ndev_queue_start(self->aq_nic,
ring[AQ_VEC_TX_ID].idx);
}
was_tx_cleaned = true; was_tx_cleaned = true;
} }
...@@ -271,7 +275,7 @@ void aq_vec_deinit(struct aq_vec_s *self) ...@@ -271,7 +275,7 @@ void aq_vec_deinit(struct aq_vec_s *self)
for (i = 0U, ring = self->ring[0]; for (i = 0U, ring = self->ring[0];
self->tx_rings > i; ++i, ring = self->ring[i]) { self->tx_rings > i; ++i, ring = self->ring[i]) {
aq_ring_tx_deinit(&ring[AQ_VEC_TX_ID]); aq_ring_tx_clean(&ring[AQ_VEC_TX_ID]);
aq_ring_rx_deinit(&ring[AQ_VEC_RX_ID]); aq_ring_rx_deinit(&ring[AQ_VEC_RX_ID]);
} }
err_exit:; err_exit:;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment