Eric,
I am trying to make a change to my design to be able to do the steps described below but am running into problems. The example below is on a single core but of course I intend to extend the idea to multicore.
For IPv4 and UDP packets, I want the PA after matching on MAC address and then IP address and protocol type and ip type matching to be directed to a regular LUT2 port # matching, if it fails then I want it to be directed to a custom LUT2 entry with a arange of UDP ports. So for example UDP port 0x8000 could be the port # I am trying to match on using the pa_addPort command and then if it fails then I want to setup in the pa_addIp to have the nextrtFail set to use custom LUT2 with a range of UDP ports. I am trying to do this so that I can have the PA differentiate between say port 0x8000 and ports 0x8001-0x80FF and can then have the PA tag them with different swInfo words and also possible remove the ethernet and other headers for those packets received on port 0x8000.
Is what I am trying feasible? I cannot see any reason why it should not be the case but...
When I tried setting up by using the pa_addIp command with routeInfo set to {DEST_CONTINUE_LUT2, no custom type} and ntFailInfo set to {DEST_CONTINUE_LUT2, custom LUT2 type and custom Index = 1), the PA LLD returned error -10 which is errconfig. Looking through the pa LLD code for pa_addIp it points to only two cases when this happens:
1. if the ipInfo fields spi, greProto, sctpPort are non-zero which is not the case for my ipInfo structure.
2. if the iptype is not IPV4 or IPv6 which is again not the case for me.
Thanks, Aamir
Thanks for the suggestion. I will in the future ping you on an existing thread and point to the new post. The forum should have an ability to direct a new thread email to a particular person. Currently it talks of BCC to a friend. Anyways I will suggest this to the E2E organizers. Thanks.
As for my issues:
I have resolved issue 1, it was due to incorrect multicore etc legacy code. Basically when a desciptor is popped of the Tx free Q and its length field (word 3 in the descriptor) is modified to specify the actual length of the Tx packet sent to the PA, when it is freed back after use and pushed back to the Tx Free Q it does not reset the length field to be the same as word 6 of the descriptor which is should do. So when it makes use of that buffer descriptor again in the future in the setup my code (and also legacy TI code in a function such as Add_Port etc) it sets the cmdSize to be equal to the descriptor buffer length (which has not been reset) and so the pa_addCustomLUt2 fails as the length is no longer sufficient.
I fixed this by resetting the word 3 field in the descriptor if the host receives a reply back from the PA prior to popping the descriptor into the variable pHostDesc i.e. Just after the "if Qmss)getQueueEntryCOunt (gPaCfgCmdRespQHand) > 0).
As for issue 2 I am not sure if you mean that you think there is an issue with how TI is implementing the delete capability or how I am implementing the use of it? Basically there is nothing complicated about the actual packet vs received packet. I am sending a short UDP packet over Ethernet to the EVM. The PA is stripping of the Ethernet and IP headers and the DRC at the end and is keeping the UDP header 8 bytes (0x8000 0x8000 0x0012 0x0178 and the body 10 bytes (0x00010203040506070809). I can share my code with you offline or you can try removing UDP headers.
Hi, Aamir:
[Eric] I have verified the current implementation and believed that the commad shall remove the UDP header successfully. However, there is some issue how we handle the end of payload offset after deletion operation. Therefore, it will delete some extra bytes prior to CRC. If this is the observed behavior, I can send you the firmware patches since the offical fix will not be available in the near future. If you may provide the memory dump of the descriptor and data buffer of the received packet, I should be able to see whether there are other problems.
Best regards,
Eric
Hi Eric,
I am not observing any deletion of the UDP header so I am not seeing your behaviour.
This is the memory dump (in words - descriptor is 64 bytes) starting at an example descriptor at 0xc0124c0
0000002C 00000000 800002E1 00000100 0C001300 00000000 00000100 0C00130000000000 55550004 33334444 00000000 00000000 00000000 00000000 00000000
This is the memory dump (in words only show the first 64 bytes) starting at an example buffer at 0xc001300
00800080 2DB82600 03020100 07060504 11100908 15141312 19181716 2322212027262524 00002928 00000000 00000000 00000000 00000000 00000000 00000000
Can you share with my an example code that shows your use of the CMD_PATCH_DATA with the delete option (PA_PATCH_OP_DELETE)
Sorry I did a memory dump of the descriptor prior to updating some of the elements of the descriptor. It should have read as follows:
0E000026 00000000 860002E1 00000026 0C001300 00000000 00000100 0C00130000000000 CCCCCCCC 00000000 00000000 B8400000 00260440 0E000000 81360102
Here is some sample code:
static paPatchInfo_t t5PatchCmd2 = { pa_PATCH_OP_DELETE, /* ctrlBitfield */ 8, /* nPatchBytes */ 0, /* totalPatchSize */ 0, /* offset */ NULL /* Pointer to the patch data */ };
static paCmdInfo_t t5CmdSet2[] ={ /* Command 0: Remove header */ { pa_CMD_REMOVE_HEADER, { { 0, /* ctrlBitfield */ 0, /* dest */ 0, /* pktType */ 0, /* flowId */ 0, /* queue */ 0, /* swInfo0 */ 0, /* swInfo1 */ 0 /* multiRouteIndex */ } } }, /* Command 1: Delete Bytes */ { pa_CMD_PATCH_DATA, { { 0, /* ctrlBitfield */ 0, /* dest */ 0, /* pktType */ 0, /* flowId */ 0, /* queue */ 0, /* swInfo0 */ 0, /* swInfo1 */ 0 /* multiRouteIndex */ } } }, /* Command 2: Remove Tail */ { pa_CMD_REMOVE_TAIL, { { 0, /* ctrlBitfield */ 0, /* dest */ 0, /* pktType */ 0, /* flowId */ 0, /* queue */ 0, /* swInfo0 */ 0, /* swInfo1 */ 0 /* multiRouteIndex */ } } } };
static paCmdInfo_t t5CmdSetCmd2 = { pa_CMD_CMDSET, { { T5_CMDSET_2_INDEX /* Command set index */ } } };
...
t5CmdSet2[1].params.patch = t5PatchCmd2; t5CmdSetCmd2.params.cmdSet.index = T5_CMDSET_2_INDEX;
I think I am essentially doing the same thing although your example does not actually show how you are making use of the command set within the pa_addPort or pa_addCustomLUt2 etc. Can you confirm the steps that I am doing are correct and have outlined in a previous posting on this same thread? I will repeat them here again as I cannot understand why it does not work for me.
I first configure the PA making use of the pa_configCmdSet function call with the following parameters:
Pa_configCmdSet (gPaInstHand, index=0, nCmd=3, headerAndTailCmdSet, pHostDesc->bufPtr, &cmdSize, &cmdReplyInfo, &cmdDest)
where headerAndTailCmdSet is an array of 3 commands similar to what you have in t5CmdSet2[] above except that I have replaced the innermost {} in the middle command in the array
pa_CMD_PATCH_DATA, { { 0, /* ctrlBitfield */ 0, /* dest */ 0, /* pktType */ 0, /* flowId */ 0, /* queue */ 0, /* swInfo0 */ 0, /* swInfo1 */ 0 /* multiRouteIndex */ } }
with
{
pa_PATCH_OP_DELETE, /* ctrlBitfield */ 8, /* nPatchBytes */ 0, /* totalPatchSize */ 0, /* offset */ NULL /* Pointer to the patch data */ };
The intent being that this is the command set to remove header, 8 bytes of remaining UDP header and tail. There are 3 commands as part of this set hence nCmds=3. The index of this command set is taken to be zero.
Finally, when configuring the PA when using the pa_addCustomLUT2 function, need to configure the routeInfo.pCmd field within the routeInfo array in the Pa_addCustomLUT2 call to make use of this command set index. This is done similar to what you have above by setting routeInfo.pCmd=t5CmdSetCmd2. This then implies that for this particular PA rule, process through the Cmdset 0 which includes remove headers, UDP headers and tail prior to sending to host.
static paCmdInfo_t t5CmdSetCmd2 = { pa_CMD_CMDSET, { { 0 /* Command set index */ } } };
Aamir
The initialization table does not seem to work since the command parameters paCmdInfo_t.params is an Union and there is no way the compiler will know which element should be used.
You need to initialize the patch parameters with the following code as I pointed out at the previous response:
Thanks!
I had actually tried what you suggested with the red highlighted part prior to my earlier posting but did not realize it was kind of working as my packet was too small (10 bytes long) to realize what had happened. I tried it again and it does work except that in addition to removing the 8 byte header it also removes the 8 bytes from the end of the packet which you alluded to in an earlier post. Can you send me the patch for this problem. Thanks for your help.
1526.pam_bin.c
Please try the firmware patch attached.
Thanks, it works!