Tool/software: TI-RTOS
Hello.
We are sending and receiving RAW Ethernet packets from IPU1 using GMAC.
Reception is OK. All packets sent from PC are received.
When sending we have the following problem.
sendnc() function returns no errors, but only 1 to 5 packets from 20 are actually sent out of the device and received by the PC.
We use NDK version 2.25.01.11.
We use the following TI RTOS configuration:
app.cfg Global.ndkTickPeriod = 10; Global.kernTaskPriLevel = 11; Global.serviceReportHook = null; Global.IPv6 = false; Global.enableCodeGeneration = true; Global.pktNumFrameBufs = 1920;
We use the following procedure:
#define GOOSE_PACK_TYPE 0x88B8 static uint8_t test_pkt[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // SRC MAC 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // DEST MAC 0x88, 0xB8, // proto 0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, 0x01, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0xc0, 0xa8, 0x01, 0x16, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xa8, 0x01, 0x02, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0xfe, 0xfe, 0x00, 0x00}; taskParams.instance->name = "IPU1_eth_taskFxn"; taskParams.stackSize = 0x1500; taskParams.priority = 4; Task_create(IPU1_eth_taskFxn, &taskParams, &eb); Void IPU1_eth_taskFxn(UArg arg0, UArg arg1) { unsigned char *data_in = NULL; unsigned char *data_out = NULL; HANDLE handlerRecBuff; HANDLE handlerSendBuff; struct timeval to; struct sockaddr_in sockaddr; SOCKET s = socket(AF_RAWETH, SOCK_RAWETH, GOOSE_PACK_TYPE); setsockopt(s, SOL_SOCKET, SO_IFDEVICE, &val, sizeof(val) for (;;) { code = recvnc(s, (void **)&data_in, 0, &handlerRecBuff); if (code == -1) { UART_printf("Failed: %d\n", fdError()); } else { UART_printf("Success: %d\n",code); for(int i=0;i<code;i++) { UART_printf("0x%x ",data_in[i]); if(i%10 == 9) UART_printf("\n"); } UART_printf("sizeof(test_pkt) %d ",sizeof(test_pkt)); for(int j=0;j<20;j++) { code = getsendncbuff(s,sizeof(test_pkt),&data_out,&handlerSendBuff); //mac_source data_out[0] = data_in[6]; data_out[1] = data_in[7]; data_out[2] = data_in[8]; data_out[3] = data_in[9]; data_out[4] = data_in[10]; data_out[5] = data_in[11]; //MAC destination data_out[6] = data_in[0]; data_out[7] = data_in[1]; data_out[8] = data_in[2]; data_out[9] = data_in[3]; data_out[10] = data_in[4]; data_out[11] = data_in[5]; for(int i=12;i < sizeof(test_pkt);i++) data_out[i]=test_pkt[i]; if (code == -1) UART_printf("Failed getsendncbuff: %d\n", fdError()); else { data_out[15] = j;//count code = sendnc(s, data_out, sizeof(test_pkt),handlerSendBuff,0); if (code == -1) { UART_printf("Failed send: %d\n", fdError()); } else { UART_printf("Success send: %d\n",code); } } sendncfree(handlerSendBuff); } recvncfree(handlerRecBuff); } } }
Thanks