ixgbe: pull out stats update to common routines
Introduce ixgbe_update_{r,t}x_ring_stats() that will be used by both standard and ZC datapath. Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
This commit is contained in:
parent
60e4caf36b
commit
836aeaf73a
@ -1105,6 +1105,44 @@ static int ixgbe_tx_maxrate(struct net_device *netdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_update_tx_ring_stats - Update Tx ring specific counters
|
||||
* @tx_ring: ring to update
|
||||
* @q_vector: queue vector ring belongs to
|
||||
* @pkts: number of processed packets
|
||||
* @bytes: number of processed bytes
|
||||
*/
|
||||
void ixgbe_update_tx_ring_stats(struct ixgbe_ring *tx_ring,
|
||||
struct ixgbe_q_vector *q_vector, u64 pkts,
|
||||
u64 bytes)
|
||||
{
|
||||
u64_stats_update_begin(&tx_ring->syncp);
|
||||
tx_ring->stats.bytes += bytes;
|
||||
tx_ring->stats.packets += pkts;
|
||||
u64_stats_update_end(&tx_ring->syncp);
|
||||
q_vector->tx.total_bytes += bytes;
|
||||
q_vector->tx.total_packets += pkts;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_update_rx_ring_stats - Update Rx ring specific counters
|
||||
* @rx_ring: ring to update
|
||||
* @q_vector: queue vector ring belongs to
|
||||
* @pkts: number of processed packets
|
||||
* @bytes: number of processed bytes
|
||||
*/
|
||||
void ixgbe_update_rx_ring_stats(struct ixgbe_ring *rx_ring,
|
||||
struct ixgbe_q_vector *q_vector, u64 pkts,
|
||||
u64 bytes)
|
||||
{
|
||||
u64_stats_update_begin(&rx_ring->syncp);
|
||||
rx_ring->stats.bytes += bytes;
|
||||
rx_ring->stats.packets += pkts;
|
||||
u64_stats_update_end(&rx_ring->syncp);
|
||||
q_vector->rx.total_bytes += bytes;
|
||||
q_vector->rx.total_packets += pkts;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_clean_tx_irq - Reclaim resources after transmit completes
|
||||
* @q_vector: structure containing interrupt and ring information
|
||||
@ -1207,12 +1245,8 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
|
||||
|
||||
i += tx_ring->count;
|
||||
tx_ring->next_to_clean = i;
|
||||
u64_stats_update_begin(&tx_ring->syncp);
|
||||
tx_ring->stats.bytes += total_bytes;
|
||||
tx_ring->stats.packets += total_packets;
|
||||
u64_stats_update_end(&tx_ring->syncp);
|
||||
q_vector->tx.total_bytes += total_bytes;
|
||||
q_vector->tx.total_packets += total_packets;
|
||||
ixgbe_update_tx_ring_stats(tx_ring, q_vector, total_packets,
|
||||
total_bytes);
|
||||
adapter->tx_ipsec += total_ipsec;
|
||||
|
||||
if (check_for_tx_hang(tx_ring) && ixgbe_check_tx_hang(tx_ring)) {
|
||||
@ -2429,12 +2463,8 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
|
||||
ixgbe_xdp_ring_update_tail_locked(ring);
|
||||
}
|
||||
|
||||
u64_stats_update_begin(&rx_ring->syncp);
|
||||
rx_ring->stats.packets += total_rx_packets;
|
||||
rx_ring->stats.bytes += total_rx_bytes;
|
||||
u64_stats_update_end(&rx_ring->syncp);
|
||||
q_vector->rx.total_packets += total_rx_packets;
|
||||
q_vector->rx.total_bytes += total_rx_bytes;
|
||||
ixgbe_update_rx_ring_stats(rx_ring, q_vector, total_rx_packets,
|
||||
total_rx_bytes);
|
||||
|
||||
return total_rx_packets;
|
||||
}
|
||||
|
@ -46,4 +46,11 @@ bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector,
|
||||
int ixgbe_xsk_wakeup(struct net_device *dev, u32 queue_id, u32 flags);
|
||||
void ixgbe_xsk_clean_tx_ring(struct ixgbe_ring *tx_ring);
|
||||
|
||||
void ixgbe_update_tx_ring_stats(struct ixgbe_ring *tx_ring,
|
||||
struct ixgbe_q_vector *q_vector, u64 pkts,
|
||||
u64 bytes);
|
||||
void ixgbe_update_rx_ring_stats(struct ixgbe_ring *rx_ring,
|
||||
struct ixgbe_q_vector *q_vector, u64 pkts,
|
||||
u64 bytes);
|
||||
|
||||
#endif /* #define _IXGBE_TXRX_COMMON_H_ */
|
||||
|
@ -359,12 +359,8 @@ construct_skb:
|
||||
ixgbe_xdp_ring_update_tail_locked(ring);
|
||||
}
|
||||
|
||||
u64_stats_update_begin(&rx_ring->syncp);
|
||||
rx_ring->stats.packets += total_rx_packets;
|
||||
rx_ring->stats.bytes += total_rx_bytes;
|
||||
u64_stats_update_end(&rx_ring->syncp);
|
||||
q_vector->rx.total_packets += total_rx_packets;
|
||||
q_vector->rx.total_bytes += total_rx_bytes;
|
||||
ixgbe_update_rx_ring_stats(rx_ring, q_vector, total_rx_packets,
|
||||
total_rx_bytes);
|
||||
|
||||
if (xsk_uses_need_wakeup(rx_ring->xsk_pool)) {
|
||||
if (failure || rx_ring->next_to_clean == rx_ring->next_to_use)
|
||||
@ -499,13 +495,8 @@ bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector,
|
||||
}
|
||||
|
||||
tx_ring->next_to_clean = ntc;
|
||||
|
||||
u64_stats_update_begin(&tx_ring->syncp);
|
||||
tx_ring->stats.bytes += total_bytes;
|
||||
tx_ring->stats.packets += total_packets;
|
||||
u64_stats_update_end(&tx_ring->syncp);
|
||||
q_vector->tx.total_bytes += total_bytes;
|
||||
q_vector->tx.total_packets += total_packets;
|
||||
ixgbe_update_tx_ring_stats(tx_ring, q_vector, total_packets,
|
||||
total_bytes);
|
||||
|
||||
if (xsk_frames)
|
||||
xsk_tx_completed(pool, xsk_frames);
|
||||
|
Loading…
x
Reference in New Issue
Block a user