Commit 2135f9b1 authored by Raghu Vatsavayi's avatar Raghu Vatsavayi Committed by David S. Miller

liquidio VF vlan support

Adds support for VF vlan features.
Signed-off-by: default avatarRaghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: default avatarDerek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: default avatarSatanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: default avatarFelix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 107bc0aa
...@@ -1350,6 +1350,7 @@ liquidio_push_packet(u32 octeon_id __attribute__((unused)), ...@@ -1350,6 +1350,7 @@ liquidio_push_packet(u32 octeon_id __attribute__((unused)),
container_of(param, struct octeon_droq, napi); container_of(param, struct octeon_droq, napi);
struct net_device *netdev = (struct net_device *)arg; struct net_device *netdev = (struct net_device *)arg;
struct sk_buff *skb = (struct sk_buff *)skbuff; struct sk_buff *skb = (struct sk_buff *)skbuff;
u16 vtag = 0;
if (netdev) { if (netdev) {
struct lio *lio = GET_LIO(netdev); struct lio *lio = GET_LIO(netdev);
...@@ -1403,6 +1404,16 @@ liquidio_push_packet(u32 octeon_id __attribute__((unused)), ...@@ -1403,6 +1404,16 @@ liquidio_push_packet(u32 octeon_id __attribute__((unused)),
else else
skb->ip_summed = CHECKSUM_NONE; skb->ip_summed = CHECKSUM_NONE;
/* inbound VLAN tag */
if ((netdev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
rh->r_dh.vlan) {
u16 priority = rh->r_dh.priority;
u16 vid = rh->r_dh.vlan;
vtag = (priority << VLAN_PRIO_SHIFT) | vid;
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vtag);
}
packet_was_received = (napi_gro_receive(napi, skb) != GRO_DROP); packet_was_received = (napi_gro_receive(napi, skb) != GRO_DROP);
if (packet_was_received) { if (packet_was_received) {
...@@ -2025,6 +2036,12 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -2025,6 +2036,12 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
tx_info->s.gso_segs = skb_shinfo(skb)->gso_segs; tx_info->s.gso_segs = skb_shinfo(skb)->gso_segs;
} }
/* HW insert VLAN tag */
if (skb_vlan_tag_present(skb)) {
irh->priority = skb_vlan_tag_get(skb) >> VLAN_PRIO_SHIFT;
irh->vlan = skb_vlan_tag_get(skb) & VLAN_VID_MASK;
}
status = octnet_send_nic_data_pkt(oct, &ndata); status = octnet_send_nic_data_pkt(oct, &ndata);
if (status == IQ_SEND_FAILED) if (status == IQ_SEND_FAILED)
goto lio_xmit_failed; goto lio_xmit_failed;
...@@ -2074,6 +2091,61 @@ static void liquidio_tx_timeout(struct net_device *netdev) ...@@ -2074,6 +2091,61 @@ static void liquidio_tx_timeout(struct net_device *netdev)
txqs_wake(netdev); txqs_wake(netdev);
} }
static int
liquidio_vlan_rx_add_vid(struct net_device *netdev,
__be16 proto __attribute__((unused)), u16 vid)
{
struct lio *lio = GET_LIO(netdev);
struct octeon_device *oct = lio->oct_dev;
struct octnic_ctrl_pkt nctrl;
int ret = 0;
memset(&nctrl, 0, sizeof(struct octnic_ctrl_pkt));
nctrl.ncmd.u64 = 0;
nctrl.ncmd.s.cmd = OCTNET_CMD_ADD_VLAN_FILTER;
nctrl.ncmd.s.param1 = vid;
nctrl.iq_no = lio->linfo.txpciq[0].s.q_no;
nctrl.wait_time = 100;
nctrl.netpndev = (u64)netdev;
nctrl.cb_fn = liquidio_link_ctrl_cmd_completion;
ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl);
if (ret < 0) {
dev_err(&oct->pci_dev->dev, "Add VLAN filter failed in core (ret: 0x%x)\n",
ret);
}
return ret;
}
static int
liquidio_vlan_rx_kill_vid(struct net_device *netdev,
__be16 proto __attribute__((unused)), u16 vid)
{
struct lio *lio = GET_LIO(netdev);
struct octeon_device *oct = lio->oct_dev;
struct octnic_ctrl_pkt nctrl;
int ret = 0;
memset(&nctrl, 0, sizeof(struct octnic_ctrl_pkt));
nctrl.ncmd.u64 = 0;
nctrl.ncmd.s.cmd = OCTNET_CMD_DEL_VLAN_FILTER;
nctrl.ncmd.s.param1 = vid;
nctrl.iq_no = lio->linfo.txpciq[0].s.q_no;
nctrl.wait_time = 100;
nctrl.netpndev = (u64)netdev;
nctrl.cb_fn = liquidio_link_ctrl_cmd_completion;
ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl);
if (ret < 0) {
dev_err(&oct->pci_dev->dev, "Add VLAN filter failed in core (ret: 0x%x)\n",
ret);
}
return ret;
}
/** Sending command to enable/disable RX checksum offload /** Sending command to enable/disable RX checksum offload
* @param netdev pointer to network device * @param netdev pointer to network device
* @param command OCTNET_CMD_TNL_RX_CSUM_CTL * @param command OCTNET_CMD_TNL_RX_CSUM_CTL
...@@ -2180,6 +2252,8 @@ static const struct net_device_ops lionetdevops = { ...@@ -2180,6 +2252,8 @@ static const struct net_device_ops lionetdevops = {
.ndo_set_mac_address = liquidio_set_mac, .ndo_set_mac_address = liquidio_set_mac,
.ndo_set_rx_mode = liquidio_set_mcast_list, .ndo_set_rx_mode = liquidio_set_mcast_list,
.ndo_tx_timeout = liquidio_tx_timeout, .ndo_tx_timeout = liquidio_tx_timeout,
.ndo_vlan_rx_add_vid = liquidio_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = liquidio_vlan_rx_kill_vid,
.ndo_change_mtu = liquidio_change_mtu, .ndo_change_mtu = liquidio_change_mtu,
.ndo_fix_features = liquidio_fix_features, .ndo_fix_features = liquidio_fix_features,
.ndo_set_features = liquidio_set_features, .ndo_set_features = liquidio_set_features,
...@@ -2388,6 +2462,12 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) ...@@ -2388,6 +2462,12 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
| NETIF_F_LRO; | NETIF_F_LRO;
netif_set_gso_max_size(netdev, OCTNIC_GSO_MAX_SIZE); netif_set_gso_max_size(netdev, OCTNIC_GSO_MAX_SIZE);
netdev->vlan_features = lio->dev_capability;
/* Add any unchangeable hw features */
lio->dev_capability |= NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_TX;
netdev->features = (lio->dev_capability & ~NETIF_F_LRO); netdev->features = (lio->dev_capability & ~NETIF_F_LRO);
netdev->hw_features = lio->dev_capability; netdev->hw_features = lio->dev_capability;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment