I am trying to use SDK 1.9 DPAA on T4240 . I need how the physical addresses (that FMAN puts the etherent packets via DMA) are allocated for use of FMAN DMA.
My problem is about alignment. I need dword aligned skb->data addresses after receiving packets from FMAN, but in dpa_rx routine after skb_pull of ethernet header(14 bytes) I have skb->data addresses which are not dword aligned, but my hardware DMA requires dword aligned addresses so I need to change the skb->data address without loss of packet fields.
Any help will be appreciated.
It looks like that code should be changed for assigning alignment data buffer.
Usually the following code is used for data alignment:
#define MASK_ALIGNMENT_4BYTES (0x03) /*FEC needs 4bytes alignment*/
#define MASK_ALIGNMENT_8BYTES (0x07) /*FEC needs 64bytes alignment*/
#define MASK_ALIGNMENT_32BYTES (0x1F) /*FEC needs 32bytes alignment*/
#define ADDR_ALIGNMENT(x) ((unsigned char *)(((unsigned long )(x) + (MASK_ALIGNMENT)) & (~MASK_ALIGNMENT)))
Length of array should be the following:
L - is real length of array
LL=L+MASK_ALIGNMENT - requried size of memory
Have a great day,
Pavel
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------