From: Kelly Daly <kelly@au1.ibm.com>
To: netdev@vger.kernel.org
Cc: rusty@rustcorp.com.au, davem@davemloft.net
Subject: [PATCH 2/3] Rough VJ Channel Implementation - vj_ne2k.patch
Date: Wed, 26 Apr 2006 11:47:40 +0000 [thread overview]
Message-ID: <200604261147.40359.kelly@au.ibm.com> (raw)
Today 11:25:13
Signed-off-by: Kelly Daly <kelly@au.ibm.com>
Hacked NE2K driver using VJ Channels on receive.
Takes packet data and dumps it into a VJ buffer instead of skb.
Not implemented on transmit.
Useful for testing under QEMU.
-----
diff -r 47031a1f466c linux-2.6.16/drivers/net/8390.c
--- linux-2.6.16/drivers/net/8390.c Thu Mar 23 06:32:12 2006
+++ linux-2.6.16/drivers/net/8390.c Mon Apr 24 19:50:46 2006
@@ -74,6 +74,8 @@
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
+
+#include <linux/vjchan.h>
#define NS8390_CORE
#include "8390.h"
@@ -718,31 +720,30 @@
}
else if ((pkt_stat & 0x0F) == ENRSR_RXOK)
{
- struct sk_buff *skb;
-
- skb = dev_alloc_skb(pkt_len+2);
- if (skb == NULL)
- {
+
+//NOT make skb - make a buffer!
+ struct vj_buffer *vjbuffer;
+ int desc_num;
+
+ vjbuffer = vj_get_buffer(&desc_num);
+ if (vjbuffer == NULL) {
+//fail
if (ei_debug > 1)
- printk(KERN_DEBUG "%s: Couldn't allocate a sk_buff of size %d.\n",
- dev->name, pkt_len);
+ printk(KERN_DEBUG "%s: Couldn't allocate a vj buffer.\n",
+ dev->name);
ei_local->stat.rx_dropped++;
break;
}
- else
- {
- skb_reserve(skb,2); /* IP headers on 16 byte boundaries */
- skb->dev = dev;
- skb_put(skb, pkt_len); /* Make room */
- ei_block_input(dev, pkt_len, skb, current_offset + sizeof(rx_frame));
- skb->protocol=eth_type_trans(skb,dev);
- netif_rx(skb);
- dev->last_rx = jiffies;
- ei_local->stat.rx_packets++;
- ei_local->stat.rx_bytes += pkt_len;
- if (pkt_stat & ENRSR_PHY)
- ei_local->stat.multicast++;
- }
+ vjbuffer->data_len = pkt_len;
+ vjbuffer->ifindex = dev->ifindex;
+ ei_block_input(dev, pkt_len, vjbuffer->data, current_offset + sizeof(rx_frame));
+ vj_netif_rx(vjbuffer, desc_num, eth_vj_type_trans(vjbuffer));
+ dev->last_rx = jiffies;
+ ei_local->stat.rx_packets++;
+ ei_local->stat.rx_bytes += pkt_len;
+ if (pkt_stat & ENRSR_PHY)
+ ei_local->stat.multicast++;
+
}
else
{
diff -r 47031a1f466c linux-2.6.16/drivers/net/8390.h
--- linux-2.6.16/drivers/net/8390.h Thu Mar 23 06:32:12 2006
+++ linux-2.6.16/drivers/net/8390.h Mon Apr 24 19:50:46 2006
@@ -10,7 +10,6 @@
#include <linux/config.h>
#include <linux/if_ether.h>
#include <linux/ioport.h>
-#include <linux/skbuff.h>
#define TX_PAGES 12 /* Two Tx slots */
@@ -49,7 +48,7 @@
void (*reset_8390)(struct net_device *);
void (*get_8390_hdr)(struct net_device *, struct e8390_pkt_hdr *, int);
void (*block_output)(struct net_device *, int, const unsigned char *, int);
- void (*block_input)(struct net_device *, int, struct sk_buff *, int);
+ void (*block_input)(struct net_device *, int, char *, int);
unsigned long rmem_start;
unsigned long rmem_end;
void __iomem *mem;
diff -r 47031a1f466c linux-2.6.16/drivers/net/ne2k-pci.c
--- linux-2.6.16/drivers/net/ne2k-pci.c Thu Mar 23 06:32:12 2006
+++ linux-2.6.16/drivers/net/ne2k-pci.c Mon Apr 24 19:50:46 2006
@@ -172,7 +172,7 @@
static void ne2k_pci_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
int ring_page);
static void ne2k_pci_block_input(struct net_device *dev, int count,
- struct sk_buff *skb, int ring_offset);
+ char *data, int ring_offset);
static void ne2k_pci_block_output(struct net_device *dev, const int count,
const unsigned char *buf, const int start_page);
static struct ethtool_ops ne2k_pci_ethtool_ops;
@@ -503,10 +503,9 @@
the packet out through the "remote DMA" dataport using outb. */
static void ne2k_pci_block_input(struct net_device *dev, int count,
- struct sk_buff *skb, int ring_offset)
+ char *buf, int ring_offset)
{
long nic_base = dev->base_addr;
- char *buf = skb->data;
/* This *shouldn't* happen. If it does, it's the last thing you'll see */
if (ei_status.dmaing) {
reply other threads:[~2006-04-26 1:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200604261147.40359.kelly@au.ibm.com \
--to=kelly@au1.ibm.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.