Commit 04f207fb authored by Igor Russkikh's avatar Igor Russkikh Committed by David S. Miller

net: aquantia: implement vlan offload configuration

set_features should update flags and reinit hardware if
vlan offload settings were changed.
Signed-off-by: default avatarIgor Russkikh <igor.russkikh@aquantia.com>
Tested-by: default avatarNikita Danilov <ndanilov@aquantia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 880b3ca5
...@@ -108,11 +108,16 @@ static int aq_ndev_change_mtu(struct net_device *ndev, int new_mtu) ...@@ -108,11 +108,16 @@ static int aq_ndev_change_mtu(struct net_device *ndev, int new_mtu)
static int aq_ndev_set_features(struct net_device *ndev, static int aq_ndev_set_features(struct net_device *ndev,
netdev_features_t features) netdev_features_t features)
{ {
bool is_vlan_rx_strip = !!(features & NETIF_F_HW_VLAN_CTAG_RX);
bool is_vlan_tx_insert = !!(features & NETIF_F_HW_VLAN_CTAG_TX);
struct aq_nic_s *aq_nic = netdev_priv(ndev); struct aq_nic_s *aq_nic = netdev_priv(ndev);
struct aq_nic_cfg_s *aq_cfg = aq_nic_get_cfg(aq_nic); bool need_ndev_restart = false;
struct aq_nic_cfg_s *aq_cfg;
bool is_lro = false; bool is_lro = false;
int err = 0; int err = 0;
aq_cfg = aq_nic_get_cfg(aq_nic);
if (!(features & NETIF_F_NTUPLE)) { if (!(features & NETIF_F_NTUPLE)) {
if (aq_nic->ndev->features & NETIF_F_NTUPLE) { if (aq_nic->ndev->features & NETIF_F_NTUPLE) {
err = aq_clear_rxnfc_all_rules(aq_nic); err = aq_clear_rxnfc_all_rules(aq_nic);
...@@ -135,17 +140,32 @@ static int aq_ndev_set_features(struct net_device *ndev, ...@@ -135,17 +140,32 @@ static int aq_ndev_set_features(struct net_device *ndev,
if (aq_cfg->is_lro != is_lro) { if (aq_cfg->is_lro != is_lro) {
aq_cfg->is_lro = is_lro; aq_cfg->is_lro = is_lro;
need_ndev_restart = true;
if (netif_running(ndev)) {
aq_ndev_close(ndev);
aq_ndev_open(ndev);
}
} }
} }
if ((aq_nic->ndev->features ^ features) & NETIF_F_RXCSUM)
if ((aq_nic->ndev->features ^ features) & NETIF_F_RXCSUM) {
err = aq_nic->aq_hw_ops->hw_set_offload(aq_nic->aq_hw, err = aq_nic->aq_hw_ops->hw_set_offload(aq_nic->aq_hw,
aq_cfg); aq_cfg);
if (unlikely(err))
goto err_exit;
}
if (aq_cfg->is_vlan_rx_strip != is_vlan_rx_strip) {
aq_cfg->is_vlan_rx_strip = is_vlan_rx_strip;
need_ndev_restart = true;
}
if (aq_cfg->is_vlan_tx_insert != is_vlan_tx_insert) {
aq_cfg->is_vlan_tx_insert = is_vlan_tx_insert;
need_ndev_restart = true;
}
if (need_ndev_restart && netif_running(ndev)) {
aq_ndev_close(ndev);
aq_ndev_open(ndev);
}
err_exit: err_exit:
return err; return err;
} }
......
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