netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]  e100: Enable receiving bogus packets, and transmitting bad/custom CRC
@ 2003-11-24 23:24 Ben Greear
  2003-11-24 23:29 ` David S. Miller
  2003-12-13 19:00 ` Rask Ingemann Lambertsen
  0 siblings, 2 replies; 11+ messages in thread
From: Ben Greear @ 2003-11-24 23:24 UTC (permalink / raw)
  To: 'netdev@oss.sgi.com', Feldman, Scott

[-- Attachment #1: Type: text/plain, Size: 987 bytes --]

Thanks to those who pointed me in the right direction, here is a patch
to the e100 (2.4.23-pre9) that allows it to capture all frames, bogons included.
It also coppies the FCS to the skb so ethereal et al can read it.

It utilizes ethtool commands to get/set the rx-all feature, and uses
a new flag in the skbuff (and socket struct) structure to determine when to disable generating
the FCS on transmit.  I have the entire patch that adds the management
bits and flags, but as usual, it's mixed in with various other things...

I've done some initial testing and it seems to work as planned...

If this patch or some version thereof has a possibility of being accepted,
I'll be happy to break out the other bits into a clean patch for
a more thorough review.  If this is DOA, then I thank you for your time
anyway!

Jeff, Dave, et al, please let me know if this is of interest!

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


[-- Attachment #2: e100_rxall.patch --]
[-- Type: text/plain, Size: 10641 bytes --]

--- linux-2.4.22/drivers/net/e100/e100_main.c	2003-08-25 04:44:42.000000000 -0700
+++ linux-2.4.22.p4s/drivers/net/e100/e100_main.c	2003-11-24 14:52:47.000000000 -0800
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/** -*-linux-c-*- ************************************************************
 
   
   Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
@@ -175,7 +175,7 @@
         MODULE_PARM_DESC(X, S);
 
 /* ====================================================================== */
-static u8 e100_D101M_checksum(struct e100_private *, struct sk_buff *);
+static u8 e100_D101M_checksum(struct e100_private *, struct sk_buff *, int crc_there);
 static u8 e100_D102_check_checksum(rfd_t *);
 static int e100_ioctl(struct net_device *, struct ifreq *, int);
 static int e100_change_mtu(struct net_device *, int);
@@ -1198,11 +1198,17 @@
 	struct e100_private *bdp = dev->priv;
 	unsigned char promisc_enbl;
 	unsigned char mulcast_enbl;
+	unsigned char enable_rx_all;
 
 	promisc_enbl = ((dev->flags & IFF_PROMISC) == IFF_PROMISC);
 	mulcast_enbl = ((dev->flags & IFF_ALLMULTI) ||
 			(dev->mc_count > MAX_MULTICAST_ADDRS));
+	enable_rx_all = ((dev->priv_flags & IFF_ACCEPT_ALL_FRAMES) == IFF_ACCEPT_ALL_FRAMES);
 
+	printk("e100_set_rx_multi (%s), promisc: %d  mcast: %d rxall: %d\n",
+	       dev->name, promisc_enbl, mulcast_enbl, enable_rx_all);
+        /* NOTE:  rx_long is unconditionally set to TRUE if the chipset supports it. */
+	e100_config_rx_all(bdp, enable_rx_all);
 	e100_config_promisc(bdp, promisc_enbl);
 	e100_config_mulcast_enbl(bdp, mulcast_enbl);
 
@@ -2016,8 +2022,14 @@
 		/* do not free & unmap badly received packet.
 		 * move it to the end of skb list for reuse */
 		if (!(rfd_status & RFD_STATUS_OK)) {
-			e100_add_skb_to_end(bdp, rx_struct);
-			continue;
+			if (unlikely(dev->priv_flags & IFF_ACCEPT_ALL_FRAMES)) {
+				/* printk("%s: Accepting a bogon, rfd_status: 0x%x\n",
+				   dev->name, rfd_status); */
+			}
+			else {
+				e100_add_skb_to_end(bdp, rx_struct);
+				continue;
+			}
 		}
 
 		data_sz = min_t(u16, (le16_to_cpu(rfd->rfd_act_cnt) & 0x3fff),
@@ -2052,12 +2064,25 @@
 			if (bdp->rev_id >= D102_REV_ID) {
 				skb->ip_summed = e100_D102_check_checksum(rfd);
 			} else {
-				skb->ip_summed = e100_D101M_checksum(bdp, skb);
+				skb->ip_summed = e100_D101M_checksum(bdp, skb, !!(dev->priv_flags & IFF_ACCEPT_ALL_FRAMES));
 			}
 		} else {
 			skb->ip_summed = CHECKSUM_NONE;
 		}
 
+		/* Show the FCS when in RX-ALL mode */
+		if (unlikely(dev->priv_flags & IFF_ACCEPT_ALL_FRAMES)) {
+			if (bdp->rev_id < D102_REV_ID) {
+				/* Have to over-write the two IP checksum bytes
+				 * TODO:  Will this break vlan_hwaccel_rx???
+				 */
+				skb->tail[-4] = skb->tail[-2];
+				skb->tail[-3] = skb->tail[-1];
+				skb->tail[-2] = skb->tail[0];
+				skb->tail[-1] = skb->tail[1];
+			}
+		}
+		
 		bdp->drv_stats.net_stats.rx_bytes += skb->len;
 
 		if(bdp->vlgrp && (rfd_status & CB_STATUS_VLAN)) {
@@ -2175,6 +2200,18 @@
 		/* Clear I bit on other packets */
 		tcb->tcb_hdr.cb_cmd &= ~__constant_cpu_to_le16(CB_I_BIT);
 
+#ifdef CONFIG_SUPPORT_SEND_BAD_CRC
+	/* Use the last 4 bytes of the SKB payload packet as the CRC, used for
+	 * testing, ie sending bogus stuff.
+	 */
+	if (unlikely(skb->general_flags & DONT_DO_TX_CRC)) {
+		tcb->tcb_hdr.cb_cmd |= __constant_cpu_to_le16(CB_TX_NC_BIT);
+	}
+	else {
+		tcb->tcb_hdr.cb_cmd &= ~__constant_cpu_to_le16(CB_TX_NC_BIT);
+	}
+#endif
+	
 	tcb->tcb_skb = skb;
 
 	if (skb->ip_summed == CHECKSUM_HW) {
@@ -2934,13 +2971,16 @@
  * assign this value to skb->csum.
  */
 static unsigned char
-e100_D101M_checksum(struct e100_private *bdp, struct sk_buff *skb)
+e100_D101M_checksum(struct e100_private *bdp, struct sk_buff *skb, int crc_there)
 {
 	unsigned short proto = (skb->protocol);
-
+	int offset = 0;
+	if (unlikely(crc_there)) {
+		offset = -4;
+	}
 	if (proto == __constant_htons(ETH_P_IP)) {
 
-		skb->csum = get_unaligned((u16 *) (skb->tail));
+		skb->csum = get_unaligned((u16 *) (skb->tail - offset));
 		return CHECKSUM_HW;
 	}
 	return CHECKSUM_NONE;
@@ -3143,6 +3183,27 @@
 	}
 }
 
+static int e100_ethtool_setrxall(struct net_device *netdev, uint32_t val) {
+	unsigned short old_flags = netdev->priv_flags;
+	if (val) {
+		netdev->priv_flags |= IFF_ACCEPT_ALL_FRAMES;
+	}
+	else {
+		netdev->priv_flags &= ~(IFF_ACCEPT_ALL_FRAMES);
+	}
+
+	/* printk("e100_ethtool_setrxall (%s) val: %d\n",
+	   netdev->name, val); */
+	if (old_flags != netdev->priv_flags) {
+		/*  Kick the driver to flush the values...
+		 * TODO:  Needs review of driver folks to make sure locking is sane, etc
+		 */
+		/*printk("Kicking e100_set_multi..\n");*/
+		e100_set_multi(netdev);
+	}
+	return 0;
+}      
+
 static int
 e100_do_ethtool_ioctl(struct net_device *dev, struct ifreq *ifr)
 {
@@ -3342,7 +3403,25 @@
 		return 0;
 	}
 #endif
+	case ETHTOOL_SETRXALL: {
+		struct ethtool_value id;
+		if (copy_from_user(&id, ifr->ifr_data, sizeof(id)))
+			return -EFAULT;
+		spin_lock_bh(&dev->xmit_lock);
+		e100_ethtool_setrxall(dev, id.data);
+		spin_unlock_bh(&dev->xmit_lock);
+		return 0;
+	}
+	case ETHTOOL_GETRXALL: {
+		struct ethtool_value edata = { ETHTOOL_GSG };
+		edata.data = !!(dev->priv_flags & IFF_ACCEPT_ALL_FRAMES);
+		/*printk("GETRXALL, data: %d  priv_flags: %hx\n",
+		  edata.data, netdev->priv_flags);*/
+		if (copy_to_user(ifr->ifr_data, &edata, sizeof(edata)))
+			return -EFAULT;
+		return 0;
+	}
 	default:
 		break;
 	}			//switch
--- linux-2.4.22/drivers/net/e100/e100_config.c	2003-06-13 07:51:34.000000000 -0700
+++ linux-2.4.22.p4s/drivers/net/e100/e100_config.c	2003-11-24 14:56:14.000000000 -0800
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/**** -*-linux-c-*- ***********************************************************
 
   
   Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
@@ -326,42 +326,92 @@
 {
 	spin_lock_bh(&(bdp->config_lock));
 
-	/* if in promiscuous mode, save bad frames */
+	/* Promiscuity */
 	if (enable) {
 
+		if (!(bdp->config[15] & CB_CFIG_PROMISCUOUS)) {
+			bdp->config[15] |= CB_CFIG_PROMISCUOUS;
+			E100_CONFIG(bdp, 15);
+		}
+
+	} else {		/* not in promiscuous mode */
+
+		if (bdp->config[15] & CB_CFIG_PROMISCUOUS) {
+			bdp->config[15] &= ~CB_CFIG_PROMISCUOUS;
+			E100_CONFIG(bdp, 15);
+		}
+	}
+
+	spin_unlock_bh(&(bdp->config_lock));
+}
+
+
+/**
+ * e100_config_promisc - configure promiscuous mode
+ * @bdp: atapter's private data struct
+ * @enable: should we enable this option or not
+ *
+ * This routine will enable or disable receiving all frames to
+ * memory, including bad ones, short ones, and long ones.  It also
+ * causes the Frame Check Sum (FCS) to be transferred to memory.
+ */
+void
+e100_config_rx_all(struct e100_private *bdp, unsigned char enable)
+{
+	spin_lock_bh(&(bdp->config_lock));
+
+	/* Should we save bad frames? */
+        if (enable) {
 		if (!(bdp->config[6] & CB_CFIG_SAVE_BAD_FRAMES)) {
 			bdp->config[6] |= CB_CFIG_SAVE_BAD_FRAMES;
 			E100_CONFIG(bdp, 6);
 		}
 
-		if (bdp->config[7] & (u8) BIT_0) {
-			bdp->config[7] &= (u8) (~BIT_0);
+                /* Don't discard short-receive */
+		if (bdp->config[7] & (u8) CB_CFIG_DISC_SHORT_FRAMES) {
+			bdp->config[7] &= (u8) (~CB_CFIG_DISC_SHORT_FRAMES);
 			E100_CONFIG(bdp, 7);
 		}
 
-		if (!(bdp->config[15] & CB_CFIG_PROMISCUOUS)) {
-			bdp->config[15] |= CB_CFIG_PROMISCUOUS;
-			E100_CONFIG(bdp, 15);
+		/* Save over-runs */
+		if (!(bdp->config[6] & CB_CFIG_SAVE_OVERRUNS)) {
+			bdp->config[6] |= CB_CFIG_SAVE_OVERRUNS;
+			E100_CONFIG(bdp, 6);
 		}
 
-	} else {		/* not in promiscuous mode */
-
+		/* Transfer the etherne CRC to memory too */
+		if (!(bdp->config[18] & CB_CFIG_CRC_IN_MEM)) {
+			bdp->config[18] |= CB_CFIG_CRC_IN_MEM;
+			E100_CONFIG(bdp, 18);
+		}
+		
+        }
+        else {
+		/* Don't discard short frames */
 		if (bdp->config[6] & CB_CFIG_SAVE_BAD_FRAMES) {
 			bdp->config[6] &= ~CB_CFIG_SAVE_BAD_FRAMES;
 			E100_CONFIG(bdp, 6);
 		}
 
-		if (!(bdp->config[7] & (u8) BIT_0)) {
-			bdp->config[7] |= (u8) (BIT_0);
+		/* Discard short-receive */
+		if (!(bdp->config[7] & (u8) CB_CFIG_DISC_SHORT_FRAMES)) {
+			bdp->config[7] |= (u8) (CB_CFIG_DISC_SHORT_FRAMES);
 			E100_CONFIG(bdp, 7);
 		}
 
-		if (bdp->config[15] & CB_CFIG_PROMISCUOUS) {
-			bdp->config[15] &= ~CB_CFIG_PROMISCUOUS;
-			E100_CONFIG(bdp, 15);
+		/* Discard over-runs */
+		if (bdp->config[6] & CB_CFIG_SAVE_OVERRUNS) {
+			bdp->config[6] &= !CB_CFIG_SAVE_OVERRUNS;
+			E100_CONFIG(bdp, 6);
 		}
-	}
+
+		/* Don't send CRC (FCS) to memory */
+		if (bdp->config[18] & CB_CFIG_CRC_IN_MEM) {
+			bdp->config[18] &= !CB_CFIG_CRC_IN_MEM;
+			E100_CONFIG(bdp, 18);
+		}
+        }
 
 	spin_unlock_bh(&(bdp->config_lock));
 }
--- linux-2.4.22/drivers/net/e100/e100_config.h	2003-06-13 07:51:34.000000000 -0700
+++ linux-2.4.22.p4s/drivers/net/e100/e100_config.h	2003-11-24 00:57:14.000000000 -0800
@@ -67,6 +67,7 @@
 #define CB_CFIG_CI_INT             BIT_3	/* Command Complete Interrupt */
 #define CB_CFIG_EXT_TCB_DIS        BIT_4	/* Extended TCB */
 #define CB_CFIG_EXT_STAT_DIS       BIT_5	/* Extended Stats */
+#define CB_CFIG_SAVE_OVERRUNS      BIT_6	/* Save over-run frames if != 0 */
 #define CB_CFIG_SAVE_BAD_FRAMES    BIT_7	/* Save Bad Frames Enabled */
 
 /* byte 7 bit definitions*/
@@ -117,6 +118,8 @@
 #define CB_CFIG_STRIPPING           BIT_0	/* Padding Disabled */
 #define CB_CFIG_PADDING             BIT_1	/* Padding Disabled */
 #define CB_CFIG_CRC_IN_MEM          BIT_2	/* Transfer CRC To Memory */
+/* Only valid for 82558 and 82559.  Must be zero for 82557 */
+#define CB_CFIG_LONG_RX_OK          BIT_3	/* OK to receive Long frames */
 
 /* byte 19 bit definitions*/
 #define CB_CFIG_TX_ADDR_WAKE        BIT_0	/* Address Wakeup */
@@ -142,8 +145,7 @@
 /* byte 22 bit defines */
 #define CB_CFIG_RECEIVE_GAMLA_MODE  BIT_0	/* D102 receive mode */
 #define CB_CFIG_VLAN_DROP_ENABLE    BIT_1	/* vlan stripping */
-
-#define CB_CFIG_LONG_RX_OK	    BIT_3
+/* LONG-RX OK (needed for VLAN) is in byte 18, bit 3, see above */
 
 #define NO_LOOPBACK	0	
 #define MAC_LOOPBACK	0x01
@@ -155,6 +157,7 @@
 extern unsigned char e100_config(struct e100_private *bdp);
 extern void e100_config_fc(struct e100_private *bdp);
 extern void e100_config_promisc(struct e100_private *bdp, unsigned char enable);
+extern void e100_config_rx_all(struct e100_private *bdp, unsigned char enable);
 extern void e100_config_brdcast_dsbl(struct e100_private *bdp);
 extern void e100_config_mulcast_enbl(struct e100_private *bdp,
 				     unsigned char enable);

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]  e100: Enable receiving bogus packets, and transmitting bad/custom CRC
  2003-11-24 23:24 [PATCH] e100: Enable receiving bogus packets, and transmitting bad/custom CRC Ben Greear
@ 2003-11-24 23:29 ` David S. Miller
  2003-11-24 23:48   ` Ben Greear
  2003-12-13 19:00 ` Rask Ingemann Lambertsen
  1 sibling, 1 reply; 11+ messages in thread
From: David S. Miller @ 2003-11-24 23:29 UTC (permalink / raw)
  To: Ben Greear; +Cc: netdev, scott.feldman

On Mon, 24 Nov 2003 15:24:11 -0800
Ben Greear <greearb@candelatech.com> wrote:

> Jeff, Dave, et al, please let me know if this is of interest!

I think the rx_all facility is very useful.

Secondarily, I think we should address the other features
seperately.

What I think you should do is split out the rx_all functionality
into a seperate patch, and once we've refined and integrated that
we can work one-by-one on the CRC and other bits.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]  e100: Enable receiving bogus packets, and transmitting bad/custom CRC
  2003-11-24 23:29 ` David S. Miller
@ 2003-11-24 23:48   ` Ben Greear
  2003-11-25  1:33     ` David S. Miller
  2003-11-25 14:56     ` Rask Ingemann Lambertsen
  0 siblings, 2 replies; 11+ messages in thread
From: Ben Greear @ 2003-11-24 23:48 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, scott.feldman

David S. Miller wrote:
> On Mon, 24 Nov 2003 15:24:11 -0800
> Ben Greear <greearb@candelatech.com> wrote:
> 
> 
>>Jeff, Dave, et al, please let me know if this is of interest!
> 
> 
> I think the rx_all facility is very useful.
> 
> Secondarily, I think we should address the other features
> seperately.
> 
> What I think you should do is split out the rx_all functionality
> into a seperate patch, and once we've refined and integrated that
> we can work one-by-one on the CRC and other bits.


So, RX-ALL can be one flag, another for RX-FCS, and the TX-CUSTOM-FCS
can be a separate patch altogether?

It would also be possible to add individual 'rx-foo', ie long, bad-crc, bad-frame, etc.
But, I think that would probably be over-kill at this point.

Any problem with using the netdev->priv_flags to hold the RX-ALL and RX-FCS flags?

Btw, it's impossible (afaik) to see the CRC errors generically w/out accessing netlink
(which I assume works, but have never actually tried), ie
there is no column in /proc/net/dev for rx-crc-errors.  It would be an excellent
time to allow me to add the ethtool hook to read the net_device_stats struct via
a single ioctl call! :)


Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]  e100: Enable receiving bogus packets, and transmitting bad/custom CRC
  2003-11-24 23:48   ` Ben Greear
@ 2003-11-25  1:33     ` David S. Miller
  2003-11-25  7:53       ` [PATCH 0/3] e100: Enable receiving bogus packets and saving FCS Ben Greear
  2003-11-25 14:42       ` [PATCH] e100: Enable receiving bogus packets, and transmitting bad/custom CRC Rask Ingemann Lambertsen
  2003-11-25 14:56     ` Rask Ingemann Lambertsen
  1 sibling, 2 replies; 11+ messages in thread
From: David S. Miller @ 2003-11-25  1:33 UTC (permalink / raw)
  To: Ben Greear; +Cc: netdev, scott.feldman

On Mon, 24 Nov 2003 15:48:25 -0800
Ben Greear <greearb@candelatech.com> wrote:

> So, RX-ALL can be one flag, another for RX-FCS, and the TX-CUSTOM-FCS
> can be a separate patch altogether?

That is the basic idea, yes.

> Any problem with using the netdev->priv_flags to hold the RX-ALL and RX-FCS flags?

I see no problem with that.

Another option is to let the driver maintain the state bits
internally, but I see no reason to do that.

> Btw, it's impossible (afaik) to see the CRC errors generically w/out
> accessing netlink (which I assume works, but have never actually tried), ie
> there is no column in /proc/net/dev for rx-crc-errors.  It would be
> an excellent time to allow me to add the ethtool hook to read the
> net_device_stats struct via a single ioctl call! :)

The netlink thing does work, trust me :)
You could argue that 'ip -s link' should print this out, and I'd
agree with you on that.

However, one thing I want to make absolutely clear is that I do not
want multiple ways to get the same information out of the kernel.
We decided to build netlink into the kernel always because this means
it is present in everyone's kernel.  And therefore, we don't need to
add another way to obtain the same config information already
available via netlink.  The existing cases where an ioctl() style
call exists to obtain the same info available via netlink is merely
for compatability with older BSD tools.  No new such things will be
added.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 0/3]  e100: Enable receiving bogus packets and saving FCS
  2003-11-25  1:33     ` David S. Miller
@ 2003-11-25  7:53       ` Ben Greear
  2003-11-25 14:42       ` [PATCH] e100: Enable receiving bogus packets, and transmitting bad/custom CRC Rask Ingemann Lambertsen
  1 sibling, 0 replies; 11+ messages in thread
From: Ben Greear @ 2003-11-25  7:53 UTC (permalink / raw)
  Cc: netdev

David S. Miller wrote:
> On Mon, 24 Nov 2003 15:48:25 -0800
> Ben Greear <greearb@candelatech.com> wrote:
> 
> 
>>So, RX-ALL can be one flag, another for RX-FCS, and the TX-CUSTOM-FCS
>>can be a separate patch altogether?
> 
> 
> That is the basic idea, yes.

Here are three patches.  These were extracted manually from my
big patchset.  Where flags are defined, I left in the pktgen receive
flag and the send-to-self flag from my larger patch set.
If this is unacceptable, I can shuffle the flags around....

rx_all_ethtool.patch is the ethtool glue to turn on/off the RX-ALL and SAVE-FCS
flags.  I have not tested any of the ethtool-ops code branches as e100 and e1000
does not appear to use it.

rx_all_headers.patch should take care of defining the flags in if.h and netdevice.h

rx_all_e100.patch converts the e100 driver to support these features.  I've
ripped out the tx-custom-fcs code, but the rx-all and save-fcs code is there.
The default behaviour is virtually identical, because while the old code
was enabling receiving a lot of bad packets when in PROMISC mode, the check
in e100_main rx code was throwing away anything that was not marked as good
anyway...

> However, one thing I want to make absolutely clear is that I do not
> want multiple ways to get the same information out of the kernel.
> We decided to build netlink into the kernel always because this means
> it is present in everyone's kernel.  And therefore, we don't need to
> add another way to obtain the same config information already
> available via netlink.  The existing cases where an ioctl() style
> call exists to obtain the same info available via netlink is merely
> for compatability with older BSD tools.  No new such things will be
> added.

Ok, I won't ask again.  I attempted to get rid of all the 'ndstats'
code from these patches.  If some is still in there, it's an accident
and I'll remove it.

Thanks,
Ben


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 0/3]  e100: Enable receiving bogus packets and saving FCS
@ 2003-11-25  9:17 Ben Greear
  0 siblings, 0 replies; 11+ messages in thread
From: Ben Greear @ 2003-11-25  9:17 UTC (permalink / raw)
  To: 'netdev@oss.sgi.com'


David S. Miller wrote:
> On Mon, 24 Nov 2003 15:48:25 -0800
> Ben Greear <greearb@candelatech.com> wrote:
> 
> 
>>So, RX-ALL can be one flag, another for RX-FCS, and the TX-CUSTOM-FCS
>>can be a separate patch altogether?
> 
> 
> That is the basic idea, yes.

Here are three patches.  These were extracted manually from my
big patchset.  Where flags are defined, I left in the pktgen receive
flag and the send-to-self flag from my larger patch set.
If this is unacceptable, I can shuffle the flags around....

rx_all_ethtool.patch is the ethtool glue to turn on/off the RX-ALL and SAVE-FCS
flags.  I have not tested any of the ethtool-ops code branches as e100 and e1000
does not appear to use it.

rx_all_headers.patch should take care of defining the flags in if.h and netdevice.h

rx_all_e100.patch converts the e100 driver to support these features.  I've
ripped out the tx-custom-fcs code, but the rx-all and save-fcs code is there.
The default behaviour is virtually identical, because while the old code
was enabling receiving a lot of bad packets when in PROMISC mode, the check
in e100_main rx code was throwing away anything that was not marked as good
anyway...

> However, one thing I want to make absolutely clear is that I do not
> want multiple ways to get the same information out of the kernel.
> We decided to build netlink into the kernel always because this means
> it is present in everyone's kernel.  And therefore, we don't need to
> add another way to obtain the same config information already
> available via netlink.  The existing cases where an ioctl() style
> call exists to obtain the same info available via netlink is merely
> for compatability with older BSD tools.  No new such things will be
> added.

Ok, I won't ask again.  I attempted to get rid of all the 'ndstats'
code from these patches.  If some is still in there, it's an accident
and I'll remove it.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]  e100: Enable receiving bogus packets, and transmitting bad/custom CRC
  2003-11-25  1:33     ` David S. Miller
  2003-11-25  7:53       ` [PATCH 0/3] e100: Enable receiving bogus packets and saving FCS Ben Greear
@ 2003-11-25 14:42       ` Rask Ingemann Lambertsen
  2003-11-25 14:45         ` David S. Miller
  1 sibling, 1 reply; 11+ messages in thread
From: Rask Ingemann Lambertsen @ 2003-11-25 14:42 UTC (permalink / raw)
  To: netdev

On Mon, Nov 24, 2003 at 05:33:30PM -0800, David S. Miller wrote:
> On Mon, 24 Nov 2003 15:48:25 -0800
> Ben Greear <greearb@candelatech.com> wrote:
> 
> > Btw, it's impossible (afaik) to see the CRC errors generically w/out
> > accessing netlink (which I assume works, but have never actually tried), ie

> The netlink thing does work, trust me :)
> You could argue that 'ip -s link' should print this out, and I'd
> agree with you on that.

Give it another -s, i.e. 'ip -s -s link', and it does. :-)

-- 
Regards,
Rask Ingemann Lambertsen

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]  e100: Enable receiving bogus packets, and transmitting bad/custom CRC
  2003-11-25 14:42       ` [PATCH] e100: Enable receiving bogus packets, and transmitting bad/custom CRC Rask Ingemann Lambertsen
