bnxt.c (d5430d31ca72ec37fd539fd1c5230859509be4ef) bnxt.c (2ae7408fedfee979e01ed3801223c632bb124c46)
1/* Broadcom NetXtreme-C/E network driver.
2 *
3 * Copyright (c) 2014-2016 Broadcom Corporation
4 * Copyright (c) 2016-2017 Broadcom Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation.

--- 36 unchanged lines hidden (view full) ---

45#include <linux/workqueue.h>
46#include <linux/prefetch.h>
47#include <linux/cache.h>
48#include <linux/log2.h>
49#include <linux/aer.h>
50#include <linux/bitmap.h>
51#include <linux/cpu_rmap.h>
52#include <linux/cpumask.h>
1/* Broadcom NetXtreme-C/E network driver.
2 *
3 * Copyright (c) 2014-2016 Broadcom Corporation
4 * Copyright (c) 2016-2017 Broadcom Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation.

--- 36 unchanged lines hidden (view full) ---

45#include <linux/workqueue.h>
46#include <linux/prefetch.h>
47#include <linux/cache.h>
48#include <linux/log2.h>
49#include <linux/aer.h>
50#include <linux/bitmap.h>
51#include <linux/cpu_rmap.h>
52#include <linux/cpumask.h>
53#include <net/pkt_cls.h>
53
54#include "bnxt_hsi.h"
55#include "bnxt.h"
56#include "bnxt_ulp.h"
57#include "bnxt_sriov.h"
58#include "bnxt_ethtool.h"
59#include "bnxt_dcb.h"
60#include "bnxt_xdp.h"
61#include "bnxt_vfr.h"
54
55#include "bnxt_hsi.h"
56#include "bnxt.h"
57#include "bnxt_ulp.h"
58#include "bnxt_sriov.h"
59#include "bnxt_ethtool.h"
60#include "bnxt_dcb.h"
61#include "bnxt_xdp.h"
62#include "bnxt_vfr.h"
63#include "bnxt_tc.h"
62
63#define BNXT_TX_TIMEOUT (5 * HZ)
64
65static const char version[] =
66 "Broadcom NetXtreme-C/E driver " DRV_MODULE_NAME " v" DRV_MODULE_VERSION "\n";
67
68MODULE_LICENSE("GPL");
69MODULE_DESCRIPTION("Broadcom BCM573xx network driver");

--- 7230 unchanged lines hidden (view full) ---

7300 bp->num_stat_ctxs = bp->cp_nr_rings;
7301
7302 if (netif_running(bp->dev))
7303 return bnxt_open_nic(bp, true, false);
7304
7305 return 0;
7306}
7307
64
65#define BNXT_TX_TIMEOUT (5 * HZ)
66
67static const char version[] =
68 "Broadcom NetXtreme-C/E driver " DRV_MODULE_NAME " v" DRV_MODULE_VERSION "\n";
69
70MODULE_LICENSE("GPL");
71MODULE_DESCRIPTION("Broadcom BCM573xx network driver");

--- 7230 unchanged lines hidden (view full) ---

7302 bp->num_stat_ctxs = bp->cp_nr_rings;
7303
7304 if (netif_running(bp->dev))
7305 return bnxt_open_nic(bp, true, false);
7306
7307 return 0;
7308}
7309
7308static int bnxt_setup_tc(struct net_device *dev, enum tc_setup_type type,
7309 void *type_data)
7310static int bnxt_setup_flower(struct net_device *dev,
7311 struct tc_cls_flower_offload *cls_flower)
7310{
7312{
7311 struct tc_mqprio_qopt *mqprio = type_data;
7313 struct bnxt *bp = netdev_priv(dev);
7312
7314
7313 if (type != TC_SETUP_MQPRIO)
7315 if (BNXT_VF(bp))
7314 return -EOPNOTSUPP;
7315
7316 return -EOPNOTSUPP;
7317
7316 mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
7318 return bnxt_tc_setup_flower(bp, bp->pf.fw_fid, cls_flower);
7319}
7317
7320
7318 return bnxt_setup_mq_tc(dev, mqprio->num_tc);
7321static int bnxt_setup_tc(struct net_device *dev, enum tc_setup_type type,
7322 void *type_data)
7323{
7324 switch (type) {
7325 case TC_SETUP_CLSFLOWER:
7326 return bnxt_setup_flower(dev, type_data);
7327 case TC_SETUP_MQPRIO: {
7328 struct tc_mqprio_qopt *mqprio = type_data;
7329
7330 mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
7331
7332 return bnxt_setup_mq_tc(dev, mqprio->num_tc);
7333 }
7334 default:
7335 return -EOPNOTSUPP;
7336 }
7319}
7320
7321#ifdef CONFIG_RFS_ACCEL
7322static bool bnxt_fltr_match(struct bnxt_ntuple_filter *f1,
7323 struct bnxt_ntuple_filter *f2)
7324{
7325 struct flow_keys *keys1 = &f1->fkeys;
7326 struct flow_keys *keys2 = &f2->fkeys;

--- 379 unchanged lines hidden (view full) ---

7706
7707 if (BNXT_PF(bp)) {
7708 bnxt_sriov_disable(bp);
7709 bnxt_dl_unregister(bp);
7710 }
7711
7712 pci_disable_pcie_error_reporting(pdev);
7713 unregister_netdev(dev);
7337}
7338
7339#ifdef CONFIG_RFS_ACCEL
7340static bool bnxt_fltr_match(struct bnxt_ntuple_filter *f1,
7341 struct bnxt_ntuple_filter *f2)
7342{
7343 struct flow_keys *keys1 = &f1->fkeys;
7344 struct flow_keys *keys2 = &f2->fkeys;

--- 379 unchanged lines hidden (view full) ---

7724
7725 if (BNXT_PF(bp)) {
7726 bnxt_sriov_disable(bp);
7727 bnxt_dl_unregister(bp);
7728 }
7729
7730 pci_disable_pcie_error_reporting(pdev);
7731 unregister_netdev(dev);
7732 bnxt_shutdown_tc(bp);
7714 cancel_work_sync(&bp->sp_task);
7715 bp->sp_event = 0;
7716
7717 bnxt_clear_int_mode(bp);
7718 bnxt_hwrm_func_drv_unrgtr(bp);
7719 bnxt_free_hwrm_resources(bp);
7720 bnxt_free_hwrm_short_cmd_req(bp);
7721 bnxt_ethtool_free(bp);

--- 375 unchanged lines hidden (view full) ---

8097 goto init_err_pci_clean;
8098
8099 bnxt_get_wol_settings(bp);
8100 if (bp->flags & BNXT_FLAG_WOL_CAP)
8101 device_set_wakeup_enable(&pdev->dev, bp->wol);
8102 else
8103 device_set_wakeup_capable(&pdev->dev, false);
8104
7733 cancel_work_sync(&bp->sp_task);
7734 bp->sp_event = 0;
7735
7736 bnxt_clear_int_mode(bp);
7737 bnxt_hwrm_func_drv_unrgtr(bp);
7738 bnxt_free_hwrm_resources(bp);
7739 bnxt_free_hwrm_short_cmd_req(bp);
7740 bnxt_ethtool_free(bp);

--- 375 unchanged lines hidden (view full) ---

8116 goto init_err_pci_clean;
8117
8118 bnxt_get_wol_settings(bp);
8119 if (bp->flags & BNXT_FLAG_WOL_CAP)
8120 device_set_wakeup_enable(&pdev->dev, bp->wol);
8121 else
8122 device_set_wakeup_capable(&pdev->dev, false);
8123
8124 if (BNXT_PF(bp))
8125 bnxt_init_tc(bp);
8126
8105 rc = register_netdev(dev);
8106 if (rc)
8127 rc = register_netdev(dev);
8128 if (rc)
8107 goto init_err_clr_int;
8129 goto init_err_cleanup_tc;
8108
8109 if (BNXT_PF(bp))
8110 bnxt_dl_register(bp);
8111
8112 netdev_info(dev, "%s found at mem %lx, node addr %pM\n",
8113 board_info[ent->driver_data].name,
8114 (long)pci_resource_start(pdev, 0), dev->dev_addr);
8115
8116 bnxt_parse_log_pcie_link(bp);
8117
8118 return 0;
8119
8130
8131 if (BNXT_PF(bp))
8132 bnxt_dl_register(bp);
8133
8134 netdev_info(dev, "%s found at mem %lx, node addr %pM\n",
8135 board_info[ent->driver_data].name,
8136 (long)pci_resource_start(pdev, 0), dev->dev_addr);
8137
8138 bnxt_parse_log_pcie_link(bp);
8139
8140 return 0;
8141
8120init_err_clr_int:
8142init_err_cleanup_tc:
8143 bnxt_shutdown_tc(bp);
8121 bnxt_clear_int_mode(bp);
8122
8123init_err_pci_clean:
8124 bnxt_cleanup_pci(bp);
8125
8126init_err_free:
8127 free_netdev(dev);
8128 return rc;

--- 210 unchanged lines hidden ---
8144 bnxt_clear_int_mode(bp);
8145
8146init_err_pci_clean:
8147 bnxt_cleanup_pci(bp);
8148
8149init_err_free:
8150 free_netdev(dev);
8151 return rc;

--- 210 unchanged lines hidden ---