summaryrefslogtreecommitdiff
path: root/lib/librte_pmd_e1000
diff options
context:
space:
mode:
authorIntel <intel.com>2013-07-23 00:00:00 +0200
committerThomas Monjalon <thomas.monjalon@6wind.com>2013-09-17 14:16:10 +0200
commit0f6b7c7f7a3752983a30cd9fb7fb1ffe3c3f4205 (patch)
tree8c988d771047cb005acb17605c50dee44297b30d /lib/librte_pmd_e1000
parentc25e53e079715d337d0fc9ad7f9412f08791ac01 (diff)
downloaddpdk-0f6b7c7f7a3752983a30cd9fb7fb1ffe3c3f4205.zip
dpdk-0f6b7c7f7a3752983a30cd9fb7fb1ffe3c3f4205.tar.gz
dpdk-0f6b7c7f7a3752983a30cd9fb7fb1ffe3c3f4205.tar.xz
igb: use DD bit to count RX available descriptors
Signed-off-by: Intel
Diffstat (limited to 'lib/librte_pmd_e1000')
-rw-r--r--lib/librte_pmd_e1000/em_ethdev.c2
-rw-r--r--lib/librte_pmd_e1000/em_rxtx.c27
-rw-r--r--lib/librte_pmd_e1000/igb_rxtx.c29
3 files changed, 32 insertions, 26 deletions
diff --git a/lib/librte_pmd_e1000/em_ethdev.c b/lib/librte_pmd_e1000/em_ethdev.c
index 7c6bf77..dd73e22 100644
--- a/lib/librte_pmd_e1000/em_ethdev.c
+++ b/lib/librte_pmd_e1000/em_ethdev.c
@@ -147,7 +147,7 @@ static struct eth_dev_ops eth_em_ops = {
.vlan_offload_set = eth_em_vlan_offload_set,
.rx_queue_setup = eth_em_rx_queue_setup,
.rx_queue_release = eth_em_rx_queue_release,
- .rx_queue_count = eth_em_rx_queue_count,
+ .rx_queue_count = eth_em_rx_queue_count,
.tx_queue_setup = eth_em_tx_queue_setup,
.tx_queue_release = eth_em_tx_queue_release,
.dev_led_on = eth_em_led_on,
diff --git a/lib/librte_pmd_e1000/em_rxtx.c b/lib/librte_pmd_e1000/em_rxtx.c
index b63071f..a6b2acd 100644
--- a/lib/librte_pmd_e1000/em_rxtx.c
+++ b/lib/librte_pmd_e1000/em_rxtx.c
@@ -1420,10 +1420,10 @@ eth_em_rx_queue_setup(struct rte_eth_dev *dev,
uint32_t
eth_em_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
{
+#define EM_RXQ_SCAN_INTERVAL 4
+ volatile struct e1000_rx_desc *rxdp;
struct em_rx_queue *rxq;
- uint32_t nb_pkts_available;
- uint32_t rx_rdh;
- uint32_t rx_id;
+ uint32_t desc = 0;
if (rx_queue_id >= dev->data->nb_rx_queues) {
PMD_RX_LOG(DEBUG,"Invalid RX queue_id=%d\n", rx_queue_id);
@@ -1431,15 +1431,18 @@ eth_em_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
}
rxq = dev->data->rx_queues[rx_queue_id];
- rx_id = (uint16_t) ((rxq->rx_tail == 0) ? (rxq->nb_rx_desc - 1) :
- (rxq->rx_tail - 1));
- rx_rdh = E1000_PCI_REG(rxq->rdh_reg_addr);
- if (rx_rdh > rx_id)
- nb_pkts_available = rx_rdh - rx_id;
- else
- nb_pkts_available = rx_rdh - rx_id + rxq->nb_rx_desc;
-
- return (nb_pkts_available);
+ rxdp = &(rxq->rx_ring[rxq->rx_tail]);
+
+ while ((desc < rxq->nb_rx_desc) &&
+ (rxdp->status & E1000_RXD_STAT_DD)) {
+ desc += EM_RXQ_SCAN_INTERVAL;
+ rxdp += EM_RXQ_SCAN_INTERVAL;
+ if (rxq->rx_tail + desc >= rxq->nb_rx_desc)
+ rxdp = &(rxq->rx_ring[rxq->rx_tail +
+ desc - rxq->nb_rx_desc]);
+ }
+
+ return desc;
}
void
diff --git a/lib/librte_pmd_e1000/igb_rxtx.c b/lib/librte_pmd_e1000/igb_rxtx.c
index 87fe56f..b816fb5 100644
--- a/lib/librte_pmd_e1000/igb_rxtx.c
+++ b/lib/librte_pmd_e1000/igb_rxtx.c
@@ -1391,26 +1391,29 @@ eth_igb_rx_queue_setup(struct rte_eth_dev *dev,
uint32_t
eth_igb_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
{
+#define IGB_RXQ_SCAN_INTERVAL 4
+ volatile union e1000_adv_rx_desc *rxdp;
struct igb_rx_queue *rxq;
- uint32_t nb_pkts_available;
- uint32_t rx_rdh;
- uint32_t rx_id;
+ uint32_t desc = 0;
if (rx_queue_id >= dev->data->nb_rx_queues) {
- PMD_RX_LOG(DEBUG,"Invalid RX queue_id=%d\n", rx_queue_id);
+ PMD_RX_LOG(ERR, "Invalid RX queue id=%d\n", rx_queue_id);
return 0;
}
rxq = dev->data->rx_queues[rx_queue_id];
- rx_id = (uint16_t) ((rxq->rx_tail == 0) ? (rxq->nb_rx_desc - 1) :
- (rxq->rx_tail - 1));
- rx_rdh = E1000_PCI_REG(rxq->rdh_reg_addr);
- if (rx_rdh > rx_id)
- nb_pkts_available = rx_rdh - rx_id;
- else
- nb_pkts_available = rx_rdh - rx_id + rxq->nb_rx_desc;
-
- return (nb_pkts_available);
+ rxdp = &(rxq->rx_ring[rxq->rx_tail]);
+
+ while ((desc < rxq->nb_rx_desc) &&
+ (rxdp->wb.upper.status_error & E1000_RXD_STAT_DD)) {
+ desc += IGB_RXQ_SCAN_INTERVAL;
+ rxdp += IGB_RXQ_SCAN_INTERVAL;
+ if (rxq->rx_tail + desc >= rxq->nb_rx_desc)
+ rxdp = &(rxq->rx_ring[rxq->rx_tail +
+ desc - rxq->nb_rx_desc]);
+ }
+
+ return 0;
}
void