@ 2003-11-25 14:45         ` David S. Miller
  0 siblings, 0 replies; 11+ messages in thread
From: David S. Miller @ 2003-11-25 14:45 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen; +Cc: netdev

On Tue, 25 Nov 2003 15:42:49 +0100
Rask Ingemann Lambertsen <rask@sygehus.dk> wrote:

> On Mon, Nov 24, 2003 at 05:33:30PM -0800, David S. Miller wrote:
> > The netlink thing does work, trust me :)
> > You could argue that 'ip -s link' should print this out, and I'd
> > agree with you on that.
> 
> Give it another -s, i.e. 'ip -s -s link', and it does. :-)

I certainly learned something today :)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]  e100: Enable receiving bogus packets, and transmitting bad/custom CRC
  2003-11-24 23:48   ` Ben Greear
  2003-11-25  1:33     ` David S. Miller
@ 2003-11-25 14:56     ` Rask Ingemann Lambertsen
  1 sibling, 0 replies; 11+ messages in thread
From: Rask Ingemann Lambertsen @ 2003-11-25 14:56 UTC (permalink / raw)
  To: netdev

On Mon, Nov 24, 2003 at 03:48:25PM -0800, Ben Greear wrote:
> 
> So, RX-ALL can be one flag, another for RX-FCS, and the TX-CUSTOM-FCS
> can be a separate patch altogether?

