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: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a02a26f0d6
commit
3f4d202942
1 changed files with 17 additions and 22 deletions
|
@ -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)
|
||||||
*/
|
*/
|
||||||
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)
|
||||||
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)
|
||||||
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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)
|
||||||
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)
|
||||||
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)
|
||||||
|
|
||||||
/* 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)
|
||||||
/* 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;
|
||||||
|
|
Loading…
Add table
Reference in a new issue