aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMykyta Iziumtsev <mykyta.iziumtsev@linaro.org>2017-10-25 13:21:11 +0200
committerMykyta Iziumtsev <mykyta.iziumtsev@linaro.org>2017-10-25 13:24:21 +0200
commitf86e974c97ba8ef6756046bb1938657ddb550066 (patch)
treebc3ab961a99888350b1cb5694792d97bfbad1af0
parent7f18ca52a39592aa79c3d57a627056ea86c93edd (diff)
e1000e: modify TX path
Make the test xmit function send 100 ARP packets instead of single UDP packet. Signed-off-by: Mykyta Iziumtsev <mykyta.iziumtsev@linaro.org>
-rw-r--r--drivers/e1000e.c91
1 files changed, 61 insertions, 30 deletions
diff --git a/drivers/e1000e.c b/drivers/e1000e.c
index 31d8251..5160d0b 100644
--- a/drivers/e1000e.c
+++ b/drivers/e1000e.c
@@ -196,40 +196,71 @@ void *e1000e_map_mmio(int device, size_t *len)
void e1000e_xmit(void *txring, struct iomem data, volatile void *ioaddr)
{
- /* test udp packet */
- static const char pkt_udp[] = {
- 0x02, 0x50, 0x43, 0xff, 0xff, 0x01, /* mac dst */
- 0x00, 0x60, 0xdd, 0x45, 0xe5, 0x67, /* mac src */
- 0x08, 0x00, 0x45, 0x00, 0x00, 0x32,
- 0x38, 0xb8, 0x40, 0x00, 0x40, 0x11,
- 0x1e, 0xae, 0xc0, 0xa8, 0x31, 0x03, /* ip src: 192.168.49.3 and dst 192.168.49.1 */
- 0xc0, 0xa8, 0x31, 0x01, 0xed, 0x19,
- 0x00, 0x35, 0x00, 0x1e, 0x8b, 0xf4,
- 0xc4, 0x2e, 0x01, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x74, 0x65, 0x73, 0x74, 0x00,
- 0x00, 0x01, 0x00, 0x01
+ /* ARP request packet */
+ static const unsigned char pkt_arp_req[] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, 0x4d,
+ 0x30, 0x64, 0x43, 0xf7, 0x08, 0x06, 0x00, 0x01,
+ 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, 0xf4, 0x4d,
+ 0x30, 0x64, 0x43, 0xf7, 0xc0, 0xa8, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xa8,
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
};
- const int idx = 0;
- e1000_tx_desc_t *tx_desc = (e1000_tx_desc_t *)txring + idx;
- char *tx_buff = (char *)(data.vaddr + idx * 2048);
- uint32_t txd_cmd = E1000_TXD_CMD_IFCS | E1000_TXD_CMD_EOP | E1000_TXD_CMD_RS |
- E1000_TXD_CMD_IDE;
-
- /* XXX FIXME need proper packet size and sizeof(src) *NOT* dst */
- memcpy(tx_buff, pkt_udp, sizeof(pkt_udp));
- tx_desc->buffer_addr = odpdrv_cpu_to_le_64(data.iova + idx * 2048);
- tx_desc->lower.data = odpdrv_cpu_to_le_32(txd_cmd | sizeof(pkt_udp));
- tx_desc->upper.data = odpdrv_cpu_to_le_32(0);
- dma_wmb();
+ int idx;
+ uint32_t txd_cmd =
+ E1000_TXD_CMD_IFCS | E1000_TXD_CMD_EOP | E1000_TXD_CMD_RS |
+ E1000_TXD_CMD_IDE;
+
+ for (idx = 0; idx < 100; idx++) {
+ volatile e1000_tx_desc_t *tx_desc =
+ (e1000_tx_desc_t *) txring + idx;
+ volatile unsigned char *tx_buff =
+ (unsigned char *) (data.vaddr + idx * 2048);
+
+ /* XXX FIXME need proper packet size and sizeof(src) *NOT* dst */
+ memcpy((void *) tx_buff, pkt_arp_req, sizeof(pkt_arp_req));
+ tx_desc->buffer_addr =
+ odpdrv_cpu_to_le_64(data.iova + idx * 2048);
+ tx_desc->lower.data =
+ odpdrv_cpu_to_le_32(txd_cmd | sizeof(pkt_arp_req));
+ tx_desc->upper.data = odpdrv_cpu_to_le_32(0);
+
+ dma_wmb();
+
+ printf("Triggering xmit of dummy packet\n");
+ print_packet((void *) tx_buff);
+
+#if 0
+ printf("tx_desc->buffer_addr == 0x%016lx\n",
+ tx_desc->buffer_addr);
+ printf("tx_desc->lower == 0x%08x\n", tx_desc->lower.data);
+ printf("tx_desc->upper == 0x%08x\n", tx_desc->upper.data);
+ printf("TDT == 0x%08x\n",
+ io_read32(ioaddr + E1000_TDT_OFFSET));
+ printf("TDH == 0x%08x\n",
+ io_read32(ioaddr + E1000_TDH_OFFSET));
+
+ usleep(100 * 1000);
+#endif
+
+ io_write32(odpdrv_cpu_to_le_32(idx + 1),
+ ioaddr + E1000_TDT_OFFSET);
- printf("Triggering xmit of dummy packet\n");
- printf("tx_desc->buffer_addr == 0x%016lx\n", tx_desc->buffer_addr);
- printf("tx_desc->lower == 0x%08x\n", tx_desc->lower.data);
- printf("tx_desc->upper == 0x%08x\n", tx_desc->upper.data);
+ usleep(100 * 1000);
- io_write32(odpdrv_cpu_to_le_32(idx + 1), ioaddr + E1000_TDT_OFFSET);
+#if 0
+ printf("TDT == 0x%08x\n",
+ io_read32(ioaddr + E1000_TDT_OFFSET));
+ printf("TDH == 0x%08x\n",
+ io_read32(ioaddr + E1000_TDH_OFFSET));
+ printf("tx_desc->buffer_addr == 0x%016lx\n",
+ tx_desc->buffer_addr);
+ printf("tx_desc->lower == 0x%08x\n", tx_desc->lower.data);
+ printf("tx_desc->upper == 0x%08x\n", tx_desc->upper.data);
+#endif
+ }
return;
}