diff options
| author | Sunil Goutham <sgoutham@cavium.com> | 2017-05-02 09:06:53 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2017-05-02 15:41:21 -0400 |
| commit | 927987f39f116db477fcd74ced2a2aea940e585c (patch) | |
| tree | c6cf03552f1d0ceb79680120b98eec5247de6e0b | |
| parent | 0dada88b8cd74569abc3dda50f1b268a5868f6f2 (diff) | |
net: thunderx: Cleanup receive buffer allocation
Get rid of unnecessary double pointer references and type casting
in receive buffer allocation code.
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c index 90c5bc7d7344..e4a02a96d4f0 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c | |||
| @@ -145,7 +145,7 @@ static struct pgcache *nicvf_alloc_page(struct nicvf *nic, | |||
| 145 | 145 | ||
| 146 | /* Allocate buffer for packet reception */ | 146 | /* Allocate buffer for packet reception */ |
| 147 | static inline int nicvf_alloc_rcv_buffer(struct nicvf *nic, struct rbdr *rbdr, | 147 | static inline int nicvf_alloc_rcv_buffer(struct nicvf *nic, struct rbdr *rbdr, |
| 148 | gfp_t gfp, u32 buf_len, u64 **rbuf) | 148 | gfp_t gfp, u32 buf_len, u64 *rbuf) |
| 149 | { | 149 | { |
| 150 | struct pgcache *pgcache = NULL; | 150 | struct pgcache *pgcache = NULL; |
| 151 | 151 | ||
| @@ -172,10 +172,10 @@ static inline int nicvf_alloc_rcv_buffer(struct nicvf *nic, struct rbdr *rbdr, | |||
| 172 | nic->rb_page = pgcache->page; | 172 | nic->rb_page = pgcache->page; |
| 173 | ret: | 173 | ret: |
| 174 | /* HW will ensure data coherency, CPU sync not required */ | 174 | /* HW will ensure data coherency, CPU sync not required */ |
| 175 | *rbuf = (u64 *)((u64)dma_map_page_attrs(&nic->pdev->dev, nic->rb_page, | 175 | *rbuf = (u64)dma_map_page_attrs(&nic->pdev->dev, nic->rb_page, |
| 176 | nic->rb_page_offset, buf_len, | 176 | nic->rb_page_offset, buf_len, |
| 177 | DMA_FROM_DEVICE, | 177 | DMA_FROM_DEVICE, |
| 178 | DMA_ATTR_SKIP_CPU_SYNC)); | 178 | DMA_ATTR_SKIP_CPU_SYNC); |
| 179 | if (dma_mapping_error(&nic->pdev->dev, (dma_addr_t)*rbuf)) { | 179 | if (dma_mapping_error(&nic->pdev->dev, (dma_addr_t)*rbuf)) { |
| 180 | if (!nic->rb_page_offset) | 180 | if (!nic->rb_page_offset) |
| 181 | __free_pages(nic->rb_page, 0); | 181 | __free_pages(nic->rb_page, 0); |
| @@ -212,7 +212,7 @@ static int nicvf_init_rbdr(struct nicvf *nic, struct rbdr *rbdr, | |||
| 212 | int ring_len, int buf_size) | 212 | int ring_len, int buf_size) |
| 213 | { | 213 | { |
| 214 | int idx; | 214 | int idx; |
| 215 | u64 *rbuf; | 215 | u64 rbuf; |
| 216 | struct rbdr_entry_t *desc; | 216 | struct rbdr_entry_t *desc; |
| 217 | int err; | 217 | int err; |
| 218 | 218 | ||
| @@ -257,7 +257,7 @@ static int nicvf_init_rbdr(struct nicvf *nic, struct rbdr *rbdr, | |||
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | desc = GET_RBDR_DESC(rbdr, idx); | 259 | desc = GET_RBDR_DESC(rbdr, idx); |
| 260 | desc->buf_addr = (u64)rbuf & ~(NICVF_RCV_BUF_ALIGN_BYTES - 1); | 260 | desc->buf_addr = rbuf & ~(NICVF_RCV_BUF_ALIGN_BYTES - 1); |
| 261 | } | 261 | } |
| 262 | 262 | ||
| 263 | nicvf_get_page(nic); | 263 | nicvf_get_page(nic); |
| @@ -330,7 +330,7 @@ static void nicvf_refill_rbdr(struct nicvf *nic, gfp_t gfp) | |||
| 330 | int refill_rb_cnt; | 330 | int refill_rb_cnt; |
| 331 | struct rbdr *rbdr; | 331 | struct rbdr *rbdr; |
| 332 | struct rbdr_entry_t *desc; | 332 | struct rbdr_entry_t *desc; |
| 333 | u64 *rbuf; | 333 | u64 rbuf; |
| 334 | int new_rb = 0; | 334 | int new_rb = 0; |
| 335 | 335 | ||
| 336 | refill: | 336 | refill: |
| @@ -364,7 +364,7 @@ refill: | |||
| 364 | break; | 364 | break; |
| 365 | 365 | ||
| 366 | desc = GET_RBDR_DESC(rbdr, tail); | 366 | desc = GET_RBDR_DESC(rbdr, tail); |
| 367 | desc->buf_addr = (u64)rbuf & ~(NICVF_RCV_BUF_ALIGN_BYTES - 1); | 367 | desc->buf_addr = rbuf & ~(NICVF_RCV_BUF_ALIGN_BYTES - 1); |
| 368 | refill_rb_cnt--; | 368 | refill_rb_cnt--; |
| 369 | new_rb++; | 369 | new_rb++; |
| 370 | } | 370 | } |
