Commit dc9c02b7 authored by Shinas Rasheed's avatar Shinas Rasheed Committed by David S. Miller

octeon_ep: remove atomic variable usage in Tx data path

Replace atomic variable "instr_pending" which represents number of
posted tx instructions pending completion, with host_write_idx and
flush_index variables in the xmit and completion processing respectively.
Signed-off-by: default avatarShinas Rasheed <srasheed@marvell.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 373d9a55
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#define OCTEP_64BYTE_INSTR 64 #define OCTEP_64BYTE_INSTR 64
/* Tx Queue: maximum descriptors per ring */ /* Tx Queue: maximum descriptors per ring */
/* This needs to be a power of 2 */
#define OCTEP_IQ_MAX_DESCRIPTORS 1024 #define OCTEP_IQ_MAX_DESCRIPTORS 1024
/* Minimum input (Tx) requests to be enqueued to ring doorbell */ /* Minimum input (Tx) requests to be enqueued to ring doorbell */
#define OCTEP_DB_MIN 8 #define OCTEP_DB_MIN 8
......
...@@ -777,7 +777,7 @@ static int octep_stop(struct net_device *netdev) ...@@ -777,7 +777,7 @@ static int octep_stop(struct net_device *netdev)
*/ */
static inline int octep_iq_full_check(struct octep_iq *iq) static inline int octep_iq_full_check(struct octep_iq *iq)
{ {
if (likely((iq->max_count - atomic_read(&iq->instr_pending)) >= if (likely((IQ_INSTR_SPACE(iq)) >
OCTEP_WAKE_QUEUE_THRESHOLD)) OCTEP_WAKE_QUEUE_THRESHOLD))
return 0; return 0;
...@@ -794,7 +794,7 @@ static inline int octep_iq_full_check(struct octep_iq *iq) ...@@ -794,7 +794,7 @@ static inline int octep_iq_full_check(struct octep_iq *iq)
/* check again and restart the queue, in case NAPI has just freed /* check again and restart the queue, in case NAPI has just freed
* enough Tx ring entries. * enough Tx ring entries.
*/ */
if (unlikely((iq->max_count - atomic_read(&iq->instr_pending)) >= if (unlikely(IQ_INSTR_SPACE(iq) >
OCTEP_WAKE_QUEUE_THRESHOLD)) { OCTEP_WAKE_QUEUE_THRESHOLD)) {
netif_start_subqueue(iq->netdev, iq->q_no); netif_start_subqueue(iq->netdev, iq->q_no);
iq->stats.restart_cnt++; iq->stats.restart_cnt++;
...@@ -903,12 +903,9 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb, ...@@ -903,12 +903,9 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb,
__netdev_tx_sent_queue(iq->netdev_q, skb->len, xmit_more); __netdev_tx_sent_queue(iq->netdev_q, skb->len, xmit_more);
skb_tx_timestamp(skb); skb_tx_timestamp(skb);
atomic_inc(&iq->instr_pending);
iq->fill_cnt++; iq->fill_cnt++;
wi++; wi++;
if (wi == iq->max_count) iq->host_write_index = wi & iq->ring_size_mask;
wi = 0;
iq->host_write_index = wi;
/* octep_iq_full_check stops the queue and returns /* octep_iq_full_check stops the queue and returns
* true if so, in case the queue has become full * true if so, in case the queue has become full
......
...@@ -40,6 +40,15 @@ ...@@ -40,6 +40,15 @@
#define OCTEP_OQ_INTR_RESEND_BIT 59 #define OCTEP_OQ_INTR_RESEND_BIT 59
#define OCTEP_MMIO_REGIONS 3 #define OCTEP_MMIO_REGIONS 3
#define IQ_INSTR_PENDING(iq) ({ typeof(iq) iq__ = (iq); \
((iq__)->host_write_index - (iq__)->flush_index) & \
(iq__)->ring_size_mask; \
})
#define IQ_INSTR_SPACE(iq) ({ typeof(iq) iq_ = (iq); \
(iq_)->max_count - IQ_INSTR_PENDING(iq_); \
})
/* PCI address space mapping information. /* PCI address space mapping information.
* Each of the 3 address spaces given by BAR0, BAR2 and BAR4 of * Each of the 3 address spaces given by BAR0, BAR2 and BAR4 of
* Octeon gets mapped to different physical address spaces in * Octeon gets mapped to different physical address spaces in
......
...@@ -21,7 +21,6 @@ static void octep_iq_reset_indices(struct octep_iq *iq) ...@@ -21,7 +21,6 @@ static void octep_iq_reset_indices(struct octep_iq *iq)
iq->flush_index = 0; iq->flush_index = 0;
iq->pkts_processed = 0; iq->pkts_processed = 0;
iq->pkt_in_done = 0; iq->pkt_in_done = 0;
atomic_set(&iq->instr_pending, 0);
} }
/** /**
...@@ -82,7 +81,6 @@ int octep_iq_process_completions(struct octep_iq *iq, u16 budget) ...@@ -82,7 +81,6 @@ int octep_iq_process_completions(struct octep_iq *iq, u16 budget)
} }
iq->pkts_processed += compl_pkts; iq->pkts_processed += compl_pkts;
atomic_sub(compl_pkts, &iq->instr_pending);
iq->stats.instr_completed += compl_pkts; iq->stats.instr_completed += compl_pkts;
iq->stats.bytes_sent += compl_bytes; iq->stats.bytes_sent += compl_bytes;
iq->stats.sgentry_sent += compl_sg; iq->stats.sgentry_sent += compl_sg;
...@@ -91,7 +89,7 @@ int octep_iq_process_completions(struct octep_iq *iq, u16 budget) ...@@ -91,7 +89,7 @@ int octep_iq_process_completions(struct octep_iq *iq, u16 budget)
netdev_tx_completed_queue(iq->netdev_q, compl_pkts, compl_bytes); netdev_tx_completed_queue(iq->netdev_q, compl_pkts, compl_bytes);
if (unlikely(__netif_subqueue_stopped(iq->netdev, iq->q_no)) && if (unlikely(__netif_subqueue_stopped(iq->netdev, iq->q_no)) &&
((iq->max_count - atomic_read(&iq->instr_pending)) > (IQ_INSTR_SPACE(iq) >
OCTEP_WAKE_QUEUE_THRESHOLD)) OCTEP_WAKE_QUEUE_THRESHOLD))
netif_wake_subqueue(iq->netdev, iq->q_no); netif_wake_subqueue(iq->netdev, iq->q_no);
return !budget; return !budget;
...@@ -144,7 +142,6 @@ static void octep_iq_free_pending(struct octep_iq *iq) ...@@ -144,7 +142,6 @@ static void octep_iq_free_pending(struct octep_iq *iq)
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
} }
atomic_set(&iq->instr_pending, 0);
iq->flush_index = fi; iq->flush_index = fi;
netdev_tx_reset_queue(netdev_get_tx_queue(iq->netdev, iq->q_no)); netdev_tx_reset_queue(netdev_get_tx_queue(iq->netdev, iq->q_no));
} }
......
...@@ -172,9 +172,6 @@ struct octep_iq { ...@@ -172,9 +172,6 @@ struct octep_iq {
/* Statistics for this input queue. */ /* Statistics for this input queue. */
struct octep_iq_stats stats; struct octep_iq_stats stats;
/* This field keeps track of the instructions pending in this queue. */
atomic_t instr_pending;
/* Pointer to the Virtual Base addr of the input ring. */ /* Pointer to the Virtual Base addr of the input ring. */
struct octep_tx_desc_hw *desc_ring; struct octep_tx_desc_hw *desc_ring;
......
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