diff options
Diffstat (limited to 'drivers/net')
| -rw-r--r-- | drivers/net/ethernet/amazon/ena/ena_netdev.c | 28 | ||||
| -rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 23 | ||||
| -rw-r--r-- | drivers/net/ethernet/broadcom/bnxt/bnxt.c | 19 | ||||
| -rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 75 | ||||
| -rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 47 | ||||
| -rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 15 | ||||
| -rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 14 | ||||
| -rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/fs_core.h | 4 | ||||
| -rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c | 7 | ||||
| -rw-r--r-- | drivers/net/hyperv/hyperv_net.h | 1 | ||||
| -rw-r--r-- | drivers/net/hyperv/netvsc.c | 18 | ||||
| -rw-r--r-- | drivers/net/hyperv/netvsc_drv.c | 3 | ||||
| -rw-r--r-- | drivers/net/xen-netfront.c | 2 |
13 files changed, 39 insertions, 217 deletions
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c index a822e70c2af3..f2af87d70594 100644 --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c | |||
| @@ -3386,32 +3386,6 @@ err_disable_device: | |||
| 3386 | } | 3386 | } |
| 3387 | 3387 | ||
| 3388 | /*****************************************************************************/ | 3388 | /*****************************************************************************/ |
| 3389 | static int ena_sriov_configure(struct pci_dev *dev, int numvfs) | ||
| 3390 | { | ||
| 3391 | int rc; | ||
| 3392 | |||
| 3393 | if (numvfs > 0) { | ||
| 3394 | rc = pci_enable_sriov(dev, numvfs); | ||
| 3395 | if (rc != 0) { | ||
| 3396 | dev_err(&dev->dev, | ||
| 3397 | "pci_enable_sriov failed to enable: %d vfs with the error: %d\n", | ||
| 3398 | numvfs, rc); | ||
| 3399 | return rc; | ||
| 3400 | } | ||
| 3401 | |||
| 3402 | return numvfs; | ||
| 3403 | } | ||
| 3404 | |||
| 3405 | if (numvfs == 0) { | ||
| 3406 | pci_disable_sriov(dev); | ||
| 3407 | return 0; | ||
| 3408 | } | ||
| 3409 | |||
| 3410 | return -EINVAL; | ||
| 3411 | } | ||
| 3412 | |||
| 3413 | /*****************************************************************************/ | ||
| 3414 | /*****************************************************************************/ | ||
| 3415 | 3389 | ||
| 3416 | /* ena_remove - Device Removal Routine | 3390 | /* ena_remove - Device Removal Routine |
| 3417 | * @pdev: PCI device information struct | 3391 | * @pdev: PCI device information struct |
| @@ -3526,7 +3500,7 @@ static struct pci_driver ena_pci_driver = { | |||
| 3526 | .suspend = ena_suspend, | 3500 | .suspend = ena_suspend, |
| 3527 | .resume = ena_resume, | 3501 | .resume = ena_resume, |
| 3528 | #endif | 3502 | #endif |
| 3529 | .sriov_configure = ena_sriov_configure, | 3503 | .sriov_configure = pci_sriov_configure_simple, |
| 3530 | }; | 3504 | }; |
| 3531 | 3505 | ||
| 3532 | static int __init ena_init(void) | 3506 | static int __init ena_init(void) |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index c766ae23bc74..5b1ed240bf18 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
| @@ -13922,8 +13922,6 @@ static int bnx2x_init_one(struct pci_dev *pdev, | |||
| 13922 | { | 13922 | { |
| 13923 | struct net_device *dev = NULL; | 13923 | struct net_device *dev = NULL; |
| 13924 | struct bnx2x *bp; | 13924 | struct bnx2x *bp; |
| 13925 | enum pcie_link_width pcie_width; | ||
| 13926 | enum pci_bus_speed pcie_speed; | ||
| 13927 | int rc, max_non_def_sbs; | 13925 | int rc, max_non_def_sbs; |
| 13928 | int rx_count, tx_count, rss_count, doorbell_size; | 13926 | int rx_count, tx_count, rss_count, doorbell_size; |
| 13929 | int max_cos_est; | 13927 | int max_cos_est; |
| @@ -14091,21 +14089,12 @@ static int bnx2x_init_one(struct pci_dev *pdev, | |||
| 14091 | dev_addr_add(bp->dev, bp->fip_mac, NETDEV_HW_ADDR_T_SAN); | 14089 | dev_addr_add(bp->dev, bp->fip_mac, NETDEV_HW_ADDR_T_SAN); |
| 14092 | rtnl_unlock(); | 14090 | rtnl_unlock(); |
| 14093 | } | 14091 | } |
| 14094 | if (pcie_get_minimum_link(bp->pdev, &pcie_speed, &pcie_width) || | 14092 | BNX2X_DEV_INFO( |
| 14095 | pcie_speed == PCI_SPEED_UNKNOWN || | 14093 | "%s (%c%d) PCI-E found at mem %lx, IRQ %d, node addr %pM\n", |
| 14096 | pcie_width == PCIE_LNK_WIDTH_UNKNOWN) | 14094 | board_info[ent->driver_data].name, |
| 14097 | BNX2X_DEV_INFO("Failed to determine PCI Express Bandwidth\n"); | 14095 | (CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4), |
| 14098 | else | 14096 | dev->base_addr, bp->pdev->irq, dev->dev_addr); |
| 14099 | BNX2X_DEV_INFO( | 14097 | pcie_print_link_status(bp->pdev); |
| 14100 | "%s (%c%d) PCI-E x%d %s found at mem %lx, IRQ %d, node addr %pM\n", | ||
| 14101 | board_info[ent->driver_data].name, | ||
| 14102 | (CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4), | ||
| 14103 | pcie_width, | ||
| 14104 | pcie_speed == PCIE_SPEED_2_5GT ? "2.5GHz" : | ||
| 14105 | pcie_speed == PCIE_SPEED_5_0GT ? "5.0GHz" : | ||
| 14106 | pcie_speed == PCIE_SPEED_8_0GT ? "8.0GHz" : | ||
| 14107 | "Unknown", | ||
| 14108 | dev->base_addr, bp->pdev->irq, dev->dev_addr); | ||
| 14109 | 14098 | ||
| 14110 | bnx2x_register_phc(bp); | 14099 | bnx2x_register_phc(bp); |
| 14111 | 14100 | ||
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index dfa0839f6656..176fc9f4d7de 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | |||
| @@ -8685,22 +8685,6 @@ static int bnxt_init_mac_addr(struct bnxt *bp) | |||
| 8685 | return rc; | 8685 | return rc; |
| 8686 | } | 8686 | } |
| 8687 | 8687 | ||
| 8688 | static void bnxt_parse_log_pcie_link(struct bnxt *bp) | ||
| 8689 | { | ||
| 8690 | enum pcie_link_width width = PCIE_LNK_WIDTH_UNKNOWN; | ||
| 8691 | enum pci_bus_speed speed = PCI_SPEED_UNKNOWN; | ||
| 8692 | |||
| 8693 | if (pcie_get_minimum_link(pci_physfn(bp->pdev), &speed, &width) || | ||
| 8694 | speed == PCI_SPEED_UNKNOWN || width == PCIE_LNK_WIDTH_UNKNOWN) | ||
| 8695 | netdev_info(bp->dev, "Failed to determine PCIe Link Info\n"); | ||
| 8696 | else | ||
| 8697 | netdev_info(bp->dev, "PCIe: Speed %s Width x%d\n", | ||
| 8698 | speed == PCIE_SPEED_2_5GT ? "2.5GT/s" : | ||
| 8699 | speed == PCIE_SPEED_5_0GT ? "5.0GT/s" : | ||
| 8700 | speed == PCIE_SPEED_8_0GT ? "8.0GT/s" : | ||
| 8701 | "Unknown", width); | ||
| 8702 | } | ||
| 8703 | |||
| 8704 | static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 8688 | static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
| 8705 | { | 8689 | { |
| 8706 | static int version_printed; | 8690 | static int version_printed; |
| @@ -8915,8 +8899,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 8915 | netdev_info(dev, "%s found at mem %lx, node addr %pM\n", | 8899 | netdev_info(dev, "%s found at mem %lx, node addr %pM\n", |
| 8916 | board_info[ent->driver_data].name, | 8900 | board_info[ent->driver_data].name, |
| 8917 | (long)pci_resource_start(pdev, 0), dev->dev_addr); | 8901 | (long)pci_resource_start(pdev, 0), dev->dev_addr); |
| 8918 | 8902 | pcie_print_link_status(pdev); | |
| 8919 | bnxt_parse_log_pcie_link(bp); | ||
| 8920 | 8903 | ||
| 8921 | return 0; | 8904 | return 0; |
| 8922 | 8905 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 0efae2030e71..35cb3ae4f7b6 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
| @@ -5066,79 +5066,6 @@ static int init_rss(struct adapter *adap) | |||
| 5066 | return 0; | 5066 | return 0; |
| 5067 | } | 5067 | } |
| 5068 | 5068 | ||
| 5069 | static int cxgb4_get_pcie_dev_link_caps(struct adapter *adap, | ||
| 5070 | enum pci_bus_speed *speed, | ||
| 5071 | enum pcie_link_width *width) | ||
| 5072 | { | ||
| 5073 | u32 lnkcap1, lnkcap2; | ||
| 5074 | int err1, err2; | ||
| 5075 | |||
| 5076 | #define PCIE_MLW_CAP_SHIFT 4 /* start of MLW mask in link capabilities */ | ||
| 5077 | |||
| 5078 | *speed = PCI_SPEED_UNKNOWN; | ||
| 5079 | *width = PCIE_LNK_WIDTH_UNKNOWN; | ||
| 5080 | |||
| 5081 | err1 = pcie_capability_read_dword(adap->pdev, PCI_EXP_LNKCAP, | ||
| 5082 | &lnkcap1); | ||
| 5083 | err2 = pcie_capability_read_dword(adap->pdev, PCI_EXP_LNKCAP2, | ||
| 5084 | &lnkcap2); | ||
| 5085 | if (!err2 && lnkcap2) { /* PCIe r3.0-compliant */ | ||
| 5086 | if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_8_0GB) | ||
| 5087 | *speed = PCIE_SPEED_8_0GT; | ||
| 5088 | else if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_5_0GB) | ||
| 5089 | *speed = PCIE_SPEED_5_0GT; | ||
| 5090 | else if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_2_5GB) | ||
| 5091 | *speed = PCIE_SPEED_2_5GT; | ||
| 5092 | } | ||
| 5093 | if (!err1) { | ||
| 5094 | *width = (lnkcap1 & PCI_EXP_LNKCAP_MLW) >> PCIE_MLW_CAP_SHIFT; | ||
| 5095 | if (!lnkcap2) { /* pre-r3.0 */ | ||
| 5096 | if (lnkcap1 & PCI_EXP_LNKCAP_SLS_5_0GB) | ||
| 5097 | *speed = PCIE_SPEED_5_0GT; | ||
| 5098 | else if (lnkcap1 & PCI_EXP_LNKCAP_SLS_2_5GB) | ||
| 5099 | *speed = PCIE_SPEED_2_5GT; | ||
| 5100 | } | ||
| 5101 | } | ||
| 5102 | |||
| 5103 | if (*speed == PCI_SPEED_UNKNOWN || *width == PCIE_LNK_WIDTH_UNKNOWN) | ||
| 5104 | return err1 ? err1 : err2 ? err2 : -EINVAL; | ||
| 5105 | return 0; | ||
| 5106 | } | ||
| 5107 | |||
| 5108 | static void cxgb4_check_pcie_caps(struct adapter *adap) | ||
| 5109 | { | ||
| 5110 | enum pcie_link_width width, width_cap; | ||
| 5111 | enum pci_bus_speed speed, speed_cap; | ||
| 5112 | |||
| 5113 | #define PCIE_SPEED_STR(speed) \ | ||
| 5114 | (speed == PCIE_SPEED_8_0GT ? "8.0GT/s" : \ | ||
| 5115 | speed == PCIE_SPEED_5_0GT ? "5.0GT/s" : \ | ||
| 5116 | speed == PCIE_SPEED_2_5GT ? "2.5GT/s" : \ | ||
| 5117 | "Unknown") | ||
| 5118 | |||
| 5119 | if (cxgb4_get_pcie_dev_link_caps(adap, &speed_cap, &width_cap)) { | ||
| 5120 | dev_warn(adap->pdev_dev, | ||
| 5121 | "Unable to determine PCIe device BW capabilities\n"); | ||
| 5122 | return; | ||
| 5123 | } | ||
| 5124 | |||
| 5125 | if (pcie_get_minimum_link(adap->pdev, &speed, &width) || | ||
| 5126 | speed == PCI_SPEED_UNKNOWN || width == PCIE_LNK_WIDTH_UNKNOWN) { | ||
| 5127 | dev_warn(adap->pdev_dev, | ||
| 5128 | "Unable to determine PCI Express bandwidth.\n"); | ||
| 5129 | return; | ||
| 5130 | } | ||
| 5131 | |||
| 5132 | dev_info(adap->pdev_dev, "PCIe link speed is %s, device supports %s\n", | ||
| 5133 | PCIE_SPEED_STR(speed), PCIE_SPEED_STR(speed_cap)); | ||
| 5134 | dev_info(adap->pdev_dev, "PCIe link width is x%d, device supports x%d\n", | ||
| 5135 | width, width_cap); | ||
| 5136 | if (speed < speed_cap || width < width_cap) | ||
| 5137 | dev_info(adap->pdev_dev, | ||
| 5138 | "A slot with more lanes and/or higher speed is " | ||
| 5139 | "suggested for optimal performance.\n"); | ||
| 5140 | } | ||
| 5141 | |||
| 5142 | /* Dump basic information about the adapter */ | 5069 | /* Dump basic information about the adapter */ |
| 5143 | static void print_adapter_info(struct adapter *adapter) | 5070 | static void print_adapter_info(struct adapter *adapter) |
| 5144 | { | 5071 | { |
| @@ -5798,7 +5725,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 5798 | } | 5725 | } |
| 5799 | 5726 | ||
| 5800 | /* check for PCI Express bandwidth capabiltites */ | 5727 | /* check for PCI Express bandwidth capabiltites */ |
| 5801 | cxgb4_check_pcie_caps(adapter); | 5728 | pcie_print_link_status(pdev); |
| 5802 | 5729 | ||
| 5803 | err = init_rss(adapter); | 5730 | err = init_rss(adapter); |
| 5804 | if (err) | 5731 | if (err) |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 38b4e4899490..4929f7265598 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
| @@ -245,9 +245,6 @@ static void ixgbe_check_minimum_link(struct ixgbe_adapter *adapter, | |||
| 245 | int expected_gts) | 245 | int expected_gts) |
| 246 | { | 246 | { |
| 247 | struct ixgbe_hw *hw = &adapter->hw; | 247 | struct ixgbe_hw *hw = &adapter->hw; |
| 248 | int max_gts = 0; | ||
| 249 | enum pci_bus_speed speed = PCI_SPEED_UNKNOWN; | ||
| 250 | enum pcie_link_width width = PCIE_LNK_WIDTH_UNKNOWN; | ||
| 251 | struct pci_dev *pdev; | 248 | struct pci_dev *pdev; |
| 252 | 249 | ||
| 253 | /* Some devices are not connected over PCIe and thus do not negotiate | 250 | /* Some devices are not connected over PCIe and thus do not negotiate |
| @@ -263,49 +260,7 @@ static void ixgbe_check_minimum_link(struct ixgbe_adapter *adapter, | |||
| 263 | else | 260 | else |
| 264 | pdev = adapter->pdev; | 261 | pdev = adapter->pdev; |
| 265 | 262 | ||
| 266 | if (pcie_get_minimum_link(pdev, &speed, &width) || | 263 | pcie_print_link_status(pdev); |
| 267 | speed == PCI_SPEED_UNKNOWN || width == PCIE_LNK_WIDTH_UNKNOWN) { | ||
| 268 | e_dev_warn("Unable to determine PCI Express bandwidth.\n"); | ||
| 269 | return; | ||
| 270 | } | ||
| 271 | |||
| 272 | switch (speed) { | ||
| 273 | case PCIE_SPEED_2_5GT: | ||
| 274 | /* 8b/10b encoding reduces max throughput by 20% */ | ||
| 275 | max_gts = 2 * width; | ||
| 276 | break; | ||
| 277 | case PCIE_SPEED_5_0GT: | ||
| 278 | /* 8b/10b encoding reduces max throughput by 20% */ | ||
| 279 | max_gts = 4 * width; | ||
| 280 | break; | ||
| 281 | case PCIE_SPEED_8_0GT: | ||
| 282 | /* 128b/130b encoding reduces throughput by less than 2% */ | ||
| 283 | max_gts = 8 * width; | ||
| 284 | break; | ||
| 285 | default: | ||
| 286 | e_dev_warn("Unable to determine PCI Express bandwidth.\n"); | ||
| 287 | return; | ||
| 288 | } | ||
| 289 | |||
| 290 | e_dev_info("PCI Express bandwidth of %dGT/s available\n", | ||
| 291 | max_gts); | ||
| 292 | e_dev_info("(Speed:%s, Width: x%d, Encoding Loss:%s)\n", | ||
| 293 | (speed == PCIE_SPEED_8_0GT ? "8.0GT/s" : | ||
| 294 | speed == PCIE_SPEED_5_0GT ? "5.0GT/s" : | ||
| 295 | speed == PCIE_SPEED_2_5GT ? "2.5GT/s" : | ||
| 296 | "Unknown"), | ||
| 297 | width, | ||
| 298 | (speed == PCIE_SPEED_2_5GT ? "20%" : | ||
| 299 | speed == PCIE_SPEED_5_0GT ? "20%" : | ||
| 300 | speed == PCIE_SPEED_8_0GT ? "<2%" : | ||
| 301 | "Unknown")); | ||
| 302 | |||
| 303 | if (max_gts < expected_gts) { | ||
| 304 | e_dev_warn("This is not sufficient for optimal performance of this card.\n"); | ||
| 305 | e_dev_warn("For optimal performance, at least %dGT/s of bandwidth is required.\n", | ||
| 306 | expected_gts); | ||
| 307 | e_dev_warn("A slot with more lanes and/or higher speed is suggested.\n"); | ||
| 308 | } | ||
| 309 | } | 264 | } |
| 310 | 265 | ||
| 311 | static void ixgbe_service_event_schedule(struct ixgbe_adapter *adapter) | 266 | static void ixgbe_service_event_schedule(struct ixgbe_adapter *adapter) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 6cab1dd66d1b..f63dfbcd29fe 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | |||
| @@ -2104,21 +2104,18 @@ static int mlx5_eswitch_query_vport_drop_stats(struct mlx5_core_dev *dev, | |||
| 2104 | struct mlx5_vport *vport = &esw->vports[vport_idx]; | 2104 | struct mlx5_vport *vport = &esw->vports[vport_idx]; |
| 2105 | u64 rx_discard_vport_down, tx_discard_vport_down; | 2105 | u64 rx_discard_vport_down, tx_discard_vport_down; |
| 2106 | u64 bytes = 0; | 2106 | u64 bytes = 0; |
| 2107 | u16 idx = 0; | ||
| 2108 | int err = 0; | 2107 | int err = 0; |
| 2109 | 2108 | ||
| 2110 | if (!vport->enabled || esw->mode != SRIOV_LEGACY) | 2109 | if (!vport->enabled || esw->mode != SRIOV_LEGACY) |
| 2111 | return 0; | 2110 | return 0; |
| 2112 | 2111 | ||
| 2113 | if (vport->egress.drop_counter) { | 2112 | if (vport->egress.drop_counter) |
| 2114 | idx = vport->egress.drop_counter->id; | 2113 | mlx5_fc_query(dev, vport->egress.drop_counter, |
| 2115 | mlx5_fc_query(dev, idx, &stats->rx_dropped, &bytes); | 2114 | &stats->rx_dropped, &bytes); |
| 2116 | } | ||
| 2117 | 2115 | ||
| 2118 | if (vport->ingress.drop_counter) { | 2116 | if (vport->ingress.drop_counter) |
| 2119 | idx = vport->ingress.drop_counter->id; | 2117 | mlx5_fc_query(dev, vport->ingress.drop_counter, |
| 2120 | mlx5_fc_query(dev, idx, &stats->tx_dropped, &bytes); | 2118 | &stats->tx_dropped, &bytes); |
| 2121 | } | ||
| 2122 | 2119 | ||
| 2123 | if (!MLX5_CAP_GEN(dev, receive_discard_vport_down) && | 2120 | if (!MLX5_CAP_GEN(dev, receive_discard_vport_down) && |
| 2124 | !MLX5_CAP_GEN(dev, transmit_discard_vport_down)) | 2121 | !MLX5_CAP_GEN(dev, transmit_discard_vport_down)) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index e1b609c61d59..49a75d31185e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | |||
| @@ -325,7 +325,8 @@ static bool check_valid_mask(u8 match_criteria_enable, const u32 *match_criteria | |||
| 325 | if (match_criteria_enable & ~( | 325 | if (match_criteria_enable & ~( |
| 326 | (1 << MLX5_CREATE_FLOW_GROUP_IN_MATCH_CRITERIA_ENABLE_OUTER_HEADERS) | | 326 | (1 << MLX5_CREATE_FLOW_GROUP_IN_MATCH_CRITERIA_ENABLE_OUTER_HEADERS) | |
| 327 | (1 << MLX5_CREATE_FLOW_GROUP_IN_MATCH_CRITERIA_ENABLE_MISC_PARAMETERS) | | 327 | (1 << MLX5_CREATE_FLOW_GROUP_IN_MATCH_CRITERIA_ENABLE_MISC_PARAMETERS) | |
| 328 | (1 << MLX5_CREATE_FLOW_GROUP_IN_MATCH_CRITERIA_ENABLE_INNER_HEADERS))) | 328 | (1 << MLX5_CREATE_FLOW_GROUP_IN_MATCH_CRITERIA_ENABLE_INNER_HEADERS) | |
| 329 | (1 << MLX5_CREATE_FLOW_GROUP_IN_MATCH_CRITERIA_ENABLE_MISC_PARAMETERS_2))) | ||
| 329 | return false; | 330 | return false; |
| 330 | 331 | ||
| 331 | if (!(match_criteria_enable & | 332 | if (!(match_criteria_enable & |
| @@ -361,6 +362,17 @@ static bool check_valid_mask(u8 match_criteria_enable, const u32 *match_criteria | |||
| 361 | return false; | 362 | return false; |
| 362 | } | 363 | } |
| 363 | 364 | ||
| 365 | if (!(match_criteria_enable & | ||
| 366 | 1 << MLX5_CREATE_FLOW_GROUP_IN_MATCH_CRITERIA_ENABLE_MISC_PARAMETERS_2)) { | ||
| 367 | char *fg_type_mask = MLX5_ADDR_OF(fte_match_param, | ||
| 368 | match_criteria, misc_parameters_2); | ||
| 369 | |||
| 370 | if (fg_type_mask[0] || | ||
| 371 | memcmp(fg_type_mask, fg_type_mask + 1, | ||
| 372 | MLX5_ST_SZ_BYTES(fte_match_set_misc2) - 1)) | ||
| 373 | return false; | ||
| 374 | } | ||
| 375 | |||
| 364 | return check_last_reserved(match_criteria); | 376 | return check_last_reserved(match_criteria); |
| 365 | } | 377 | } |
| 366 | 378 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h index e26d3e9d5f9f..32070e5d993d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h | |||
| @@ -159,7 +159,7 @@ struct mlx5_ft_underlay_qp { | |||
| 159 | u32 qpn; | 159 | u32 qpn; |
| 160 | }; | 160 | }; |
| 161 | 161 | ||
| 162 | #define MLX5_FTE_MATCH_PARAM_RESERVED reserved_at_600 | 162 | #define MLX5_FTE_MATCH_PARAM_RESERVED reserved_at_800 |
| 163 | /* Calculate the fte_match_param length and without the reserved length. | 163 | /* Calculate the fte_match_param length and without the reserved length. |
| 164 | * Make sure the reserved field is the last. | 164 | * Make sure the reserved field is the last. |
| 165 | */ | 165 | */ |
| @@ -233,8 +233,6 @@ void mlx5_fc_queue_stats_work(struct mlx5_core_dev *dev, | |||
| 233 | unsigned long delay); | 233 | unsigned long delay); |
| 234 | void mlx5_fc_update_sampling_interval(struct mlx5_core_dev *dev, | 234 | void mlx5_fc_update_sampling_interval(struct mlx5_core_dev *dev, |
| 235 | unsigned long interval); | 235 | unsigned long interval); |
| 236 | int mlx5_fc_query(struct mlx5_core_dev *dev, u16 id, | ||
| 237 | u64 *packets, u64 *bytes); | ||
| 238 | 236 | ||
| 239 | int mlx5_init_fs(struct mlx5_core_dev *dev); | 237 | int mlx5_init_fs(struct mlx5_core_dev *dev); |
| 240 | void mlx5_cleanup_fs(struct mlx5_core_dev *dev); | 238 | void mlx5_cleanup_fs(struct mlx5_core_dev *dev); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c index b7ab929d5f8e..58af6be13dfa 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c | |||
| @@ -243,6 +243,7 @@ err_out: | |||
| 243 | 243 | ||
| 244 | return ERR_PTR(err); | 244 | return ERR_PTR(err); |
| 245 | } | 245 | } |
| 246 | EXPORT_SYMBOL(mlx5_fc_create); | ||
| 246 | 247 | ||
| 247 | void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter) | 248 | void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter) |
| 248 | { | 249 | { |
| @@ -260,6 +261,7 @@ void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter) | |||
| 260 | mlx5_cmd_fc_free(dev, counter->id); | 261 | mlx5_cmd_fc_free(dev, counter->id); |
| 261 | kfree(counter); | 262 | kfree(counter); |
| 262 | } | 263 | } |
| 264 | EXPORT_SYMBOL(mlx5_fc_destroy); | ||
| 263 | 265 | ||
| 264 | int mlx5_init_fc_stats(struct mlx5_core_dev *dev) | 266 | int mlx5_init_fc_stats(struct mlx5_core_dev *dev) |
| 265 | { | 267 | { |
| @@ -312,11 +314,12 @@ void mlx5_cleanup_fc_stats(struct mlx5_core_dev *dev) | |||
| 312 | } | 314 | } |
| 313 | } | 315 | } |
| 314 | 316 | ||
| 315 | int mlx5_fc_query(struct mlx5_core_dev *dev, u16 id, | 317 | int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter, |
| 316 | u64 *packets, u64 *bytes) | 318 | u64 *packets, u64 *bytes) |
| 317 | { | 319 | { |
| 318 | return mlx5_cmd_fc_query(dev, id, packets, bytes); | 320 | return mlx5_cmd_fc_query(dev, counter->id, packets, bytes); |
| 319 | } | 321 | } |
| 322 | EXPORT_SYMBOL(mlx5_fc_query); | ||
| 320 | 323 | ||
| 321 | void mlx5_fc_query_cached(struct mlx5_fc *counter, | 324 | void mlx5_fc_query_cached(struct mlx5_fc *counter, |
| 322 | u64 *bytes, u64 *packets, u64 *lastuse) | 325 | u64 *bytes, u64 *packets, u64 *lastuse) |
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 99d8e7398a5b..23304aca25f9 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h | |||
| @@ -189,7 +189,6 @@ struct netvsc_device; | |||
| 189 | struct net_device_context; | 189 | struct net_device_context; |
| 190 | 190 | ||
| 191 | extern u32 netvsc_ring_bytes; | 191 | extern u32 netvsc_ring_bytes; |
| 192 | extern struct reciprocal_value netvsc_ring_reciprocal; | ||
| 193 | 192 | ||
| 194 | struct netvsc_device *netvsc_device_add(struct hv_device *device, | 193 | struct netvsc_device *netvsc_device_add(struct hv_device *device, |
| 195 | const struct netvsc_device_info *info); | 194 | const struct netvsc_device_info *info); |
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index d2ee66c259a7..5d5bd513847f 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c | |||
| @@ -31,7 +31,6 @@ | |||
| 31 | #include <linux/vmalloc.h> | 31 | #include <linux/vmalloc.h> |
| 32 | #include <linux/rtnetlink.h> | 32 | #include <linux/rtnetlink.h> |
| 33 | #include <linux/prefetch.h> | 33 | #include <linux/prefetch.h> |
| 34 | #include <linux/reciprocal_div.h> | ||
| 35 | 34 | ||
| 36 | #include <asm/sync_bitops.h> | 35 | #include <asm/sync_bitops.h> |
| 37 | 36 | ||
| @@ -635,17 +634,6 @@ void netvsc_device_remove(struct hv_device *device) | |||
| 635 | #define RING_AVAIL_PERCENT_HIWATER 20 | 634 | #define RING_AVAIL_PERCENT_HIWATER 20 |
| 636 | #define RING_AVAIL_PERCENT_LOWATER 10 | 635 | #define RING_AVAIL_PERCENT_LOWATER 10 |
| 637 | 636 | ||
| 638 | /* | ||
| 639 | * Get the percentage of available bytes to write in the ring. | ||
| 640 | * The return value is in range from 0 to 100. | ||
| 641 | */ | ||
| 642 | static u32 hv_ringbuf_avail_percent(const struct hv_ring_buffer_info *ring_info) | ||
| 643 | { | ||
| 644 | u32 avail_write = hv_get_bytes_to_write(ring_info); | ||
| 645 | |||
| 646 | return reciprocal_divide(avail_write * 100, netvsc_ring_reciprocal); | ||
| 647 | } | ||
| 648 | |||
| 649 | static inline void netvsc_free_send_slot(struct netvsc_device *net_device, | 637 | static inline void netvsc_free_send_slot(struct netvsc_device *net_device, |
| 650 | u32 index) | 638 | u32 index) |
| 651 | { | 639 | { |
| @@ -694,8 +682,8 @@ static void netvsc_send_tx_complete(struct net_device *ndev, | |||
| 694 | struct netdev_queue *txq = netdev_get_tx_queue(ndev, q_idx); | 682 | struct netdev_queue *txq = netdev_get_tx_queue(ndev, q_idx); |
| 695 | 683 | ||
| 696 | if (netif_tx_queue_stopped(txq) && | 684 | if (netif_tx_queue_stopped(txq) && |
| 697 | (hv_ringbuf_avail_percent(&channel->outbound) > RING_AVAIL_PERCENT_HIWATER || | 685 | (hv_get_avail_to_write_percent(&channel->outbound) > |
| 698 | queue_sends < 1)) { | 686 | RING_AVAIL_PERCENT_HIWATER || queue_sends < 1)) { |
| 699 | netif_tx_wake_queue(txq); | 687 | netif_tx_wake_queue(txq); |
| 700 | ndev_ctx->eth_stats.wake_queue++; | 688 | ndev_ctx->eth_stats.wake_queue++; |
| 701 | } | 689 | } |
| @@ -802,7 +790,7 @@ static inline int netvsc_send_pkt( | |||
| 802 | struct netdev_queue *txq = netdev_get_tx_queue(ndev, packet->q_idx); | 790 | struct netdev_queue *txq = netdev_get_tx_queue(ndev, packet->q_idx); |
| 803 | u64 req_id; | 791 | u64 req_id; |
| 804 | int ret; | 792 | int ret; |
| 805 | u32 ring_avail = hv_ringbuf_avail_percent(&out_channel->outbound); | 793 | u32 ring_avail = hv_get_avail_to_write_percent(&out_channel->outbound); |
| 806 | 794 | ||
| 807 | nvmsg.hdr.msg_type = NVSP_MSG1_TYPE_SEND_RNDIS_PKT; | 795 | nvmsg.hdr.msg_type = NVSP_MSG1_TYPE_SEND_RNDIS_PKT; |
| 808 | if (skb) | 796 | if (skb) |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 8eec156418ea..7b18a8c267c2 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
| @@ -35,7 +35,6 @@ | |||
| 35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
| 36 | #include <linux/rtnetlink.h> | 36 | #include <linux/rtnetlink.h> |
| 37 | #include <linux/netpoll.h> | 37 | #include <linux/netpoll.h> |
| 38 | #include <linux/reciprocal_div.h> | ||
| 39 | 38 | ||
| 40 | #include <net/arp.h> | 39 | #include <net/arp.h> |
| 41 | #include <net/route.h> | 40 | #include <net/route.h> |
| @@ -59,7 +58,6 @@ static unsigned int ring_size __ro_after_init = 128; | |||
| 59 | module_param(ring_size, uint, 0444); | 58 | module_param(ring_size, uint, 0444); |
| 60 | MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)"); | 59 | MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)"); |
| 61 | unsigned int netvsc_ring_bytes __ro_after_init; | 60 | unsigned int netvsc_ring_bytes __ro_after_init; |
| 62 | struct reciprocal_value netvsc_ring_reciprocal __ro_after_init; | ||
| 63 | 61 | ||
| 64 | static const u32 default_msg = NETIF_MSG_DRV | NETIF_MSG_PROBE | | 62 | static const u32 default_msg = NETIF_MSG_DRV | NETIF_MSG_PROBE | |
| 65 | NETIF_MSG_LINK | NETIF_MSG_IFUP | | 63 | NETIF_MSG_LINK | NETIF_MSG_IFUP | |
| @@ -2132,7 +2130,6 @@ static int __init netvsc_drv_init(void) | |||
| 2132 | ring_size); | 2130 | ring_size); |
| 2133 | } | 2131 | } |
| 2134 | netvsc_ring_bytes = ring_size * PAGE_SIZE; | 2132 | netvsc_ring_bytes = ring_size * PAGE_SIZE; |
| 2135 | netvsc_ring_reciprocal = reciprocal_value(netvsc_ring_bytes); | ||
| 2136 | 2133 | ||
| 2137 | ret = vmbus_driver_register(&netvsc_drv); | 2134 | ret = vmbus_driver_register(&netvsc_drv); |
| 2138 | if (ret) | 2135 | if (ret) |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 4dd0668003e7..679da1abd73c 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
| @@ -564,7 +564,7 @@ static u16 xennet_select_queue(struct net_device *dev, struct sk_buff *skb, | |||
| 564 | 564 | ||
| 565 | #define MAX_XEN_SKB_FRAGS (65536 / XEN_PAGE_SIZE + 1) | 565 | #define MAX_XEN_SKB_FRAGS (65536 / XEN_PAGE_SIZE + 1) |
| 566 | 566 | ||
| 567 | static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) | 567 | static netdev_tx_t xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) |
| 568 | { | 568 | { |
| 569 | struct netfront_info *np = netdev_priv(dev); | 569 | struct netfront_info *np = netdev_priv(dev); |
| 570 | struct netfront_stats *tx_stats = this_cpu_ptr(np->tx_stats); | 570 | struct netfront_stats *tx_stats = this_cpu_ptr(np->tx_stats); |
