提交 ae3e5f0e 编写于 作者: A Alan Cox 提交者: Greg Kroah-Hartman

staging: et131x: Clean up the RFD struct/types

Signed-off-by: NAlan Cox <alan@linux.intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 64b72831
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
#include "et1310_rx.h" #include "et1310_rx.h"
#include "et131x.h" #include "et131x.h"
void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd); void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd);
/** /**
* et131x_rx_dma_memory_alloc * et131x_rx_dma_memory_alloc
...@@ -372,7 +372,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) ...@@ -372,7 +372,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
* RFDs will be allocated from this pool. * RFDs will be allocated from this pool.
*/ */
rx_ring->RecvLookaside = kmem_cache_create(adapter->netdev->name, rx_ring->RecvLookaside = kmem_cache_create(adapter->netdev->name,
sizeof(MP_RFD), sizeof(struct rfd),
0, 0,
SLAB_CACHE_DMA | SLAB_CACHE_DMA |
SLAB_HWCACHE_ALIGN, SLAB_HWCACHE_ALIGN,
...@@ -396,7 +396,7 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) ...@@ -396,7 +396,7 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
u32 index; u32 index;
u32 bufsize; u32 bufsize;
u32 pktStatRingSize; u32 pktStatRingSize;
PMP_RFD rfd; struct rfd *rfd;
struct rx_ring *rx_ring; struct rx_ring *rx_ring;
/* Setup some convenience pointers */ /* Setup some convenience pointers */
...@@ -406,11 +406,11 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) ...@@ -406,11 +406,11 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
WARN_ON(rx_ring->nReadyRecv != rx_ring->NumRfd); WARN_ON(rx_ring->nReadyRecv != rx_ring->NumRfd);
while (!list_empty(&rx_ring->RecvList)) { while (!list_empty(&rx_ring->RecvList)) {
rfd = (MP_RFD *) list_entry(rx_ring->RecvList.next, rfd = (struct rfd *) list_entry(rx_ring->RecvList.next,
MP_RFD, list_node); struct rfd, list_node);
list_del(&rfd->list_node); list_del(&rfd->list_node);
rfd->Packet = NULL; rfd->skb = NULL;
kmem_cache_free(adapter->rx_ring.RecvLookaside, rfd); kmem_cache_free(adapter->rx_ring.RecvLookaside, rfd);
} }
...@@ -537,7 +537,7 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) ...@@ -537,7 +537,7 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
int et131x_init_recv(struct et131x_adapter *adapter) int et131x_init_recv(struct et131x_adapter *adapter)
{ {
int status = -ENOMEM; int status = -ENOMEM;
PMP_RFD rfd = NULL; struct rfd *rfd = NULL;
u32 rfdct; u32 rfdct;
u32 numrfd = 0; u32 numrfd = 0;
struct rx_ring *rx_ring; struct rx_ring *rx_ring;
...@@ -557,7 +557,7 @@ int et131x_init_recv(struct et131x_adapter *adapter) ...@@ -557,7 +557,7 @@ int et131x_init_recv(struct et131x_adapter *adapter)
continue; continue;
} }
rfd->Packet = NULL; rfd->skb = NULL;
/* Add this RFD to the RecvList */ /* Add this RFD to the RecvList */
list_add_tail(&rfd->list_node, &rx_ring->RecvList); list_add_tail(&rfd->list_node, &rx_ring->RecvList);
...@@ -776,12 +776,12 @@ void et131x_rx_dma_enable(struct et131x_adapter *etdev) ...@@ -776,12 +776,12 @@ void et131x_rx_dma_enable(struct et131x_adapter *etdev)
* the packet to it, puts the RFD in the RecvPendList, and also returns * the packet to it, puts the RFD in the RecvPendList, and also returns
* the pointer to the RFD. * the pointer to the RFD.
*/ */
PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) struct rfd * nic_rx_pkts(struct et131x_adapter *etdev)
{ {
struct rx_ring *rx_local = &etdev->rx_ring; struct rx_ring *rx_local = &etdev->rx_ring;
struct rx_status_block *status; struct rx_status_block *status;
struct pkt_stat_desc *psr; struct pkt_stat_desc *psr;
PMP_RFD rfd; struct rfd *rfd;
u32 i; u32 i;
u8 *buf; u8 *buf;
unsigned long flags; unsigned long flags;
...@@ -858,7 +858,7 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) ...@@ -858,7 +858,7 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev)
rfd = NULL; rfd = NULL;
element = rx_local->RecvList.next; element = rx_local->RecvList.next;
rfd = (PMP_RFD) list_entry(element, MP_RFD, list_node); rfd = (struct rfd *) list_entry(element, struct rfd, list_node);
if (rfd == NULL) { if (rfd == NULL) {
spin_unlock_irqrestore(&etdev->rcv_lock, flags); spin_unlock_irqrestore(&etdev->rcv_lock, flags);
...@@ -938,7 +938,7 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) ...@@ -938,7 +938,7 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev)
* of Multicast address we have, then * of Multicast address we have, then
* this means we did not find this * this means we did not find this
* packet's matching address in our * packet's matching address in our
* list. Set the PacketSize to zero, * list. Set the len to zero,
* so we free our RFD when we return * so we free our RFD when we return
* from this function. * from this function.
*/ */
...@@ -962,21 +962,21 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) ...@@ -962,21 +962,21 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev)
if (len > 0) { if (len > 0) {
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
/* rfd->PacketSize = len - 4; */ /*rfd->len = len - 4; */
rfd->PacketSize = len; rfd->len = len;
skb = dev_alloc_skb(rfd->PacketSize + 2); skb = dev_alloc_skb(rfd->len + 2);
if (!skb) { if (!skb) {
dev_err(&etdev->pdev->dev, dev_err(&etdev->pdev->dev,
"Couldn't alloc an SKB for Rx\n"); "Couldn't alloc an SKB for Rx\n");
return NULL; return NULL;
} }
etdev->net_stats.rx_bytes += rfd->PacketSize; etdev->net_stats.rx_bytes += rfd->len;
memcpy(skb_put(skb, rfd->PacketSize), memcpy(skb_put(skb, rfd->len),
rx_local->fbr[rindex]->virt[bindex], rx_local->fbr[rindex]->virt[bindex],
rfd->PacketSize); rfd->len);
skb->dev = etdev->netdev; skb->dev = etdev->netdev;
skb->protocol = eth_type_trans(skb, etdev->netdev); skb->protocol = eth_type_trans(skb, etdev->netdev);
...@@ -984,7 +984,7 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) ...@@ -984,7 +984,7 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev)
netif_rx(skb); netif_rx(skb);
} else { } else {
rfd->PacketSize = 0; rfd->len = 0;
} }
nic_return_rfd(etdev, rfd); nic_return_rfd(etdev, rfd);
...@@ -1011,7 +1011,7 @@ void et131x_reset_recv(struct et131x_adapter *etdev) ...@@ -1011,7 +1011,7 @@ void et131x_reset_recv(struct et131x_adapter *etdev)
*/ */
void et131x_handle_recv_interrupt(struct et131x_adapter *etdev) void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
{ {
PMP_RFD rfd = NULL; struct rfd *rfd = NULL;
u32 count = 0; u32 count = 0;
bool done = true; bool done = true;
...@@ -1035,7 +1035,7 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev) ...@@ -1035,7 +1035,7 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
*/ */
if (!etdev->PacketFilter || if (!etdev->PacketFilter ||
!(etdev->Flags & fMP_ADAPTER_LINK_DETECTION) || !(etdev->Flags & fMP_ADAPTER_LINK_DETECTION) ||
rfd->PacketSize == 0) { rfd->len == 0) {
continue; continue;
} }
...@@ -1082,7 +1082,7 @@ static inline u32 bump_fbr(u32 *fbr, u32 limit) ...@@ -1082,7 +1082,7 @@ static inline u32 bump_fbr(u32 *fbr, u32 limit)
* @etdev: pointer to our adapter * @etdev: pointer to our adapter
* @rfd: pointer to the RFD * @rfd: pointer to the RFD
*/ */
void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD rfd) void nic_return_rfd(struct et131x_adapter *etdev, struct rfd *rfd)
{ {
struct rx_ring *rx_local = &etdev->rx_ring; struct rx_ring *rx_local = &etdev->rx_ring;
struct rxdma_regs __iomem *rx_dma = &etdev->regs->rxdma; struct rxdma_regs __iomem *rx_dma = &etdev->regs->rxdma;
......
...@@ -126,9 +126,9 @@ void SetPhy_10BaseTHalfDuplex(struct et131x_adapter *adapter); ...@@ -126,9 +126,9 @@ void SetPhy_10BaseTHalfDuplex(struct et131x_adapter *adapter);
int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter); int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter);
void et131x_rx_dma_memory_free(struct et131x_adapter *adapter); void et131x_rx_dma_memory_free(struct et131x_adapter *adapter);
int et131x_rfd_resources_alloc(struct et131x_adapter *adapter, int et131x_rfd_resources_alloc(struct et131x_adapter *adapter,
struct _MP_RFD *pMpRfd); struct rfd *rfd);
void et131x_rfd_resources_free(struct et131x_adapter *adapter, void et131x_rfd_resources_free(struct et131x_adapter *adapter,
struct _MP_RFD *pMpRfd); struct rfd *rfd);
int et131x_init_recv(struct et131x_adapter *adapter); int et131x_init_recv(struct et131x_adapter *adapter);
void ConfigRxDmaRegs(struct et131x_adapter *adapter); void ConfigRxDmaRegs(struct et131x_adapter *adapter);
......
...@@ -83,13 +83,13 @@ ...@@ -83,13 +83,13 @@
#define LO_MARK_PERCENT_FOR_RX 15 #define LO_MARK_PERCENT_FOR_RX 15
/* RFD (Receive Frame Descriptor) */ /* RFD (Receive Frame Descriptor) */
typedef struct _MP_RFD { struct rfd {
struct list_head list_node; struct list_head list_node;
struct sk_buff *Packet; struct sk_buff *skb;
u32 PacketSize; /* total size of receive frame */ u32 len; /* total size of receive frame */
u16 bufferindex; u16 bufferindex;
u8 ringindex; u8 ringindex;
} MP_RFD, *PMP_RFD; };
/* Flow Control */ /* Flow Control */
#define FLOW_BOTH 0 #define FLOW_BOTH 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册