Commit fb70ed67 authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

Staging: et131x: clean up WORD2 usage

A little more complex but again move the structure and typedef into into the
documentation
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b44207ab
...@@ -516,8 +516,9 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) ...@@ -516,8 +516,9 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
*/ */
if ((pPacket->len - pPacket->data_len) <= 1514) { if ((pPacket->len - pPacket->data_len) <= 1514) {
CurDesc[FragmentNumber].DataBufferPtrHigh = 0; CurDesc[FragmentNumber].DataBufferPtrHigh = 0;
CurDesc[FragmentNumber].word2.bits. /* Low 16bits are length, high is vlan and
length_in_bytes = unused currently so zero */
CurDesc[FragmentNumber].word2 =
pPacket->len - pPacket->data_len; pPacket->len - pPacket->data_len;
/* NOTE: Here, the dma_addr_t returned from /* NOTE: Here, the dma_addr_t returned from
...@@ -536,9 +537,8 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) ...@@ -536,9 +537,8 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
} else { } else {
CurDesc[FragmentNumber].DataBufferPtrHigh = 0; CurDesc[FragmentNumber].DataBufferPtrHigh = 0;
CurDesc[FragmentNumber].word2.bits. CurDesc[FragmentNumber].word2 =
length_in_bytes = (pPacket->len - pPacket->data_len) / 2;
((pPacket->len - pPacket->data_len) / 2);
/* NOTE: Here, the dma_addr_t returned from /* NOTE: Here, the dma_addr_t returned from
* pci_map_single() is implicitly cast as a * pci_map_single() is implicitly cast as a
...@@ -556,9 +556,8 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) ...@@ -556,9 +556,8 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
CurDesc[FragmentNumber].DataBufferPtrHigh = 0; CurDesc[FragmentNumber].DataBufferPtrHigh = 0;
CurDesc[FragmentNumber].word2.bits. CurDesc[FragmentNumber].word2 =
length_in_bytes = (pPacket->len - pPacket->data_len) / 2;
((pPacket->len - pPacket->data_len) / 2);
/* NOTE: Here, the dma_addr_t returned from /* NOTE: Here, the dma_addr_t returned from
* pci_map_single() is implicitly cast as a * pci_map_single() is implicitly cast as a
...@@ -579,7 +578,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) ...@@ -579,7 +578,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb)
} }
} else { } else {
CurDesc[FragmentNumber].DataBufferPtrHigh = 0; CurDesc[FragmentNumber].DataBufferPtrHigh = 0;
CurDesc[FragmentNumber].word2.bits.length_in_bytes = CurDesc[FragmentNumber].word2 =
pFragList[loopIndex - 1].size; pFragList[loopIndex - 1].size;
/* NOTE: Here, the dma_addr_t returned from /* NOTE: Here, the dma_addr_t returned from
...@@ -724,7 +723,7 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev, ...@@ -724,7 +723,7 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev,
pci_unmap_single(etdev->pdev, pci_unmap_single(etdev->pdev,
desc->DataBufferPtrLow, desc->DataBufferPtrLow,
desc->word2.value, PCI_DMA_TODEVICE); desc->word2, PCI_DMA_TODEVICE);
add_10bit(&pMpTcb->WrIndexStart, 1); add_10bit(&pMpTcb->WrIndexStart, 1);
if (INDEX10(pMpTcb->WrIndexStart) >= if (INDEX10(pMpTcb->WrIndexStart) >=
......
...@@ -63,29 +63,14 @@ ...@@ -63,29 +63,14 @@
/* Typedefs for Tx Descriptor Ring */ /* Typedefs for Tx Descriptor Ring */
/* /*
* TXDESC_WORD2_t structure holds part of the control bits in the Tx Descriptor * word 2 of the control bits in the Tx Descriptor ring for the ET-1310
* ring for the ET-1310 *
*/ * 0-15: length of packet
typedef union _txdesc_word2_t { * 16-27: VLAN tag
u32 value; * 28: VLAN CFI
struct { * 29-31: VLAN priority
#ifdef _BIT_FIELDS_HTOL *
u32 vlan_prio:3; /* bits 29-31(VLAN priority) */ * word 3 of the control bits in the Tx Descriptor ring for the ET-1310
u32 vlan_cfi:1; /* bit 28(cfi) */
u32 vlan_tag:12; /* bits 16-27(VLAN tag) */
u32 length_in_bytes:16; /* bits 0-15(packet length) */
#else
u32 length_in_bytes:16; /* bits 0-15(packet length) */
u32 vlan_tag:12; /* bits 16-27(VLAN tag) */
u32 vlan_cfi:1; /* bit 28(cfi) */
u32 vlan_prio:3; /* bits 29-31(VLAN priority) */
#endif /* _BIT_FIELDS_HTOL */
} bits;
} TXDESC_WORD2_t, *PTXDESC_WORD2_t;
/*
* word 3 of the control bits in the Tx Descriptor ring for the
* ET-1310
* *
* 0: last packet in the sequence * 0: last packet in the sequence
* 1: first packet in the sequence * 1: first packet in the sequence
...@@ -108,7 +93,7 @@ typedef union _txdesc_word2_t { ...@@ -108,7 +93,7 @@ typedef union _txdesc_word2_t {
typedef struct _tx_desc_entry_t { typedef struct _tx_desc_entry_t {
u32 DataBufferPtrHigh; u32 DataBufferPtrHigh;
u32 DataBufferPtrLow; u32 DataBufferPtrLow;
TXDESC_WORD2_t word2; /* control words how to xmit the */ u32 word2; /* control words how to xmit the */
u32 word3; /* data (detailed above) */ u32 word3; /* data (detailed above) */
} TX_DESC_ENTRY_t, *PTX_DESC_ENTRY_t; } TX_DESC_ENTRY_t, *PTX_DESC_ENTRY_t;
......
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