diff options
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e_main.c')
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_main.c | 162 |
1 files changed, 82 insertions, 80 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 601d482694ea..221aa4795017 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -101,10 +101,10 @@ int i40e_allocate_dma_mem_d(struct i40e_hw *hw, struct i40e_dma_mem *mem, | |||
101 | mem->size = ALIGN(size, alignment); | 101 | mem->size = ALIGN(size, alignment); |
102 | mem->va = dma_zalloc_coherent(&pf->pdev->dev, mem->size, | 102 | mem->va = dma_zalloc_coherent(&pf->pdev->dev, mem->size, |
103 | &mem->pa, GFP_KERNEL); | 103 | &mem->pa, GFP_KERNEL); |
104 | if (mem->va) | 104 | if (!mem->va) |
105 | return 0; | 105 | return -ENOMEM; |
106 | 106 | ||
107 | return -ENOMEM; | 107 | return 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | /** | 110 | /** |
@@ -136,10 +136,10 @@ int i40e_allocate_virt_mem_d(struct i40e_hw *hw, struct i40e_virt_mem *mem, | |||
136 | mem->size = size; | 136 | mem->size = size; |
137 | mem->va = kzalloc(size, GFP_KERNEL); | 137 | mem->va = kzalloc(size, GFP_KERNEL); |
138 | 138 | ||
139 | if (mem->va) | 139 | if (!mem->va) |
140 | return 0; | 140 | return -ENOMEM; |
141 | 141 | ||
142 | return -ENOMEM; | 142 | return 0; |
143 | } | 143 | } |
144 | 144 | ||
145 | /** | 145 | /** |
@@ -174,8 +174,7 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile, | |||
174 | u16 needed, u16 id) | 174 | u16 needed, u16 id) |
175 | { | 175 | { |
176 | int ret = -ENOMEM; | 176 | int ret = -ENOMEM; |
177 | int i = 0; | 177 | int i, j; |
178 | int j = 0; | ||
179 | 178 | ||
180 | if (!pile || needed == 0 || id >= I40E_PILE_VALID_BIT) { | 179 | if (!pile || needed == 0 || id >= I40E_PILE_VALID_BIT) { |
181 | dev_info(&pf->pdev->dev, | 180 | dev_info(&pf->pdev->dev, |
@@ -186,7 +185,7 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile, | |||
186 | 185 | ||
187 | /* start the linear search with an imperfect hint */ | 186 | /* start the linear search with an imperfect hint */ |
188 | i = pile->search_hint; | 187 | i = pile->search_hint; |
189 | while (i < pile->num_entries && ret < 0) { | 188 | while (i < pile->num_entries) { |
190 | /* skip already allocated entries */ | 189 | /* skip already allocated entries */ |
191 | if (pile->list[i] & I40E_PILE_VALID_BIT) { | 190 | if (pile->list[i] & I40E_PILE_VALID_BIT) { |
192 | i++; | 191 | i++; |
@@ -205,6 +204,7 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile, | |||
205 | pile->list[i+j] = id | I40E_PILE_VALID_BIT; | 204 | pile->list[i+j] = id | I40E_PILE_VALID_BIT; |
206 | ret = i; | 205 | ret = i; |
207 | pile->search_hint = i + j; | 206 | pile->search_hint = i + j; |
207 | break; | ||
208 | } else { | 208 | } else { |
209 | /* not enough, so skip over it and continue looking */ | 209 | /* not enough, so skip over it and continue looking */ |
210 | i += j; | 210 | i += j; |
@@ -1388,7 +1388,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) | |||
1388 | bool add_happened = false; | 1388 | bool add_happened = false; |
1389 | int filter_list_len = 0; | 1389 | int filter_list_len = 0; |
1390 | u32 changed_flags = 0; | 1390 | u32 changed_flags = 0; |
1391 | i40e_status ret = 0; | 1391 | i40e_status aq_ret = 0; |
1392 | struct i40e_pf *pf; | 1392 | struct i40e_pf *pf; |
1393 | int num_add = 0; | 1393 | int num_add = 0; |
1394 | int num_del = 0; | 1394 | int num_del = 0; |
@@ -1449,28 +1449,28 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) | |||
1449 | 1449 | ||
1450 | /* flush a full buffer */ | 1450 | /* flush a full buffer */ |
1451 | if (num_del == filter_list_len) { | 1451 | if (num_del == filter_list_len) { |
1452 | ret = i40e_aq_remove_macvlan(&pf->hw, | 1452 | aq_ret = i40e_aq_remove_macvlan(&pf->hw, |
1453 | vsi->seid, del_list, num_del, | 1453 | vsi->seid, del_list, num_del, |
1454 | NULL); | 1454 | NULL); |
1455 | num_del = 0; | 1455 | num_del = 0; |
1456 | memset(del_list, 0, sizeof(*del_list)); | 1456 | memset(del_list, 0, sizeof(*del_list)); |
1457 | 1457 | ||
1458 | if (ret) | 1458 | if (aq_ret) |
1459 | dev_info(&pf->pdev->dev, | 1459 | dev_info(&pf->pdev->dev, |
1460 | "ignoring delete macvlan error, err %d, aq_err %d while flushing a full buffer\n", | 1460 | "ignoring delete macvlan error, err %d, aq_err %d while flushing a full buffer\n", |
1461 | ret, | 1461 | aq_ret, |
1462 | pf->hw.aq.asq_last_status); | 1462 | pf->hw.aq.asq_last_status); |
1463 | } | 1463 | } |
1464 | } | 1464 | } |
1465 | if (num_del) { | 1465 | if (num_del) { |
1466 | ret = i40e_aq_remove_macvlan(&pf->hw, vsi->seid, | 1466 | aq_ret = i40e_aq_remove_macvlan(&pf->hw, vsi->seid, |
1467 | del_list, num_del, NULL); | 1467 | del_list, num_del, NULL); |
1468 | num_del = 0; | 1468 | num_del = 0; |
1469 | 1469 | ||
1470 | if (ret) | 1470 | if (aq_ret) |
1471 | dev_info(&pf->pdev->dev, | 1471 | dev_info(&pf->pdev->dev, |
1472 | "ignoring delete macvlan error, err %d, aq_err %d\n", | 1472 | "ignoring delete macvlan error, err %d, aq_err %d\n", |
1473 | ret, pf->hw.aq.asq_last_status); | 1473 | aq_ret, pf->hw.aq.asq_last_status); |
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | kfree(del_list); | 1476 | kfree(del_list); |
@@ -1515,32 +1515,30 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) | |||
1515 | 1515 | ||
1516 | /* flush a full buffer */ | 1516 | /* flush a full buffer */ |
1517 | if (num_add == filter_list_len) { | 1517 | if (num_add == filter_list_len) { |
1518 | ret = i40e_aq_add_macvlan(&pf->hw, | 1518 | aq_ret = i40e_aq_add_macvlan(&pf->hw, vsi->seid, |
1519 | vsi->seid, | 1519 | add_list, num_add, |
1520 | add_list, | 1520 | NULL); |
1521 | num_add, | ||
1522 | NULL); | ||
1523 | num_add = 0; | 1521 | num_add = 0; |
1524 | 1522 | ||
1525 | if (ret) | 1523 | if (aq_ret) |
1526 | break; | 1524 | break; |
1527 | memset(add_list, 0, sizeof(*add_list)); | 1525 | memset(add_list, 0, sizeof(*add_list)); |
1528 | } | 1526 | } |
1529 | } | 1527 | } |
1530 | if (num_add) { | 1528 | if (num_add) { |
1531 | ret = i40e_aq_add_macvlan(&pf->hw, vsi->seid, | 1529 | aq_ret = i40e_aq_add_macvlan(&pf->hw, vsi->seid, |
1532 | add_list, num_add, NULL); | 1530 | add_list, num_add, NULL); |
1533 | num_add = 0; | 1531 | num_add = 0; |
1534 | } | 1532 | } |
1535 | kfree(add_list); | 1533 | kfree(add_list); |
1536 | add_list = NULL; | 1534 | add_list = NULL; |
1537 | 1535 | ||
1538 | if (add_happened && (!ret)) { | 1536 | if (add_happened && (!aq_ret)) { |
1539 | /* do nothing */; | 1537 | /* do nothing */; |
1540 | } else if (add_happened && (ret)) { | 1538 | } else if (add_happened && (aq_ret)) { |
1541 | dev_info(&pf->pdev->dev, | 1539 | dev_info(&pf->pdev->dev, |
1542 | "add filter failed, err %d, aq_err %d\n", | 1540 | "add filter failed, err %d, aq_err %d\n", |
1543 | ret, pf->hw.aq.asq_last_status); | 1541 | aq_ret, pf->hw.aq.asq_last_status); |
1544 | if ((pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOSPC) && | 1542 | if ((pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOSPC) && |
1545 | !test_bit(__I40E_FILTER_OVERFLOW_PROMISC, | 1543 | !test_bit(__I40E_FILTER_OVERFLOW_PROMISC, |
1546 | &vsi->state)) { | 1544 | &vsi->state)) { |
@@ -1556,28 +1554,27 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) | |||
1556 | if (changed_flags & IFF_ALLMULTI) { | 1554 | if (changed_flags & IFF_ALLMULTI) { |
1557 | bool cur_multipromisc; | 1555 | bool cur_multipromisc; |
1558 | cur_multipromisc = !!(vsi->current_netdev_flags & IFF_ALLMULTI); | 1556 | cur_multipromisc = !!(vsi->current_netdev_flags & IFF_ALLMULTI); |
1559 | ret = i40e_aq_set_vsi_multicast_promiscuous(&vsi->back->hw, | 1557 | aq_ret = i40e_aq_set_vsi_multicast_promiscuous(&vsi->back->hw, |
1560 | vsi->seid, | 1558 | vsi->seid, |
1561 | cur_multipromisc, | 1559 | cur_multipromisc, |
1562 | NULL); | 1560 | NULL); |
1563 | if (ret) | 1561 | if (aq_ret) |
1564 | dev_info(&pf->pdev->dev, | 1562 | dev_info(&pf->pdev->dev, |
1565 | "set multi promisc failed, err %d, aq_err %d\n", | 1563 | "set multi promisc failed, err %d, aq_err %d\n", |
1566 | ret, pf->hw.aq.asq_last_status); | 1564 | aq_ret, pf->hw.aq.asq_last_status); |
1567 | } | 1565 | } |
1568 | if ((changed_flags & IFF_PROMISC) || promisc_forced_on) { | 1566 | if ((changed_flags & IFF_PROMISC) || promisc_forced_on) { |
1569 | bool cur_promisc; | 1567 | bool cur_promisc; |
1570 | cur_promisc = (!!(vsi->current_netdev_flags & IFF_PROMISC) || | 1568 | cur_promisc = (!!(vsi->current_netdev_flags & IFF_PROMISC) || |
1571 | test_bit(__I40E_FILTER_OVERFLOW_PROMISC, | 1569 | test_bit(__I40E_FILTER_OVERFLOW_PROMISC, |
1572 | &vsi->state)); | 1570 | &vsi->state)); |
1573 | ret = i40e_aq_set_vsi_unicast_promiscuous(&vsi->back->hw, | 1571 | aq_ret = i40e_aq_set_vsi_unicast_promiscuous(&vsi->back->hw, |
1574 | vsi->seid, | 1572 | vsi->seid, |
1575 | cur_promisc, | 1573 | cur_promisc, NULL); |
1576 | NULL); | 1574 | if (aq_ret) |
1577 | if (ret) | ||
1578 | dev_info(&pf->pdev->dev, | 1575 | dev_info(&pf->pdev->dev, |
1579 | "set uni promisc failed, err %d, aq_err %d\n", | 1576 | "set uni promisc failed, err %d, aq_err %d\n", |
1580 | ret, pf->hw.aq.asq_last_status); | 1577 | aq_ret, pf->hw.aq.asq_last_status); |
1581 | } | 1578 | } |
1582 | 1579 | ||
1583 | clear_bit(__I40E_CONFIG_BUSY, &vsi->state); | 1580 | clear_bit(__I40E_CONFIG_BUSY, &vsi->state); |
@@ -1790,6 +1787,8 @@ int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid) | |||
1790 | * i40e_vsi_kill_vlan - Remove vsi membership for given vlan | 1787 | * i40e_vsi_kill_vlan - Remove vsi membership for given vlan |
1791 | * @vsi: the vsi being configured | 1788 | * @vsi: the vsi being configured |
1792 | * @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 | ||
1793 | **/ | 1792 | **/ |
1794 | int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid) | 1793 | int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid) |
1795 | { | 1794 | { |
@@ -1863,37 +1862,39 @@ int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid) | |||
1863 | * 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 |
1864 | * @netdev: network interface to be adjusted | 1863 | * @netdev: network interface to be adjusted |
1865 | * @vid: vlan id to be added | 1864 | * @vid: vlan id to be added |
1865 | * | ||
1866 | * net_device_ops implementation for adding vlan ids | ||
1866 | **/ | 1867 | **/ |
1867 | static int i40e_vlan_rx_add_vid(struct net_device *netdev, | 1868 | static int i40e_vlan_rx_add_vid(struct net_device *netdev, |
1868 | __always_unused __be16 proto, u16 vid) | 1869 | __always_unused __be16 proto, u16 vid) |
1869 | { | 1870 | { |
1870 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 1871 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
1871 | struct i40e_vsi *vsi = np->vsi; | 1872 | struct i40e_vsi *vsi = np->vsi; |
1872 | int ret; | 1873 | int ret = 0; |
1873 | 1874 | ||
1874 | if (vid > 4095) | 1875 | if (vid > 4095) |
1875 | return 0; | 1876 | return -EINVAL; |
1877 | |||
1878 | netdev_info(netdev, "adding %pM vid=%d\n", netdev->dev_addr, vid); | ||
1876 | 1879 | ||
1877 | netdev_info(vsi->netdev, "adding %pM vid=%d\n", | ||
1878 | netdev->dev_addr, vid); | ||
1879 | /* If the network stack called us with vid = 0, we should | 1880 | /* If the network stack called us with vid = 0, we should |
1880 | * indicate to i40e_vsi_add_vlan() that we want to receive | 1881 | * indicate to i40e_vsi_add_vlan() that we want to receive |
1881 | * any traffic (i.e. with any vlan tag, or untagged) | 1882 | * any traffic (i.e. with any vlan tag, or untagged) |
1882 | */ | 1883 | */ |
1883 | ret = i40e_vsi_add_vlan(vsi, vid ? vid : I40E_VLAN_ANY); | 1884 | ret = i40e_vsi_add_vlan(vsi, vid ? vid : I40E_VLAN_ANY); |
1884 | 1885 | ||
1885 | if (!ret) { | 1886 | if (!ret && (vid < VLAN_N_VID)) |
1886 | if (vid < VLAN_N_VID) | 1887 | set_bit(vid, vsi->active_vlans); |
1887 | set_bit(vid, vsi->active_vlans); | ||
1888 | } | ||
1889 | 1888 | ||
1890 | return 0; | 1889 | return ret; |
1891 | } | 1890 | } |
1892 | 1891 | ||
1893 | /** | 1892 | /** |
1894 | * 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 |
1895 | * @netdev: network interface to be adjusted | 1894 | * @netdev: network interface to be adjusted |
1896 | * @vid: vlan id to be removed | 1895 | * @vid: vlan id to be removed |
1896 | * | ||
1897 | * net_device_ops implementation for adding vlan ids | ||
1897 | **/ | 1898 | **/ |
1898 | static int i40e_vlan_rx_kill_vid(struct net_device *netdev, | 1899 | static int i40e_vlan_rx_kill_vid(struct net_device *netdev, |
1899 | __always_unused __be16 proto, u16 vid) | 1900 | __always_unused __be16 proto, u16 vid) |
@@ -1901,15 +1902,16 @@ static int i40e_vlan_rx_kill_vid(struct net_device *netdev, | |||
1901 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 1902 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
1902 | struct i40e_vsi *vsi = np->vsi; | 1903 | struct i40e_vsi *vsi = np->vsi; |
1903 | 1904 | ||
1904 | netdev_info(vsi->netdev, "removing %pM vid=%d\n", | 1905 | netdev_info(netdev, "removing %pM vid=%d\n", netdev->dev_addr, vid); |
1905 | netdev->dev_addr, vid); | 1906 | |
1906 | /* return code is ignored as there is nothing a user | 1907 | /* return code is ignored as there is nothing a user |
1907 | * can do about failure to remove and a log message was | 1908 | * can do about failure to remove and a log message was |
1908 | * already printed from another function | 1909 | * already printed from the other function |
1909 | */ | 1910 | */ |
1910 | i40e_vsi_kill_vlan(vsi, vid); | 1911 | i40e_vsi_kill_vlan(vsi, vid); |
1911 | 1912 | ||
1912 | clear_bit(vid, vsi->active_vlans); | 1913 | clear_bit(vid, vsi->active_vlans); |
1914 | |||
1913 | return 0; | 1915 | return 0; |
1914 | } | 1916 | } |
1915 | 1917 | ||
@@ -1936,10 +1938,10 @@ static void i40e_restore_vlan(struct i40e_vsi *vsi) | |||
1936 | * @vsi: the vsi being adjusted | 1938 | * @vsi: the vsi being adjusted |
1937 | * @vid: the vlan id to set as a PVID | 1939 | * @vid: the vlan id to set as a PVID |
1938 | **/ | 1940 | **/ |
1939 | i40e_status i40e_vsi_add_pvid(struct i40e_vsi *vsi, u16 vid) | 1941 | int i40e_vsi_add_pvid(struct i40e_vsi *vsi, u16 vid) |
1940 | { | 1942 | { |
1941 | struct i40e_vsi_context ctxt; | 1943 | struct i40e_vsi_context ctxt; |
1942 | i40e_status ret; | 1944 | i40e_status aq_ret; |
1943 | 1945 | ||
1944 | vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID); | 1946 | vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID); |
1945 | vsi->info.pvid = cpu_to_le16(vid); | 1947 | vsi->info.pvid = cpu_to_le16(vid); |
@@ -1948,14 +1950,15 @@ i40e_status i40e_vsi_add_pvid(struct i40e_vsi *vsi, u16 vid) | |||
1948 | 1950 | ||
1949 | ctxt.seid = vsi->seid; | 1951 | ctxt.seid = vsi->seid; |
1950 | memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); | 1952 | memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); |
1951 | ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL); | 1953 | aq_ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL); |
1952 | if (ret) { | 1954 | if (aq_ret) { |
1953 | dev_info(&vsi->back->pdev->dev, | 1955 | dev_info(&vsi->back->pdev->dev, |
1954 | "%s: update vsi failed, aq_err=%d\n", | 1956 | "%s: update vsi failed, aq_err=%d\n", |
1955 | __func__, vsi->back->hw.aq.asq_last_status); | 1957 | __func__, vsi->back->hw.aq.asq_last_status); |
1958 | return -ENOENT; | ||
1956 | } | 1959 | } |
1957 | 1960 | ||
1958 | return ret; | 1961 | return 0; |
1959 | } | 1962 | } |
1960 | 1963 | ||
1961 | /** | 1964 | /** |
@@ -3326,7 +3329,8 @@ static void i40e_pf_unquiesce_all_vsi(struct i40e_pf *pf) | |||
3326 | **/ | 3329 | **/ |
3327 | 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) |
3328 | { | 3331 | { |
3329 | int num_tc = 0, i; | 3332 | u8 num_tc = 0; |
3333 | int i; | ||
3330 | 3334 | ||
3331 | /* Scan the ETS Config Priority Table to find | 3335 | /* Scan the ETS Config Priority Table to find |
3332 | * traffic class enabled for a given priority | 3336 | * traffic class enabled for a given priority |
@@ -3341,9 +3345,7 @@ static u8 i40e_dcb_get_num_tc(struct i40e_dcbx_config *dcbcfg) | |||
3341 | /* Traffic class index starts from zero so | 3345 | /* Traffic class index starts from zero so |
3342 | * increment to return the actual count | 3346 | * increment to return the actual count |
3343 | */ | 3347 | */ |
3344 | num_tc++; | 3348 | return num_tc + 1; |
3345 | |||
3346 | return num_tc; | ||
3347 | } | 3349 | } |
3348 | 3350 | ||
3349 | /** | 3351 | /** |
@@ -3451,28 +3453,27 @@ static int i40e_vsi_get_bw_info(struct i40e_vsi *vsi) | |||
3451 | struct i40e_aqc_query_vsi_bw_config_resp bw_config = {0}; | 3453 | struct i40e_aqc_query_vsi_bw_config_resp bw_config = {0}; |
3452 | struct i40e_pf *pf = vsi->back; | 3454 | struct i40e_pf *pf = vsi->back; |
3453 | struct i40e_hw *hw = &pf->hw; | 3455 | struct i40e_hw *hw = &pf->hw; |
3456 | i40e_status aq_ret; | ||
3454 | u32 tc_bw_max; | 3457 | u32 tc_bw_max; |
3455 | int ret; | ||
3456 | int i; | 3458 | int i; |
3457 | 3459 | ||
3458 | /* Get the VSI level BW configuration */ | 3460 | /* Get the VSI level BW configuration */ |
3459 | ret = i40e_aq_query_vsi_bw_config(hw, vsi->seid, &bw_config, NULL); | 3461 | aq_ret = i40e_aq_query_vsi_bw_config(hw, vsi->seid, &bw_config, NULL); |
3460 | if (ret) { | 3462 | if (aq_ret) { |
3461 | dev_info(&pf->pdev->dev, | 3463 | dev_info(&pf->pdev->dev, |
3462 | "couldn't get pf vsi bw config, err %d, aq_err %d\n", | 3464 | "couldn't get pf vsi bw config, err %d, aq_err %d\n", |
3463 | ret, pf->hw.aq.asq_last_status); | 3465 | aq_ret, pf->hw.aq.asq_last_status); |
3464 | return ret; | 3466 | return -EINVAL; |
3465 | } | 3467 | } |
3466 | 3468 | ||
3467 | /* Get the VSI level BW configuration per TC */ | 3469 | /* Get the VSI level BW configuration per TC */ |
3468 | ret = i40e_aq_query_vsi_ets_sla_config(hw, vsi->seid, | 3470 | aq_ret = i40e_aq_query_vsi_ets_sla_config(hw, vsi->seid, &bw_ets_config, |
3469 | &bw_ets_config, | 3471 | NULL); |
3470 | NULL); | 3472 | if (aq_ret) { |
3471 | if (ret) { | ||
3472 | dev_info(&pf->pdev->dev, | 3473 | dev_info(&pf->pdev->dev, |
3473 | "couldn't get pf vsi ets bw config, err %d, aq_err %d\n", | 3474 | "couldn't get pf vsi ets bw config, err %d, aq_err %d\n", |
3474 | ret, pf->hw.aq.asq_last_status); | 3475 | aq_ret, pf->hw.aq.asq_last_status); |
3475 | return ret; | 3476 | return -EINVAL; |
3476 | } | 3477 | } |
3477 | 3478 | ||
3478 | if (bw_config.tc_valid_bits != bw_ets_config.tc_valid_bits) { | 3479 | if (bw_config.tc_valid_bits != bw_ets_config.tc_valid_bits) { |
@@ -3494,7 +3495,8 @@ static int i40e_vsi_get_bw_info(struct i40e_vsi *vsi) | |||
3494 | /* 3 bits out of 4 for each TC */ | 3495 | /* 3 bits out of 4 for each TC */ |
3495 | 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); |
3496 | } | 3497 | } |
3497 | return ret; | 3498 | |
3499 | return 0; | ||
3498 | } | 3500 | } |
3499 | 3501 | ||
3500 | /** | 3502 | /** |
@@ -3505,30 +3507,30 @@ static int i40e_vsi_get_bw_info(struct i40e_vsi *vsi) | |||
3505 | * | 3507 | * |
3506 | * Returns 0 on success, negative value on failure | 3508 | * Returns 0 on success, negative value on failure |
3507 | **/ | 3509 | **/ |
3508 | static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, | 3510 | static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc, |
3509 | u8 enabled_tc, | ||
3510 | u8 *bw_share) | 3511 | u8 *bw_share) |
3511 | { | 3512 | { |
3512 | struct i40e_aqc_configure_vsi_tc_bw_data bw_data; | 3513 | struct i40e_aqc_configure_vsi_tc_bw_data bw_data; |
3513 | int i, ret = 0; | 3514 | i40e_status aq_ret; |
3515 | int i; | ||
3514 | 3516 | ||
3515 | bw_data.tc_valid_bits = enabled_tc; | 3517 | bw_data.tc_valid_bits = enabled_tc; |
3516 | for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) | 3518 | for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) |
3517 | bw_data.tc_bw_credits[i] = bw_share[i]; | 3519 | bw_data.tc_bw_credits[i] = bw_share[i]; |
3518 | 3520 | ||
3519 | ret = i40e_aq_config_vsi_tc_bw(&vsi->back->hw, vsi->seid, | 3521 | aq_ret = i40e_aq_config_vsi_tc_bw(&vsi->back->hw, vsi->seid, &bw_data, |
3520 | &bw_data, NULL); | 3522 | NULL); |
3521 | if (ret) { | 3523 | if (aq_ret) { |
3522 | dev_info(&vsi->back->pdev->dev, | 3524 | dev_info(&vsi->back->pdev->dev, |
3523 | "%s: AQ command Config VSI BW allocation per TC failed = %d\n", | 3525 | "%s: AQ command Config VSI BW allocation per TC failed = %d\n", |
3524 | __func__, vsi->back->hw.aq.asq_last_status); | 3526 | __func__, vsi->back->hw.aq.asq_last_status); |
3525 | return ret; | 3527 | return -EINVAL; |
3526 | } | 3528 | } |
3527 | 3529 | ||
3528 | for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) | 3530 | for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) |
3529 | vsi->info.qs_handle[i] = bw_data.qs_handles[i]; | 3531 | vsi->info.qs_handle[i] = bw_data.qs_handles[i]; |
3530 | 3532 | ||
3531 | return ret; | 3533 | return 0; |
3532 | } | 3534 | } |
3533 | 3535 | ||
3534 | /** | 3536 | /** |