Commit 5e848e4c authored by Sunil Goutham's avatar Sunil Goutham Committed by David S. Miller

net: thunderx: Optimize RBDR descriptor handling

Receive buffer's physical address or iova will anyway not
go beyond 49bits, since it is the max supported HW address.
As per perf, updating bitfields i.e buf_addr:42 in RBDR
descriptor entry consumes lots of cpu cycles, hence changed
it to a 64bit field with alignment requirements taken care of.
Signed-off-by: default avatarSunil Goutham <sgoutham@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5836b442
...@@ -257,7 +257,7 @@ static int nicvf_init_rbdr(struct nicvf *nic, struct rbdr *rbdr, ...@@ -257,7 +257,7 @@ static int nicvf_init_rbdr(struct nicvf *nic, struct rbdr *rbdr,
} }
desc = GET_RBDR_DESC(rbdr, idx); desc = GET_RBDR_DESC(rbdr, idx);
desc->buf_addr = (u64)rbuf >> NICVF_RCV_BUF_ALIGN; desc->buf_addr = (u64)rbuf & ~(NICVF_RCV_BUF_ALIGN_BYTES - 1);
} }
nicvf_get_page(nic); nicvf_get_page(nic);
...@@ -286,7 +286,7 @@ static void nicvf_free_rbdr(struct nicvf *nic, struct rbdr *rbdr) ...@@ -286,7 +286,7 @@ static void nicvf_free_rbdr(struct nicvf *nic, struct rbdr *rbdr)
/* Release page references */ /* Release page references */
while (head != tail) { while (head != tail) {
desc = GET_RBDR_DESC(rbdr, head); desc = GET_RBDR_DESC(rbdr, head);
buf_addr = ((u64)desc->buf_addr) << NICVF_RCV_BUF_ALIGN; buf_addr = desc->buf_addr;
phys_addr = nicvf_iova_to_phys(nic, buf_addr); phys_addr = nicvf_iova_to_phys(nic, buf_addr);
dma_unmap_page_attrs(&nic->pdev->dev, buf_addr, RCV_FRAG_LEN, dma_unmap_page_attrs(&nic->pdev->dev, buf_addr, RCV_FRAG_LEN,
DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC); DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC);
...@@ -297,7 +297,7 @@ static void nicvf_free_rbdr(struct nicvf *nic, struct rbdr *rbdr) ...@@ -297,7 +297,7 @@ static void nicvf_free_rbdr(struct nicvf *nic, struct rbdr *rbdr)
} }
/* Release buffer of tail desc */ /* Release buffer of tail desc */
desc = GET_RBDR_DESC(rbdr, tail); desc = GET_RBDR_DESC(rbdr, tail);
buf_addr = ((u64)desc->buf_addr) << NICVF_RCV_BUF_ALIGN; buf_addr = desc->buf_addr;
phys_addr = nicvf_iova_to_phys(nic, buf_addr); phys_addr = nicvf_iova_to_phys(nic, buf_addr);
dma_unmap_page_attrs(&nic->pdev->dev, buf_addr, RCV_FRAG_LEN, dma_unmap_page_attrs(&nic->pdev->dev, buf_addr, RCV_FRAG_LEN,
DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC); DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC);
...@@ -364,7 +364,7 @@ static void nicvf_refill_rbdr(struct nicvf *nic, gfp_t gfp) ...@@ -364,7 +364,7 @@ static void nicvf_refill_rbdr(struct nicvf *nic, gfp_t gfp)
break; break;
desc = GET_RBDR_DESC(rbdr, tail); desc = GET_RBDR_DESC(rbdr, tail);
desc->buf_addr = (u64)rbuf >> NICVF_RCV_BUF_ALIGN; desc->buf_addr = (u64)rbuf & ~(NICVF_RCV_BUF_ALIGN_BYTES - 1);
refill_rb_cnt--; refill_rb_cnt--;
new_rb++; new_rb++;
} }
......
...@@ -359,15 +359,7 @@ union cq_desc_t { ...@@ -359,15 +359,7 @@ union cq_desc_t {
}; };
struct rbdr_entry_t { struct rbdr_entry_t {
#if defined(__BIG_ENDIAN_BITFIELD) u64 buf_addr;
u64 rsvd0:15;
u64 buf_addr:42;
u64 cache_align:7;
#elif defined(__LITTLE_ENDIAN_BITFIELD)
u64 cache_align:7;
u64 buf_addr:42;
u64 rsvd0:15;
#endif
}; };
/* TCP reassembly context */ /* TCP reassembly context */
......
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