Commit 3f4d2029 authored by Mark Einon's avatar Mark Einon Committed by Greg Kroah-Hartman

staging: et131x: Reduce split lines by renaming some psr variables

Modify some packet status ring associated variables to save a few
split lines:

pktstat_ringsize -> psr_size
psr_num_entries -> psr_entries
index -> ii
Signed-off-by: default avatarMark Einon <mark.einon@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a02a26f0
...@@ -288,7 +288,7 @@ struct rx_ring { ...@@ -288,7 +288,7 @@ struct rx_ring {
void *ps_ring_virtaddr; void *ps_ring_virtaddr;
dma_addr_t ps_ring_physaddr; dma_addr_t ps_ring_physaddr;
u32 local_psr_full; u32 local_psr_full;
u32 psr_num_entries; u32 psr_entries;
struct rx_status_block *rx_status_block; struct rx_status_block *rx_status_block;
dma_addr_t rx_status_bus; dma_addr_t rx_status_bus;
...@@ -1650,7 +1650,7 @@ static void et131x_config_rx_dma_regs(struct et131x_adapter *adapter) ...@@ -1650,7 +1650,7 @@ static void et131x_config_rx_dma_regs(struct et131x_adapter *adapter)
*/ */
writel(upper_32_bits(rx_local->ps_ring_physaddr), &rx_dma->psr_base_hi); writel(upper_32_bits(rx_local->ps_ring_physaddr), &rx_dma->psr_base_hi);
writel(lower_32_bits(rx_local->ps_ring_physaddr), &rx_dma->psr_base_lo); writel(lower_32_bits(rx_local->ps_ring_physaddr), &rx_dma->psr_base_lo);
writel(rx_local->psr_num_entries - 1, &rx_dma->psr_num_des); writel(rx_local->psr_entries - 1, &rx_dma->psr_num_des);
writel(0, &rx_dma->psr_full_offset); writel(0, &rx_dma->psr_full_offset);
psr_num_des = readl(&rx_dma->psr_num_des) & ET_RXDMA_PSR_NUM_DES_MASK; psr_num_des = readl(&rx_dma->psr_num_des) & ET_RXDMA_PSR_NUM_DES_MASK;
...@@ -1999,7 +1999,7 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) ...@@ -1999,7 +1999,7 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
u8 id; u8 id;
u32 i, j; u32 i, j;
u32 bufsize; u32 bufsize;
u32 pktstat_ringsize; u32 psr_size;
u32 fbr_chunksize; u32 fbr_chunksize;
struct rx_ring *rx_ring = &adapter->rx_ring; struct rx_ring *rx_ring = &adapter->rx_ring;
struct fbr_lookup *fbr; struct fbr_lookup *fbr;
...@@ -2046,8 +2046,8 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) ...@@ -2046,8 +2046,8 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
rx_ring->fbr[1]->num_entries = 128; rx_ring->fbr[1]->num_entries = 128;
} }
rx_ring->psr_num_entries = rx_ring->fbr[0]->num_entries + rx_ring->psr_entries = rx_ring->fbr[0]->num_entries +
rx_ring->fbr[1]->num_entries; rx_ring->fbr[1]->num_entries;
for (id = 0; id < NUM_FBRS; id++) { for (id = 0; id < NUM_FBRS; id++) {
fbr = rx_ring->fbr[id]; fbr = rx_ring->fbr[id];
...@@ -2106,11 +2106,10 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) ...@@ -2106,11 +2106,10 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
} }
/* Allocate an area of memory for FIFO of Packet Status ring entries */ /* Allocate an area of memory for FIFO of Packet Status ring entries */
pktstat_ringsize = psr_size = sizeof(struct pkt_stat_desc) * rx_ring->psr_entries;
sizeof(struct pkt_stat_desc) * rx_ring->psr_num_entries;
rx_ring->ps_ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev, rx_ring->ps_ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev,
pktstat_ringsize, psr_size,
&rx_ring->ps_ring_physaddr, &rx_ring->ps_ring_physaddr,
GFP_KERNEL); GFP_KERNEL);
...@@ -2149,9 +2148,9 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) ...@@ -2149,9 +2148,9 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
static void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) static void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
{ {
u8 id; u8 id;
u32 index; u32 ii;
u32 bufsize; u32 bufsize;
u32 pktstat_ringsize; u32 psr_size;
struct rfd *rfd; struct rfd *rfd;
struct rx_ring *rx_ring = &adapter->rx_ring; struct rx_ring *rx_ring = &adapter->rx_ring;
struct fbr_lookup *fbr; struct fbr_lookup *fbr;
...@@ -2176,18 +2175,16 @@ static void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) ...@@ -2176,18 +2175,16 @@ static void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
continue; continue;
/* First the packet memory */ /* First the packet memory */
for (index = 0; for (ii = 0; ii < fbr->num_entries / FBR_CHUNKS; ii++) {
index < fbr->num_entries / FBR_CHUNKS; if (fbr->mem_virtaddrs[ii]) {
index++) {
if (fbr->mem_virtaddrs[index]) {
bufsize = fbr->buffsize * FBR_CHUNKS; bufsize = fbr->buffsize * FBR_CHUNKS;
dma_free_coherent(&adapter->pdev->dev, dma_free_coherent(&adapter->pdev->dev,
bufsize, bufsize,
fbr->mem_virtaddrs[index], fbr->mem_virtaddrs[ii],
fbr->mem_physaddrs[index]); fbr->mem_physaddrs[ii]);
fbr->mem_virtaddrs[index] = NULL; fbr->mem_virtaddrs[ii] = NULL;
} }
} }
...@@ -2203,10 +2200,9 @@ static void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) ...@@ -2203,10 +2200,9 @@ static void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
/* Free Packet Status Ring */ /* Free Packet Status Ring */
if (rx_ring->ps_ring_virtaddr) { if (rx_ring->ps_ring_virtaddr) {
pktstat_ringsize = sizeof(struct pkt_stat_desc) * psr_size = sizeof(struct pkt_stat_desc) * rx_ring->psr_entries;
rx_ring->psr_num_entries;
dma_free_coherent(&adapter->pdev->dev, pktstat_ringsize, dma_free_coherent(&adapter->pdev->dev, psr_size,
rx_ring->ps_ring_virtaddr, rx_ring->ps_ring_virtaddr,
rx_ring->ps_ring_physaddr); rx_ring->ps_ring_physaddr);
...@@ -2377,8 +2373,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *adapter) ...@@ -2377,8 +2373,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *adapter)
/* Indicate that we have used this PSR entry. */ /* Indicate that we have used this PSR entry. */
/* FIXME wrap 12 */ /* FIXME wrap 12 */
add_12bit(&rx_local->local_psr_full, 1); add_12bit(&rx_local->local_psr_full, 1);
if ( if ((rx_local->local_psr_full & 0xFFF) > rx_local->psr_entries - 1) {
(rx_local->local_psr_full & 0xFFF) > rx_local->psr_num_entries - 1) {
/* Clear psr full and toggle the wrap bit */ /* Clear psr full and toggle the wrap bit */
rx_local->local_psr_full &= ~0xFFF; rx_local->local_psr_full &= ~0xFFF;
rx_local->local_psr_full ^= 0x1000; rx_local->local_psr_full ^= 0x1000;
......
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