netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next-2.6 PATCH 6/9] vxge: Check if FCS stripping is disabled by the firmware.
@ 2009-10-05  9:11 Sreenivasa Honnur
  0 siblings, 0 replies; 6+ messages in thread
From: Sreenivasa Honnur @ 2009-10-05  9:11 UTC (permalink / raw)
  To: davem; +Cc: netdev, support

- Added a function to check if FCS stripping is disabled by the firmware, if
  it is not disabled fail driver load.

- By default FCS stripping is disabled by the firmware. With this assumption
  driver decrements the indicated packet length by 4 bytes(FCS length).

- This patch ensures that FCS stripping is disabled during driver load time.

Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
---
diff -urpN patch5/drivers/net/vxge/vxge-config.c patch6/drivers/net/vxge/vxge-config.c
--- patch5/drivers/net/vxge/vxge-config.c	2009-09-04 01:24:25.000000000 -0700
+++ patch6/drivers/net/vxge/vxge-config.c	2009-09-04 01:33:43.000000000 -0700
@@ -2157,6 +2157,28 @@ exit:
 }
 
 /*
+ * vxge_hw_vpath_strip_fcs_check - Check for FCS strip.
+ */
+enum vxge_hw_status
+vxge_hw_vpath_strip_fcs_check(struct __vxge_hw_device *hldev, u64 vpath_mask)
+{
+	struct vxge_hw_vpmgmt_reg       __iomem *vpmgmt_reg;
+	enum vxge_hw_status status = VXGE_HW_OK;
+	int i = 0, j = 0;
+
+	for (i = 0; i < VXGE_HW_MAX_VIRTUAL_PATHS; i++) {
+		if (!((vpath_mask) & vxge_mBIT(i)))
+			continue;
+		vpmgmt_reg = hldev->vpmgmt_reg[i];
+		for (j = 0; j < VXGE_HW_MAC_MAX_MAC_PORT_ID; j++) {
+			if (readq(&vpmgmt_reg->rxmac_cfg0_port_vpmgmt_clone[j])
+			& VXGE_HW_RXMAC_CFG0_PORT_VPMGMT_CLONE_STRIP_FCS)
+				return VXGE_HW_FAIL;
+		}
+	}
+	return status;
+}
+/*
  * vxge_hw_mgmt_reg_Write - Write Titan register.
  */
 enum vxge_hw_status
