Skip to content

Commit

Permalink
RDMA/nes: Fix VLAN support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chien Tung authored and Roland Dreier committed Feb 17, 2008
1 parent 11e0704 commit edd2fd6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/infiniband/hw/nes/nes_nic.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ static int nes_netdev_change_mtu(struct net_device *netdev, int new_mtu)
return -EINVAL;

netdev->mtu = new_mtu;
nesvnic->max_frame_size = new_mtu+ETH_HLEN;
nesvnic->max_frame_size = new_mtu + VLAN_ETH_HLEN;

if (netdev->mtu > 1500) {
jumbomode=1;
Expand Down Expand Up @@ -1494,10 +1494,15 @@ static void nes_netdev_vlan_rx_register(struct net_device *netdev, struct vlan_g
{
struct nes_vnic *nesvnic = netdev_priv(netdev);
struct nes_device *nesdev = nesvnic->nesdev;
struct nes_adapter *nesadapter = nesdev->nesadapter;
u32 u32temp;
unsigned long flags;

spin_lock_irqsave(&nesadapter->phy_lock, flags);
nesvnic->vlan_grp = grp;

nes_debug(NES_DBG_NETDEV, "%s: %s\n", __func__, netdev->name);

/* Enable/Disable VLAN Stripping */
u32temp = nes_read_indexed(nesdev, NES_IDX_PCIX_DIAG);
if (grp)
Expand All @@ -1506,6 +1511,7 @@ static void nes_netdev_vlan_rx_register(struct net_device *netdev, struct vlan_g
u32temp |= 0x02000000;

nes_write_indexed(nesdev, NES_IDX_PCIX_DIAG, u32temp);
spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
}


Expand Down Expand Up @@ -1564,7 +1570,7 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
nesvnic->msg_enable = netif_msg_init(debug, default_msg);
nesvnic->netdev_index = nesdev->netdev_count;
nesvnic->perfect_filter_index = nesdev->nesadapter->netdev_count;
nesvnic->max_frame_size = netdev->mtu+netdev->hard_header_len;
nesvnic->max_frame_size = netdev->mtu + netdev->hard_header_len + VLAN_HLEN;

curr_qp_map = nic_qp_mapping_per_function[PCI_FUNC(nesdev->pcidev->devfn)];
nesvnic->nic.qp_id = curr_qp_map[nesdev->netdev_count].qpid;
Expand Down

0 comments on commit edd2fd6

Please sign in to comment.