Yes. For example, the i82586 can support RX-ALL but not RX-FCS, and
TX-CUSTOM-FCS would be more work than with i82596 and i82557/8/9. Since the
i82586 has a global (as opposed to per TX cmd) TX-CUSTOM-FCS flag, it would
be necessary to send a configure command whenever this flag changes from one
TX skb to another. So yes, please separate these features.

-- 
Regards,
Rask Ingemann Lambertsen

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]  e100: Enable receiving bogus packets, and transmitting bad/custom CRC
  2003-11-24 23:24 [PATCH] e100: Enable receiving bogus packets, and transmitting bad/custom CRC Ben Greear
  2003-11-24 23:29 ` David S. Miller
@ 2003-12-13 19:00 ` Rask Ingemann Lambertsen
  2003-12-13 19:12   ` Ben Greear
  1 sibling, 1 reply; 11+ messages in thread
From: Rask Ingemann Lambertsen @ 2003-12-13 19:00 UTC (permalink / raw)
  To: Ben Greear; +Cc: netdev

On Mon, Nov 24, 2003 at 03:24:11PM -0800, Ben Greear wrote:
> Thanks to those who pointed me in the right direction, here is a patch
> to the e100 (2.4.23-pre9) that allows it to capture all frames, bogons included.
> It also coppies the FCS to the skb so ethereal et al can read it.
> 
> It utilizes ethtool commands to get/set the rx-all feature, and uses
> a new flag in the skbuff (and socket struct) structure to determine when to disable generating
> the FCS on transmit.  I have the entire patch that adds the management
> bits and flags, but as usual, it's mixed in with various other things...

Reading the tulip manual (see below) triggered a question: When transmitting
a custom CRC, who is responsible for padding the frame to the minimum length?
If frame padding is left to the driver, what should be used for padding?

I (or rather, Google) found the tulip documentation at
<URL:http://www.intel.com/design/network/manuals/278074.htm>. The tulip
chips are capable of all these tricks too.

-- 
Regards,
Rask Ingemann Lambertsen

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]  e100: Enable receiving bogus packets, and transmitting bad/custom CRC
  2003-12-13 19:00 ` Rask Ingemann Lambertsen
