cxgbe: Minor fixes in cxgbe pmd
cover cxgbe: Minor fixes in cxgbe pmd
This series of patches fix some issues and recent regressions in cxgbe pmd.
Patch 1 fixes a regression where queue setup for cxgbe pmd fails with -EINVAL because cxgbe pmd requires a min of 1024 descriptors, but most examples and apps initialize with 128 rx descriptors and 512 tx descriptors.
Patch 2 replaces spinning for a lock with a better trylock in tx alarm callback.
Rahul Lakkireddy (2):
cxgbe: fix queue setup failure due to strict min desc requirement
cxgbe: fix unnecessary spinning for a lock with trylock instead
drivers/net/cxgbe/base/adapter.h | 9 +++++++++ drivers/net/cxgbe/cxgbe.h | 2 +- drivers/net/cxgbe/sge.c | 21 ++++++++++++--------- 3 files changed, 22 insertions(+), 10 deletions(-)
Signature · 1 line
2.5.3
PATCH 1/2 cxgbe: fix queue setup failure due to strict min desc requirement
Most dpdk examples and apps seem to initialize with a minimum of 128 rx descriptors and 512 tx descriptors for queue setup. However, CXGBE PMD enforces a minimum of 1024 descriptors. This causes the dpdk stack to return -EINVAL because the apps do not request the minimum required.
The fix is to relax this enforcing in CXGBE PMD. A minimum of 128 descriptors seems to be a good number with the least impact on the performance.
--- drivers/net/cxgbe/cxgbe.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/cxgbe/cxgbe.h +1 -1
@@ -37,7 +37,7 @@#include "common.h" #include "t4_regs.h" -#define CXGBE_MIN_RING_DESC_SIZE 1024/* Min TX/RX descriptor ring size */ +#define CXGBE_MIN_RING_DESC_SIZE 128/* Min TX/RX descriptor ring size */ #define CXGBE_MAX_RING_DESC_SIZE 4096/* Max TX/RX descriptor ring size */ #define CXGBE_DEFAULT_TX_DESC_SIZE 1024/* Default TX ring size */
Signature · 1 line
2.5.3
PATCH 2/2 cxgbe: fix unnecessary spinning for a lock with trylock instead
In reply to Rahul LakkireddyCXGBE PMD depends on an alarm to periodically transmit any pending coalesced packets and hence spins for a lock for each tx queue in the alarm callback.
A better solution is to try to get a lock whenever possible, instead of spinning for it.
--- drivers/net/cxgbe/base/adapter.h | 9 +++++++++ drivers/net/cxgbe/sge.c | 21 ++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-)
drivers/net/cxgbe/base/adapter.h +9 -0
@@ -473,6 +473,15 @@ static inline void t4_os_unlock(rte_spinlock_t *lock) }/** +* t4_os_trylock - try to get a lock +* @lock: the spinlock +*/ +static inline int t4_os_trylock (rte_spinlock_t *lock) +{ +return rte_spinlock_trylock (lock); +} + +/** * t4_os_init_list_head - initialize * @head: head of list to initialize [to empty] */
drivers/net/cxgbe/sge.c +12 -9
@@ -808,20 +808,23 @@ static void tx_timer_cb(void *data)struct adapter *adap = (struct adapter *)data;struct sge_eth_txq *txq = &adap->sge.ethtxq[0 ];int i; +unsigned int coal_idx;/* monitor any pending tx */ for (i =0 ; i < adap->sge.max_ethqsets; i++, txq++) { -t4_os_lock (&txq->txq_lock); -if (txq->q.coalesce.idx) { -if (txq->q.coalesce.idx == txq->q.last_coal_idx && - txq->q.pidx == txq->q.last_pidx) { -ship_tx_pkt_coalesce_wr (adap, txq); - }else { - txq->q.last_coal_idx = txq->q.coalesce.idx; - txq->q.last_pidx = txq->q.pidx; +if (t4_os_trylock (&txq->txq_lock)) { + coal_idx = txq->q.coalesce.idx; +if (coal_idx) { +if (coal_idx == txq->q.last_coal_idx && + txq->q.pidx == txq->q.last_pidx) { +ship_tx_pkt_coalesce_wr (adap, txq); + }else { + txq->q.last_coal_idx = coal_idx; + txq->q.last_pidx = txq->q.pidx; + } } +t4_os_unlock (&txq->txq_lock); } -t4_os_unlock (&txq->txq_lock); }rte_eal_alarm_set (50 , tx_timer_cb, (void *)adap); }
Signature · 1 line
2.5.3
Thomas Monjalon
Applied2015-11-20 18:43, Rahul Lakkireddy:
Quoted 7 lines
This series of patches fix some issues and recent regressions in cxgbe pmd.
Patch 1 fixes a regression where queue setup for cxgbe pmd fails with
-EINVALbecause cxgbe pmd requires a min of 1024 descriptors, but most examples and apps initialize with 128 rx descriptors and 512 tx descriptors.
Quoted 6 lines
Patch 2 replaces spinning for a lock with a better trylock in tx alarm callback.
Rahul Lakkireddy (2):
cxgbe: fix queue setup failure due to strict min desc requirement
cxgbe: fix unnecessary spinning for a lock with trylock instead
Applied, thanks