summaryrefslogtreecommitdiffstats
path: root/drivers/net/qlcnic/qlcnic_init.c
diff options
context:
space:
mode:
authorAmit Kumar Salecha <amit.salecha@qlogic.com>2010-10-04 04:20:09 +0000
committerDavid S. Miller <davem@davemloft.net>2010-10-04 22:46:48 -0700
commit31dee692e22eedaf2540fa543fa9c91df6ab8bda (patch)
tree10e544e30a4dfe906282b8ddfaf7a9f379bd9535 /drivers/net/qlcnic/qlcnic_init.c
parent21a180cda012e1f93e362dd4a9b0bfd3d8c92940 (diff)
downloadblackbird-op-linux-31dee692e22eedaf2540fa543fa9c91df6ab8bda.tar.gz
blackbird-op-linux-31dee692e22eedaf2540fa543fa9c91df6ab8bda.zip
qlcnic: fix internal loopback test
o Loop 10 times with delay of 1 ms to rcv packet. o Print garbage packet. o Try send/receive MAX(16) packet, instead of exit from test, if a packet is not received. Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic/qlcnic_init.c')
-rw-r--r--drivers/net/qlcnic/qlcnic_init.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index 5c33d15c874a..908a25b5597a 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -1693,6 +1693,18 @@ qlcnic_post_rx_buffers_nodb(struct qlcnic_adapter *adapter,
spin_unlock(&rds_ring->lock);
}
+static void dump_skb(struct sk_buff *skb)
+{
+ int i;
+ unsigned char *data = skb->data;
+
+ for (i = 0; i < skb->len; i++) {
+ printk("%02x ", data[i]);
+ if ((i & 0x0f) == 8)
+ printk("\n");
+ }
+}
+
static struct qlcnic_rx_buffer *
qlcnic_process_rcv_diag(struct qlcnic_adapter *adapter,
struct qlcnic_host_sds_ring *sds_ring,
@@ -1723,13 +1735,18 @@ qlcnic_process_rcv_diag(struct qlcnic_adapter *adapter,
if (!skb)
return buffer;
- skb_put(skb, rds_ring->skb_size);
+ if (length > rds_ring->skb_size)
+ skb_put(skb, rds_ring->skb_size);
+ else
+ skb_put(skb, length);
if (pkt_offset)
skb_pull(skb, pkt_offset);
if (!qlcnic_check_loopback_buff(skb->data))
adapter->diag_cnt++;
+ else
+ dump_skb(skb);
dev_kfree_skb_any(skb);
adapter->stats.rx_pkts++;
OpenPOWER on IntegriCloud