@ 2003-12-13 19:12   ` Ben Greear
  0 siblings, 0 replies; 11+ messages in thread
From: Ben Greear @ 2003-12-13 19:12 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen; +Cc: netdev, David S. Miller

Rask Ingemann Lambertsen wrote:
> On Mon, Nov 24, 2003 at 03:24:11PM -0800, Ben Greear wrote:
> 
>>Thanks to those who pointed me in the right direction, here is a patch
>>to the e100 (2.4.23-pre9) that allows it to capture all frames, bogons included.
>>It also coppies the FCS to the skb so ethereal et al can read it.
>>
>>It utilizes ethtool commands to get/set the rx-all feature, and uses
>>a new flag in the skbuff (and socket struct) structure to determine when to disable generating
>>the FCS on transmit.  I have the entire patch that adds the management
>>bits and flags, but as usual, it's mixed in with various other things...
> 
> 
> Reading the tulip manual (see below) triggered a question: When transmitting
> a custom CRC, who is responsible for padding the frame to the minimum length?
> If frame padding is left to the driver, what should be used for padding?

Hrm, I have not tested this, as my sending app itself enforces the minimum
size.  I am guessing that padding is up to the driver/OS in this case,
but I'd have to re-read the e100 docs to be sure...

> I (or rather, Google) found the tulip documentation at
> <URL:http://www.intel.com/design/network/manuals/278074.htm>. The tulip
> chips are capable of all these tricks too.

Cool, I'll check out this doc soon.  If you happen to write up a tulip driver
patch for this feature, please let me know.  I have lots of 4-port tulip nics to
test on here...

DaveM:  Are you interested in getting these patches into 2.4.24-preX?  (It would
be helpful to get the infrastructure and ethtool portions in, even if the driver
parts remain outside the tree for a bit longer.)


Thanks,
Ben

> 


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-12-13 19:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-24 23:24 [PATCH] e100: Enable receiving bogus packets, and transmitting bad/custom CRC Ben Greear
2003-11-24 23:29 ` David S. Miller
2003-11-24 23:48   ` Ben Greear
2003-11-25  1:33     ` David S. Miller
2003-11-25  7:53       ` [PATCH 0/3] e100: Enable receiving bogus packets and saving FCS Ben Greear
2003-11-25 14:42       ` [PATCH] e100: Enable receiving bogus packets, and transmitting bad/custom CRC Rask Ingemann Lambertsen
2003-11-25 14:45         ` David S. Miller
2003-11-25 14:56     ` Rask Ingemann Lambertsen
2003-12-13 19:00 ` Rask Ingemann Lambertsen
2003-12-13 19:12   ` Ben Greear
  -- strict thread matches above, loose matches on Subject: below --
2003-11-25  9:17 [PATCH 0/3] e100: Enable receiving bogus packets and saving FCS Ben Greear

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).