netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1 net-2.6] s2io: enabling VLAN tag stripping at driver initialization
@ 2008-09-04 17:46 Breno Leitao
  2008-09-04 19:10 ` Ramkrishna Vepa
  0 siblings, 1 reply; 5+ messages in thread
From: Breno Leitao @ 2008-09-04 17:46 UTC (permalink / raw)
  To: ram.vepa, santosh.rastapur, sivakumar.subramani,
	sreenivasa.honnur
  Cc: jeff, Jay Vosburgh, netdev, Lorandi

Actually s2io has a bug in VLAN support. VLAN doesn't work except if
you'd opened the interface in promiscuous mode before. 
This happens because VLAN tag stripping is not enable by default (when
the device is loaded). It is only enabled when the device leaves
promiscuous mode.

Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>

---

diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index a2b0730..e656c80 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -8206,6 +8206,14 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
 	/* Initialize device name */
 	sprintf(sp->name, "%s Neterion %s", dev->name, sp->product_name);
 
+	/* Initialize VLAN tag strip */
+	if (vlan_tag_strip) {
+		val64 = readq(&bar0->rx_pa_cfg);
+		val64 |= RX_PA_CFG_STRIP_VLAN_TAG;
+		writeq(val64, &bar0->rx_pa_cfg);
+		vlan_strip_flag = 1;
+	}
+
 	/*
 	 * Make Link state as off at this point, when the Link change
 	 * interrupt comes the state will be automatically changed to

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

* RE: [PATCH 1/1 net-2.6] s2io: enabling VLAN tag stripping at driver initialization
  2008-09-04 17:46 [PATCH 1/1 net-2.6] s2io: enabling VLAN tag stripping at driver initialization Breno Leitao
@ 2008-09-04 19:10 ` Ramkrishna Vepa
  2008-09-04 20:52   ` Breno Leitao
  0 siblings, 1 reply; 5+ messages in thread
From: Ramkrishna Vepa @ 2008-09-04 19:10 UTC (permalink / raw)
  To: Breno Leitao, Rastapur Santosh, Sivakumar Subramani
  Cc: jeff, Jay Vosburgh, netdev, Lorandi

Breno,

When the chip comes out of reset, it's default setting is to strip the
vlan tag. So, in your patch, you will need to do this differently. The
vlan_strip_flag will have to be moved to the nic structure and
initialized there. 

> +	if (vlan_tag_strip)
> +		sp->vlan_strip_flag = 1;
> +	else 
> +		sp->vlan_strip_flag = 0;

Thanks,
Ram

> Actually s2io has a bug in VLAN support. VLAN doesn't work except if
> you'd opened the interface in promiscuous mode before.
> This happens because VLAN tag stripping is not enable by default (when
> the device is loaded). It is only enabled when the device leaves
> promiscuous mode.
> 
> Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
> 
> ---
> 
> diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
> index a2b0730..e656c80 100644
> --- a/drivers/net/s2io.c
> +++ b/drivers/net/s2io.c
> @@ -8206,6 +8206,14 @@ s2io_init_nic(struct pci_dev *pdev, const
struct
> pci_device_id *pre)
>  	/* Initialize device name */
>  	sprintf(sp->name, "%s Neterion %s", dev->name,
sp->product_name);
> 
> +	/* Initialize VLAN tag strip */
> +	if (vlan_tag_strip) {
> +		val64 = readq(&bar0->rx_pa_cfg);
> +		val64 |= RX_PA_CFG_STRIP_VLAN_TAG;
> +		writeq(val64, &bar0->rx_pa_cfg);
> +		vlan_strip_flag = 1;
> +	}
> +
>  	/*
>  	 * Make Link state as off at this point, when the Link change
>  	 * interrupt comes the state will be automatically changed to
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/1 net-2.6] s2io: enabling VLAN tag stripping at driver initialization
  2008-09-04 19:10 ` Ramkrishna Vepa
