net: socionext: Use descriptor info instead of MMIO reads on Rx
MMIO reads for remaining packets in queue occur (at least)twice per invocation of netsec_process_rx(). We can use the packet descriptor to identify if it's owned by the hardware and break out, avoiding the more expensive MMIO read operations. This has a ~2% increase on the pps of the Rx path when tested with 64byte packets Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
78aca3bbee
commit
63ae7949e9
@ -642,8 +642,6 @@ static struct sk_buff *netsec_get_rx_pkt_data(struct netsec_priv *priv,
|
|||||||
|
|
||||||
tmp_skb = netsec_alloc_skb(priv, &td);
|
tmp_skb = netsec_alloc_skb(priv, &td);
|
||||||
|
|
||||||
dma_rmb();
|
|
||||||
|
|
||||||
tail = dring->tail;
|
tail = dring->tail;
|
||||||
|
|
||||||
if (!tmp_skb) {
|
if (!tmp_skb) {
|
||||||
@ -657,8 +655,6 @@ static struct sk_buff *netsec_get_rx_pkt_data(struct netsec_priv *priv,
|
|||||||
/* move tail ahead */
|
/* move tail ahead */
|
||||||
dring->tail = (dring->tail + 1) % DESC_NUM;
|
dring->tail = (dring->tail + 1) % DESC_NUM;
|
||||||
|
|
||||||
dring->pkt_cnt--;
|
|
||||||
|
|
||||||
return skb;
|
return skb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -731,25 +727,24 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget)
|
|||||||
struct netsec_desc_ring *dring = &priv->desc_ring[NETSEC_RING_RX];
|
struct netsec_desc_ring *dring = &priv->desc_ring[NETSEC_RING_RX];
|
||||||
struct net_device *ndev = priv->ndev;
|
struct net_device *ndev = priv->ndev;
|
||||||
struct netsec_rx_pkt_info rx_info;
|
struct netsec_rx_pkt_info rx_info;
|
||||||
int done = 0, rx_num = 0;
|
int done = 0;
|
||||||
struct netsec_desc desc;
|
struct netsec_desc desc;
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
u16 len;
|
u16 len;
|
||||||
|
|
||||||
while (done < budget) {
|
while (done < budget) {
|
||||||
if (!rx_num) {
|
u16 idx = dring->tail;
|
||||||
rx_num = netsec_read(priv, NETSEC_REG_NRM_RX_PKTCNT);
|
struct netsec_de *de = dring->vaddr + (DESC_SZ * idx);
|
||||||
dring->pkt_cnt += rx_num;
|
|
||||||
|
|
||||||
/* move head 'rx_num' */
|
if (de->attr & (1U << NETSEC_RX_PKT_OWN_FIELD))
|
||||||
dring->head = (dring->head + rx_num) % DESC_NUM;
|
break;
|
||||||
|
|
||||||
rx_num = dring->pkt_cnt;
|
/* This barrier is needed to keep us from reading
|
||||||
if (!rx_num)
|
* any other fields out of the netsec_de until we have
|
||||||
break;
|
* verified the descriptor has been written back
|
||||||
}
|
*/
|
||||||
|
dma_rmb();
|
||||||
done++;
|
done++;
|
||||||
rx_num--;
|
|
||||||
skb = netsec_get_rx_pkt_data(priv, &rx_info, &desc, &len);
|
skb = netsec_get_rx_pkt_data(priv, &rx_info, &desc, &len);
|
||||||
if (unlikely(!skb) || rx_info.err_flag) {
|
if (unlikely(!skb) || rx_info.err_flag) {
|
||||||
netif_err(priv, drv, priv->ndev,
|
netif_err(priv, drv, priv->ndev,
|
||||||
|
Loading…
Reference in New Issue
Block a user