summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ec4a839)
raw | patch | inline | side by side (parent: ec4a839)
author | Tinku Mannan <tmannan@ti.com> | |
Wed, 3 Jul 2019 13:08:23 +0000 (09:08 -0400) | ||
committer | Mahesh Radhakrishnan <a0875154@ti.com> | |
Wed, 10 Jul 2019 18:27:07 +0000 (13:27 -0500) |
packet send via emac_send which is less than 60 bytes will be zero padded
upto 60 bytes and packet length will be set to 60 bytes by the driver at
time of emac_send.
Signed-off-by: Tinku Mannan <tmannan@ti.com>
upto 60 bytes and packet length will be set to 60 bytes by the driver at
time of emac_send.
Signed-off-by: Tinku Mannan <tmannan@ti.com>
test/EmacLoopbackTest/test_utils_switch_k3.c | patch | blob | history |
diff --git a/test/EmacLoopbackTest/test_utils_switch_k3.c b/test/EmacLoopbackTest/test_utils_switch_k3.c
index 6d6bf16f415e2fbe77c7efd4f70b1e76cfabc1e9..2e98a8ff61db4a0b96161a726cd6cbba7d674501 100644 (file)
PRUICSS_Handle prussHandle[EMAC_MAX_ICSS] = {NULL, NULL, NULL};
int hs_index[EMAC_MAX_ICSS * EMAC_MAC_PORTS_PER_ICSS]; //one per icss slice
+/* This flag will be enabled by test app in app_test_zero_fill() when sending packet
+ * which has length less than 60 bytes and to ensure the driver will set packet length to
+ * 60 bytes and zero fill the packet upto 60 bytes before transmission */
+uint32_t g_app_test_zero_fill = 0;
/* Test will use network firmware to verify packet transmission
* and reception between 2 physical ICSSG ports, each ICSSG port needs to be connected
0xfe,0xfe, 0x00, 0x00
};
+#define APP_TEST_PKT_SIZE_44_BYTE 44
+#define APP_TEST_PKT_SIZE_60_BYTE 60
+
+/* packet sent which is less than 60 bytes */
+static uint8_t app_test_zero_fill_pkt_44[APP_TEST_PKT_SIZE_44_BYTE] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x48, 0x93, 0xfe, 0xda, 0x16, 0x4a,
+ 0x08, 0x06, 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
+};
+/* to to verify packet less than 60 bytes has been zero filled by driver */
+static uint8_t app_test_zero_fill_pkt_60[APP_TEST_PKT_SIZE_60_BYTE] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x48, 0x93, 0xfe, 0xda, 0x16, 0x4a,
+ 0x08, 0x06, 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,
+ 0x00, 0x00,0x00,0x00,
+ 0x00, 0x00,0x00,0x00,
+ 0x00, 0x00,0x00,0x00,
+ 0x00, 0x00,0x00,0x00
+};
static uint8_t mac1_mc[6] = {0x01, 0x93, 0x20, 0x21, 0x22, 0x22};
static uint8_t app_test_mc1_pkt[APP_TEST_PKT_SIZE] = {
{
if (p_desc->AppPrivate)
{
- if (memcmp(p_desc->pDataBuffer, pTestPkt, APP_TEST_PKT_SIZE) == 0)
+ if (g_app_test_zero_fill == 1)
{
- UART_printf("app_test_rx_pkt_cb: port %d: received packet %d, packet length: %d, rx timestamp: 0x%x%08x\n",
+ if (memcmp(p_desc->pDataBuffer, app_test_zero_fill_pkt_60, APP_TEST_PKT_SIZE_60_BYTE) == 0)
+ {
+ UART_printf("app_test_rx_pkt_cb: port %d: received packet %d, packet length: %d, rx timestamp: 0x%x%08x\n",
port_num,
pkt_rcv_count,
p_desc->PktLength,
(unsigned int)(p_desc->RxTimeStamp >> 32),
(unsigned int)(p_desc->RxTimeStamp & 0xFFFFFFFF));
+ }
+ else
+ {
+ UART_printf("app_test_rx_pkt_cb: port %u: packet match failed, packet length: %d\n", port_num, p_desc->PktLength);
+ }
}
else
{
- UART_printf("app_test_rx_pkt_cb: port %u: packet match failed, packet length: %d\n", port_num, p_desc->PktLength);
+ if (memcmp(p_desc->pDataBuffer, pTestPkt, APP_TEST_PKT_SIZE) == 0)
+ {
+ UART_printf("app_test_rx_pkt_cb: port %d: received packet %d, packet length: %d, rx timestamp: 0x%x%08x\n",
+ port_num,
+ pkt_rcv_count,
+ p_desc->PktLength,
+ (unsigned int)(p_desc->RxTimeStamp >> 32),
+ (unsigned int)(p_desc->RxTimeStamp & 0xFFFFFFFF));
+ }
+ else
+ {
+ UART_printf("app_test_rx_pkt_cb: port %u: packet match failed, packet length: %d\n", port_num, p_desc->PktLength);
+ }
}
app_free_pkt(port_num, (EMAC_PKT_DESC_T*) p_desc->AppPrivate);
if (testPktClone == 1)
UART_printf("\napp_test_local_injection: END\n");
}
+void app_test_zero_fill(void)
+{
+
+ g_app_test_zero_fill = 1;
+ UART_printf("\napp_test_zero_fill: BEGIN\n");
+ pTestPkt = (uint8_t*)(&app_test_zero_fill_pkt_44[0]);
+ app_test_send(EMAC_SWITCH_PORT1, pTestPkt, 0, APP_TEST_PKT_SIZE_44_BYTE,0);
+ g_app_test_zero_fill = 0;
+ UART_printf("app_test_zero_fill: END\n");
+}
void app_test_send_ioctl_cmd(uint32_t port_num, EMAC_IOCTL_CMD ioctl_cmd, uint32_t sub_cmd)
{
/* Verify local injection using loopback connection between SW1 and SW1 */
app_test_local_injection();
+ /* verify packet < 64 bytes is padded with zero's upto 60 bytes by driver */
+ app_test_zero_fill();
+
/* Test cloning logic in the driver */
app_test_pkt_clone();
Task_sleep(1000);