@ 2008-09-04 20:52   ` Breno Leitao
  2008-09-04 21:00     ` Ramkrishna Vepa
  2008-09-13 20:26     ` Jeff Garzik
  0 siblings, 2 replies; 5+ messages in thread
From: Breno Leitao @ 2008-09-04 20:52 UTC (permalink / raw)
  To: Ramkrishna Vepa
  Cc: santosh.rastapur, sivakumar.subramani, sreenivasa.honnur, jeff,
	Jay Vosburgh, netdev, Lorandi

Actually s2io has a bug in VLAN support. VLAN doesn't work except if
you'd opened the interface in promiscuous mode before.
This happens because VLAN tag stripping is not correctly marked as
enabled at device startup

Also, the vlan_strip_flag field was moved to the private network
structure. 

Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>

---

diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index a2b0730..1386d76 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -371,9 +371,6 @@ static void s2io_vlan_rx_register(struct net_device *dev,
 				flags[i]);
 }
 
-/* A flag indicating whether 'RX_PA_CFG_STRIP_VLAN_TAG' bit is set or not */
-static int vlan_strip_flag;
-
 /* Unregister the vlan */
 static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid)
 {
@@ -2303,7 +2300,7 @@ static int start_nic(struct s2io_nic *nic)
 		val64 = readq(&bar0->rx_pa_cfg);
 		val64 &= ~RX_PA_CFG_STRIP_VLAN_TAG;
 		writeq(val64, &bar0->rx_pa_cfg);
-		vlan_strip_flag = 0;
+		nic->vlan_strip_flag = 0;
 	}
 
 	/*
@@ -5010,7 +5007,7 @@ static void s2io_set_multicast(struct net_device *dev)
 			val64 = readq(&bar0->rx_pa_cfg);
 			val64 &= ~RX_PA_CFG_STRIP_VLAN_TAG;
 			writeq(val64, &bar0->rx_pa_cfg);
-			vlan_strip_flag = 0;
+			sp->vlan_strip_flag = 0;
 		}
 
 		val64 = readq(&bar0->mac_cfg);
@@ -5032,7 +5029,7 @@ static void s2io_set_multicast(struct net_device *dev)
 			val64 = readq(&bar0->rx_pa_cfg);
 			val64 |= RX_PA_CFG_STRIP_VLAN_TAG;
 			writeq(val64, &bar0->rx_pa_cfg);
-			vlan_strip_flag = 1;
+			sp->vlan_strip_flag = 1;
 		}
 
 		val64 = readq(&bar0->mac_cfg);
@@ -8206,6 +8203,11 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
 	/* Initialize device name */
 	sprintf(sp->name, "%s Neterion %s", dev->name, sp->product_name);
 
+	if (vlan_tag_strip)
+		sp->vlan_strip_flag = 1;
+	else
+		sp->vlan_strip_flag = 0;
+
 	/*
 	 * Make Link state as off at this point, when the Link change
 	 * interrupt comes the state will be automatically changed to
@@ -8311,7 +8313,7 @@ static int check_L2_lro_capable(u8 *buffer, struct iphdr **ip,
 		 * If vlan stripping is disabled and the frame is VLAN tagged,
 		 * shift the offset by the VLAN header size bytes.
 		 */
-		if ((!vlan_strip_flag) &&
+		if ((!sp->vlan_strip_flag) &&
 			(rxdp->Control_1 & RXD_FRAME_VLAN_TAG))
 			ip_off += HEADER_VLAN_SIZE;
 	} else {
@@ -8592,7 +8594,7 @@ static void queue_rx_frame(struct sk_buff *skb, u16 vlan_tag)
 
 	skb->protocol = eth_type_trans(skb, dev);
 	if (sp->vlgrp && vlan_tag
-		&& (vlan_strip_flag)) {
+		&& (sp->vlan_strip_flag)) {
 		/* Queueing the vlan frame to the upper layer */
 		if (sp->config.napi)
 			vlan_hwaccel_receive_skb(skb, sp->vlgrp, vlan_tag);
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index 6722a2f..55cb943 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -962,6 +962,7 @@ struct s2io_nic {
 	int task_flag;
 	unsigned long long start_time;
 	struct vlan_group *vlgrp;
+	int vlan_strip_flag;
 #define MSIX_FLG                0xA5
 	int num_entries;
 	struct msix_entry *entries;

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

* RE: [PATCH 1/1 net-2.6] s2io: enabling VLAN tag stripping at driver initialization
  2008-09-04 20:52   ` Breno Leitao
@ 2008-09-04 21:00     ` Ramkrishna Vepa
  2008-09-13 20:26     ` Jeff Garzik
  1 sibling, 0 replies; 5+ messages in thread
From: Ramkrishna Vepa @ 2008-09-04 21:00 UTC (permalink / raw)
  To: Breno Leitao
  Cc: Rastapur Santosh, Sivakumar Subramani, Sreenivasa Honnur, jeff,
	Jay Vosburgh, netdev, Lorandi, support

Breno/Jeff,
This patch looks good.

Thanks,
Ram

