diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_main.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 60c71527f57c..221aa4795017 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -1787,6 +1787,8 @@ int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid) | |||
1787 | * i40e_vsi_kill_vlan - Remove vsi membership for given vlan | 1787 | * i40e_vsi_kill_vlan - Remove vsi membership for given vlan |
1788 | * @vsi: the vsi being configured | 1788 | * @vsi: the vsi being configured |
1789 | * @vid: vlan id to be removed (0 = untagged only , -1 = any) | 1789 | * @vid: vlan id to be removed (0 = untagged only , -1 = any) |
1790 | * | ||
1791 | * Return: 0 on success or negative otherwise | ||
1790 | **/ | 1792 | **/ |
1791 | int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid) | 1793 | int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid) |
1792 | { | 1794 | { |
@@ -1860,37 +1862,39 @@ int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid) | |||
1860 | * i40e_vlan_rx_add_vid - Add a vlan id filter to HW offload | 1862 | * i40e_vlan_rx_add_vid - Add a vlan id filter to HW offload |
1861 | * @netdev: network interface to be adjusted | 1863 | * @netdev: network interface to be adjusted |
1862 | * @vid: vlan id to be added | 1864 | * @vid: vlan id to be added |
1865 | * | ||
1866 | * net_device_ops implementation for adding vlan ids | ||
1863 | **/ | 1867 | **/ |
1864 | static int i40e_vlan_rx_add_vid(struct net_device *netdev, | 1868 | static int i40e_vlan_rx_add_vid(struct net_device *netdev, |
1865 | __always_unused __be16 proto, u16 vid) | 1869 | __always_unused __be16 proto, u16 vid) |
1866 | { | 1870 | { |
1867 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 1871 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
1868 | struct i40e_vsi *vsi = np->vsi; | 1872 | struct i40e_vsi *vsi = np->vsi; |
1869 | int ret; | 1873 | int ret = 0; |
1870 | 1874 | ||
1871 | if (vid > 4095) | 1875 | if (vid > 4095) |
1872 | return 0; | 1876 | return -EINVAL; |
1877 | |||
1878 | netdev_info(netdev, "adding %pM vid=%d\n", netdev->dev_addr, vid); | ||
1873 | 1879 | ||
1874 | netdev_info(vsi->netdev, "adding %pM vid=%d\n", | ||
1875 | netdev->dev_addr, vid); | ||
1876 | /* If the network stack called us with vid = 0, we should | 1880 | /* If the network stack called us with vid = 0, we should |
1877 | * indicate to i40e_vsi_add_vlan() that we want to receive | 1881 | * indicate to i40e_vsi_add_vlan() that we want to receive |
1878 | * any traffic (i.e. with any vlan tag, or untagged) | 1882 | * any traffic (i.e. with any vlan tag, or untagged) |
1879 | */ | 1883 | */ |
1880 | ret = i40e_vsi_add_vlan(vsi, vid ? vid : I40E_VLAN_ANY); | 1884 | ret = i40e_vsi_add_vlan(vsi, vid ? vid : I40E_VLAN_ANY); |
1881 | 1885 | ||
1882 | if (!ret) { | 1886 | if (!ret && (vid < VLAN_N_VID)) |
1883 | if (vid < VLAN_N_VID) | 1887 | set_bit(vid, vsi->active_vlans); |
1884 | set_bit(vid, vsi->active_vlans); | ||
1885 | } | ||
1886 | 1888 | ||
1887 | return 0; | 1889 | return ret; |
1888 | } | 1890 | } |
1889 | 1891 | ||
1890 | /** | 1892 | /** |
1891 | * i40e_vlan_rx_kill_vid - Remove a vlan id filter from HW offload | 1893 | * i40e_vlan_rx_kill_vid - Remove a vlan id filter from HW offload |
1892 | * @netdev: network interface to be adjusted | 1894 | * @netdev: network interface to be adjusted |
1893 | * @vid: vlan id to be removed | 1895 | * @vid: vlan id to be removed |
1896 | * | ||
1897 | * net_device_ops implementation for adding vlan ids | ||
1894 | **/ | 1898 | **/ |
1895 | static int i40e_vlan_rx_kill_vid(struct net_device *netdev, | 1899 | static int i40e_vlan_rx_kill_vid(struct net_device *netdev, |
1896 | __always_unused __be16 proto, u16 vid) | 1900 | __always_unused __be16 proto, u16 vid) |
@@ -1898,15 +1902,16 @@ static int i40e_vlan_rx_kill_vid(struct net_device *netdev, | |||
1898 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 1902 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
1899 | struct i40e_vsi *vsi = np->vsi; | 1903 | struct i40e_vsi *vsi = np->vsi; |
1900 | 1904 | ||
1901 | netdev_info(vsi->netdev, "removing %pM vid=%d\n", | 1905 | netdev_info(netdev, "removing %pM vid=%d\n", netdev->dev_addr, vid); |
1902 | netdev->dev_addr, vid); | 1906 | |
1903 | /* return code is ignored as there is nothing a user | 1907 | /* return code is ignored as there is nothing a user |
1904 | * can do about failure to remove and a log message was | 1908 | * can do about failure to remove and a log message was |
1905 | * already printed from another function | 1909 | * already printed from the other function |
1906 | */ | 1910 | */ |
1907 | i40e_vsi_kill_vlan(vsi, vid); | 1911 | i40e_vsi_kill_vlan(vsi, vid); |
1908 | 1912 | ||
1909 | clear_bit(vid, vsi->active_vlans); | 1913 | clear_bit(vid, vsi->active_vlans); |
1914 | |||
1910 | return 0; | 1915 | return 0; |
1911 | } | 1916 | } |
1912 | 1917 | ||
@@ -3324,7 +3329,8 @@ static void i40e_pf_unquiesce_all_vsi(struct i40e_pf *pf) | |||
3324 | **/ | 3329 | **/ |
3325 | static u8 i40e_dcb_get_num_tc(struct i40e_dcbx_config *dcbcfg) | 3330 | static u8 i40e_dcb_get_num_tc(struct i40e_dcbx_config *dcbcfg) |
3326 | { | 3331 | { |
3327 | int num_tc = 0, i; | 3332 | u8 num_tc = 0; |
3333 | int i; | ||
3328 | 3334 | ||
3329 | /* Scan the ETS Config Priority Table to find | 3335 | /* Scan the ETS Config Priority Table to find |
3330 | * traffic class enabled for a given priority | 3336 | * traffic class enabled for a given priority |
@@ -3339,9 +3345,7 @@ static u8 i40e_dcb_get_num_tc(struct i40e_dcbx_config *dcbcfg) | |||
3339 | /* Traffic class index starts from zero so | 3345 | /* Traffic class index starts from zero so |
3340 | * increment to return the actual count | 3346 | * increment to return the actual count |
3341 | */ | 3347 | */ |
3342 | num_tc++; | 3348 | return num_tc + 1; |
3343 | |||
3344 | return num_tc; | ||
3345 | } | 3349 | } |
3346 | 3350 | ||
3347 | /** | 3351 | /** |
@@ -3491,6 +3495,7 @@ static int i40e_vsi_get_bw_info(struct i40e_vsi *vsi) | |||
3491 | /* 3 bits out of 4 for each TC */ | 3495 | /* 3 bits out of 4 for each TC */ |
3492 | vsi->bw_ets_max_quanta[i] = (u8)((tc_bw_max >> (i*4)) & 0x7); | 3496 | vsi->bw_ets_max_quanta[i] = (u8)((tc_bw_max >> (i*4)) & 0x7); |
3493 | } | 3497 | } |
3498 | |||
3494 | return 0; | 3499 | return 0; |
3495 | } | 3500 | } |
3496 | 3501 | ||