diff options
author | Chien Tung <ctung@neteffect.com> | 2008-02-15 22:00:36 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-02-17 00:16:33 -0500 |
commit | edd2fd643c500c812cae5b0d314ab9db9f959898 (patch) | |
tree | 46e7fb390f08cc58ca521c714742651cadf89098 /drivers/infiniband/hw/nes | |
parent | 11e0704b7ec3abfeaee7e3a56f11c82024d1ae01 (diff) |
RDMA/nes: Fix VLAN support
We need to account for the VLAN header size in nes_netdev_change_mtu()
and nes_netdev_init(). Also, add spin lock/unlock during VLAN RX
registration so only one process can assign VLAN group for a given
interface at a time.
Signed-off-by: Chien Tung <ctung@neteffect.com>
Signed-off-by: Glenn Streiff <gstreiff@neteffect.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/nes')
-rw-r--r-- | drivers/infiniband/hw/nes/nes_nic.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c index 67827ad894e9..eee77da61935 100644 --- a/drivers/infiniband/hw/nes/nes_nic.c +++ b/drivers/infiniband/hw/nes/nes_nic.c | |||
@@ -932,7 +932,7 @@ static int nes_netdev_change_mtu(struct net_device *netdev, int new_mtu) | |||
932 | return -EINVAL; | 932 | return -EINVAL; |
933 | 933 | ||
934 | netdev->mtu = new_mtu; | 934 | netdev->mtu = new_mtu; |
935 | nesvnic->max_frame_size = new_mtu+ETH_HLEN; | 935 | nesvnic->max_frame_size = new_mtu + VLAN_ETH_HLEN; |
936 | 936 | ||
937 | if (netdev->mtu > 1500) { | 937 | if (netdev->mtu > 1500) { |
938 | jumbomode=1; | 938 | jumbomode=1; |
@@ -1494,10 +1494,15 @@ static void nes_netdev_vlan_rx_register(struct net_device *netdev, struct vlan_g | |||
1494 | { | 1494 | { |
1495 | struct nes_vnic *nesvnic = netdev_priv(netdev); | 1495 | struct nes_vnic *nesvnic = netdev_priv(netdev); |
1496 | struct nes_device *nesdev = nesvnic->nesdev; | 1496 | struct nes_device *nesdev = nesvnic->nesdev; |
1497 | struct nes_adapter *nesadapter = nesdev->nesadapter; | ||
1497 | u32 u32temp; | 1498 | u32 u32temp; |
1499 | unsigned long flags; | ||
1498 | 1500 | ||
1501 | spin_lock_irqsave(&nesadapter->phy_lock, flags); | ||
1499 | nesvnic->vlan_grp = grp; | 1502 | nesvnic->vlan_grp = grp; |
1500 | 1503 | ||
1504 | nes_debug(NES_DBG_NETDEV, "%s: %s\n", __func__, netdev->name); | ||
1505 | |||
1501 | /* Enable/Disable VLAN Stripping */ | 1506 | /* Enable/Disable VLAN Stripping */ |
1502 | u32temp = nes_read_indexed(nesdev, NES_IDX_PCIX_DIAG); | 1507 | u32temp = nes_read_indexed(nesdev, NES_IDX_PCIX_DIAG); |
1503 | if (grp) | 1508 | if (grp) |
@@ -1506,6 +1511,7 @@ static void nes_netdev_vlan_rx_register(struct net_device *netdev, struct vlan_g | |||
1506 | u32temp |= 0x02000000; | 1511 | u32temp |= 0x02000000; |
1507 | 1512 | ||
1508 | nes_write_indexed(nesdev, NES_IDX_PCIX_DIAG, u32temp); | 1513 | nes_write_indexed(nesdev, NES_IDX_PCIX_DIAG, u32temp); |
1514 | spin_unlock_irqrestore(&nesadapter->phy_lock, flags); | ||
1509 | } | 1515 | } |
1510 | 1516 | ||
1511 | 1517 | ||
@@ -1564,7 +1570,7 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev, | |||
1564 | nesvnic->msg_enable = netif_msg_init(debug, default_msg); | 1570 | nesvnic->msg_enable = netif_msg_init(debug, default_msg); |
1565 | nesvnic->netdev_index = nesdev->netdev_count; | 1571 | nesvnic->netdev_index = nesdev->netdev_count; |
1566 | nesvnic->perfect_filter_index = nesdev->nesadapter->netdev_count; | 1572 | nesvnic->perfect_filter_index = nesdev->nesadapter->netdev_count; |
1567 | nesvnic->max_frame_size = netdev->mtu+netdev->hard_header_len; | 1573 | nesvnic->max_frame_size = netdev->mtu + netdev->hard_header_len + VLAN_HLEN; |
1568 | 1574 | ||
1569 | curr_qp_map = nic_qp_mapping_per_function[PCI_FUNC(nesdev->pcidev->devfn)]; | 1575 | curr_qp_map = nic_qp_mapping_per_function[PCI_FUNC(nesdev->pcidev->devfn)]; |
1570 | nesvnic->nic.qp_id = curr_qp_map[nesdev->netdev_count].qpid; | 1576 | nesvnic->nic.qp_id = curr_qp_map[nesdev->netdev_count].qpid; |