> -----Original Message-----
> From: Breno Leitao [mailto:leitao@linux.vnet.ibm.com]
> Sent: Thursday, September 04, 2008 1:53 PM
> To: Ramkrishna Vepa
> Cc: Rastapur Santosh; Sivakumar Subramani; Sreenivasa Honnur;
> jeff@garzik.org; Jay Vosburgh; netdev; Lorandi
> Subject: Re: [PATCH 1/1 net-2.6] s2io: enabling VLAN tag stripping at
> driver initialization
> 
> Actually s2io has a bug in VLAN support. VLAN doesn't work except if
> you'd opened the interface in promiscuous mode before.
> This happens because VLAN tag stripping is not correctly marked as
> enabled at device startup
> 
> Also, the vlan_strip_flag field was moved to the private network
> structure.
> 
> Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
> 
> ---
> 
> diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
> index a2b0730..1386d76 100644
> --- a/drivers/net/s2io.c
> +++ b/drivers/net/s2io.c
> @@ -371,9 +371,6 @@ static void s2io_vlan_rx_register(struct
net_device
> *dev,
>  				flags[i]);
>  }
> 
> -/* A flag indicating whether 'RX_PA_CFG_STRIP_VLAN_TAG' bit is set or
not
> */
> -static int vlan_strip_flag;
> -
>  /* Unregister the vlan */
>  static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned
long
> vid)
>  {
> @@ -2303,7 +2300,7 @@ static int start_nic(struct s2io_nic *nic)
>  		val64 = readq(&bar0->rx_pa_cfg);
>  		val64 &= ~RX_PA_CFG_STRIP_VLAN_TAG;
>  		writeq(val64, &bar0->rx_pa_cfg);
> -		vlan_strip_flag = 0;
> +		nic->vlan_strip_flag = 0;
>  	}
> 
>  	/*
> @@ -5010,7 +5007,7 @@ static void s2io_set_multicast(struct net_device
> *dev)
>  			val64 = readq(&bar0->rx_pa_cfg);
>  			val64 &= ~RX_PA_CFG_STRIP_VLAN_TAG;
>  			writeq(val64, &bar0->rx_pa_cfg);
> -			vlan_strip_flag = 0;
> +			sp->vlan_strip_flag = 0;
>  		}
> 
>  		val64 = readq(&bar0->mac_cfg);
> @@ -5032,7 +5029,7 @@ static void s2io_set_multicast(struct net_device
> *dev)
>  			val64 = readq(&bar0->rx_pa_cfg);
>  			val64 |= RX_PA_CFG_STRIP_VLAN_TAG;
>  			writeq(val64, &bar0->rx_pa_cfg);
> -			vlan_strip_flag = 1;
> +			sp->vlan_strip_flag = 1;
>  		}
> 
>  		val64 = readq(&bar0->mac_cfg);
> @@ -8206,6 +8203,11 @@ s2io_init_nic(struct pci_dev *pdev, const
struct
> pci_device_id *pre)
>  	/* Initialize device name */
>  	sprintf(sp->name, "%s Neterion %s", dev->name,
sp->product_name);
> 
> +	if (vlan_tag_strip)
> +		sp->vlan_strip_flag = 1;
> +	else
> +		sp->vlan_strip_flag = 0;
> +
>  	/*
>  	 * Make Link state as off at this point, when the Link change
>  	 * interrupt comes the state will be automatically changed to
> @@ -8311,7 +8313,7 @@ static int check_L2_lro_capable(u8 *buffer,
struct
> iphdr **ip,
>  		 * If vlan stripping is disabled and the frame is VLAN
tagged,
>  		 * shift the offset by the VLAN header size bytes.
>  		 */
> -		if ((!vlan_strip_flag) &&
> +		if ((!sp->vlan_strip_flag) &&
>  			(rxdp->Control_1 & RXD_FRAME_VLAN_TAG))
>  			ip_off += HEADER_VLAN_SIZE;
>  	} else {
> @@ -8592,7 +8594,7 @@ static void queue_rx_frame(struct sk_buff *skb,
u16
> vlan_tag)
> 
>  	skb->protocol = eth_type_trans(skb, dev);
>  	if (sp->vlgrp && vlan_tag
> -		&& (vlan_strip_flag)) {
> +		&& (sp->vlan_strip_flag)) {
>  		/* Queueing the vlan frame to the upper layer */
>  		if (sp->config.napi)
>  			vlan_hwaccel_receive_skb(skb, sp->vlgrp,
vlan_tag);
> diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
> index 6722a2f..55cb943 100644
> --- a/drivers/net/s2io.h
> +++ b/drivers/net/s2io.h
> @@ -962,6 +962,7 @@ struct s2io_nic {
>  	int task_flag;
>  	unsigned long long start_time;
>  	struct vlan_group *vlgrp;
> +	int vlan_strip_flag;
>  #define MSIX_FLG                0xA5
>  	int num_entries;
>  	struct msix_entry *entries;

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

* Re: [PATCH 1/1 net-2.6] s2io: enabling VLAN tag stripping at driver initialization
  2008-09-04 20:52   ` Breno Leitao
  2008-09-04 21:00     ` Ramkrishna Vepa
@ 2008-09-13 20:26     ` Jeff Garzik
  1 sibling, 0 replies; 5+ messages in thread
From: Jeff Garzik @ 2008-09-13 20:26 UTC (permalink / raw)
  To: Breno Leitao
  Cc: Ramkrishna Vepa, santosh.rastapur, sivakumar.subramani,
	sreenivasa.honnur, Jay Vosburgh, netdev, Lorandi

Breno Leitao wrote:
> Actually s2io has a bug in VLAN support. VLAN doesn't work except if
> you'd opened the interface in promiscuous mode before.
> This happens because VLAN tag stripping is not correctly marked as
> enabled at device startup
> 
> Also, the vlan_strip_flag field was moved to the private network
> structure. 
> 
> Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>

applied



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

end of thread, other threads:[~2008-09-13 20:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-04 17:46 [PATCH 1/1 net-2.6] s2io: enabling VLAN tag stripping at driver initialization Breno Leitao
2008-09-04 19:10 ` Ramkrishna Vepa
2008-09-04 20:52   ` Breno Leitao
2008-09-04 21:00     ` Ramkrishna Vepa
2008-09-13 20:26     ` Jeff Garzik

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