diff -urpN patch5/drivers/net/vxge/vxge-config.h patch6/drivers/net/vxge/vxge-config.h
--- patch5/drivers/net/vxge/vxge-config.h	2009-09-04 01:23:26.000000000 -0700
+++ patch6/drivers/net/vxge/vxge-config.h	2009-09-04 01:29:17.000000000 -0700
@@ -2201,6 +2201,8 @@ __vxge_hw_vpath_func_id_get(
 enum vxge_hw_status
 __vxge_hw_vpath_reset_check(struct __vxge_hw_virtualpath *vpath);
 
+enum vxge_hw_status
+vxge_hw_vpath_strip_fcs_check(struct __vxge_hw_device *hldev, u64 vpath_mask);
 /**
  * vxge_debug
  * @level: level of debug verbosity.
diff -urpN patch5/drivers/net/vxge/vxge-main.c patch6/drivers/net/vxge/vxge-main.c
--- patch5/drivers/net/vxge/vxge-main.c	2009-09-04 01:23:26.000000000 -0700
+++ patch6/drivers/net/vxge/vxge-main.c	2009-09-04 01:31:12.000000000 -0700
@@ -4244,6 +4244,15 @@ vxge_probe(struct pci_dev *pdev, const s
 			goto _exit3;
 	}
 
+	/* if FCS stripping is not disabled in MAC fail driver load */
+	if (vxge_hw_vpath_strip_fcs_check(hldev, vpath_mask) != VXGE_HW_OK) {
+		vxge_debug_init(VXGE_ERR,
+			"%s: FCS stripping is not disabled in MAC"
+			" failing driver load", VXGE_DRIVER_NAME);
+		ret = -EINVAL;
+		goto _exit4;
+	}
+
 	vxge_hw_device_debug_set(hldev, VXGE_ERR, VXGE_COMPONENT_LL);
 
 	/* set private device info */


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

* [net-next-2.6 PATCH 6/9] vxge: Check if FCS stripping is disabled by the firmware.
@ 2009-10-05 11:56 Sreenivasa Honnur
  2009-10-05 13:04 ` Eric Dumazet
  0 siblings, 1 reply; 6+ messages in thread
From: Sreenivasa Honnur @ 2009-10-05 11:56 UTC (permalink / raw)
  To: davem; +Cc: netdev, support

- Added a function to check if FCS stripping is disabled by the firmware, if
  it is not disabled fail driver load.

- By default FCS stripping is disabled by the firmware. With this assumption
  driver decrements the indicated packet length by 4 bytes(FCS length).

- This patch ensures that FCS stripping is disabled during driver load time.

Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
---
diff -urpN patch5/drivers/net/vxge/vxge-config.c patch6/drivers/net/vxge/vxge-config.c
--- patch5/drivers/net/vxge/vxge-config.c	2009-09-04 01:24:25.000000000 -0700
+++ patch6/drivers/net/vxge/vxge-config.c	2009-09-04 01:33:43.000000000 -0700
@@ -2157,6 +2157,28 @@ exit:
 }
 
 /*
+ * vxge_hw_vpath_strip_fcs_check - Check for FCS strip.
+ */
+enum vxge_hw_status
+vxge_hw_vpath_strip_fcs_check(struct __vxge_hw_device *hldev, u64 vpath_mask)
+{
+	struct vxge_hw_vpmgmt_reg       __iomem *vpmgmt_reg;
+	enum vxge_hw_status status = VXGE_HW_OK;
+	int i = 0, j = 0;
+
+	for (i = 0; i < VXGE_HW_MAX_VIRTUAL_PATHS; i++) {
+		if (!((vpath_mask) & vxge_mBIT(i)))
+			continue;
+		vpmgmt_reg = hldev->vpmgmt_reg[i];
+		for (j = 0; j < VXGE_HW_MAC_MAX_MAC_PORT_ID; j++) {
+			if (readq(&vpmgmt_reg->rxmac_cfg0_port_vpmgmt_clone[j])
+			& VXGE_HW_RXMAC_CFG0_PORT_VPMGMT_CLONE_STRIP_FCS)
+				return VXGE_HW_FAIL;
+		}
+	}
+	return status;
+}
+/*
  * vxge_hw_mgmt_reg_Write - Write Titan register.
  */
 enum vxge_hw_status
diff -urpN patch5/drivers/net/vxge/vxge-config.h patch6/drivers/net/vxge/vxge-config.h
--- patch5/drivers/net/vxge/vxge-config.h	2009-09-04 01:23:26.000000000 -0700
+++ patch6/drivers/net/vxge/vxge-config.h	2009-09-04 01:29:17.000000000 -0700
@@ -2201,6 +2201,8 @@ __vxge_hw_vpath_func_id_get(
 enum vxge_hw_status
 __vxge_hw_vpath_reset_check(struct __vxge_hw_virtualpath *vpath);
 
+enum vxge_hw_status
+vxge_hw_vpath_strip_fcs_check(struct __vxge_hw_device *hldev, u64 vpath_mask);
 /**
  * vxge_debug
  * @level: level of debug verbosity.
diff -urpN patch5/drivers/net/vxge/vxge-main.c patch6/drivers/net/vxge/vxge-main.c
--- patch5/drivers/net/vxge/vxge-main.c	2009-09-04 01:23:26.000000000 -0700
+++ patch6/drivers/net/vxge/vxge-main.c	2009-09-04 01:31:12.000000000 -0700
@@ -4244,6 +4244,15 @@ vxge_probe(struct pci_dev *pdev, const s
 			goto _exit3;
 	}
 
+	/* if FCS stripping is not disabled in MAC fail driver load */
+	if (vxge_hw_vpath_strip_fcs_check(hldev, vpath_mask) != VXGE_HW_OK) {
+		vxge_debug_init(VXGE_ERR,
+			"%s: FCS stripping is not disabled in MAC"
+			" failing driver load", VXGE_DRIVER_NAME);
+		ret = -EINVAL;
+		goto _exit4;
+	}
+
 	vxge_hw_device_debug_set(hldev, VXGE_ERR, VXGE_COMPONENT_LL);
 
 	/* set private device info */


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

* Re: [net-next-2.6 PATCH 6/9] vxge: Check if FCS stripping is disabled by the firmware.
  2009-10-05 11:56 [net-next-2.6 PATCH 6/9] vxge: Check if FCS stripping is disabled by the firmware Sreenivasa Honnur
@ 2009-10-05 13:04 ` Eric Dumazet
  2009-10-05 16:44   ` Ben Greear
  2009-10-06  6:41   ` Ramkrishna Vepa
  0 siblings, 2 replies; 6+ messages in thread
From: Eric Dumazet @ 2009-10-05 13:04 UTC (permalink / raw)
  To: Sreenivasa Honnur; +Cc: davem, netdev, support

Sreenivasa Honnur a écrit :
> - Added a function to check if FCS stripping is disabled by the firmware, if
>   it is not disabled fail driver load.
> 
> - By default FCS stripping is disabled by the firmware. With this assumption
>   driver decrements the indicated packet length by 4 bytes(FCS length).
> 
> - This patch ensures that FCS stripping is disabled during driver load time.
> 
> Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>

What the big deal about FCS not being stripped ?

Denying driver load for this litle detail seems very hard.
You could issue a warning if there is a performance hit, but allow the driver
to function.

If this adapter has the ability to disable/enable it at firmware level,
you might replace

pkt_length -= ETH_FCS_LEN;

by :

pkt_length -= adapter->fcs_length;  

Granted you initialized adapter->fcs_length to 0 or 4 depending on firmware setup.



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

* Re: [net-next-2.6 PATCH 6/9] vxge: Check if FCS stripping is disabled by the firmware.
  2009-10-05 13:04 ` Eric Dumazet
@ 2009-10-05 16:44   ` Ben Greear
  2009-10-06  6:41   ` Ramkrishna Vepa
  1 sibling, 0 replies; 6+ messages in thread
From: Ben Greear @ 2009-10-05 16:44 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Sreenivasa Honnur, davem, netdev, support

On 10/05/2009 06:04 AM, Eric Dumazet wrote:
> Sreenivasa Honnur a écrit :
>> - Added a function to check if FCS stripping is disabled by the firmware, if
>>    it is not disabled fail driver load.
>>
>> - By default FCS stripping is disabled by the firmware. With this assumption
>>    driver decrements the indicated packet length by 4 bytes(FCS length).
>>
>> - This patch ensures that FCS stripping is disabled during driver load time.
>>
>> Signed-off-by: Sreenivasa Honnur<sreenivasa.honnur@neterion.com>
>
> What the big deal about FCS not being stripped ?

I'd consider it a feature to be able to receive the CRC...would be nice for
sniffing applications!

Ben

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


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

* RE: [net-next-2.6 PATCH 6/9] vxge: Check if FCS stripping is disabled by the firmware.
  2009-10-05 13:04 ` Eric Dumazet
  2009-10-05 16:44   ` Ben Greear
@ 2009-10-06  6:41   ` Ramkrishna Vepa
  2009-10-06  6:47     ` Eric Dumazet
  1 sibling, 1 reply; 6+ messages in thread
From: Ramkrishna Vepa @ 2009-10-06  6:41 UTC (permalink / raw)
  To: Eric Dumazet, Sreenivasa Honnur; +Cc: davem, netdev

> > - Added a function to check if FCS stripping is disabled by the
> firmware, if
> >   it is not disabled fail driver load.
> >
> > - By default FCS stripping is disabled by the firmware. With this
> assumption
> >   driver decrements the indicated packet length by 4 bytes(FCS
length).
> >
> > - This patch ensures that FCS stripping is disabled during driver
load
> time.
> >
> > Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
> 
> What the big deal about FCS not being stripped ?
[Ram] The minimum frame size that can be received by the hardware is 57
Bytes. A 64 Byte Ethernet frame with the vlan tag and fcs stripped will
result in a 56 Byte frame which will lock up the receive engine. The
work around is to disable fcs stripping in the hardware which is a
privileged operation done with a firmware version that the driver checks
for currently.

Ram

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

* Re: [net-next-2.6 PATCH 6/9] vxge: Check if FCS stripping is disabled by the firmware.
  2009-10-06  6:41   ` Ramkrishna Vepa
@ 2009-10-06  6:47     ` Eric Dumazet
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2009-10-06  6:47 UTC (permalink / raw)
  To: Ramkrishna Vepa; +Cc: Sreenivasa Honnur, davem, netdev

Ramkrishna Vepa a écrit :
> [Ram] The minimum frame size that can be received by the hardware is 57
> Bytes. A 64 Byte Ethernet frame with the vlan tag and fcs stripped will
> result in a 56 Byte frame which will lock up the receive engine. The
> work around is to disable fcs stripping in the hardware which is a
> privileged operation done with a firmware version that the driver checks
> for currently.

Thanks for the info, this could be added in Changelog or some comment, as it
might help to diagnose similar problems elsewhere :)

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

end of thread, other threads:[~2009-10-06  6:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-05 11:56 [net-next-2.6 PATCH 6/9] vxge: Check if FCS stripping is disabled by the firmware Sreenivasa Honnur
2009-10-05 13:04 ` Eric Dumazet
2009-10-05 16:44   ` Ben Greear
2009-10-06  6:41   ` Ramkrishna Vepa
2009-10-06  6:47     ` Eric Dumazet
  -- strict thread matches above, loose matches on Subject: below --
2009-10-05  9:11 Sreenivasa Honnur

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).