aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/s2io.c
diff options
context:
space:
mode:
authorSivakumar Subramani <Sivakumar.Subramani@neterion.com>2007-02-24 01:59:39 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-27 04:27:11 -0500
commit926930b202d56c3dfb6aea0a0c6bfba2b87a8c03 (patch)
treef90a836770fbed53e8291b21c242d7addd3e6b28 /drivers/net/s2io.c
parent9fc93a41a1ad11da128f37e60cac01b67990cfb4 (diff)
S2IO: Added a loadable parameter to enable or disable vlan stripping in frame.
- Added code to not to strip vlan tag when driver is in promiscuous mode - Added module loadable parameter 'vlan_tag_strip" through which user can enable or disable vlan stripping irrespective of mode ( promiscuous or non-promiscuous ). Signed-off-by: Sivakumar Subramani <sivakumar.subramani@neterion.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/s2io.c')
-rw-r--r--drivers/net/s2io.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index cdf36745bb7b..89881aa2fc31 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -42,6 +42,14 @@
42 * Possible values '1' for enable '0' for disable. Default is '0' 42 * Possible values '1' for enable '0' for disable. Default is '0'
43 * lro_max_pkts: This parameter defines maximum number of packets can be 43 * lro_max_pkts: This parameter defines maximum number of packets can be
44 * aggregated as a single large packet 44 * aggregated as a single large packet
45 * napi: This parameter used to enable/disable NAPI (polling Rx)
46 * Possible values '1' for enable and '0' for disable. Default is '1'
47 * ufo: This parameter used to enable/disable UDP Fragmentation Offload(UFO)
48 * Possible values '1' for enable and '0' for disable. Default is '0'
49 * vlan_tag_strip: This can be used to enable or disable vlan stripping.
50 * Possible values '1' for enable , '0' for disable.
51 * Default is '2' - which means disable in promisc mode
52 * and enable in non-promiscuous mode.
45 ************************************************************************/ 53 ************************************************************************/
46 54
47#include <linux/module.h> 55#include <linux/module.h>
@@ -293,6 +301,9 @@ static void s2io_vlan_rx_register(struct net_device *dev,
293 spin_unlock_irqrestore(&nic->tx_lock, flags); 301 spin_unlock_irqrestore(&nic->tx_lock, flags);
294} 302}
295 303
304/* A flag indicating whether 'RX_PA_CFG_STRIP_VLAN_TAG' bit is set or not */
305int vlan_strip_flag;
306
296/* Unregister the vlan */ 307/* Unregister the vlan */
297static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid) 308static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid)
298{ 309{
@@ -404,6 +415,7 @@ S2IO_PARM_INT(indicate_max_pkts, 0);
404 415
405S2IO_PARM_INT(napi, 1); 416S2IO_PARM_INT(napi, 1);
406S2IO_PARM_INT(ufo, 0); 417S2IO_PARM_INT(ufo, 0);
418S2IO_PARM_INT(vlan_tag_strip, NO_STRIP_IN_PROMISC);
407 419
408static unsigned int tx_fifo_len[MAX_TX_FIFOS] = 420static unsigned int tx_fifo_len[MAX_TX_FIFOS] =
409 {DEFAULT_FIFO_0_LEN, [1 ...(MAX_TX_FIFOS - 1)] = DEFAULT_FIFO_1_7_LEN}; 421 {DEFAULT_FIFO_0_LEN, [1 ...(MAX_TX_FIFOS - 1)] = DEFAULT_FIFO_1_7_LEN};
@@ -1371,7 +1383,7 @@ static int init_nic(struct s2io_nic *nic)
1371 &bar0->rts_frm_len_n[i]); 1383 &bar0->rts_frm_len_n[i]);
1372 } 1384 }
1373 } 1385 }
1374 1386
1375 /* Disable differentiated services steering logic */ 1387 /* Disable differentiated services steering logic */
1376 for (i = 0; i < 64; i++) { 1388 for (i = 0; i < 64; i++) {
1377 if (rts_ds_steer(nic, i, 0) == FAILURE) { 1389 if (rts_ds_steer(nic, i, 0) == FAILURE) {
@@ -1953,6 +1965,13 @@ static int start_nic(struct s2io_nic *nic)
1953 writeq(val64, &bar0->rx_pa_cfg); 1965 writeq(val64, &bar0->rx_pa_cfg);
1954 } 1966 }
1955 1967
1968 if (vlan_tag_strip == 0) {
1969 val64 = readq(&bar0->rx_pa_cfg);
1970 val64 &= ~RX_PA_CFG_STRIP_VLAN_TAG;
1971 writeq(val64, &bar0->rx_pa_cfg);
1972 vlan_strip_flag = 0;
1973 }
1974
1956 /* 1975 /*
1957 * Enabling MC-RLDRAM. After enabling the device, we timeout 1976 * Enabling MC-RLDRAM. After enabling the device, we timeout
1958 * for around 100ms, which is approximately the time required 1977 * for around 100ms, which is approximately the time required
@@ -4352,6 +4371,13 @@ static void s2io_set_multicast(struct net_device *dev)
4352 writeq(RMAC_CFG_KEY(0x4C0D), &bar0->rmac_cfg_key); 4371 writeq(RMAC_CFG_KEY(0x4C0D), &bar0->rmac_cfg_key);
4353 writel((u32) (val64 >> 32), (add + 4)); 4372 writel((u32) (val64 >> 32), (add + 4));
4354 4373
4374 if (vlan_tag_strip != 1) {
4375 val64 = readq(&bar0->rx_pa_cfg);
4376 val64 &= ~RX_PA_CFG_STRIP_VLAN_TAG;
4377 writeq(val64, &bar0->rx_pa_cfg);
4378 vlan_strip_flag = 0;
4379 }
4380
4355 val64 = readq(&bar0->mac_cfg); 4381 val64 = readq(&bar0->mac_cfg);
4356 sp->promisc_flg = 1; 4382 sp->promisc_flg = 1;
4357 DBG_PRINT(INFO_DBG, "%s: entered promiscuous mode\n", 4383 DBG_PRINT(INFO_DBG, "%s: entered promiscuous mode\n",
@@ -4367,6 +4393,13 @@ static void s2io_set_multicast(struct net_device *dev)
4367 writeq(RMAC_CFG_KEY(0x4C0D), &bar0->rmac_cfg_key); 4393 writeq(RMAC_CFG_KEY(0x4C0D), &bar0->rmac_cfg_key);
4368 writel((u32) (val64 >> 32), (add + 4)); 4394 writel((u32) (val64 >> 32), (add + 4));
4369 4395
4396 if (vlan_tag_strip != 0) {
4397 val64 = readq(&bar0->rx_pa_cfg);
4398 val64 |= RX_PA_CFG_STRIP_VLAN_TAG;
4399 writeq(val64, &bar0->rx_pa_cfg);
4400 vlan_strip_flag = 1;
4401 }
4402
4370 val64 = readq(&bar0->mac_cfg); 4403 val64 = readq(&bar0->mac_cfg);
4371 sp->promisc_flg = 0; 4404 sp->promisc_flg = 0;
4372 DBG_PRINT(INFO_DBG, "%s: left promiscuous mode\n", 4405 DBG_PRINT(INFO_DBG, "%s: left promiscuous mode\n",
@@ -6614,7 +6647,8 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
6614 6647
6615 if (!sp->lro) { 6648 if (!sp->lro) {
6616 skb->protocol = eth_type_trans(skb, dev); 6649 skb->protocol = eth_type_trans(skb, dev);
6617 if (sp->vlgrp && RXD_GET_VLAN_TAG(rxdp->Control_2)) { 6650 if ((sp->vlgrp && RXD_GET_VLAN_TAG(rxdp->Control_2) &&
6651 vlan_strip_flag)) {
6618 /* Queueing the vlan frame to the upper layer */ 6652 /* Queueing the vlan frame to the upper layer */
6619 if (napi) 6653 if (napi)
6620 vlan_hwaccel_receive_skb(skb, sp->vlgrp, 6654 vlan_hwaccel_receive_skb(skb, sp->vlgrp,