Commit 3795fb03 authored by Vikram Narayanan's avatar Vikram Narayanan

test_mods/ixgbe: Update mac and PCI dev.fn

Update hard-coded mac address and PCI DEV.FN number. Also add verbose prints
for debugging TCP packets.
Signed-off-by: Vikram Narayanan's avatarVikram Narayanan <vikram186@gmail.com>
parent 28267e78
......@@ -29,7 +29,7 @@ static struct net_device *g_net_device;
#ifdef IOMMU_ASSIGN
/* device for IOMMU assignment */
struct pcidev_info dev_assign = { 0x0000, 0x04, 0x00, 0x1 };
struct pcidev_info dev_assign = { 0x0000, 0x42, 0x00, 0x1 };
#endif
struct kmem_cache *skb_c_cache;
......@@ -281,6 +281,7 @@ static void destroy_async_channel(struct thc_channel *chnl)
LIBLCD_ERR("failed to translate rx to cptr");
goto fail2;
}
printk("%s, destroying channel %p", __func__, chnl);
/*
* Unmap and kill tx/rx
*/
......@@ -307,7 +308,7 @@ fail1:
return;
}
struct thc_channel_group_item *ptrs[32];
struct thc_channel_group_item *ptrs[32] = {0};
int create_one_async_channel(struct thc_channel **chnl, cptr_t *tx, cptr_t *rx)
{
......@@ -330,6 +331,7 @@ int create_one_async_channel(struct thc_channel **chnl, cptr_t *tx, cptr_t *rx)
thc_channel_group_item_add(&ch_grp, xmit_ch_item);
printk("%s, assingning ptrs[%d] to %p", __func__, idx % 32, xmit_ch_item);
ptrs[idx++%32] = xmit_ch_item;
return 0;
......@@ -340,17 +342,16 @@ int create_async_channel(void)
int ret;
cptr_t tx, rx;
cptr_t tx_xmit, rx_xmit;
cptr_t tx_xmit2, rx_xmit2;
cptr_t txirq_xmit, rxirq_xmit;
struct thc_channel *chnl;
struct thc_channel *xmit_chnl;
#ifdef EXTRA_CHANNELS
cptr_t tx_xmit2, rx_xmit2;
cptr_t txirq_xmit, rxirq_xmit;
struct thc_channel *xmit_chnl2;
struct thc_channel *xmit_irq_chnl;
/* struct thc_channel_group_item *ch_item;
struct thc_channel_group_item *xmit_ch_item;
struct thc_channel_group_item *xmit_ch_item2;
struct thc_channel_group_item *xmit_chirq_item;
*/
#endif
/*
* Set up async and sync channels
*/
......@@ -370,6 +371,9 @@ int create_async_channel(void)
goto fail_ch;
}
ptrs[0] = ptrs[1] = NULL;
#ifdef EXTRA_CHANNELS
if (create_one_async_channel(&xmit_chnl2, &tx_xmit2, &rx_xmit2)) {
LIBLCD_ERR("async channel creation failed");
goto fail_ch;
......@@ -379,70 +383,19 @@ int create_async_channel(void)
LIBLCD_ERR("async channel creation failed");
goto fail_ch;
}
#if 0
ret = setup_async_channel(&tx, &rx, &chnl);
if (ret) {
LIBLCD_ERR("async chnl setup failed");
goto fail2;
}
ch_item = kzalloc(sizeof(*ch_item), GFP_KERNEL);
thc_channel_group_item_init(ch_item, chnl, NULL);
thc_channel_group_item_add(&ch_grp, ch_item);
ret = setup_async_channel(&tx_xmit, &rx_xmit, &xmit_chnl);
if (ret) {
LIBLCD_ERR("async xmit chnl setup failed");
goto fail2;
}
xmit_ch_item = kzalloc(sizeof(*xmit_ch_item), GFP_KERNEL);
thc_channel_group_item_init(xmit_ch_item, xmit_chnl, NULL);
thc_channel_group_item_add(&ch_grp, xmit_ch_item);
ret = setup_async_channel(&tx_xmit2, &rx_xmit2, &xmit_chnl2);
if (ret) {
LIBLCD_ERR("async xmit chnl setup failed");
goto fail2;
}
xmit_ch_item2 = kzalloc(sizeof(*xmit_ch_item2), GFP_KERNEL);
thc_channel_group_item_init(xmit_ch_item2, xmit_chnl2, NULL);
thc_channel_group_item_add(&ch_grp, xmit_ch_item2);
ret = setup_async_channel(&txirq_xmit, &rxirq_xmit,
&xmit_irq_chnl);
if (ret) {
LIBLCD_ERR("async xmit chnl setup failed");
goto fail2;
}
xmit_chirq_item = kzalloc(sizeof(*xmit_chirq_item),
GFP_KERNEL);
thc_channel_group_item_init(xmit_chirq_item, xmit_irq_chnl,
NULL);
thc_channel_group_item_add(&ch_grp, xmit_chirq_item);
#endif
lcd_set_cr0(ixgbe_sync_endpoint);
lcd_set_cr1(rx);
lcd_set_cr2(tx);
lcd_set_cr3(rx_xmit);
lcd_set_cr4(tx_xmit);
#ifdef EXTRA_CHANNELS
lcd_set_cr5(rxirq_xmit);
lcd_set_cr6(txirq_xmit);
lcd_set_cr7(rx_xmit2);
// lcd_set_cr8(tx_xmit2);
lcd_set_cr8(tx_xmit2);
#endif
LIBLCD_MSG("sync call %s", __func__);
ret = lcd_sync_call(ixgbe_register_channel);
......@@ -456,9 +409,11 @@ int create_async_channel(void)
lcd_set_cr2(CAP_CPTR_NULL);
lcd_set_cr3(CAP_CPTR_NULL);
lcd_set_cr4(CAP_CPTR_NULL);
#ifdef EXTRA_CHANNELS
lcd_set_cr5(CAP_CPTR_NULL);
lcd_set_cr6(CAP_CPTR_NULL);
#endif
if (ret) {
LIBLCD_ERR("lcd_call");
goto fail3;
......@@ -2677,6 +2632,7 @@ int ndo_start_xmit_clean_callee(struct fipc_message *_request,
struct skbuff_members *skb_lcd;
__be16 proto;
void *mem;
unsigned int seq, ack;
#ifdef LCD_MEASUREMENT
TS_DECL(xmit);
#endif
......@@ -2693,10 +2649,10 @@ int ndo_start_xmit_clean_callee(struct fipc_message *_request,
fipc_recv_msg_end(thc_channel_to_fipc(_channel),
_request);
if (_channel == ixgbe_async)
printk("%s, Got msg - reqc 0x%x | xmitty %d",
__func__, request_cookie,
xmit_type);
//if (_channel == ixgbe_async)
// printk("%s, Got msg - reqc 0x%x | xmitty %d",
// __func__, request_cookie,
// xmit_type);
skb_c = mem = kmem_cache_alloc(skb_c_cache,
GFP_KERNEL);
......@@ -2744,6 +2700,27 @@ int ndo_start_xmit_clean_callee(struct fipc_message *_request,
#ifdef LCD_MEASUREMENT
TS_START_LCD(xmit);
#endif
/* if TCP */
/* 38-41 - Seq no
* 42-45 - Ack no
*/
if (skb->data[23] == 0x6) {
unsigned char flags = (skb->data[46] & 0x0F) | skb->data[47];
seq = (skb->data[38] << 24) | (skb->data[39] << 16) | (skb->data[40] << 8) | skb->data[41];
ack = (skb->data[42] << 24) | (skb->data[43] << 16) | (skb->data[44] << 8) | skb->data[45];
printk("got pkt | cookie %d | proto %x | IP proto %x | TCP.seq %u | TCP.ack %u | TCP Flags [%s%s%s%s%s]\n",
request_cookie, htons(skb->protocol),
skb->data[23], seq, ack,
(flags & 0x1) ? " FIN " : "",
(flags & 0x2) ? " SYN " : "",
(flags & 0x4) ? " RST " : "",
(flags & 0x8) ? " PSH " : "",
(flags & 0x10) ? " ACK " : "");
}
func_ret = ixgbe_xmit_frame(skb, g_netdev);
if (func_ret)
......@@ -2767,12 +2744,12 @@ int ndo_start_xmit_clean_callee(struct fipc_message *_request,
request_cookie,
_response);
// printk("%s, posting response for reqc 0x%x", __func__,
// request_cookie);
// printk("%s, posting response for pkt | cookie %d | seq %u | ack %u", __func__,
// request_cookie, seq, ack);
if (_channel == ixgbe_async)
printk("%s, Sending reply for reqc 0x%x", __func__,
request_cookie);
// if (_channel == ixgbe_async)
// printk("%s, Sending reply for reqc 0x%x", __func__,
// request_cookie);
fail_alloc:
return ret;
......@@ -2816,10 +2793,10 @@ int ndo_start_xmit_callee(struct fipc_message *_request,
fipc_recv_msg_end(thc_channel_to_fipc(_channel),
_request);
if (_channel == ixgbe_async)
printk("%s, Got msg - reqc 0x%x | xmitty %d",
__func__, request_cookie,
xmit_type);
// if (_channel == ixgbe_async)
// printk("%s, Got msg - reqc 0x%x | xmitty %d",
// __func__, request_cookie,
// xmit_type);
switch (xmit_type) {
case VOLUNTEER_XMIT:
......@@ -2957,9 +2934,9 @@ int ndo_start_xmit_callee(struct fipc_message *_request,
thc_ipc_reply(_channel,
request_cookie,
_response);
if (_channel == ixgbe_async)
printk("%s, Sending reply for reqc 0x%x", __func__,
request_cookie);
// if (_channel == ixgbe_async)
// printk("%s, Sending reply for reqc 0x%x", __func__,
// request_cookie);
fail_alloc:
fail_sync:
return ret;
......
......@@ -50,8 +50,8 @@
#endif
#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
#define IXGBE_FCOE
#include "ixgbe_fcoe.h"
//#define IXGBE_FCOE
//#include "ixgbe_fcoe.h"
#endif /* CONFIG_FCOE or CONFIG_FCOE_MODULE */
#ifdef CONFIG_IXGBE_DCA
#include <linux/dca.h>
......
......@@ -43,7 +43,7 @@ unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
int skb_pad(struct sk_buff *skb, int pad) { LIBLCD_MSG("================>$$$$$$ Dummy %s called", __func__); return 0; }
int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len) { LIBLCD_MSG("================>$$$$$$ Dummy %s called", __func__); return 0; }
int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len) { LIBLCD_MSG("================>$$$$$$ Dummy %s called", __func__); dump_stack(); return 0; }
int skb_checksum_help(struct sk_buff *skb) { LIBLCD_MSG("================>$$$$$$ Dummy %s called", __func__); return 0; }
......
......@@ -1479,6 +1479,7 @@ int ndo_start_xmit_nonlcd(struct sk_buff *skb,
cptr_t skb_cptr, skbd_cptr;
struct skbuff_members *skb_lcd;
bool got_resp = false;
u64 tcp_count = global_tx_count;
#ifdef TIMESTAMP
TS_DECL(mndo_xmit);
#endif
......@@ -1613,6 +1614,10 @@ int ndo_start_xmit_nonlcd(struct sk_buff *skb,
break;
}
if (skb->data[23] == 0x6) {
printk("%s, ipc_send | pts %p | reqc 0x%x | seq %llu\n",
__func__, PTS(), request_cookie, tcp_count);
}
again:
async_msg_blocking_recv_start(async_chnl, &_response);
......@@ -1640,6 +1645,12 @@ again:
_response);
}
if (skb->data[23] == 0x6) {
printk("%s, ipc_recv | pts %p | reqc 0x%x | seq %llu\n",
__func__, PTS(), request_cookie, tcp_count);
}
//printk("%s, queue_mapping %d\n", __func__, skb->queue_mapping);
#ifdef TIMESTAMP
TS_STOP(mndo_xmit);
times_ndo_xmit[iter] = TS_DIFF(mndo_xmit);
......@@ -1823,6 +1834,7 @@ int ndo_start_xmit(struct sk_buff *skb,
struct skbuff_members *skb_lcd;
cptr_t sync_end;
struct thc_channel *async_chnl = NULL;
u64 tcp_count = 0;
xmit_type = check_skb_range(skb);
if (!PTS()) {
......@@ -1862,8 +1874,8 @@ int ndo_start_xmit(struct sk_buff *skb,
} else if(!strncmp(current->comm, "iperf",
strlen("iperf")) ||
!strncmp(current->comm, "netperf",
strlen("netperf"))) {
!strncmp(current->comm, "lt-iperf3",
strlen("lt-iperf3"))) {
printk("[%d]%s[pid=%d] calling prep_channel\n",
smp_processor_id(), current->comm,
......@@ -1908,6 +1920,29 @@ int ndo_start_xmit(struct sk_buff *skb,
return NETDEV_TX_OK;
}
/* if TCP */
/* 38-41 - Seq no
* 42-45 - Ack no
*/
if (skb->data[23] == 0x6) {
unsigned int seq = (skb->data[38] << 24) | (skb->data[39] << 16) | (skb->data[40] << 8) | skb->data[41];
unsigned int ack = (skb->data[42] << 24) | (skb->data[43] << 16) | (skb->data[44] << 8) | skb->data[45];
unsigned char flags = (skb->data[46] & 0x0F) | skb->data[47];
printk("%s, xmit via cpu=%d:%10s[%d] | pts %p | proto %x | IP proto %x | TCP.seq %u | TCP.ack %u | TCP Flags [%s%s%s%s%s]\n",
__func__, smp_processor_id(), current->comm, current->pid,
PTS(), htons(skb->protocol), skb->data[23], seq, ack,
(flags & 0x1) ? " FIN " : "",
(flags & 0x2) ? " SYN " : "",
(flags & 0x4) ? " RST " : "",
(flags & 0x8) ? " PSH " : "",
(flags & 0x10) ? " ACK " : "");
tcp_count = global_tx_count;
}
global_tx_count++;
//printk("%s, nr_frags %d\n", __func__, skb_shinfo(skb)->nr_frags);
if (PTS()->nonlcd_ctx) {
......@@ -2047,9 +2082,9 @@ quit:
ret = thc_ipc_send_request(async_chnl,
_request, &request_cookie);
printk("%s, ipc send ret %d | pts %p | reqc 0x%x\n",
__func__, ret,
PTS(), request_cookie);
if (skb->data[23] == 0x6)
printk("%s, ipc_send | pts %p | reqc 0x%x | seq %llu\n",
__func__, PTS(), request_cookie, tcp_count);
if (ret) {
LIBLCD_ERR("thc_ipc_call");
......@@ -2068,9 +2103,15 @@ quit:
request_cookie,
&_response);
printk("%s, ipc recv resp %d | pts %p | reqc 0x%x\n",
__func__, ret, PTS(),
request_cookie);
//printk("%s, queue_mapping %d\n", __func__, skb->queue_mapping);
if (skb->data[23] == 0x6)
printk("%s, ipc_recv | pts %p | reqc 0x%x | seq %llu\n",
__func__, PTS(), request_cookie, tcp_count);
//printk("%s, xmit via KLCD | pts %p | cookie %d | proto %x | IP proto %x | TCP flags %x\n",
// __func__, PTS(), request_cookie, htons(skb->protocol),
// skb->data[23], (skb->data[46] & 0x0F) | skb->data[47]);
if (ret) {
LIBLCD_ERR("thc_ipc_recv_response");
......@@ -3233,7 +3274,8 @@ int register_netdev_callee(struct fipc_message *_request,
unsigned int request_cookie;
int func_ret;
//a0:36:9f:08:1c:3e
u8 mac_addr[] = {0xa0, 0x36, 0x9f, 0x08, 0x1c, 0x3e};
//eth7 a0:36:9f:08:1c:4a
u8 mac_addr[] = {0xa0, 0x36, 0x9f, 0x08, 0x1c, 0x4a};
request_cookie = thc_get_request_cookie(_request);
ret = glue_cap_lookup_net_device_type(cspace,
......@@ -5669,7 +5711,6 @@ skip:
}
#else
void ixgbe_pull_tail(struct sk_buff *skb)
{
struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0];
......@@ -5730,6 +5771,8 @@ int napi_gro_receive_callee(struct fipc_message *_request,
nr_frags_tail;
unsigned int pull_len;
unsigned char nr_frags;
unsigned char buffer[300] = {0};
bool tcp = false;
u32 frag_off = 0, frag_size = 0;
#ifndef NAPI_RX_SEND_ONLY
......@@ -5820,9 +5863,32 @@ int napi_gro_receive_callee(struct fipc_message *_request,
skb_pull_inline(skb, ETH_HLEN);
/* if TCP */
if (skb->data[9] == 0x6) {
unsigned char flags = (skb->data[32] & 0x0F) | skb->data[33];
unsigned int seq = (skb->data[24] << 24) | (skb->data[25] << 16) | (skb->data[26] << 8) | skb->data[27];
unsigned int ack = (skb->data[28] << 24) | (skb->data[29] << 16) | (skb->data[30] << 8) | skb->data[31];
sprintf(buffer, "%s, recv cpu=%d:%10s[%d] | pts %p | proto %x | IP proto %x | TCP.seq %u | TCP.ack %u | TCP Flags [%s%s%s%s%s] ",
__func__, smp_processor_id(), current->comm, current->pid,
PTS(), htons(skb->protocol), skb->data[9], seq, ack,
(flags & 0x1) ? " FIN " : "",
(flags & 0x2) ? " SYN " : "",
(flags & 0x4) ? " RST " : "",
(flags & 0x8) ? " PSH " : "",
(flags & 0x10) ? " ACK " : "");
tcp = true;
} else {
sprintf(buffer, "%s, recv cpu=%d:%10s[%d] | pts %p | proto %x | IP proto %x",
__func__, smp_processor_id(), current->comm, current->pid,
PTS(), htons(skb->protocol), skb->data[9]);
}
//printk("%s context {\n", buffer);
func_ret = napi_gro_receive(napi, skb);
//printk("%s, %d\n", __func__, func_ret);
//printk("} ==> ret_val = %d\n", func_ret);
if (p)
set_page_count(p, old_pcount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment