aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/et131x/et1310_rx.c65
-rw-r--r--drivers/staging/et131x/et1310_rx.h16
2 files changed, 40 insertions, 41 deletions
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index 6719c4ee6a7..cdc9105d553 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -116,10 +116,9 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
116 116
117 /* Alloc memory for the lookup table */ 117 /* Alloc memory for the lookup table */
118#ifdef USE_FBR0 118#ifdef USE_FBR0
119 rx_ring->Fbr[0] = kmalloc(sizeof(FBRLOOKUPTABLE), GFP_KERNEL); 119 rx_ring->fbr[0] = kmalloc(sizeof(struct fbr_lookup), GFP_KERNEL);
120#endif 120#endif
121 121 rx_ring->fbr[1] = kmalloc(sizeof(struct fbr_lookup), GFP_KERNEL);
122 rx_ring->Fbr[1] = kmalloc(sizeof(FBRLOOKUPTABLE), GFP_KERNEL);
123 122
124 /* The first thing we will do is configure the sizes of the buffer 123 /* The first thing we will do is configure the sizes of the buffer
125 * rings. These will change based on jumbo packet support. Larger 124 * rings. These will change based on jumbo packet support. Larger
@@ -270,23 +269,23 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
270 /* Save the Virtual address of this index for quick 269 /* Save the Virtual address of this index for quick
271 * access later 270 * access later
272 */ 271 */
273 rx_ring->Fbr[1]->Va[index] = 272 rx_ring->fbr[1]->virt[index] =
274 (uint8_t *) rx_ring->Fbr1MemVa[i] + 273 (uint8_t *) rx_ring->Fbr1MemVa[i] +
275 (j * rx_ring->Fbr1BufferSize) + Fbr1Offset; 274 (j * rx_ring->Fbr1BufferSize) + Fbr1Offset;
276 275
277 /* now store the physical address in the descriptor 276 /* now store the physical address in the descriptor
278 * so the device can access it 277 * so the device can access it
279 */ 278 */
280 rx_ring->Fbr[1]->PAHigh[index] = 279 rx_ring->fbr[1]->bus_high[index] =
281 (u32) (Fbr1TempPa >> 32); 280 (u32) (Fbr1TempPa >> 32);
282 rx_ring->Fbr[1]->PALow[index] = (u32) Fbr1TempPa; 281 rx_ring->fbr[1]->bus_low[index] = (u32) Fbr1TempPa;
283 282
284 Fbr1TempPa += rx_ring->Fbr1BufferSize; 283 Fbr1TempPa += rx_ring->Fbr1BufferSize;
285 284
286 rx_ring->Fbr[1]->Buffer1[index] = 285 rx_ring->fbr[1]->buffer1[index] =
287 rx_ring->Fbr[1]->Va[index]; 286 rx_ring->fbr[1]->virt[index];
288 rx_ring->Fbr[1]->Buffer2[index] = 287 rx_ring->fbr[1]->buffer2[index] =
289 rx_ring->Fbr[1]->Va[index] - 4; 288 rx_ring->fbr[1]->virt[index] - 4;
290 } 289 }
291 } 290 }
292 291
@@ -319,20 +318,20 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
319 for (j = 0; j < FBR_CHUNKS; j++) { 318 for (j = 0; j < FBR_CHUNKS; j++) {
320 u32 index = (i * FBR_CHUNKS) + j; 319 u32 index = (i * FBR_CHUNKS) + j;
321 320
322 rx_ring->Fbr[0]->Va[index] = 321 rx_ring->fbr[0]->virt[index] =
323 (uint8_t *) rx_ring->Fbr0MemVa[i] + 322 (uint8_t *) rx_ring->Fbr0MemVa[i] +
324 (j * rx_ring->Fbr0BufferSize) + Fbr0Offset; 323 (j * rx_ring->Fbr0BufferSize) + Fbr0Offset;
325 324
326 rx_ring->Fbr[0]->PAHigh[index] = 325 rx_ring->fbr[0]->bus_high[index] =
327 (u32) (Fbr0TempPa >> 32); 326 (u32) (Fbr0TempPa >> 32);
328 rx_ring->Fbr[0]->PALow[index] = (u32) Fbr0TempPa; 327 rx_ring->fbr[0]->bus_low[index] = (u32) Fbr0TempPa;
329 328
330 Fbr0TempPa += rx_ring->Fbr0BufferSize; 329 Fbr0TempPa += rx_ring->Fbr0BufferSize;
331 330
332 rx_ring->Fbr[0]->Buffer1[index] = 331 rx_ring->fbr[0]->buffer1[index] =
333 rx_ring->Fbr[0]->Va[index]; 332 rx_ring->fbr[0]->virt[index];
334 rx_ring->Fbr[0]->Buffer2[index] = 333 rx_ring->fbr[0]->buffer2[index] =
335 rx_ring->Fbr[0]->Va[index] - 4; 334 rx_ring->fbr[0]->virt[index] - 4;
336 } 335 }
337 } 336 }
338#endif 337#endif
@@ -525,10 +524,10 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
525 524
526 /* Free the FBR Lookup Table */ 525 /* Free the FBR Lookup Table */
527#ifdef USE_FBR0 526#ifdef USE_FBR0
528 kfree(rx_ring->Fbr[0]); 527 kfree(rx_ring->fbr[0]);
529#endif 528#endif
530 529
531 kfree(rx_ring->Fbr[1]); 530 kfree(rx_ring->fbr[1]);
532 531
533 /* Reset Counters */ 532 /* Reset Counters */
534 rx_ring->nReadyRecv = 0; 533 rx_ring->nReadyRecv = 0;
@@ -609,9 +608,9 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev)
609 * are ever returned, make sure the high part is retrieved here 608 * are ever returned, make sure the high part is retrieved here
610 * before storing the adjusted address. 609 * before storing the adjusted address.
611 */ 610 */
612 writel((u32) ((u64)rx_local->pRxStatusPa >> 32), 611 writel((u32) ((u64)rx_local->rx_status_bus >> 32),
613 &rx_dma->dma_wb_base_hi); 612 &rx_dma->dma_wb_base_hi);
614 writel((u32) rx_local->pRxStatusPa, &rx_dma->dma_wb_base_lo); 613 writel((u32) rx_local->rx_status_bus, &rx_dma->dma_wb_base_lo);
615 614
616 memset(rx_local->rx_status_block, 0, sizeof(struct rx_status_block)); 615 memset(rx_local->rx_status_block, 0, sizeof(struct rx_status_block));
617 616
@@ -636,8 +635,8 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev)
636 /* Now's the best time to initialize FBR1 contents */ 635 /* Now's the best time to initialize FBR1 contents */
637 fbr_entry = (struct fbr_desc *) rx_local->pFbr1RingVa; 636 fbr_entry = (struct fbr_desc *) rx_local->pFbr1RingVa;
638 for (entry = 0; entry < rx_local->Fbr1NumEntries; entry++) { 637 for (entry = 0; entry < rx_local->Fbr1NumEntries; entry++) {
639 fbr_entry->addr_hi = rx_local->Fbr[1]->PAHigh[entry]; 638 fbr_entry->addr_hi = rx_local->fbr[1]->bus_high[entry];
640 fbr_entry->addr_lo = rx_local->Fbr[1]->PALow[entry]; 639 fbr_entry->addr_lo = rx_local->fbr[1]->bus_low[entry];
641 fbr_entry->word2 = entry; 640 fbr_entry->word2 = entry;
642 fbr_entry++; 641 fbr_entry++;
643 } 642 }
@@ -661,8 +660,8 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev)
661 /* Now's the best time to initialize FBR0 contents */ 660 /* Now's the best time to initialize FBR0 contents */
662 fbr_entry = (struct fbr_desc *) rx_local->pFbr0RingVa; 661 fbr_entry = (struct fbr_desc *) rx_local->pFbr0RingVa;
663 for (entry = 0; entry < rx_local->Fbr0NumEntries; entry++) { 662 for (entry = 0; entry < rx_local->Fbr0NumEntries; entry++) {
664 fbr_entry->addr_hi = rx_local->Fbr[0]->PAHigh[entry]; 663 fbr_entry->addr_hi = rx_local->fbr[0]->bus_high[entry];
665 fbr_entry->addr_lo = rx_local->Fbr[0]->PALow[entry]; 664 fbr_entry->addr_lo = rx_local->fbr[0]->bus_low[entry];
666 fbr_entry->word2 = entry; 665 fbr_entry->word2 = entry;
667 fbr_entry++; 666 fbr_entry++;
668 } 667 }
@@ -893,7 +892,7 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev)
893 892
894 if (len) { 893 if (len) {
895 if (etdev->ReplicaPhyLoopbk == 1) { 894 if (etdev->ReplicaPhyLoopbk == 1) {
896 buf = rx_local->Fbr[rindex]->Va[bindex]; 895 buf = rx_local->fbr[rindex]->virt[bindex];
897 896
898 if (memcmp(&buf[6], &etdev->CurrentAddress[0], 897 if (memcmp(&buf[6], &etdev->CurrentAddress[0],
899 ETH_ALEN) == 0) { 898 ETH_ALEN) == 0) {
@@ -917,8 +916,8 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev)
917 if ((etdev->PacketFilter & ET131X_PACKET_TYPE_MULTICAST) 916 if ((etdev->PacketFilter & ET131X_PACKET_TYPE_MULTICAST)
918 && !(etdev->PacketFilter & ET131X_PACKET_TYPE_PROMISCUOUS) 917 && !(etdev->PacketFilter & ET131X_PACKET_TYPE_PROMISCUOUS)
919 && !(etdev->PacketFilter & ET131X_PACKET_TYPE_ALL_MULTICAST)) { 918 && !(etdev->PacketFilter & ET131X_PACKET_TYPE_ALL_MULTICAST)) {
920 buf = rx_local->Fbr[rindex]-> 919 buf = rx_local->fbr[rindex]->
921 Va[bindex]; 920 virt[bindex];
922 921
923 /* Loop through our list to see if the 922 /* Loop through our list to see if the
924 * destination address of this packet 923 * destination address of this packet
@@ -984,7 +983,7 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev)
984 etdev->net_stats.rx_bytes += rfd->PacketSize; 983 etdev->net_stats.rx_bytes += rfd->PacketSize;
985 984
986 memcpy(skb_put(skb, rfd->PacketSize), 985 memcpy(skb_put(skb, rfd->PacketSize),
987 rx_local->Fbr[rindex]->Va[bindex], 986 rx_local->fbr[rindex]->virt[bindex],
988 rfd->PacketSize); 987 rfd->PacketSize);
989 988
990 skb->dev = etdev->netdev; 989 skb->dev = etdev->netdev;
@@ -1118,8 +1117,8 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD rfd)
1118 * the PA / Buffer Index for the returned buffer into 1117 * the PA / Buffer Index for the returned buffer into
1119 * the oldest (next to be freed)FBR entry 1118 * the oldest (next to be freed)FBR entry
1120 */ 1119 */
1121 next->addr_hi = rx_local->Fbr[1]->PAHigh[bi]; 1120 next->addr_hi = rx_local->fbr[1]->bus_high[bi];
1122 next->addr_lo = rx_local->Fbr[1]->PALow[bi]; 1121 next->addr_lo = rx_local->fbr[1]->bus_low[bi];
1123 next->word2 = bi; 1122 next->word2 = bi;
1124 1123
1125 writel(bump_fbr(&rx_local->local_Fbr1_full, 1124 writel(bump_fbr(&rx_local->local_Fbr1_full,
@@ -1136,8 +1135,8 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD rfd)
1136 * the PA / Buffer Index for the returned buffer into 1135 * the PA / Buffer Index for the returned buffer into
1137 * the oldest (next to be freed) FBR entry 1136 * the oldest (next to be freed) FBR entry
1138 */ 1137 */
1139 next->addr_hi = rx_local->Fbr[0]->PAHigh[bi]; 1138 next->addr_hi = rx_local->fbr[0]->bus_high[bi];
1140 next->addr_lo = rx_local->Fbr[0]->PALow[bi]; 1139 next->addr_lo = rx_local->fbr[0]->bus_low[bi];
1141 next->word2 = bi; 1140 next->word2 = bi;
1142 1141
1143 writel(bump_fbr(&rx_local->local_Fbr0_full, 1142 writel(bump_fbr(&rx_local->local_Fbr0_full,
diff --git a/drivers/staging/et131x/et1310_rx.h b/drivers/staging/et131x/et1310_rx.h
index b84d811e291..a8915e6e59f 100644
--- a/drivers/staging/et131x/et1310_rx.h
+++ b/drivers/staging/et131x/et1310_rx.h
@@ -230,13 +230,13 @@ struct rx_status_block {
230/* 230/*
231 * Structure for look-up table holding free buffer ring pointers 231 * Structure for look-up table holding free buffer ring pointers
232 */ 232 */
233typedef struct _FbrLookupTable { 233struct fbr_lookup {
234 void *Va[MAX_DESC_PER_RING_RX]; 234 void *virt[MAX_DESC_PER_RING_RX];
235 void *Buffer1[MAX_DESC_PER_RING_RX]; 235 void *buffer1[MAX_DESC_PER_RING_RX];
236 void *Buffer2[MAX_DESC_PER_RING_RX]; 236 void *buffer2[MAX_DESC_PER_RING_RX];
237 u32 PAHigh[MAX_DESC_PER_RING_RX]; 237 u32 bus_high[MAX_DESC_PER_RING_RX];
238 u32 PALow[MAX_DESC_PER_RING_RX]; 238 u32 bus_low[MAX_DESC_PER_RING_RX];
239} FBRLOOKUPTABLE, *PFBRLOOKUPTABLE; 239};
240 240
241/* 241/*
242 * RX_RING_t is sructure representing the adaptor's local reference(s) to the 242 * RX_RING_t is sructure representing the adaptor's local reference(s) to the
@@ -260,7 +260,7 @@ typedef struct _rx_ring_t {
260 dma_addr_t Fbr1MemPa[MAX_DESC_PER_RING_RX / FBR_CHUNKS]; 260 dma_addr_t Fbr1MemPa[MAX_DESC_PER_RING_RX / FBR_CHUNKS];
261 uint64_t Fbr1Realpa; 261 uint64_t Fbr1Realpa;
262 uint64_t Fbr1offset; 262 uint64_t Fbr1offset;
263 FBRLOOKUPTABLE *Fbr[2]; 263 struct fbr_lookup *fbr[2]; /* One per ring */
264 u32 local_Fbr1_full; 264 u32 local_Fbr1_full;
265 u32 Fbr1NumEntries; 265 u32 Fbr1NumEntries;
266 u32 Fbr1BufferSize; 266 u32 Fbr1BufferSize;