if(iph->protocol == IPPROTO_UDP) /* UDP */
{
- struct udphdr *udph = (struct udphdr *)((SIZE_PTR)iph + (iph->ihl << 2));
+ struct udphdr *udph = (struct udphdr *)((unsigned long)iph + (iph->ihl << 2));
if((udph->source == __constant_htons(CLIENT_PORT))
&& (udph->dest == __constant_htons(SERVER_PORT))) /* DHCP request */
{
struct dhcpMessage *dhcph =
- (struct dhcpMessage *)((SIZE_PTR)udph + sizeof(struct udphdr));
+ (struct dhcpMessage *)((unsigned long)udph + sizeof(struct udphdr));
if(dhcph->cookie == __constant_htonl(DHCP_MAGIC)) /* match magic word */
{
goto exit;
}
- pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ - ( (SIZE_PTR)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ-1));
+ pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ - ((unsigned long)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ-1));
pcmdpriv->rsp_allocated_buf = rtw_zmalloc(MAX_RSPSZ + 4);
goto exit;
}
- pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ( (SIZE_PTR)(pcmdpriv->rsp_allocated_buf) & 3);
+ pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ((unsigned long)(pcmdpriv->rsp_allocated_buf) & 3);
pcmdpriv->cmd_issued_cnt = pcmdpriv->cmd_done_cnt = pcmdpriv->rsp_cnt = 0;
sa = GetAddr2Ptr(pframe);
auth_mode = psecuritypriv->dot11AuthAlgrthm;
- seq = cpu_to_le16(*(u16*)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + 2));
- algorithm = cpu_to_le16(*(u16*)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN));
+ seq = cpu_to_le16(*(u16*)((unsigned long)pframe + WLAN_HDR_A3_LEN + 2));
+ algorithm = cpu_to_le16(*(u16*)((unsigned long)pframe + WLAN_HDR_A3_LEN));
DBG_8723A("auth alg=%x, seq=%X\n", algorithm, seq);
offset = (GetPrivacy(pframe))? 4: 0;
- algthm = le16_to_cpu(*(unsigned short *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset));
- seq = le16_to_cpu(*(unsigned short *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 2));
- status = le16_to_cpu(*(unsigned short *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 4));
+ algthm = le16_to_cpu(*(unsigned short *)((unsigned long)pframe + WLAN_HDR_A3_LEN + offset));
+ seq = le16_to_cpu(*(unsigned short *)((unsigned long)pframe + WLAN_HDR_A3_LEN + offset + 2));
+ status = le16_to_cpu(*(unsigned short *)((unsigned long)pframe + WLAN_HDR_A3_LEN + offset + 4));
if (status != 0)
{
}
/* memset(precvpriv->pallocated_frame_buf, 0, NR_RECVFRAME * sizeof(union recv_frame) + RXFRAME_ALIGN_SZ); */
- precvpriv->precv_frame_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(precvpriv->pallocated_frame_buf), RXFRAME_ALIGN_SZ);
- /* precvpriv->precv_frame_buf = precvpriv->pallocated_frame_buf + RXFRAME_ALIGN_SZ - */
- /* ((SIZE_PTR) (precvpriv->pallocated_frame_buf) &(RXFRAME_ALIGN_SZ-1)); */
+ precvpriv->precv_frame_buf = PTR_ALIGN(precvpriv->pallocated_frame_buf, RXFRAME_ALIGN_SZ);
precvframe = (union recv_frame*) precvpriv->precv_frame_buf;
/* 3 2. Prepare new skb to replace & release old skb */
/* force ppkt->data at 8-byte alignment address */
- skb_reserve(ppkt, 8 - ((SIZE_PTR)ppkt->data & 7));
+ skb_reserve(ppkt, 8 - ((unsigned long)ppkt->data & 7));
/* force ip_hdr at 8-byte alignment address according to shift_sz */
skb_reserve(ppkt, shift_sz);
arcfour_encrypt(&mycontext, payload+length, crc, 4);
pframe+=pxmitpriv->frag_len;
- pframe=(u8 *)RND4((SIZE_PTR)(pframe));
+ pframe=(u8 *)RND4((unsigned long)(pframe));
}
arcfour_encrypt(&mycontext, payload+length, crc, 4);
pframe+=pxmitpriv->frag_len;
- pframe=(u8 *)RND4((SIZE_PTR)(pframe));
+ pframe=(u8 *)RND4((unsigned long)(pframe));
}
}
aes_cipher(prwskey,pattrib->hdrlen,pframe, length);
pframe+=pxmitpriv->frag_len;
- pframe=(u8*)RND4((SIZE_PTR)(pframe));
+ pframe=(u8*)RND4((unsigned long)(pframe));
}
}
return _FAIL;
pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 -
- ((SIZE_PTR)(pstapriv->pallocated_stainfo_buf ) & 3);
+ ((unsigned long)(pstapriv->pallocated_stainfo_buf) & 3);
_rtw_init_queue(&pstapriv->free_sta_queue);
res= _FAIL;
goto exit;
}
- pxmitpriv->pxmit_frame_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitpriv->pallocated_frame_buf), 4);
- /* pxmitpriv->pxmit_frame_buf = pxmitpriv->pallocated_frame_buf + 4 - */
- /* ((SIZE_PTR) (pxmitpriv->pallocated_frame_buf) &3); */
+ pxmitpriv->pxmit_frame_buf = PTR_ALIGN(pxmitpriv->pallocated_frame_buf, 4);
pxframe = (struct xmit_frame*) pxmitpriv->pxmit_frame_buf;
goto exit;
}
- pxmitpriv->pxmitbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitpriv->pallocated_xmitbuf), 4);
- /* pxmitpriv->pxmitbuf = pxmitpriv->pallocated_xmitbuf + 4 - */
- /* ((SIZE_PTR) (pxmitpriv->pallocated_xmitbuf) &3); */
+ pxmitpriv->pxmitbuf = PTR_ALIGN(pxmitpriv->pallocated_xmitbuf, 4);
pxmitbuf = (struct xmit_buf*)pxmitpriv->pxmitbuf;
res= _FAIL;
goto exit;
}
- pxmitpriv->xframe_ext = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitpriv->xframe_ext_alloc_addr), 4);
+ pxmitpriv->xframe_ext = PTR_ALIGN(pxmitpriv->xframe_ext_alloc_addr, 4);
pxframe = (struct xmit_frame*)pxmitpriv->xframe_ext;
for (i = 0; i < num_xmit_extbuf; i++) {
goto exit;
}
- pxmitpriv->pxmit_extbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitpriv->pallocated_xmit_extbuf), 4);
+ pxmitpriv->pxmit_extbuf = PTR_ALIGN(pxmitpriv->pallocated_xmit_extbuf, 4);
pxmitbuf = (struct xmit_buf*)pxmitpriv->pxmit_extbuf;
goto exit;
}
- pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitbuf->pallocated_buf), 4);
+ pxmitbuf->pbuf = PTR_ALIGN(pxmitbuf->pallocated_buf, 4);
*/
if((res=rtw_os_xmit_resource_alloc(padapter, pxmitbuf,max_xmit_extbuf_size + XMITBUF_ALIGN_SZ)) == _FAIL) {
payload=pframe;
for(curfragnum=0;curfragnum<pattrib->nr_frags;curfragnum++){
- payload=(u8 *)RND4((SIZE_PTR)(payload));
+ payload=(u8 *)RND4((unsigned long)(payload));
RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("===curfragnum=%d, pframe= 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x,!!!\n",
curfragnum,*payload, *(payload+1),*(payload+2),*(payload+3),*(payload+4),*(payload+5),*(payload+6),*(payload+7)));
s32 frg_inx, frg_len, mpdu_len, llc_sz, mem_sz;
- SIZE_PTR addr;
+ unsigned long addr;
u8 *pframe, *mem_start;
u8 hw_hdr_offset;
RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("%s: There're still something in packet!\n", __FUNCTION__));
}
- addr = (SIZE_PTR)(pframe);
+ addr = (unsigned long)pframe;
mem_start = (unsigned char *)RND4(addr) + hw_hdr_offset;
memcpy(mem_start, pbuf_start + hw_hdr_offset, pattrib->hdrlen);
if (alloc_addr == NULL)
goto exit;
- pxframe = (struct xmit_frame *)N_BYTE_ALIGMENT((SIZE_PTR)(alloc_addr), 4);
+ pxframe = (struct xmit_frame *)PTR_ALIGN(alloc_addr, 4);
pxframe->alloc_addr = alloc_addr;
pxframe->padapter = pxmitpriv->adapter;
goto exit;
}
- precvpriv->precv_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(precvpriv->pallocated_recv_buf), 4);
- //precvpriv->precv_buf = precvpriv->pallocated_recv_buf + 4 -
- // ((uint) (precvpriv->pallocated_recv_buf) &(4-1));
-
+ precvpriv->precv_buf = PTR_ALIGN(precvpriv->pallocated_recv_buf, 4);
precvbuf = (struct recv_buf*)precvpriv->precv_buf;
#ifdef CONFIG_PREALLOC_RECV_SKB
{
int i;
- SIZE_PTR tmpaddr=0;
- SIZE_PTR alignment=0;
- struct sk_buff *pskb=NULL;
+ unsigned long tmpaddr = 0;
+ unsigned long alignment = 0;
+ struct sk_buff *pskb = NULL;
skb_queue_head_init(&precvpriv->free_recv_skb_queue);
{
pskb->dev = padapter->pnetdev;
- tmpaddr = (SIZE_PTR)pskb->data;
+ tmpaddr = (unsigned long)pskb->data;
alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignment));
mem_addr += w_sz;
- mem_addr = (u8 *)RND4(((SIZE_PTR)(mem_addr)));
+ mem_addr = (u8 *)RND4(((unsigned long)(mem_addr)));
}
// Added by Albert 2010/02/09
// For mstar platform, mstar suggests the address for USB IO should be 16 bytes alignment.
// Trying to fix it here.
- pIo_buf = (tmp_buf==NULL)?NULL:tmp_buf + ALIGNMENT_UNIT -((SIZE_PTR)(tmp_buf) & 0x0f );
+ pIo_buf = (tmp_buf==NULL)?NULL:tmp_buf + ALIGNMENT_UNIT -((unsigned long)(tmp_buf) & 0x0f );
#endif
if ( pIo_buf== NULL) {
precvframe->u.hdr.pkt = pkt_copy;
precvframe->u.hdr.rx_head = pkt_copy->data;
precvframe->u.hdr.rx_end = pkt_copy->data + alloc_sz;
- skb_reserve( pkt_copy, 8 - ((SIZE_PTR)( pkt_copy->data ) & 7 ));//force pkt_copy->data at 8-byte alignment address
+ skb_reserve(pkt_copy, 8 - ((unsigned long)(pkt_copy->data) & 7));//force pkt_copy->data at 8-byte alignment address
skb_reserve( pkt_copy, shift_sz );//force ip_hdr at 8-byte alignment address according to shift_sz.
memcpy(pkt_copy->data, (pbuf + pattrib->shift_sz + pattrib->drvinfo_sz + RXDESC_SIZE), skb_len);
precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail = pkt_copy->data;
precvframe_if2->u.hdr.pkt = pkt_copy;
precvframe_if2->u.hdr.rx_head = pkt_copy->data;
precvframe_if2->u.hdr.rx_end = pkt_copy->data + alloc_sz;
- skb_reserve( pkt_copy, 8 - ((SIZE_PTR)( pkt_copy->data ) & 7 ));//force pkt_copy->data at 8-byte alignment address
+ skb_reserve( pkt_copy, 8 - ((unsigned long)(pkt_copy->data) & 7));//force pkt_copy->data at 8-byte alignment address
skb_reserve( pkt_copy, shift_sz );//force ip_hdr at 8-byte alignment address according to shift_sz.
memcpy(pkt_copy->data, pbuf, skb_len);
precvframe_if2->u.hdr.rx_data = precvframe_if2->u.hdr.rx_tail = pkt_copy->data;
precvframe->u.hdr.pkt = pkt_copy;
precvframe->u.hdr.rx_head = pkt_copy->data;
precvframe->u.hdr.rx_end = pkt_copy->data + alloc_sz;
- skb_reserve( pkt_copy, 8 - ((SIZE_PTR)( pkt_copy->data ) & 7 ));//force pkt_copy->data at 8-byte alignment address
+ skb_reserve( pkt_copy, 8 - ((unsigned long)( pkt_copy->data ) & 7 ));//force pkt_copy->data at 8-byte alignment address
skb_reserve( pkt_copy, shift_sz );//force ip_hdr at 8-byte alignment address according to shift_sz.
memcpy(pkt_copy->data, (pbuf + pattrib->shift_sz + pattrib->drvinfo_sz + RXDESC_SIZE), skb_len);
precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail = pkt_copy->data;
_irqL irqL;
int err;
unsigned int pipe;
- SIZE_PTR tmpaddr=0;
- SIZE_PTR alignment=0;
+ unsigned long tmpaddr = 0;
+ unsigned long alignment = 0;
u32 ret = _SUCCESS;
PURB purb = NULL;
struct recv_buf *precvbuf = (struct recv_buf *)rmem;
return _FAIL;
}
- tmpaddr = (SIZE_PTR)precvbuf->pskb->data;
+ tmpaddr = (unsigned long)precvbuf->pskb->data;
alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
skb_reserve(precvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment));
#define MEM_ALIGNMENT_OFFSET (sizeof (SIZE_T))
#define MEM_ALIGNMENT_PADDING (sizeof(SIZE_T) - 1)
-#define SIZE_PTR SIZE_T
-#define SSIZE_PTR SSIZE_T
-
//port from fw by thomas
// TODO: Belows are Sync from SD7-Driver. It is necessary to check correctness
//from any given member of recv_frame.
// rxmem indicates the any member/address in recv_frame
- return (union recv_frame*)(((SIZE_PTR)rxmem >> RXFRAME_ALIGN) << RXFRAME_ALIGN);
+ return (union recv_frame*)(((unsigned long)rxmem >> RXFRAME_ALIGN) << RXFRAME_ALIGN);
}
*(unsigned short *)(pbuf) |= cpu_to_le16(type); \
} while(0)
-#define GetSequence(pbuf) (cpu_to_le16(*(unsigned short *)((SIZE_PTR)(pbuf) + 22)) >> 4)
+#define GetSequence(pbuf) (cpu_to_le16(*(unsigned short *)((unsigned long)(pbuf) + 22)) >> 4)
-#define GetFragNum(pbuf) (cpu_to_le16(*(unsigned short *)((SIZE_PTR)(pbuf) + 22)) & 0x0f)
+#define GetFragNum(pbuf) (cpu_to_le16(*(unsigned short *)((unsigned long)(pbuf) + 22)) & 0x0f)
-#define GetTupleCache(pbuf) (cpu_to_le16(*(unsigned short *)((SIZE_PTR)(pbuf) + 22)))
+#define GetTupleCache(pbuf) (cpu_to_le16(*(unsigned short *)((unsigned long)(pbuf) + 22)))
#define SetFragNum(pbuf, num) \
do { \
- *(unsigned short *)((SIZE_PTR)(pbuf) + 22) = \
- ((*(unsigned short *)((SIZE_PTR)(pbuf) + 22)) & le16_to_cpu(~(0x000f))) | \
+ *(unsigned short *)((unsigned long)(pbuf) + 22) = \
+ ((*(unsigned short *)((unsigned long)(pbuf) + 22)) & le16_to_cpu(~(0x000f))) | \
cpu_to_le16(0x0f & (num)); \
} while(0)
#define SetSeqNum(pbuf, num) \
do { \
- *(unsigned short *)((SIZE_PTR)(pbuf) + 22) = \
- ((*(unsigned short *)((SIZE_PTR)(pbuf) + 22)) & le16_to_cpu((unsigned short)0x000f)) | \
+ *(unsigned short *)((unsigned long)(pbuf) + 22) = \
+ ((*(unsigned short *)((unsigned long)(pbuf) + 22)) & le16_to_cpu((unsigned short)0x000f)) | \
le16_to_cpu((unsigned short)(0xfff0 & (num << 4))); \
} while(0)
#define SetDuration(pbuf, dur) \
do { \
- *(unsigned short *)((SIZE_PTR)(pbuf) + 2) = cpu_to_le16(0xffff & (dur)); \
+ *(unsigned short *)((unsigned long)(pbuf) + 2) = cpu_to_le16(0xffff & (dur)); \
} while(0)
*(unsigned short *)(pbuf) |= cpu_to_le16( (amsdu & 1) << 7); \
} while(0)
-#define GetAid(pbuf) (cpu_to_le16(*(unsigned short *)((SIZE_PTR)(pbuf) + 2)) & 0x3fff)
+#define GetAid(pbuf) (cpu_to_le16(*(unsigned short *)((unsigned long)(pbuf) + 2)) & 0x3fff)
-#define GetTid(pbuf) (cpu_to_le16(*(unsigned short *)((SIZE_PTR)(pbuf) + (((GetToDs(pbuf)<<1)|GetFrDs(pbuf))==3?30:24))) & 0x000f)
+#define GetTid(pbuf) (cpu_to_le16(*(unsigned short *)((unsigned long)(pbuf) + (((GetToDs(pbuf)<<1)|GetFrDs(pbuf))==3?30:24))) & 0x000f)
-#define GetAddr1Ptr(pbuf) ((unsigned char *)((SIZE_PTR)(pbuf) + 4))
+#define GetAddr1Ptr(pbuf) ((unsigned char *)((unsigned long)(pbuf) + 4))
-#define GetAddr2Ptr(pbuf) ((unsigned char *)((SIZE_PTR)(pbuf) + 10))
+#define GetAddr2Ptr(pbuf) ((unsigned char *)((unsigned long)(pbuf) + 10))
-#define GetAddr3Ptr(pbuf) ((unsigned char *)((SIZE_PTR)(pbuf) + 16))
+#define GetAddr3Ptr(pbuf) ((unsigned char *)((unsigned long)(pbuf) + 16))
-#define GetAddr4Ptr(pbuf) ((unsigned char *)((SIZE_PTR)(pbuf) + 24))
+#define GetAddr4Ptr(pbuf) ((unsigned char *)((unsigned long)(pbuf) + 24))
#define MacAddr_isBcst(addr) \
( \
rst = _FAIL;
goto exit;
}
- dvobj->usb_vendor_req_buf =
- (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(dvobj->usb_alloc_vendor_req_buf ), ALIGNMENT_UNIT);
+ dvobj->usb_vendor_req_buf =
+ PTR_ALIGN(dvobj->usb_alloc_vendor_req_buf, ALIGNMENT_UNIT);
exit:
#endif
uint rtw_remainder_len(struct pkt_file *pfile)
{
- return (pfile->buf_len - ((SIZE_PTR)(pfile->cur_addr) - (SIZE_PTR)(pfile->buf_start)));
+ return (pfile->buf_len - ((unsigned long)(pfile->cur_addr) - (unsigned long)(pfile->buf_start)));
}
void _rtw_open_pktfile (_pkt *pktptr, struct pkt_file *pfile)
return _FAIL;
}
- pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ);
+ pxmitbuf->pbuf = PTR_ALIGN(pxmitbuf->pallocated_buf, XMITBUF_ALIGN_SZ);
pxmitbuf->dma_transfer_addr = 0;
#endif // CONFIG_USE_USB_BUFFER_ALLOC_TX
return _FAIL;
}
- pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ);
+ pxmitbuf->pbuf = PTR_ALIGN(pxmitbuf->pallocated_buf, XMITBUF_ALIGN_SZ);
#endif
return _SUCCESS;