Commit d0128aa9 authored by Mithlesh Thukral's avatar Mithlesh Thukral Committed by Greg Kroah-Hartman

Staging: sxg: Receive code and data structure cleanups

* Cleanup in recevive buffer structure
* Drop receive data buffer as its not needed with use of skbs
* Fix error code paths in receive skb failures
Signed-off-by: default avatarLinSysSoft Sahara Team <saharaproj@linsyssoft.com>
Signed-off-by: default avatarChristopher Harrer <charrer@alacritech.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cb636fe3
This diff is collapsed.
...@@ -139,12 +139,14 @@ struct sxg_stats { ...@@ -139,12 +139,14 @@ struct sxg_stats {
/* Indications array size */ /* Indications array size */
#define SXG_RCV_ARRAYSIZE 64 #define SXG_RCV_ARRAYSIZE 64
#define SXG_ALLOCATE_RCV_PACKET(_pAdapt, _RcvDataBufferHdr) { \ #define SXG_ALLOCATE_RCV_PACKET(_pAdapt, _RcvDataBufferHdr, BufferSize) {\
struct sk_buff * skb; \ struct sk_buff * skb; \
skb = netdev_alloc_skb(_pAdapt->netdev, 2048); \ skb = netdev_alloc_skb(_pAdapt->netdev, BufferSize); \
if (skb) { \ if (skb) { \
(_RcvDataBufferHdr)->skb = skb; \ (_RcvDataBufferHdr)->skb = skb; \
skb->next = NULL; \ skb->next = NULL; \
_RcvDataBufferHdr->PhysicalAddress = pci_map_single(adapter->pcidev,\
_RcvDataBufferHdr->skb->data, BufferSize, PCI_DMA_FROMDEVICE); \
} else { \ } else { \
(_RcvDataBufferHdr)->skb = NULL; \ (_RcvDataBufferHdr)->skb = NULL; \
} \ } \
...@@ -212,8 +214,8 @@ struct sxg_stats { ...@@ -212,8 +214,8 @@ struct sxg_stats {
SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "DumbRcv", \ SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "DumbRcv", \
(_RcvDataBufferHdr), (_Packet), \ (_RcvDataBufferHdr), (_Packet), \
(_Event)->Status, 0); \ (_Event)->Status, 0); \
ASSERT((_Event)->Length <= (_RcvDataBufferHdr)->Size); \ /* ASSERT((_Event)->Length <= (_RcvDataBufferHdr)->Size); */ \
skb_put(Packet, (_Event)->Length); \ skb_put(Packet, (_Event)->Length); \
} }
/* /*
...@@ -236,7 +238,7 @@ struct sxg_stats { ...@@ -236,7 +238,7 @@ struct sxg_stats {
#define SXG_FREE_RCV_DATA_BUFFER(_pAdapt, _Hdr) { \ #define SXG_FREE_RCV_DATA_BUFFER(_pAdapt, _Hdr) { \
SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "RtnDHdr", \ SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "RtnDHdr", \
(_Hdr), (_pAdapt)->FreeRcvBufferCount, \ (_Hdr), (_pAdapt)->FreeRcvBufferCount, \
(_Hdr)->State, (_Hdr)->VirtualAddress); \ (_Hdr)->State, 0/*(_Hdr)->VirtualAddress*/); \
/* SXG_RESTORE_MDL_OFFSET(_Hdr); */ \ /* SXG_RESTORE_MDL_OFFSET(_Hdr); */ \
(_pAdapt)->FreeRcvBufferCount++; \ (_pAdapt)->FreeRcvBufferCount++; \
ASSERT(((_pAdapt)->AllRcvBlockCount * SXG_RCV_DESCRIPTORS_PER_BLOCK) \ ASSERT(((_pAdapt)->AllRcvBlockCount * SXG_RCV_DESCRIPTORS_PER_BLOCK) \
......
...@@ -705,12 +705,8 @@ struct sxg_rcv_data_buffer_hdr { ...@@ -705,12 +705,8 @@ struct sxg_rcv_data_buffer_hdr {
* Note - DO NOT USE the VirtualAddress field to locate data. * Note - DO NOT USE the VirtualAddress field to locate data.
* Use the sxg.h:SXG_RECEIVE_DATA_LOCATION macro instead. * Use the sxg.h:SXG_RECEIVE_DATA_LOCATION macro instead.
*/ */
void *VirtualAddress; /* Start of buffer */
u32 Size; /* Buffer size */
struct sxg_rcv_data_buffer_hdr *Next; /* Fastpath data buffer queue */
struct list_entry FreeList; /* Free queue of buffers */ struct list_entry FreeList; /* Free queue of buffers */
unsigned char State; /* See SXG_BUFFER state above */ unsigned char State; /* See SXG_BUFFER state above */
unsigned char Status; /* Event status (to log PUSH) */
struct sk_buff * skb; /* Double mapped (nbl and pkt)*/ struct sk_buff * skb; /* Double mapped (nbl and pkt)*/
}; };
...@@ -721,10 +717,11 @@ struct sxg_rcv_data_buffer_hdr { ...@@ -721,10 +717,11 @@ struct sxg_rcv_data_buffer_hdr {
#define SxgDumbRcvPacket skb #define SxgDumbRcvPacket skb
/* Space for struct sxg_rcv_data_buffer_hdr */ /* Space for struct sxg_rcv_data_buffer_hdr */
#define SXG_RCV_DATA_HDR_SIZE 256 #define SXG_RCV_DATA_HDR_SIZE sizeof(struct sxg_rcv_data_buffer_hdr)
/* Non jumbo = 2k including HDR */ /* Non jumbo = 2k including HDR */
#define SXG_RCV_DATA_BUFFER_SIZE 2048 #define SXG_RCV_DATA_BUFFER_SIZE 2048
#define SXG_RCV_JUMBO_BUFFER_SIZE 10240 /* jumbo = 10k including HDR */ /* jumbo = 10k including HDR */
#define SXG_RCV_JUMBO_BUFFER_SIZE 10240
/* Receive data descriptor */ /* Receive data descriptor */
struct sxg_rcv_data_descriptor { struct sxg_rcv_data_descriptor {
...@@ -954,20 +951,26 @@ struct sxg_scatter_gather { ...@@ -954,20 +951,26 @@ struct sxg_scatter_gather {
((SxgSglPoolProperties[_Pool].SGEntries - 1) * \ ((SxgSglPoolProperties[_Pool].SGEntries - 1) * \
sizeof(struct sxg_x64_sge))) sizeof(struct sxg_x64_sge)))
/* Force NDIS to give us it's own buffer so we can reformat to our own */
#define SXG_SGL_BUFFER(_SxgSgl) NULL //VSS change this value and test
#define SXG_SGL_BUFFER_LENGTH(_SxgSgl) 0 //VSS change this value and test
#define SXG_SGL_BUF_SIZE 0 //VSS change this value and test
/*
#if defined(CONFIG_X86_64) #if defined(CONFIG_X86_64)
#define SXG_SGL_BUFFER(_SxgSgl) (&_SxgSgl->Sgl) #define SXG_SGL_BUFFER(_SxgSgl) (&_SxgSgl->Sgl)
#define SXG_SGL_BUFFER_LENGTH(_SxgSgl) ((_SxgSgl)->Entries * \ #define SXG_SGL_BUFFER_LENGTH(_SxgSgl) ((_SxgSgl)->Entries * \
sizeof(struct sxg_x64_sge)) sizeof(struct sxg_x64_sge))
#define SXG_SGL_BUF_SIZE sizeof(struct sxg_x64_sgl) #define SXG_SGL_BUF_SIZE sizeof(struct sxg_x64_sgl)
#elif defined(CONFIG_X86) #elif defined(CONFIG_X86)
/* Force NDIS to give us it's own buffer so we can reformat to our own */ // Force NDIS to give us it's own buffer so we can reformat to our own
#define SXG_SGL_BUFFER(_SxgSgl) NULL #define SXG_SGL_BUFFER(_SxgSgl) NULL
#define SXG_SGL_BUFFER_LENGTH(_SxgSgl) 0 #define SXG_SGL_BUFFER_LENGTH(_SxgSgl) 0
#define SXG_SGL_BUF_SIZE 0 #define SXG_SGL_BUF_SIZE 0
#else #else
#error staging: sxg: driver is for X86 only! #error staging: sxg: driver is for X86 only!
#endif #endif
*/
/* Microcode statistics */ /* Microcode statistics */
struct sxg_ucode_stats { struct sxg_ucode_stats {
u32 RPDQOflow; /* PDQ overflow (unframed ie dq & drop 1st) */ u32 RPDQOflow; /* PDQ overflow (unframed ie dq & drop 1st) */
......
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