2016-11-29 08:54:34 +08:00
|
|
|
/**********************************************************************
|
|
|
|
* Author: Cavium, Inc.
|
|
|
|
*
|
|
|
|
* Contact: support@cavium.com
|
|
|
|
* Please include "LiquidIO" in the subject.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2003-2016 Cavium, Inc.
|
|
|
|
*
|
|
|
|
* This file is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License, Version 2, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This file is distributed in the hope that it will be useful, but
|
|
|
|
* AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
|
|
|
|
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
|
|
|
|
* NONINFRINGEMENT. See the GNU General Public License for more details.
|
|
|
|
***********************************************************************/
|
2017-02-08 07:03:03 +08:00
|
|
|
#include <linux/module.h>
|
2017-03-29 23:17:31 +08:00
|
|
|
#include <linux/interrupt.h>
|
2016-11-29 08:54:34 +08:00
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <net/vxlan.h>
|
|
|
|
#include "liquidio_common.h"
|
|
|
|
#include "octeon_droq.h"
|
|
|
|
#include "octeon_iq.h"
|
|
|
|
#include "response_manager.h"
|
|
|
|
#include "octeon_device.h"
|
2016-12-08 00:54:31 +08:00
|
|
|
#include "octeon_nic.h"
|
2016-11-29 08:54:35 +08:00
|
|
|
#include "octeon_main.h"
|
2016-12-08 00:54:31 +08:00
|
|
|
#include "octeon_network.h"
|
2016-11-29 08:54:35 +08:00
|
|
|
#include "cn23xx_vf_device.h"
|
2016-11-29 08:54:34 +08:00
|
|
|
|
|
|
|
MODULE_AUTHOR("Cavium Networks, <support@cavium.com>");
|
|
|
|
MODULE_DESCRIPTION("Cavium LiquidIO Intelligent Server Adapter Virtual Function Driver");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
static int debug = -1;
|
|
|
|
module_param(debug, int, 0644);
|
|
|
|
MODULE_PARM_DESC(debug, "NETIF_MSG debug bits");
|
|
|
|
|
|
|
|
#define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK)
|
|
|
|
|
2016-12-09 05:00:47 +08:00
|
|
|
struct oct_timestamp_resp {
|
|
|
|
u64 rh;
|
|
|
|
u64 timestamp;
|
|
|
|
u64 status;
|
|
|
|
};
|
|
|
|
|
2016-12-08 00:54:35 +08:00
|
|
|
union tx_info {
|
|
|
|
u64 u64;
|
|
|
|
struct {
|
|
|
|
#ifdef __BIG_ENDIAN_BITFIELD
|
|
|
|
u16 gso_size;
|
|
|
|
u16 gso_segs;
|
|
|
|
u32 reserved;
|
|
|
|
#else
|
|
|
|
u32 reserved;
|
|
|
|
u16 gso_segs;
|
|
|
|
u16 gso_size;
|
|
|
|
#endif
|
|
|
|
} s;
|
|
|
|
};
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
#define OCTNIC_GSO_MAX_HEADER_SIZE 128
|
|
|
|
#define OCTNIC_GSO_MAX_SIZE \
|
|
|
|
(CN23XX_DEFAULT_INPUT_JABBER - OCTNIC_GSO_MAX_HEADER_SIZE)
|
|
|
|
|
2016-11-29 08:54:34 +08:00
|
|
|
static int
|
|
|
|
liquidio_vf_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
|
|
|
|
static void liquidio_vf_remove(struct pci_dev *pdev);
|
2016-11-29 08:54:35 +08:00
|
|
|
static int octeon_device_init(struct octeon_device *oct);
|
2016-12-08 00:54:31 +08:00
|
|
|
static int liquidio_stop(struct net_device *netdev);
|
2016-11-29 08:54:34 +08:00
|
|
|
|
2016-11-29 08:54:41 +08:00
|
|
|
static int lio_wait_for_oq_pkts(struct octeon_device *oct)
|
|
|
|
{
|
|
|
|
struct octeon_device_priv *oct_priv =
|
|
|
|
(struct octeon_device_priv *)oct->priv;
|
2017-08-15 03:01:31 +08:00
|
|
|
int retry = MAX_IO_PENDING_PKT_COUNT;
|
2016-11-29 08:54:41 +08:00
|
|
|
int pkt_cnt = 0, pending_pkts;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
do {
|
|
|
|
pending_pkts = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_OCTEON_OUTPUT_QUEUES(oct); i++) {
|
|
|
|
if (!(oct->io_qmask.oq & BIT_ULL(i)))
|
|
|
|
continue;
|
|
|
|
pkt_cnt += octeon_droq_check_hw_for_pkts(oct->droq[i]);
|
|
|
|
}
|
|
|
|
if (pkt_cnt > 0) {
|
|
|
|
pending_pkts += pkt_cnt;
|
|
|
|
tasklet_schedule(&oct_priv->droq_tasklet);
|
|
|
|
}
|
|
|
|
pkt_cnt = 0;
|
|
|
|
schedule_timeout_uninterruptible(1);
|
|
|
|
|
|
|
|
} while (retry-- && pending_pkts);
|
|
|
|
|
|
|
|
return pkt_cnt;
|
|
|
|
}
|
|
|
|
|
2016-12-09 05:00:48 +08:00
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* pcierror_quiesce_device - Cause device to go quiet so it can be safely removed/reset/etc
|
|
|
|
* @oct: Pointer to Octeon device
|
2016-12-09 05:00:48 +08:00
|
|
|
*/
|
|
|
|
static void pcierror_quiesce_device(struct octeon_device *oct)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Disable the input and output queues now. No more packets will
|
|
|
|
* arrive from Octeon, but we should wait for all packet processing
|
|
|
|
* to finish.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* To allow for in-flight requests */
|
|
|
|
schedule_timeout_uninterruptible(100);
|
|
|
|
|
|
|
|
if (wait_for_pending_requests(oct))
|
|
|
|
dev_err(&oct->pci_dev->dev, "There were pending requests\n");
|
|
|
|
|
|
|
|
/* Force all requests waiting to be fetched by OCTEON to complete. */
|
|
|
|
for (i = 0; i < MAX_OCTEON_INSTR_QUEUES(oct); i++) {
|
|
|
|
struct octeon_instr_queue *iq;
|
|
|
|
|
|
|
|
if (!(oct->io_qmask.iq & BIT_ULL(i)))
|
|
|
|
continue;
|
|
|
|
iq = oct->instr_queue[i];
|
|
|
|
|
|
|
|
if (atomic_read(&iq->instr_pending)) {
|
|
|
|
spin_lock_bh(&iq->lock);
|
|
|
|
iq->fill_cnt = 0;
|
|
|
|
iq->octeon_read_index = iq->host_write_index;
|
|
|
|
iq->stats.instr_processed +=
|
|
|
|
atomic_read(&iq->instr_pending);
|
|
|
|
lio_process_iq_request_list(oct, iq, 0);
|
|
|
|
spin_unlock_bh(&iq->lock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Force all pending ordered list requests to time out. */
|
|
|
|
lio_process_ordered_list(oct, 1);
|
|
|
|
|
|
|
|
/* We do not need to wait for output queue packets to be processed. */
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* cleanup_aer_uncorrect_error_status - Cleanup PCI AER uncorrectable error status
|
|
|
|
* @dev: Pointer to PCI device
|
2016-12-09 05:00:48 +08:00
|
|
|
*/
|
|
|
|
static void cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
|
|
|
|
{
|
|
|
|
u32 status, mask;
|
|
|
|
int pos = 0x100;
|
|
|
|
|
|
|
|
pr_info("%s :\n", __func__);
|
|
|
|
|
|
|
|
pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, &status);
|
|
|
|
pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_SEVER, &mask);
|
|
|
|
if (dev->error_state == pci_channel_io_normal)
|
|
|
|
status &= ~mask; /* Clear corresponding nonfatal bits */
|
|
|
|
else
|
|
|
|
status &= mask; /* Clear corresponding fatal bits */
|
|
|
|
pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* stop_pci_io - Stop all PCI IO to a given device
|
|
|
|
* @oct: Pointer to Octeon device
|
2016-12-09 05:00:48 +08:00
|
|
|
*/
|
|
|
|
static void stop_pci_io(struct octeon_device *oct)
|
|
|
|
{
|
|
|
|
struct msix_entry *msix_entries;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* No more instructions will be forwarded. */
|
|
|
|
atomic_set(&oct->status, OCT_DEV_IN_RESET);
|
|
|
|
|
|
|
|
for (i = 0; i < oct->ifcount; i++)
|
|
|
|
netif_device_detach(oct->props[i].netdev);
|
|
|
|
|
|
|
|
/* Disable interrupts */
|
|
|
|
oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR);
|
|
|
|
|
|
|
|
pcierror_quiesce_device(oct);
|
|
|
|
if (oct->msix_on) {
|
|
|
|
msix_entries = (struct msix_entry *)oct->msix_entries;
|
|
|
|
for (i = 0; i < oct->num_msix_irqs; i++) {
|
|
|
|
/* clear the affinity_cpumask */
|
|
|
|
irq_set_affinity_hint(msix_entries[i].vector,
|
|
|
|
NULL);
|
|
|
|
free_irq(msix_entries[i].vector,
|
|
|
|
&oct->ioq_vector[i]);
|
|
|
|
}
|
|
|
|
pci_disable_msix(oct->pci_dev);
|
|
|
|
kfree(oct->msix_entries);
|
|
|
|
oct->msix_entries = NULL;
|
|
|
|
octeon_free_ioq_vector(oct);
|
|
|
|
}
|
|
|
|
dev_dbg(&oct->pci_dev->dev, "Device state is now %s\n",
|
|
|
|
lio_get_state_string(&oct->status));
|
|
|
|
|
|
|
|
/* making it a common function for all OCTEON models */
|
|
|
|
cleanup_aer_uncorrect_error_status(oct->pci_dev);
|
|
|
|
|
|
|
|
pci_disable_device(oct->pci_dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* liquidio_pcie_error_detected - called when PCI error is detected
|
|
|
|
* @pdev: Pointer to PCI device
|
|
|
|
* @state: The current pci connection state
|
2016-12-09 05:00:48 +08:00
|
|
|
*
|
|
|
|
* This function is called after a PCI bus error affecting
|
|
|
|
* this device has been detected.
|
|
|
|
*/
|
|
|
|
static pci_ers_result_t liquidio_pcie_error_detected(struct pci_dev *pdev,
|
|
|
|
pci_channel_state_t state)
|
|
|
|
{
|
|
|
|
struct octeon_device *oct = pci_get_drvdata(pdev);
|
|
|
|
|
|
|
|
/* Non-correctable Non-fatal errors */
|
|
|
|
if (state == pci_channel_io_normal) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "Non-correctable non-fatal error reported:\n");
|
|
|
|
cleanup_aer_uncorrect_error_status(oct->pci_dev);
|
|
|
|
return PCI_ERS_RESULT_CAN_RECOVER;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Non-correctable Fatal errors */
|
|
|
|
dev_err(&oct->pci_dev->dev, "Non-correctable FATAL reported by PCI AER driver\n");
|
|
|
|
stop_pci_io(oct);
|
|
|
|
|
|
|
|
return PCI_ERS_RESULT_DISCONNECT;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* For PCI-E Advanced Error Recovery (AER) Interface */
|
|
|
|
static const struct pci_error_handlers liquidio_vf_err_handler = {
|
|
|
|
.error_detected = liquidio_pcie_error_detected,
|
|
|
|
};
|
|
|
|
|
2016-11-29 08:54:34 +08:00
|
|
|
static const struct pci_device_id liquidio_vf_pci_tbl[] = {
|
|
|
|
{
|
|
|
|
PCI_VENDOR_ID_CAVIUM, OCTEON_CN23XX_VF_VID,
|
|
|
|
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
0, 0, 0, 0, 0, 0, 0
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(pci, liquidio_vf_pci_tbl);
|
|
|
|
|
|
|
|
static struct pci_driver liquidio_vf_pci_driver = {
|
|
|
|
.name = "LiquidIO_VF",
|
|
|
|
.id_table = liquidio_vf_pci_tbl,
|
|
|
|
.probe = liquidio_vf_probe,
|
|
|
|
.remove = liquidio_vf_remove,
|
2016-12-09 05:00:48 +08:00
|
|
|
.err_handler = &liquidio_vf_err_handler, /* For AER */
|
2016-11-29 08:54:34 +08:00
|
|
|
};
|
|
|
|
|
2016-12-08 00:54:32 +08:00
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* print_link_info - Print link information
|
|
|
|
* @netdev: network device
|
2016-12-08 00:54:32 +08:00
|
|
|
*/
|
|
|
|
static void print_link_info(struct net_device *netdev)
|
|
|
|
{
|
|
|
|
struct lio *lio = GET_LIO(netdev);
|
|
|
|
|
2017-08-15 03:01:56 +08:00
|
|
|
if (!ifstate_check(lio, LIO_IFSTATE_RESETTING) &&
|
|
|
|
ifstate_check(lio, LIO_IFSTATE_REGISTERED)) {
|
2016-12-08 00:54:32 +08:00
|
|
|
struct oct_link_info *linfo = &lio->linfo;
|
|
|
|
|
|
|
|
if (linfo->link.s.link_up) {
|
|
|
|
netif_info(lio, link, lio->netdev, "%d Mbps %s Duplex UP\n",
|
|
|
|
linfo->link.s.speed,
|
|
|
|
(linfo->link.s.duplex) ? "Full" : "Half");
|
|
|
|
} else {
|
|
|
|
netif_info(lio, link, lio->netdev, "Link Down\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* octnet_link_status_change - Routine to notify MTU change
|
|
|
|
* @work: work_struct data structure
|
2016-12-08 00:54:32 +08:00
|
|
|
*/
|
|
|
|
static void octnet_link_status_change(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct cavium_wk *wk = (struct cavium_wk *)work;
|
|
|
|
struct lio *lio = (struct lio *)wk->ctxptr;
|
|
|
|
|
2018-03-10 16:17:35 +08:00
|
|
|
/* lio->linfo.link.s.mtu always contains max MTU of the lio interface.
|
|
|
|
* this API is invoked only when new max-MTU of the interface is
|
|
|
|
* less than current MTU.
|
|
|
|
*/
|
2016-12-08 00:54:32 +08:00
|
|
|
rtnl_lock();
|
2018-03-10 16:17:35 +08:00
|
|
|
dev_set_mtu(lio->netdev, lio->linfo.link.s.mtu);
|
2016-12-08 00:54:32 +08:00
|
|
|
rtnl_unlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* setup_link_status_change_wq - Sets up the mtu status change work
|
|
|
|
* @netdev: network device
|
2016-12-08 00:54:32 +08:00
|
|
|
*/
|
|
|
|
static int setup_link_status_change_wq(struct net_device *netdev)
|
|
|
|
{
|
|
|
|
struct lio *lio = GET_LIO(netdev);
|
|
|
|
struct octeon_device *oct = lio->oct_dev;
|
|
|
|
|
|
|
|
lio->link_status_wq.wq = alloc_workqueue("link-status",
|
|
|
|
WQ_MEM_RECLAIM, 0);
|
|
|
|
if (!lio->link_status_wq.wq) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "unable to create cavium link status wq\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
INIT_DELAYED_WORK(&lio->link_status_wq.wk.work,
|
|
|
|
octnet_link_status_change);
|
|
|
|
lio->link_status_wq.wk.ctxptr = lio;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cleanup_link_status_change_wq(struct net_device *netdev)
|
|
|
|
{
|
|
|
|
struct lio *lio = GET_LIO(netdev);
|
|
|
|
|
|
|
|
if (lio->link_status_wq.wq) {
|
|
|
|
cancel_delayed_work_sync(&lio->link_status_wq.wk.work);
|
|
|
|
destroy_workqueue(lio->link_status_wq.wq);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* update_link_status - Update link status
|
|
|
|
* @netdev: network device
|
|
|
|
* @ls: link status structure
|
2016-12-08 00:54:32 +08:00
|
|
|
*
|
|
|
|
* Called on receipt of a link status response from the core application to
|
|
|
|
* update each interface's link status.
|
|
|
|
*/
|
|
|
|
static void update_link_status(struct net_device *netdev,
|
|
|
|
union oct_link_status *ls)
|
|
|
|
{
|
|
|
|
struct lio *lio = GET_LIO(netdev);
|
2018-03-10 16:17:35 +08:00
|
|
|
int current_max_mtu = lio->linfo.link.s.mtu;
|
2016-12-08 00:54:32 +08:00
|
|
|
struct octeon_device *oct = lio->oct_dev;
|
|
|
|
|
|
|
|
if ((lio->intf_open) && (lio->linfo.link.u64 != ls->u64)) {
|
|
|
|
lio->linfo.link.u64 = ls->u64;
|
|
|
|
|
|
|
|
print_link_info(netdev);
|
|
|
|
lio->link_changes++;
|
|
|
|
|
|
|
|
if (lio->linfo.link.s.link_up) {
|
|
|
|
netif_carrier_on(netdev);
|
2018-03-24 08:37:39 +08:00
|
|
|
wake_txqs(netdev);
|
2016-12-08 00:54:32 +08:00
|
|
|
} else {
|
|
|
|
netif_carrier_off(netdev);
|
2018-03-24 08:37:41 +08:00
|
|
|
stop_txqs(netdev);
|
2016-12-08 00:54:32 +08:00
|
|
|
}
|
|
|
|
|
2018-03-10 16:17:35 +08:00
|
|
|
if (lio->linfo.link.s.mtu != current_max_mtu) {
|
|
|
|
dev_info(&oct->pci_dev->dev,
|
|
|
|
"Max MTU Changed from %d to %d\n",
|
|
|
|
current_max_mtu, lio->linfo.link.s.mtu);
|
2017-08-16 07:26:22 +08:00
|
|
|
netdev->max_mtu = lio->linfo.link.s.mtu;
|
|
|
|
}
|
|
|
|
|
2016-12-08 00:54:32 +08:00
|
|
|
if (lio->linfo.link.s.mtu < netdev->mtu) {
|
|
|
|
dev_warn(&oct->pci_dev->dev,
|
2018-03-10 16:17:35 +08:00
|
|
|
"Current MTU is higher than new max MTU; Reducing the current mtu from %d to %d\n",
|
2016-12-08 00:54:32 +08:00
|
|
|
netdev->mtu, lio->linfo.link.s.mtu);
|
|
|
|
queue_delayed_work(lio->link_status_wq.wq,
|
|
|
|
&lio->link_status_wq.wk.work, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-29 08:54:34 +08:00
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* liquidio_vf_probe - PCI probe handler
|
|
|
|
* @pdev: PCI device structure
|
|
|
|
* @ent: unused
|
2016-11-29 08:54:34 +08:00
|
|
|
*/
|
|
|
|
static int
|
|
|
|
liquidio_vf_probe(struct pci_dev *pdev,
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
const struct pci_device_id __maybe_unused *ent)
|
2016-11-29 08:54:34 +08:00
|
|
|
{
|
|
|
|
struct octeon_device *oct_dev = NULL;
|
|
|
|
|
|
|
|
oct_dev = octeon_allocate_device(pdev->device,
|
|
|
|
sizeof(struct octeon_device_priv));
|
|
|
|
|
|
|
|
if (!oct_dev) {
|
|
|
|
dev_err(&pdev->dev, "Unable to allocate device\n");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2016-11-29 08:54:40 +08:00
|
|
|
oct_dev->msix_on = LIO_FLAG_MSIX_ENABLED;
|
2016-11-29 08:54:34 +08:00
|
|
|
|
|
|
|
dev_info(&pdev->dev, "Initializing device %x:%x.\n",
|
|
|
|
(u32)pdev->vendor, (u32)pdev->device);
|
|
|
|
|
|
|
|
/* Assign octeon_device for this device to the private data area. */
|
|
|
|
pci_set_drvdata(pdev, oct_dev);
|
|
|
|
|
|
|
|
/* set linux specific device pointer */
|
|
|
|
oct_dev->pci_dev = pdev;
|
|
|
|
|
2018-05-05 02:07:19 +08:00
|
|
|
oct_dev->subsystem_id = pdev->subsystem_vendor |
|
|
|
|
(pdev->subsystem_device << 16);
|
|
|
|
|
2016-11-29 08:54:35 +08:00
|
|
|
if (octeon_device_init(oct_dev)) {
|
|
|
|
liquidio_vf_remove(pdev);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
dev_dbg(&oct_dev->pci_dev->dev, "Device is ready\n");
|
|
|
|
|
2016-11-29 08:54:34 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-11-29 08:54:35 +08:00
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* octeon_pci_flr - PCI FLR for each Octeon device.
|
|
|
|
* @oct: octeon device
|
2016-11-29 08:54:35 +08:00
|
|
|
*/
|
|
|
|
static void octeon_pci_flr(struct octeon_device *oct)
|
|
|
|
{
|
|
|
|
pci_save_state(oct->pci_dev);
|
|
|
|
|
|
|
|
pci_cfg_access_lock(oct->pci_dev);
|
|
|
|
|
|
|
|
/* Quiesce the device completely */
|
|
|
|
pci_write_config_word(oct->pci_dev, PCI_COMMAND,
|
|
|
|
PCI_COMMAND_INTX_DISABLE);
|
|
|
|
|
2017-05-16 22:21:46 +08:00
|
|
|
pcie_flr(oct->pci_dev);
|
2016-11-29 08:54:35 +08:00
|
|
|
|
|
|
|
pci_cfg_access_unlock(oct->pci_dev);
|
|
|
|
|
|
|
|
pci_restore_state(oct->pci_dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* octeon_destroy_resources - Destroy resources associated with octeon device
|
|
|
|
* @oct: octeon device
|
2016-11-29 08:54:35 +08:00
|
|
|
*/
|
|
|
|
static void octeon_destroy_resources(struct octeon_device *oct)
|
|
|
|
{
|
2018-09-10 14:34:16 +08:00
|
|
|
struct octeon_device_priv *oct_priv =
|
|
|
|
(struct octeon_device_priv *)oct->priv;
|
2016-11-29 08:54:40 +08:00
|
|
|
struct msix_entry *msix_entries;
|
2016-11-29 08:54:38 +08:00
|
|
|
int i;
|
|
|
|
|
2016-11-29 08:54:35 +08:00
|
|
|
switch (atomic_read(&oct->status)) {
|
2016-11-29 08:54:41 +08:00
|
|
|
case OCT_DEV_RUNNING:
|
|
|
|
case OCT_DEV_CORE_OK:
|
|
|
|
/* No more instructions will be forwarded. */
|
|
|
|
atomic_set(&oct->status, OCT_DEV_IN_RESET);
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
oct->app_mode = CVM_DRV_INVALID_APP;
|
2016-11-29 08:54:41 +08:00
|
|
|
dev_dbg(&oct->pci_dev->dev, "Device state is now %s\n",
|
|
|
|
lio_get_state_string(&oct->status));
|
|
|
|
|
|
|
|
schedule_timeout_uninterruptible(HZ / 10);
|
|
|
|
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-11-29 08:54:41 +08:00
|
|
|
case OCT_DEV_HOST_OK:
|
|
|
|
case OCT_DEV_IO_QUEUES_DONE:
|
|
|
|
if (lio_wait_for_instr_fetch(oct))
|
|
|
|
dev_err(&oct->pci_dev->dev, "IQ had pending instructions\n");
|
|
|
|
|
2018-08-29 09:51:30 +08:00
|
|
|
if (wait_for_pending_requests(oct))
|
|
|
|
dev_err(&oct->pci_dev->dev, "There were pending requests\n");
|
|
|
|
|
2016-11-29 08:54:41 +08:00
|
|
|
/* Disable the input and output queues now. No more packets will
|
|
|
|
* arrive from Octeon, but we should wait for all packet
|
|
|
|
* processing to finish.
|
|
|
|
*/
|
|
|
|
oct->fn_list.disable_io_queues(oct);
|
|
|
|
|
|
|
|
if (lio_wait_for_oq_pkts(oct))
|
|
|
|
dev_err(&oct->pci_dev->dev, "OQ had pending packets\n");
|
2018-08-29 09:51:30 +08:00
|
|
|
|
|
|
|
/* Force all requests waiting to be fetched by OCTEON to
|
|
|
|
* complete.
|
|
|
|
*/
|
|
|
|
for (i = 0; i < MAX_OCTEON_INSTR_QUEUES(oct); i++) {
|
|
|
|
struct octeon_instr_queue *iq;
|
|
|
|
|
|
|
|
if (!(oct->io_qmask.iq & BIT_ULL(i)))
|
|
|
|
continue;
|
|
|
|
iq = oct->instr_queue[i];
|
|
|
|
|
|
|
|
if (atomic_read(&iq->instr_pending)) {
|
|
|
|
spin_lock_bh(&iq->lock);
|
|
|
|
iq->fill_cnt = 0;
|
|
|
|
iq->octeon_read_index = iq->host_write_index;
|
|
|
|
iq->stats.instr_processed +=
|
|
|
|
atomic_read(&iq->instr_pending);
|
|
|
|
lio_process_iq_request_list(oct, iq, 0);
|
|
|
|
spin_unlock_bh(&iq->lock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lio_process_ordered_list(oct, 1);
|
|
|
|
octeon_free_sc_done_list(oct);
|
|
|
|
octeon_free_sc_zombie_list(oct);
|
|
|
|
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-11-29 08:54:40 +08:00
|
|
|
case OCT_DEV_INTR_SET_DONE:
|
|
|
|
/* Disable interrupts */
|
|
|
|
oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR);
|
|
|
|
|
|
|
|
if (oct->msix_on) {
|
|
|
|
msix_entries = (struct msix_entry *)oct->msix_entries;
|
|
|
|
for (i = 0; i < oct->num_msix_irqs; i++) {
|
2017-08-16 03:46:18 +08:00
|
|
|
if (oct->ioq_vector[i].vector) {
|
|
|
|
irq_set_affinity_hint(
|
|
|
|
msix_entries[i].vector,
|
|
|
|
NULL);
|
|
|
|
free_irq(msix_entries[i].vector,
|
|
|
|
&oct->ioq_vector[i]);
|
|
|
|
oct->ioq_vector[i].vector = 0;
|
|
|
|
}
|
2016-11-29 08:54:40 +08:00
|
|
|
}
|
|
|
|
pci_disable_msix(oct->pci_dev);
|
|
|
|
kfree(oct->msix_entries);
|
|
|
|
oct->msix_entries = NULL;
|
2017-03-14 03:58:04 +08:00
|
|
|
kfree(oct->irq_name_storage);
|
|
|
|
oct->irq_name_storage = NULL;
|
2016-11-29 08:54:40 +08:00
|
|
|
}
|
|
|
|
/* Soft reset the octeon device before exiting */
|
|
|
|
if (oct->pci_dev->reset_fn)
|
|
|
|
octeon_pci_flr(oct);
|
|
|
|
else
|
|
|
|
cn23xx_vf_ask_pf_to_do_flr(oct);
|
|
|
|
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-11-29 08:54:40 +08:00
|
|
|
case OCT_DEV_MSIX_ALLOC_VECTOR_DONE:
|
|
|
|
octeon_free_ioq_vector(oct);
|
|
|
|
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-11-29 08:54:39 +08:00
|
|
|
case OCT_DEV_MBOX_SETUP_DONE:
|
|
|
|
oct->fn_list.free_mbox(oct);
|
|
|
|
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-11-29 08:54:38 +08:00
|
|
|
case OCT_DEV_IN_RESET:
|
|
|
|
case OCT_DEV_DROQ_INIT_DONE:
|
|
|
|
mdelay(100);
|
|
|
|
for (i = 0; i < MAX_OCTEON_OUTPUT_QUEUES(oct); i++) {
|
|
|
|
if (!(oct->io_qmask.oq & BIT_ULL(i)))
|
|
|
|
continue;
|
|
|
|
octeon_delete_droq(oct, i);
|
|
|
|
}
|
|
|
|
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-11-29 08:54:38 +08:00
|
|
|
case OCT_DEV_RESP_LIST_INIT_DONE:
|
|
|
|
octeon_delete_response_list(oct);
|
|
|
|
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-11-29 08:54:38 +08:00
|
|
|
case OCT_DEV_INSTR_QUEUE_INIT_DONE:
|
|
|
|
for (i = 0; i < MAX_OCTEON_INSTR_QUEUES(oct); i++) {
|
|
|
|
if (!(oct->io_qmask.iq & BIT_ULL(i)))
|
|
|
|
continue;
|
|
|
|
octeon_delete_instr_queue(oct, i);
|
|
|
|
}
|
|
|
|
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-11-29 08:54:38 +08:00
|
|
|
case OCT_DEV_SC_BUFF_POOL_INIT_DONE:
|
|
|
|
octeon_free_sc_buffer_pool(oct);
|
|
|
|
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-11-29 08:54:38 +08:00
|
|
|
case OCT_DEV_DISPATCH_INIT_DONE:
|
|
|
|
octeon_delete_dispatch_list(oct);
|
|
|
|
cancel_delayed_work_sync(&oct->nic_poll_work.work);
|
|
|
|
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-11-29 08:54:35 +08:00
|
|
|
case OCT_DEV_PCI_MAP_DONE:
|
|
|
|
octeon_unmap_pci_barx(oct, 0);
|
|
|
|
octeon_unmap_pci_barx(oct, 1);
|
|
|
|
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-11-29 08:54:35 +08:00
|
|
|
case OCT_DEV_PCI_ENABLE_DONE:
|
|
|
|
pci_clear_master(oct->pci_dev);
|
|
|
|
/* Disable the device, releasing the PCI INT */
|
|
|
|
pci_disable_device(oct->pci_dev);
|
|
|
|
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-11-29 08:54:35 +08:00
|
|
|
case OCT_DEV_BEGIN_STATE:
|
|
|
|
/* Nothing to be done here either */
|
|
|
|
break;
|
|
|
|
}
|
2018-09-10 14:34:16 +08:00
|
|
|
|
|
|
|
tasklet_kill(&oct_priv->droq_tasklet);
|
2016-11-29 08:54:35 +08:00
|
|
|
}
|
|
|
|
|
2016-12-08 00:54:37 +08:00
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* send_rx_ctrl_cmd - Send Rx control command
|
|
|
|
* @lio: per-network private data
|
|
|
|
* @start_stop: whether to start or stop
|
2016-12-08 00:54:37 +08:00
|
|
|
*/
|
|
|
|
static void send_rx_ctrl_cmd(struct lio *lio, int start_stop)
|
|
|
|
{
|
|
|
|
struct octeon_device *oct = (struct octeon_device *)lio->oct_dev;
|
|
|
|
struct octeon_soft_command *sc;
|
|
|
|
union octnet_cmd *ncmd;
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
if (oct->props[lio->ifidx].rx_on == start_stop)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sc = (struct octeon_soft_command *)
|
|
|
|
octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE,
|
2018-08-29 09:51:44 +08:00
|
|
|
16, 0);
|
2016-12-08 00:54:37 +08:00
|
|
|
|
|
|
|
ncmd = (union octnet_cmd *)sc->virtdptr;
|
|
|
|
|
|
|
|
ncmd->u64 = 0;
|
|
|
|
ncmd->s.cmd = OCTNET_CMD_RX_CTL;
|
|
|
|
ncmd->s.param1 = start_stop;
|
|
|
|
|
|
|
|
octeon_swap_8B_data((u64 *)ncmd, (OCTNET_CMD_SIZE >> 3));
|
|
|
|
|
|
|
|
sc->iq_no = lio->linfo.txpciq[0].s.q_no;
|
|
|
|
|
|
|
|
octeon_prepare_soft_command(oct, sc, OPCODE_NIC,
|
|
|
|
OPCODE_NIC_CMD, 0, 0, 0);
|
|
|
|
|
2018-08-29 09:51:44 +08:00
|
|
|
init_completion(&sc->complete);
|
|
|
|
sc->sc_status = OCTEON_REQUEST_PENDING;
|
2016-12-08 00:54:37 +08:00
|
|
|
|
|
|
|
retval = octeon_send_soft_command(oct, sc);
|
|
|
|
if (retval == IQ_SEND_FAILED) {
|
|
|
|
netif_info(lio, rx_err, lio->netdev, "Failed to send RX Control message\n");
|
2018-08-29 09:51:44 +08:00
|
|
|
octeon_free_soft_command(oct, sc);
|
2016-12-08 00:54:37 +08:00
|
|
|
} else {
|
|
|
|
/* Sleep on a wait queue till the cond flag indicates that the
|
|
|
|
* response arrived or timed-out.
|
|
|
|
*/
|
2018-08-29 09:51:44 +08:00
|
|
|
retval = wait_for_sc_completion_timeout(oct, sc, 0);
|
|
|
|
if (retval)
|
2016-12-08 00:54:37 +08:00
|
|
|
return;
|
2018-08-29 09:51:44 +08:00
|
|
|
|
2016-12-08 00:54:37 +08:00
|
|
|
oct->props[lio->ifidx].rx_on = start_stop;
|
2018-08-29 09:51:44 +08:00
|
|
|
WRITE_ONCE(sc->caller_is_done, true);
|
2016-12-08 00:54:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* liquidio_destroy_nic_device - Destroy NIC device interface
|
|
|
|
* @oct: octeon device
|
|
|
|
* @ifidx: which interface to destroy
|
2016-12-08 00:54:31 +08:00
|
|
|
*
|
|
|
|
* Cleanup associated with each interface for an Octeon device when NIC
|
|
|
|
* module is being unloaded or if initialization fails during load.
|
|
|
|
*/
|
|
|
|
static void liquidio_destroy_nic_device(struct octeon_device *oct, int ifidx)
|
|
|
|
{
|
|
|
|
struct net_device *netdev = oct->props[ifidx].netdev;
|
2018-09-10 14:34:16 +08:00
|
|
|
struct octeon_device_priv *oct_priv =
|
|
|
|
(struct octeon_device_priv *)oct->priv;
|
2016-12-08 00:54:37 +08:00
|
|
|
struct napi_struct *napi, *n;
|
2016-12-08 00:54:31 +08:00
|
|
|
struct lio *lio;
|
|
|
|
|
|
|
|
if (!netdev) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "%s No netdevice ptr for index %d\n",
|
|
|
|
__func__, ifidx);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
lio = GET_LIO(netdev);
|
|
|
|
|
|
|
|
dev_dbg(&oct->pci_dev->dev, "NIC device cleanup\n");
|
|
|
|
|
|
|
|
if (atomic_read(&lio->ifstate) & LIO_IFSTATE_RUNNING)
|
|
|
|
liquidio_stop(netdev);
|
|
|
|
|
2016-12-08 00:54:37 +08:00
|
|
|
if (oct->props[lio->ifidx].napi_enabled == 1) {
|
|
|
|
list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list)
|
|
|
|
napi_disable(napi);
|
|
|
|
|
|
|
|
oct->props[lio->ifidx].napi_enabled = 0;
|
|
|
|
|
|
|
|
oct->droq[0]->ops.poll_mode = 0;
|
|
|
|
}
|
|
|
|
|
2017-08-09 10:34:28 +08:00
|
|
|
/* Delete NAPI */
|
|
|
|
list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list)
|
|
|
|
netif_napi_del(napi);
|
|
|
|
|
2018-09-10 14:34:16 +08:00
|
|
|
tasklet_enable(&oct_priv->droq_tasklet);
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
if (atomic_read(&lio->ifstate) & LIO_IFSTATE_REGISTERED)
|
|
|
|
unregister_netdev(netdev);
|
|
|
|
|
2017-03-23 02:31:13 +08:00
|
|
|
cleanup_rx_oom_poll_fn(netdev);
|
|
|
|
|
2016-12-08 00:54:32 +08:00
|
|
|
cleanup_link_status_change_wq(netdev);
|
|
|
|
|
2018-04-28 14:32:49 +08:00
|
|
|
lio_delete_glists(lio);
|
2016-12-08 00:54:34 +08:00
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
free_netdev(netdev);
|
|
|
|
|
|
|
|
oct->props[ifidx].gmxport = -1;
|
|
|
|
|
|
|
|
oct->props[ifidx].netdev = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* liquidio_stop_nic_module - Stop complete NIC functionality
|
|
|
|
* @oct: octeon device
|
2016-12-08 00:54:31 +08:00
|
|
|
*/
|
|
|
|
static int liquidio_stop_nic_module(struct octeon_device *oct)
|
|
|
|
{
|
2016-12-08 00:54:37 +08:00
|
|
|
struct lio *lio;
|
|
|
|
int i, j;
|
2016-12-08 00:54:31 +08:00
|
|
|
|
|
|
|
dev_dbg(&oct->pci_dev->dev, "Stopping network interfaces\n");
|
|
|
|
if (!oct->ifcount) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "Init for Octeon was not completed\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-12-08 00:54:37 +08:00
|
|
|
spin_lock_bh(&oct->cmd_resp_wqlock);
|
|
|
|
oct->cmd_resp_state = OCT_DRV_OFFLINE;
|
|
|
|
spin_unlock_bh(&oct->cmd_resp_wqlock);
|
|
|
|
|
|
|
|
for (i = 0; i < oct->ifcount; i++) {
|
|
|
|
lio = GET_LIO(oct->props[i].netdev);
|
2017-08-16 03:46:18 +08:00
|
|
|
for (j = 0; j < oct->num_oqs; j++)
|
2016-12-08 00:54:37 +08:00
|
|
|
octeon_unregister_droq_ops(oct,
|
|
|
|
lio->linfo.rxpciq[j].s.q_no);
|
|
|
|
}
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
for (i = 0; i < oct->ifcount; i++)
|
|
|
|
liquidio_destroy_nic_device(oct, i);
|
|
|
|
|
|
|
|
dev_dbg(&oct->pci_dev->dev, "Network interfaces stopped\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-11-29 08:54:34 +08:00
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* liquidio_vf_remove - Cleans up resources at unload time
|
|
|
|
* @pdev: PCI device structure
|
2016-11-29 08:54:34 +08:00
|
|
|
*/
|
|
|
|
static void liquidio_vf_remove(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
struct octeon_device *oct_dev = pci_get_drvdata(pdev);
|
|
|
|
|
|
|
|
dev_dbg(&oct_dev->pci_dev->dev, "Stopping device\n");
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
if (oct_dev->app_mode == CVM_DRV_NIC_APP)
|
|
|
|
liquidio_stop_nic_module(oct_dev);
|
|
|
|
|
2016-11-29 08:54:35 +08:00
|
|
|
/* Reset the octeon device and cleanup all memory allocated for
|
|
|
|
* the octeon device by driver.
|
|
|
|
*/
|
|
|
|
octeon_destroy_resources(oct_dev);
|
|
|
|
|
|
|
|
dev_info(&oct_dev->pci_dev->dev, "Device removed\n");
|
|
|
|
|
2016-11-29 08:54:34 +08:00
|
|
|
/* This octeon device has been removed. Update the global
|
|
|
|
* data structure to reflect this. Free the device structure.
|
|
|
|
*/
|
|
|
|
octeon_free_device_mem(oct_dev);
|
|
|
|
}
|
|
|
|
|
2016-11-29 08:54:35 +08:00
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* octeon_pci_os_setup - PCI initialization for each Octeon device.
|
|
|
|
* @oct: octeon device
|
2016-11-29 08:54:35 +08:00
|
|
|
*/
|
|
|
|
static int octeon_pci_os_setup(struct octeon_device *oct)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_PCI_IOV
|
|
|
|
/* setup PCI stuff first */
|
|
|
|
if (!oct->pci_dev->physfn)
|
|
|
|
octeon_pci_flr(oct);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (pci_enable_device(oct->pci_dev)) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "pci_enable_device failed\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dma_set_mask_and_coherent(&oct->pci_dev->dev, DMA_BIT_MASK(64))) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "Unexpected DMA device capability\n");
|
|
|
|
pci_disable_device(oct->pci_dev);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable PCI DMA Master. */
|
|
|
|
pci_set_master(oct->pci_dev);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-12-08 00:54:36 +08:00
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* free_netbuf - Unmap and free network buffer
|
|
|
|
* @buf: buffer
|
2016-12-08 00:54:36 +08:00
|
|
|
*/
|
|
|
|
static void free_netbuf(void *buf)
|
|
|
|
{
|
|
|
|
struct octnet_buf_free_info *finfo;
|
|
|
|
struct sk_buff *skb;
|
|
|
|
struct lio *lio;
|
|
|
|
|
|
|
|
finfo = (struct octnet_buf_free_info *)buf;
|
|
|
|
skb = finfo->skb;
|
|
|
|
lio = finfo->lio;
|
|
|
|
|
|
|
|
dma_unmap_single(&lio->oct_dev->pci_dev->dev, finfo->dptr, skb->len,
|
|
|
|
DMA_TO_DEVICE);
|
|
|
|
|
|
|
|
tx_buffer_free(skb);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* free_netsgbuf - Unmap and free gather buffer
|
|
|
|
* @buf: buffer
|
2016-12-08 00:54:36 +08:00
|
|
|
*/
|
|
|
|
static void free_netsgbuf(void *buf)
|
|
|
|
{
|
|
|
|
struct octnet_buf_free_info *finfo;
|
|
|
|
struct octnic_gather *g;
|
|
|
|
struct sk_buff *skb;
|
|
|
|
int i, frags, iq;
|
|
|
|
struct lio *lio;
|
|
|
|
|
|
|
|
finfo = (struct octnet_buf_free_info *)buf;
|
|
|
|
skb = finfo->skb;
|
|
|
|
lio = finfo->lio;
|
|
|
|
g = finfo->g;
|
|
|
|
frags = skb_shinfo(skb)->nr_frags;
|
|
|
|
|
|
|
|
dma_unmap_single(&lio->oct_dev->pci_dev->dev,
|
|
|
|
g->sg[0].ptr[0], (skb->len - skb->data_len),
|
|
|
|
DMA_TO_DEVICE);
|
|
|
|
|
|
|
|
i = 1;
|
|
|
|
while (frags--) {
|
2019-07-23 11:08:25 +08:00
|
|
|
skb_frag_t *frag = &skb_shinfo(skb)->frags[i - 1];
|
2016-12-08 00:54:36 +08:00
|
|
|
|
|
|
|
pci_unmap_page((lio->oct_dev)->pci_dev,
|
|
|
|
g->sg[(i >> 2)].ptr[(i & 3)],
|
2019-07-23 11:08:25 +08:00
|
|
|
skb_frag_size(frag), DMA_TO_DEVICE);
|
2016-12-08 00:54:36 +08:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
2018-04-28 14:32:57 +08:00
|
|
|
iq = skb_iq(lio->oct_dev, skb);
|
2016-12-08 00:54:36 +08:00
|
|
|
|
|
|
|
spin_lock(&lio->glist_lock[iq]);
|
|
|
|
list_add_tail(&g->list, &lio->glist[iq]);
|
|
|
|
spin_unlock(&lio->glist_lock[iq]);
|
|
|
|
|
|
|
|
tx_buffer_free(skb);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* free_netsgbuf_with_resp - Unmap and free gather buffer with response
|
|
|
|
* @buf: buffer
|
2016-12-08 00:54:36 +08:00
|
|
|
*/
|
|
|
|
static void free_netsgbuf_with_resp(void *buf)
|
|
|
|
{
|
|
|
|
struct octnet_buf_free_info *finfo;
|
|
|
|
struct octeon_soft_command *sc;
|
|
|
|
struct octnic_gather *g;
|
|
|
|
struct sk_buff *skb;
|
|
|
|
int i, frags, iq;
|
|
|
|
struct lio *lio;
|
|
|
|
|
|
|
|
sc = (struct octeon_soft_command *)buf;
|
|
|
|
skb = (struct sk_buff *)sc->callback_arg;
|
|
|
|
finfo = (struct octnet_buf_free_info *)&skb->cb;
|
|
|
|
|
|
|
|
lio = finfo->lio;
|
|
|
|
g = finfo->g;
|
|
|
|
frags = skb_shinfo(skb)->nr_frags;
|
|
|
|
|
|
|
|
dma_unmap_single(&lio->oct_dev->pci_dev->dev,
|
|
|
|
g->sg[0].ptr[0], (skb->len - skb->data_len),
|
|
|
|
DMA_TO_DEVICE);
|
|
|
|
|
|
|
|
i = 1;
|
|
|
|
while (frags--) {
|
2019-07-23 11:08:25 +08:00
|
|
|
skb_frag_t *frag = &skb_shinfo(skb)->frags[i - 1];
|
2016-12-08 00:54:36 +08:00
|
|
|
|
|
|
|
pci_unmap_page((lio->oct_dev)->pci_dev,
|
|
|
|
g->sg[(i >> 2)].ptr[(i & 3)],
|
2019-07-23 11:08:25 +08:00
|
|
|
skb_frag_size(frag), DMA_TO_DEVICE);
|
2016-12-08 00:54:36 +08:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
2018-04-28 14:32:57 +08:00
|
|
|
iq = skb_iq(lio->oct_dev, skb);
|
2016-12-08 00:54:36 +08:00
|
|
|
|
|
|
|
spin_lock(&lio->glist_lock[iq]);
|
|
|
|
list_add_tail(&g->list, &lio->glist[iq]);
|
|
|
|
spin_unlock(&lio->glist_lock[iq]);
|
|
|
|
|
|
|
|
/* Don't free the skb yet */
|
|
|
|
}
|
|
|
|
|
2016-12-08 00:54:32 +08:00
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* liquidio_open - Net device open for LiquidIO
|
|
|
|
* @netdev: network device
|
2016-12-08 00:54:32 +08:00
|
|
|
*/
|
|
|
|
static int liquidio_open(struct net_device *netdev)
|
|
|
|
{
|
|
|
|
struct lio *lio = GET_LIO(netdev);
|
|
|
|
struct octeon_device *oct = lio->oct_dev;
|
2018-09-10 14:34:16 +08:00
|
|
|
struct octeon_device_priv *oct_priv =
|
|
|
|
(struct octeon_device_priv *)oct->priv;
|
2016-12-08 00:54:37 +08:00
|
|
|
struct napi_struct *napi, *n;
|
|
|
|
|
|
|
|
if (!oct->props[lio->ifidx].napi_enabled) {
|
2018-09-10 14:34:16 +08:00
|
|
|
tasklet_disable(&oct_priv->droq_tasklet);
|
|
|
|
|
2016-12-08 00:54:37 +08:00
|
|
|
list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list)
|
|
|
|
napi_enable(napi);
|
|
|
|
|
|
|
|
oct->props[lio->ifidx].napi_enabled = 1;
|
|
|
|
|
|
|
|
oct->droq[0]->ops.poll_mode = 1;
|
|
|
|
}
|
2016-12-08 00:54:32 +08:00
|
|
|
|
|
|
|
ifstate_set(lio, LIO_IFSTATE_RUNNING);
|
|
|
|
|
|
|
|
/* Ready for link status updates */
|
|
|
|
lio->intf_open = 1;
|
|
|
|
|
|
|
|
netif_info(lio, ifup, lio->netdev, "Interface Open, ready for traffic\n");
|
2018-03-24 08:37:44 +08:00
|
|
|
start_txqs(netdev);
|
2016-12-08 00:54:32 +08:00
|
|
|
|
2018-09-01 08:44:07 +08:00
|
|
|
INIT_DELAYED_WORK(&lio->stats_wk.work, lio_fetch_stats);
|
|
|
|
lio->stats_wk.ctxptr = lio;
|
|
|
|
schedule_delayed_work(&lio->stats_wk.work, msecs_to_jiffies
|
|
|
|
(LIQUIDIO_NDEV_STATS_POLL_TIME_MS));
|
|
|
|
|
2016-12-08 00:54:37 +08:00
|
|
|
/* tell Octeon to start forwarding packets to host */
|
|
|
|
send_rx_ctrl_cmd(lio, 1);
|
|
|
|
|
2016-12-08 00:54:32 +08:00
|
|
|
dev_info(&oct->pci_dev->dev, "%s interface is opened\n", netdev->name);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* liquidio_stop - jNet device stop for LiquidIO
|
|
|
|
* @netdev: network device
|
2016-12-08 00:54:31 +08:00
|
|
|
*/
|
|
|
|
static int liquidio_stop(struct net_device *netdev)
|
|
|
|
{
|
|
|
|
struct lio *lio = GET_LIO(netdev);
|
|
|
|
struct octeon_device *oct = lio->oct_dev;
|
2018-09-10 14:34:16 +08:00
|
|
|
struct octeon_device_priv *oct_priv =
|
|
|
|
(struct octeon_device_priv *)oct->priv;
|
2017-08-09 10:34:28 +08:00
|
|
|
struct napi_struct *napi, *n;
|
|
|
|
|
2017-10-27 07:46:36 +08:00
|
|
|
/* tell Octeon to stop forwarding packets to host */
|
|
|
|
send_rx_ctrl_cmd(lio, 0);
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
netif_info(lio, ifdown, lio->netdev, "Stopping interface!\n");
|
|
|
|
/* Inform that netif carrier is down */
|
|
|
|
lio->intf_open = 0;
|
|
|
|
lio->linfo.link.s.link_up = 0;
|
|
|
|
|
|
|
|
netif_carrier_off(netdev);
|
|
|
|
lio->link_changes++;
|
|
|
|
|
|
|
|
ifstate_reset(lio, LIO_IFSTATE_RUNNING);
|
|
|
|
|
2018-03-24 08:37:41 +08:00
|
|
|
stop_txqs(netdev);
|
2016-12-08 00:54:32 +08:00
|
|
|
|
2018-03-30 02:13:22 +08:00
|
|
|
/* Wait for any pending Rx descriptors */
|
|
|
|
if (lio_wait_for_clean_oq(oct))
|
|
|
|
netif_info(lio, rx_err, lio->netdev,
|
|
|
|
"Proceeding with stop interface after partial RX desc processing\n");
|
|
|
|
|
|
|
|
if (oct->props[lio->ifidx].napi_enabled == 1) {
|
|
|
|
list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list)
|
|
|
|
napi_disable(napi);
|
|
|
|
|
|
|
|
oct->props[lio->ifidx].napi_enabled = 0;
|
|
|
|
|
|
|
|
oct->droq[0]->ops.poll_mode = 0;
|
2018-09-10 14:34:16 +08:00
|
|
|
|
|
|
|
tasklet_enable(&oct_priv->droq_tasklet);
|
2018-03-30 02:13:22 +08:00
|
|
|
}
|
|
|
|
|
2018-09-01 08:44:07 +08:00
|
|
|
cancel_delayed_work_sync(&lio->stats_wk.work);
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
dev_info(&oct->pci_dev->dev, "%s interface is stopped\n", netdev->name);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-12-08 00:54:33 +08:00
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* get_new_flags - Converts a mask based on net device flags
|
|
|
|
* @netdev: network device
|
2016-12-08 00:54:33 +08:00
|
|
|
*
|
|
|
|
* This routine generates a octnet_ifflags mask from the net device flags
|
|
|
|
* received from the OS.
|
|
|
|
*/
|
|
|
|
static enum octnet_ifflags get_new_flags(struct net_device *netdev)
|
|
|
|
{
|
|
|
|
enum octnet_ifflags f = OCTNET_IFFLAG_UNICAST;
|
|
|
|
|
|
|
|
if (netdev->flags & IFF_PROMISC)
|
|
|
|
f |= OCTNET_IFFLAG_PROMISC;
|
|
|
|
|
|
|
|
if (netdev->flags & IFF_ALLMULTI)
|
|
|
|
f |= OCTNET_IFFLAG_ALLMULTI;
|
|
|
|
|
|
|
|
if (netdev->flags & IFF_MULTICAST) {
|
|
|
|
f |= OCTNET_IFFLAG_MULTICAST;
|
|
|
|
|
|
|
|
/* Accept all multicast addresses if there are more than we
|
|
|
|
* can handle
|
|
|
|
*/
|
|
|
|
if (netdev_mc_count(netdev) > MAX_OCTEON_MULTICAST_ADDR)
|
|
|
|
f |= OCTNET_IFFLAG_ALLMULTI;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (netdev->flags & IFF_BROADCAST)
|
|
|
|
f |= OCTNET_IFFLAG_BROADCAST;
|
|
|
|
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void liquidio_set_uc_list(struct net_device *netdev)
|
|
|
|
{
|
|
|
|
struct lio *lio = GET_LIO(netdev);
|
|
|
|
struct octeon_device *oct = lio->oct_dev;
|
|
|
|
struct octnic_ctrl_pkt nctrl;
|
|
|
|
struct netdev_hw_addr *ha;
|
|
|
|
u64 *mac;
|
|
|
|
|
|
|
|
if (lio->netdev_uc_count == netdev_uc_count(netdev))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (netdev_uc_count(netdev) > MAX_NCTRL_UDD) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "too many MAC addresses in netdev uc list\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
lio->netdev_uc_count = netdev_uc_count(netdev);
|
|
|
|
|
|
|
|
memset(&nctrl, 0, sizeof(struct octnic_ctrl_pkt));
|
|
|
|
nctrl.ncmd.s.cmd = OCTNET_CMD_SET_UC_LIST;
|
|
|
|
nctrl.ncmd.s.more = lio->netdev_uc_count;
|
|
|
|
nctrl.ncmd.s.param1 = oct->vf_num;
|
|
|
|
nctrl.iq_no = lio->linfo.txpciq[0].s.q_no;
|
|
|
|
nctrl.netpndev = (u64)netdev;
|
|
|
|
nctrl.cb_fn = liquidio_link_ctrl_cmd_completion;
|
|
|
|
|
|
|
|
/* copy all the addresses into the udd */
|
|
|
|
mac = &nctrl.udd[0];
|
|
|
|
netdev_for_each_uc_addr(ha, netdev) {
|
|
|
|
ether_addr_copy(((u8 *)mac) + 2, ha->addr);
|
|
|
|
mac++;
|
|
|
|
}
|
|
|
|
|
|
|
|
octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* liquidio_set_mcast_list - Net device set_multicast_list
|
|
|
|
* @netdev: network device
|
2016-12-08 00:54:33 +08:00
|
|
|
*/
|
|
|
|
static void liquidio_set_mcast_list(struct net_device *netdev)
|
|
|
|
{
|
|
|
|
int mc_count = min(netdev_mc_count(netdev), MAX_OCTEON_MULTICAST_ADDR);
|
|
|
|
struct lio *lio = GET_LIO(netdev);
|
|
|
|
struct octeon_device *oct = lio->oct_dev;
|
|
|
|
struct octnic_ctrl_pkt nctrl;
|
|
|
|
struct netdev_hw_addr *ha;
|
|
|
|
u64 *mc;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
memset(&nctrl, 0, sizeof(struct octnic_ctrl_pkt));
|
|
|
|
|
|
|
|
/* Create a ctrl pkt command to be sent to core app. */
|
|
|
|
nctrl.ncmd.u64 = 0;
|
|
|
|
nctrl.ncmd.s.cmd = OCTNET_CMD_SET_MULTI_LIST;
|
|
|
|
nctrl.ncmd.s.param1 = get_new_flags(netdev);
|
|
|
|
nctrl.ncmd.s.param2 = mc_count;
|
|
|
|
nctrl.ncmd.s.more = mc_count;
|
|
|
|
nctrl.netpndev = (u64)netdev;
|
|
|
|
nctrl.cb_fn = liquidio_link_ctrl_cmd_completion;
|
|
|
|
|
|
|
|
/* copy all the addresses into the udd */
|
|
|
|
mc = &nctrl.udd[0];
|
|
|
|
netdev_for_each_mc_addr(ha, netdev) {
|
|
|
|
*mc = 0;
|
|
|
|
ether_addr_copy(((u8 *)mc) + 2, ha->addr);
|
|
|
|
/* no need to swap bytes */
|
|
|
|
if (++mc > &nctrl.udd[mc_count])
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
nctrl.iq_no = lio->linfo.txpciq[0].s.q_no;
|
|
|
|
|
|
|
|
/* Apparently, any activity in this call from the kernel has to
|
|
|
|
* be atomic. So we won't wait for response.
|
|
|
|
*/
|
|
|
|
|
|
|
|
ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl);
|
2018-08-29 09:51:40 +08:00
|
|
|
if (ret) {
|
2016-12-08 00:54:33 +08:00
|
|
|
dev_err(&oct->pci_dev->dev, "DEVFLAGS change failed in core (ret: 0x%x)\n",
|
|
|
|
ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
liquidio_set_uc_list(netdev);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* liquidio_set_mac - Net device set_mac_address
|
|
|
|
* @netdev: network device
|
|
|
|
* @p: opaque pointer to sockaddr
|
2016-12-08 00:54:33 +08:00
|
|
|
*/
|
|
|
|
static int liquidio_set_mac(struct net_device *netdev, void *p)
|
|
|
|
{
|
|
|
|
struct sockaddr *addr = (struct sockaddr *)p;
|
|
|
|
struct lio *lio = GET_LIO(netdev);
|
|
|
|
struct octeon_device *oct = lio->oct_dev;
|
|
|
|
struct octnic_ctrl_pkt nctrl;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (!is_valid_ether_addr(addr->sa_data))
|
|
|
|
return -EADDRNOTAVAIL;
|
|
|
|
|
|
|
|
if (ether_addr_equal(addr->sa_data, netdev->dev_addr))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (lio->linfo.macaddr_is_admin_asgnd)
|
|
|
|
return -EPERM;
|
|
|
|
|
|
|
|
memset(&nctrl, 0, sizeof(struct octnic_ctrl_pkt));
|
|
|
|
|
|
|
|
nctrl.ncmd.u64 = 0;
|
|
|
|
nctrl.ncmd.s.cmd = OCTNET_CMD_CHANGE_MACADDR;
|
|
|
|
nctrl.ncmd.s.param1 = 0;
|
|
|
|
nctrl.ncmd.s.more = 1;
|
|
|
|
nctrl.iq_no = lio->linfo.txpciq[0].s.q_no;
|
|
|
|
nctrl.netpndev = (u64)netdev;
|
|
|
|
|
|
|
|
nctrl.udd[0] = 0;
|
|
|
|
/* The MAC Address is presented in network byte order. */
|
|
|
|
ether_addr_copy((u8 *)&nctrl.udd[0] + 2, addr->sa_data);
|
|
|
|
|
|
|
|
ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl);
|
|
|
|
if (ret < 0) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "MAC Address change failed\n");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2018-08-29 09:51:40 +08:00
|
|
|
|
2018-09-06 09:40:56 +08:00
|
|
|
if (nctrl.sc_status ==
|
|
|
|
FIRMWARE_STATUS_CODE(OCTEON_REQUEST_NO_PERMISSION)) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "MAC Address change failed: no permission\n");
|
|
|
|
return -EPERM;
|
|
|
|
}
|
|
|
|
|
2016-12-08 00:54:33 +08:00
|
|
|
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
|
|
|
|
ether_addr_copy(((u8 *)&lio->linfo.hw_addr) + 2, addr->sa_data);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-04-26 08:00:22 +08:00
|
|
|
static void
|
|
|
|
liquidio_get_stats64(struct net_device *netdev,
|
|
|
|
struct rtnl_link_stats64 *lstats)
|
2016-12-09 05:00:46 +08:00
|
|
|
{
|
|
|
|
struct lio *lio = GET_LIO(netdev);
|
2018-04-26 08:00:22 +08:00
|
|
|
struct octeon_device *oct;
|
2016-12-09 05:00:46 +08:00
|
|
|
u64 pkts = 0, drop = 0, bytes = 0;
|
|
|
|
struct oct_droq_stats *oq_stats;
|
|
|
|
struct oct_iq_stats *iq_stats;
|
|
|
|
int i, iq_no, oq_no;
|
|
|
|
|
|
|
|
oct = lio->oct_dev;
|
|
|
|
|
2017-08-15 03:01:56 +08:00
|
|
|
if (ifstate_check(lio, LIO_IFSTATE_RESETTING))
|
2018-04-26 08:00:22 +08:00
|
|
|
return;
|
2017-08-15 03:01:56 +08:00
|
|
|
|
2017-08-16 03:46:18 +08:00
|
|
|
for (i = 0; i < oct->num_iqs; i++) {
|
2016-12-09 05:00:46 +08:00
|
|
|
iq_no = lio->linfo.txpciq[i].s.q_no;
|
|
|
|
iq_stats = &oct->instr_queue[iq_no]->stats;
|
|
|
|
pkts += iq_stats->tx_done;
|
|
|
|
drop += iq_stats->tx_dropped;
|
|
|
|
bytes += iq_stats->tx_tot_bytes;
|
|
|
|
}
|
|
|
|
|
2018-04-26 08:00:22 +08:00
|
|
|
lstats->tx_packets = pkts;
|
|
|
|
lstats->tx_bytes = bytes;
|
|
|
|
lstats->tx_dropped = drop;
|
2016-12-09 05:00:46 +08:00
|
|
|
|
|
|
|
pkts = 0;
|
|
|
|
drop = 0;
|
|
|
|
bytes = 0;
|
|
|
|
|
2017-08-16 03:46:18 +08:00
|
|
|
for (i = 0; i < oct->num_oqs; i++) {
|
2016-12-09 05:00:46 +08:00
|
|
|
oq_no = lio->linfo.rxpciq[i].s.q_no;
|
|
|
|
oq_stats = &oct->droq[oq_no]->stats;
|
|
|
|
pkts += oq_stats->rx_pkts_received;
|
|
|
|
drop += (oq_stats->rx_dropped +
|
|
|
|
oq_stats->dropped_nodispatch +
|
|
|
|
oq_stats->dropped_toomany +
|
|
|
|
oq_stats->dropped_nomem);
|
|
|
|
bytes += oq_stats->rx_bytes_received;
|
|
|
|
}
|
|
|
|
|
2018-04-26 08:00:22 +08:00
|
|
|
lstats->rx_bytes = bytes;
|
|
|
|
lstats->rx_packets = pkts;
|
|
|
|
lstats->rx_dropped = drop;
|
|
|
|
|
|
|
|
lstats->multicast = oct->link_stats.fromwire.fw_total_mcast;
|
|
|
|
|
|
|
|
/* detailed rx_errors: */
|
|
|
|
lstats->rx_length_errors = oct->link_stats.fromwire.l2_err;
|
|
|
|
/* recved pkt with crc error */
|
|
|
|
lstats->rx_crc_errors = oct->link_stats.fromwire.fcs_err;
|
|
|
|
/* recv'd frame alignment error */
|
|
|
|
lstats->rx_frame_errors = oct->link_stats.fromwire.frame_err;
|
|
|
|
|
|
|
|
lstats->rx_errors = lstats->rx_length_errors + lstats->rx_crc_errors +
|
|
|
|
lstats->rx_frame_errors;
|
|
|
|
|
|
|
|
/* detailed tx_errors */
|
|
|
|
lstats->tx_aborted_errors = oct->link_stats.fromhost.fw_err_pko;
|
|
|
|
lstats->tx_carrier_errors = oct->link_stats.fromhost.fw_err_link;
|
2016-12-09 05:00:46 +08:00
|
|
|
|
2018-04-26 08:00:22 +08:00
|
|
|
lstats->tx_errors = lstats->tx_aborted_errors +
|
|
|
|
lstats->tx_carrier_errors;
|
2016-12-09 05:00:46 +08:00
|
|
|
}
|
|
|
|
|
2016-12-09 05:00:47 +08:00
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* hwtstamp_ioctl - Handler for SIOCSHWTSTAMP ioctl
|
|
|
|
* @netdev: network device
|
|
|
|
* @ifr: interface request
|
2016-12-09 05:00:47 +08:00
|
|
|
*/
|
|
|
|
static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr)
|
|
|
|
{
|
|
|
|
struct lio *lio = GET_LIO(netdev);
|
|
|
|
struct hwtstamp_config conf;
|
|
|
|
|
|
|
|
if (copy_from_user(&conf, ifr->ifr_data, sizeof(conf)))
|
|
|
|
return -EFAULT;
|
|
|
|
|
|
|
|
if (conf.flags)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
switch (conf.tx_type) {
|
|
|
|
case HWTSTAMP_TX_ON:
|
|
|
|
case HWTSTAMP_TX_OFF:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return -ERANGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (conf.rx_filter) {
|
|
|
|
case HWTSTAMP_FILTER_NONE:
|
|
|
|
break;
|
|
|
|
case HWTSTAMP_FILTER_ALL:
|
|
|
|
case HWTSTAMP_FILTER_SOME:
|
|
|
|
case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
|
|
|
|
case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
|
|
|
|
case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
|
|
|
|
case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
|
|
|
|
case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
|
|
|
|
case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
|
|
|
|
case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
|
|
|
|
case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
|
|
|
|
case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
|
|
|
|
case HWTSTAMP_FILTER_PTP_V2_EVENT:
|
|
|
|
case HWTSTAMP_FILTER_PTP_V2_SYNC:
|
|
|
|
case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
|
2017-05-19 23:52:36 +08:00
|
|
|
case HWTSTAMP_FILTER_NTP_ALL:
|
2016-12-09 05:00:47 +08:00
|
|
|
conf.rx_filter = HWTSTAMP_FILTER_ALL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return -ERANGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (conf.rx_filter == HWTSTAMP_FILTER_ALL)
|
|
|
|
ifstate_set(lio, LIO_IFSTATE_RX_TIMESTAMP_ENABLED);
|
|
|
|
|
|
|
|
else
|
|
|
|
ifstate_reset(lio, LIO_IFSTATE_RX_TIMESTAMP_ENABLED);
|
|
|
|
|
|
|
|
return copy_to_user(ifr->ifr_data, &conf, sizeof(conf)) ? -EFAULT : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* liquidio_ioctl - ioctl handler
|
|
|
|
* @netdev: network device
|
|
|
|
* @ifr: interface request
|
|
|
|
* @cmd: command
|
2016-12-09 05:00:47 +08:00
|
|
|
*/
|
|
|
|
static int liquidio_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
|
|
|
|
{
|
|
|
|
switch (cmd) {
|
|
|
|
case SIOCSHWTSTAMP:
|
|
|
|
return hwtstamp_ioctl(netdev, ifr);
|
|
|
|
default:
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void handle_timestamp(struct octeon_device *oct, u32 status, void *buf)
|
|
|
|
{
|
|
|
|
struct sk_buff *skb = (struct sk_buff *)buf;
|
|
|
|
struct octnet_buf_free_info *finfo;
|
|
|
|
struct oct_timestamp_resp *resp;
|
|
|
|
struct octeon_soft_command *sc;
|
|
|
|
struct lio *lio;
|
|
|
|
|
|
|
|
finfo = (struct octnet_buf_free_info *)skb->cb;
|
|
|
|
lio = finfo->lio;
|
|
|
|
sc = finfo->sc;
|
|
|
|
oct = lio->oct_dev;
|
|
|
|
resp = (struct oct_timestamp_resp *)sc->virtrptr;
|
|
|
|
|
|
|
|
if (status != OCTEON_REQUEST_DONE) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "Tx timestamp instruction failed. Status: %llx\n",
|
|
|
|
CVM_CAST64(status));
|
|
|
|
resp->timestamp = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
octeon_swap_8B_data(&resp->timestamp, 1);
|
|
|
|
|
|
|
|
if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS)) {
|
|
|
|
struct skb_shared_hwtstamps ts;
|
|
|
|
u64 ns = resp->timestamp;
|
|
|
|
|
|
|
|
netif_info(lio, tx_done, lio->netdev,
|
|
|
|
"Got resulting SKBTX_HW_TSTAMP skb=%p ns=%016llu\n",
|
|
|
|
skb, (unsigned long long)ns);
|
|
|
|
ts.hwtstamp = ns_to_ktime(ns + lio->ptp_adjust);
|
|
|
|
skb_tstamp_tx(skb, &ts);
|
|
|
|
}
|
|
|
|
|
|
|
|
octeon_free_soft_command(oct, sc);
|
|
|
|
tx_buffer_free(skb);
|
|
|
|
}
|
|
|
|
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
/* send_nic_timestamp_pkt - Send a data packet that will be timestamped
|
|
|
|
* @oct: octeon device
|
|
|
|
* @ndata: pointer to network data
|
|
|
|
* @finfo: pointer to private network data
|
2016-12-09 05:00:47 +08:00
|
|
|
*/
|
|
|
|
static int send_nic_timestamp_pkt(struct octeon_device *oct,
|
|
|
|
struct octnic_data_pkt *ndata,
|
2017-10-27 07:18:20 +08:00
|
|
|
struct octnet_buf_free_info *finfo,
|
|
|
|
int xmit_more)
|
2016-12-09 05:00:47 +08:00
|
|
|
{
|
|
|
|
struct octeon_soft_command *sc;
|
|
|
|
int ring_doorbell;
|
|
|
|
struct lio *lio;
|
|
|
|
int retval;
|
|
|
|
u32 len;
|
|
|
|
|
|
|
|
lio = finfo->lio;
|
|
|
|
|
|
|
|
sc = octeon_alloc_soft_command_resp(oct, &ndata->cmd,
|
|
|
|
sizeof(struct oct_timestamp_resp));
|
|
|
|
finfo->sc = sc;
|
|
|
|
|
|
|
|
if (!sc) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "No memory for timestamped data packet\n");
|
|
|
|
return IQ_SEND_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ndata->reqtype == REQTYPE_NORESP_NET)
|
|
|
|
ndata->reqtype = REQTYPE_RESP_NET;
|
|
|
|
else if (ndata->reqtype == REQTYPE_NORESP_NET_SG)
|
|
|
|
ndata->reqtype = REQTYPE_RESP_NET_SG;
|
|
|
|
|
|
|
|
sc->callback = handle_timestamp;
|
|
|
|
sc->callback_arg = finfo->skb;
|
|
|
|
sc->iq_no = ndata->q_no;
|
|
|
|
|
|
|
|
len = (u32)((struct octeon_instr_ih3 *)(&sc->cmd.cmd3.ih3))->dlengsz;
|
|
|
|
|
2017-10-27 07:18:20 +08:00
|
|
|
ring_doorbell = !xmit_more;
|
2016-12-09 05:00:47 +08:00
|
|
|
|
|
|
|
retval = octeon_send_command(oct, sc->iq_no, ring_doorbell, &sc->cmd,
|
|
|
|
sc, len, ndata->reqtype);
|
|
|
|
|
|
|
|
if (retval == IQ_SEND_FAILED) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "timestamp data packet failed status: %x\n",
|
|
|
|
retval);
|
|
|
|
octeon_free_soft_command(oct, sc);
|
|
|
|
} else {
|
|
|
|
netif_info(lio, tx_queued, lio->netdev, "Queued timestamp packet\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
/**
|
|
|
|
* liquidio_xmit - Transmit networks packets to the Octeon interface
|
|
|
|
* @skb: skbuff struct to be passed to network layer.
|
|
|
|
* @netdev: pointer to network device
|
2016-12-08 00:54:35 +08:00
|
|
|
* @returns whether the packet was transmitted to the device okay or not
|
|
|
|
* (NETDEV_TX_OK or NETDEV_TX_BUSY)
|
|
|
|
*/
|
2018-09-18 14:19:05 +08:00
|
|
|
static netdev_tx_t liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
|
2016-12-08 00:54:35 +08:00
|
|
|
{
|
|
|
|
struct octnet_buf_free_info *finfo;
|
|
|
|
union octnic_cmd_setup cmdsetup;
|
|
|
|
struct octnic_data_pkt ndata;
|
|
|
|
struct octeon_instr_irh *irh;
|
|
|
|
struct oct_iq_stats *stats;
|
|
|
|
struct octeon_device *oct;
|
|
|
|
int q_idx = 0, iq_no = 0;
|
|
|
|
union tx_info *tx_info;
|
2017-10-27 07:18:20 +08:00
|
|
|
int xmit_more = 0;
|
2016-12-08 00:54:35 +08:00
|
|
|
struct lio *lio;
|
|
|
|
int status = 0;
|
|
|
|
u64 dptr = 0;
|
|
|
|
u32 tag = 0;
|
|
|
|
int j;
|
|
|
|
|
|
|
|
lio = GET_LIO(netdev);
|
|
|
|
oct = lio->oct_dev;
|
|
|
|
|
2018-04-28 14:32:57 +08:00
|
|
|
q_idx = skb_iq(lio->oct_dev, skb);
|
2018-03-24 08:37:28 +08:00
|
|
|
tag = q_idx;
|
|
|
|
iq_no = lio->linfo.txpciq[q_idx].s.q_no;
|
2016-12-08 00:54:35 +08:00
|
|
|
|
|
|
|
stats = &oct->instr_queue[iq_no]->stats;
|
|
|
|
|
|
|
|
/* Check for all conditions in which the current packet cannot be
|
|
|
|
* transmitted.
|
|
|
|
*/
|
|
|
|
if (!(atomic_read(&lio->ifstate) & LIO_IFSTATE_RUNNING) ||
|
|
|
|
(!lio->linfo.link.s.link_up) || (skb->len <= 0)) {
|
|
|
|
netif_info(lio, tx_err, lio->netdev, "Transmit failed link_status : %d\n",
|
|
|
|
lio->linfo.link.s.link_up);
|
|
|
|
goto lio_xmit_failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Use space in skb->cb to store info used to unmap and
|
|
|
|
* free the buffers.
|
|
|
|
*/
|
|
|
|
finfo = (struct octnet_buf_free_info *)skb->cb;
|
|
|
|
finfo->lio = lio;
|
|
|
|
finfo->skb = skb;
|
|
|
|
finfo->sc = NULL;
|
|
|
|
|
|
|
|
/* Prepare the attributes for the data to be passed to OSI. */
|
|
|
|
memset(&ndata, 0, sizeof(struct octnic_data_pkt));
|
|
|
|
|
|
|
|
ndata.buf = finfo;
|
|
|
|
|
|
|
|
ndata.q_no = iq_no;
|
|
|
|
|
2018-03-24 08:37:28 +08:00
|
|
|
if (octnet_iq_is_full(oct, ndata.q_no)) {
|
|
|
|
/* defer sending if queue is full */
|
|
|
|
netif_info(lio, tx_err, lio->netdev, "Transmit failed iq:%d full\n",
|
|
|
|
ndata.q_no);
|
|
|
|
stats->tx_iq_busy++;
|
|
|
|
return NETDEV_TX_BUSY;
|
2016-12-08 00:54:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ndata.datasize = skb->len;
|
|
|
|
|
|
|
|
cmdsetup.u64 = 0;
|
|
|
|
cmdsetup.s.iq_no = iq_no;
|
|
|
|
|
2016-12-09 05:00:45 +08:00
|
|
|
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
|
|
|
if (skb->encapsulation) {
|
|
|
|
cmdsetup.s.tnl_csum = 1;
|
|
|
|
stats->tx_vxlan++;
|
|
|
|
} else {
|
|
|
|
cmdsetup.s.transport_csum = 1;
|
|
|
|
}
|
|
|
|
}
|
2016-12-09 05:00:47 +08:00
|
|
|
if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
|
|
|
|
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
|
|
|
|
cmdsetup.s.timestamp = 1;
|
|
|
|
}
|
2016-12-08 00:54:35 +08:00
|
|
|
|
|
|
|
if (!skb_shinfo(skb)->nr_frags) {
|
|
|
|
cmdsetup.s.u.datasize = skb->len;
|
|
|
|
octnet_prepare_pci_cmd(oct, &ndata.cmd, &cmdsetup, tag);
|
|
|
|
/* Offload checksum calculation for TCP/UDP packets */
|
|
|
|
dptr = dma_map_single(&oct->pci_dev->dev,
|
|
|
|
skb->data,
|
|
|
|
skb->len,
|
|
|
|
DMA_TO_DEVICE);
|
|
|
|
if (dma_mapping_error(&oct->pci_dev->dev, dptr)) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "%s DMA mapping error 1\n",
|
|
|
|
__func__);
|
|
|
|
return NETDEV_TX_BUSY;
|
|
|
|
}
|
|
|
|
|
|
|
|
ndata.cmd.cmd3.dptr = dptr;
|
|
|
|
finfo->dptr = dptr;
|
|
|
|
ndata.reqtype = REQTYPE_NORESP_NET;
|
|
|
|
|
|
|
|
} else {
|
2019-07-23 11:08:25 +08:00
|
|
|
skb_frag_t *frag;
|
2016-12-08 00:54:35 +08:00
|
|
|
struct octnic_gather *g;
|
|
|
|
int i, frags;
|
|
|
|
|
|
|
|
spin_lock(&lio->glist_lock[q_idx]);
|
2018-04-28 14:32:45 +08:00
|
|
|
g = (struct octnic_gather *)
|
|
|
|
lio_list_delete_head(&lio->glist[q_idx]);
|
2016-12-08 00:54:35 +08:00
|
|
|
spin_unlock(&lio->glist_lock[q_idx]);
|
|
|
|
|
|
|
|
if (!g) {
|
|
|
|
netif_info(lio, tx_err, lio->netdev,
|
|
|
|
"Transmit scatter gather: glist null!\n");
|
|
|
|
goto lio_xmit_failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
cmdsetup.s.gather = 1;
|
|
|
|
cmdsetup.s.u.gatherptrs = (skb_shinfo(skb)->nr_frags + 1);
|
|
|
|
octnet_prepare_pci_cmd(oct, &ndata.cmd, &cmdsetup, tag);
|
|
|
|
|
|
|
|
memset(g->sg, 0, g->sg_size);
|
|
|
|
|
|
|
|
g->sg[0].ptr[0] = dma_map_single(&oct->pci_dev->dev,
|
|
|
|
skb->data,
|
|
|
|
(skb->len - skb->data_len),
|
|
|
|
DMA_TO_DEVICE);
|
|
|
|
if (dma_mapping_error(&oct->pci_dev->dev, g->sg[0].ptr[0])) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "%s DMA mapping error 2\n",
|
|
|
|
__func__);
|
|
|
|
return NETDEV_TX_BUSY;
|
|
|
|
}
|
|
|
|
add_sg_size(&g->sg[0], (skb->len - skb->data_len), 0);
|
|
|
|
|
|
|
|
frags = skb_shinfo(skb)->nr_frags;
|
|
|
|
i = 1;
|
|
|
|
while (frags--) {
|
|
|
|
frag = &skb_shinfo(skb)->frags[i - 1];
|
|
|
|
|
|
|
|
g->sg[(i >> 2)].ptr[(i & 3)] =
|
2019-07-23 11:08:25 +08:00
|
|
|
skb_frag_dma_map(&oct->pci_dev->dev,
|
|
|
|
frag, 0, skb_frag_size(frag),
|
|
|
|
DMA_TO_DEVICE);
|
2016-12-08 00:54:35 +08:00
|
|
|
if (dma_mapping_error(&oct->pci_dev->dev,
|
|
|
|
g->sg[i >> 2].ptr[i & 3])) {
|
|
|
|
dma_unmap_single(&oct->pci_dev->dev,
|
|
|
|
g->sg[0].ptr[0],
|
|
|
|
skb->len - skb->data_len,
|
|
|
|
DMA_TO_DEVICE);
|
|
|
|
for (j = 1; j < i; j++) {
|
|
|
|
frag = &skb_shinfo(skb)->frags[j - 1];
|
|
|
|
dma_unmap_page(&oct->pci_dev->dev,
|
|
|
|
g->sg[j >> 2].ptr[j & 3],
|
2019-07-23 11:08:25 +08:00
|
|
|
skb_frag_size(frag),
|
2016-12-08 00:54:35 +08:00
|
|
|
DMA_TO_DEVICE);
|
|
|
|
}
|
|
|
|
dev_err(&oct->pci_dev->dev, "%s DMA mapping error 3\n",
|
|
|
|
__func__);
|
|
|
|
return NETDEV_TX_BUSY;
|
|
|
|
}
|
|
|
|
|
2019-07-23 11:08:25 +08:00
|
|
|
add_sg_size(&g->sg[(i >> 2)], skb_frag_size(frag),
|
|
|
|
(i & 3));
|
2016-12-08 00:54:35 +08:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
2017-03-07 10:45:59 +08:00
|
|
|
dptr = g->sg_dma_ptr;
|
2016-12-08 00:54:35 +08:00
|
|
|
|
|
|
|
ndata.cmd.cmd3.dptr = dptr;
|
|
|
|
finfo->dptr = dptr;
|
|
|
|
finfo->g = g;
|
|
|
|
|
|
|
|
ndata.reqtype = REQTYPE_NORESP_NET_SG;
|
|
|
|
}
|
|
|
|
|
|
|
|
irh = (struct octeon_instr_irh *)&ndata.cmd.cmd3.irh;
|
|
|
|
tx_info = (union tx_info *)&ndata.cmd.cmd3.ossp[0];
|
|
|
|
|
|
|
|
if (skb_shinfo(skb)->gso_size) {
|
|
|
|
tx_info->s.gso_size = skb_shinfo(skb)->gso_size;
|
|
|
|
tx_info->s.gso_segs = skb_shinfo(skb)->gso_segs;
|
|
|
|
}
|
|
|
|
|
2016-12-09 05:00:44 +08:00
|
|
|
/* HW insert VLAN tag */
|
|
|
|
if (skb_vlan_tag_present(skb)) {
|
|
|
|
irh->priority = skb_vlan_tag_get(skb) >> VLAN_PRIO_SHIFT;
|
|
|
|
irh->vlan = skb_vlan_tag_get(skb) & VLAN_VID_MASK;
|
|
|
|
}
|
|
|
|
|
2019-04-01 22:42:14 +08:00
|
|
|
xmit_more = netdev_xmit_more();
|
2017-10-27 07:18:20 +08:00
|
|
|
|
2016-12-09 05:00:47 +08:00
|
|
|
if (unlikely(cmdsetup.s.timestamp))
|
2017-10-27 07:18:20 +08:00
|
|
|
status = send_nic_timestamp_pkt(oct, &ndata, finfo, xmit_more);
|
2016-12-09 05:00:47 +08:00
|
|
|
else
|
2017-10-27 07:18:20 +08:00
|
|
|
status = octnet_send_nic_data_pkt(oct, &ndata, xmit_more);
|
2016-12-08 00:54:35 +08:00
|
|
|
if (status == IQ_SEND_FAILED)
|
|
|
|
goto lio_xmit_failed;
|
|
|
|
|
|
|
|
netif_info(lio, tx_queued, lio->netdev, "Transmit queued successfully\n");
|
|
|
|
|
|
|
|
if (status == IQ_SEND_STOP) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "Rcvd IQ_SEND_STOP signal; stopping IQ-%d\n",
|
|
|
|
iq_no);
|
2018-03-24 08:37:30 +08:00
|
|
|
netif_stop_subqueue(netdev, q_idx);
|
2016-12-08 00:54:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
netif_trans_update(netdev);
|
|
|
|
|
2017-01-27 03:52:35 +08:00
|
|
|
if (tx_info->s.gso_segs)
|
|
|
|
stats->tx_done += tx_info->s.gso_segs;
|
2016-12-08 00:54:35 +08:00
|
|
|
else
|
|
|
|
stats->tx_done++;
|
2017-01-27 03:52:35 +08:00
|
|
|
stats->tx_tot_bytes += ndata.datasize;
|
2016-12-08 00:54:35 +08:00
|
|
|
|
|
|
|
return NETDEV_TX_OK;
|
|
|
|
|
|
|
|
lio_xmit_failed:
|
|
|
|
stats->tx_dropped++;
|
|
|
|
netif_info(lio, tx_err, lio->netdev, "IQ%d Transmit dropped:%llu\n",
|
|
|
|
iq_no, stats->tx_dropped);
|
|
|
|
if (dptr)
|
|
|
|
dma_unmap_single(&oct->pci_dev->dev, dptr,
|
|
|
|
ndata.datasize, DMA_TO_DEVICE);
|
2017-10-27 07:18:20 +08:00
|
|
|
|
|
|
|
octeon_ring_doorbell_locked(oct, iq_no);
|
|
|
|
|
2016-12-08 00:54:35 +08:00
|
|
|
tx_buffer_free(skb);
|
|
|
|
return NETDEV_TX_OK;
|
|
|
|
}
|
|
|
|
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
/**
|
|
|
|
* liquidio_tx_timeout - Network device Tx timeout
|
|
|
|
* @netdev: pointer to network device
|
|
|
|
* @txqueue: index of the hung transmit queue
|
2016-12-08 00:54:35 +08:00
|
|
|
*/
|
netdev: pass the stuck queue to the timeout handler
This allows incrementing the correct timeout statistic without any mess.
Down the road, devices can learn to reset just the specific queue.
The patch was generated with the following script:
use strict;
use warnings;
our $^I = '.bak';
my @work = (
["arch/m68k/emu/nfeth.c", "nfeth_tx_timeout"],
["arch/um/drivers/net_kern.c", "uml_net_tx_timeout"],
["arch/um/drivers/vector_kern.c", "vector_net_tx_timeout"],
["arch/xtensa/platforms/iss/network.c", "iss_net_tx_timeout"],
["drivers/char/pcmcia/synclink_cs.c", "hdlcdev_tx_timeout"],
["drivers/infiniband/ulp/ipoib/ipoib_main.c", "ipoib_timeout"],
["drivers/infiniband/ulp/ipoib/ipoib_main.c", "ipoib_timeout"],
["drivers/message/fusion/mptlan.c", "mpt_lan_tx_timeout"],
["drivers/misc/sgi-xp/xpnet.c", "xpnet_dev_tx_timeout"],
["drivers/net/appletalk/cops.c", "cops_timeout"],
["drivers/net/arcnet/arcdevice.h", "arcnet_timeout"],
["drivers/net/arcnet/arcnet.c", "arcnet_timeout"],
["drivers/net/arcnet/com20020.c", "arcnet_timeout"],
["drivers/net/ethernet/3com/3c509.c", "el3_tx_timeout"],
["drivers/net/ethernet/3com/3c515.c", "corkscrew_timeout"],
["drivers/net/ethernet/3com/3c574_cs.c", "el3_tx_timeout"],
["drivers/net/ethernet/3com/3c589_cs.c", "el3_tx_timeout"],
["drivers/net/ethernet/3com/3c59x.c", "vortex_tx_timeout"],
["drivers/net/ethernet/3com/3c59x.c", "vortex_tx_timeout"],
["drivers/net/ethernet/3com/typhoon.c", "typhoon_tx_timeout"],
["drivers/net/ethernet/8390/8390.h", "ei_tx_timeout"],
["drivers/net/ethernet/8390/8390.h", "eip_tx_timeout"],
["drivers/net/ethernet/8390/8390.c", "ei_tx_timeout"],
["drivers/net/ethernet/8390/8390p.c", "eip_tx_timeout"],
["drivers/net/ethernet/8390/ax88796.c", "ax_ei_tx_timeout"],
["drivers/net/ethernet/8390/axnet_cs.c", "axnet_tx_timeout"],
["drivers/net/ethernet/8390/etherh.c", "__ei_tx_timeout"],
["drivers/net/ethernet/8390/hydra.c", "__ei_tx_timeout"],
["drivers/net/ethernet/8390/mac8390.c", "__ei_tx_timeout"],
["drivers/net/ethernet/8390/mcf8390.c", "__ei_tx_timeout"],
["drivers/net/ethernet/8390/lib8390.c", "__ei_tx_timeout"],
["drivers/net/ethernet/8390/ne2k-pci.c", "ei_tx_timeout"],
["drivers/net/ethernet/8390/pcnet_cs.c", "ei_tx_timeout"],
["drivers/net/ethernet/8390/smc-ultra.c", "ei_tx_timeout"],
["drivers/net/ethernet/8390/wd.c", "ei_tx_timeout"],
["drivers/net/ethernet/8390/zorro8390.c", "__ei_tx_timeout"],
["drivers/net/ethernet/adaptec/starfire.c", "tx_timeout"],
["drivers/net/ethernet/agere/et131x.c", "et131x_tx_timeout"],
["drivers/net/ethernet/allwinner/sun4i-emac.c", "emac_timeout"],
["drivers/net/ethernet/alteon/acenic.c", "ace_watchdog"],
["drivers/net/ethernet/amazon/ena/ena_netdev.c", "ena_tx_timeout"],
["drivers/net/ethernet/amd/7990.h", "lance_tx_timeout"],
["drivers/net/ethernet/amd/7990.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/a2065.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/am79c961a.c", "am79c961_timeout"],
["drivers/net/ethernet/amd/amd8111e.c", "amd8111e_tx_timeout"],
["drivers/net/ethernet/amd/ariadne.c", "ariadne_tx_timeout"],
["drivers/net/ethernet/amd/atarilance.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/au1000_eth.c", "au1000_tx_timeout"],
["drivers/net/ethernet/amd/declance.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/lance.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/mvme147.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/ni65.c", "ni65_timeout"],
["drivers/net/ethernet/amd/nmclan_cs.c", "mace_tx_timeout"],
["drivers/net/ethernet/amd/pcnet32.c", "pcnet32_tx_timeout"],
["drivers/net/ethernet/amd/sunlance.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/xgbe/xgbe-drv.c", "xgbe_tx_timeout"],
["drivers/net/ethernet/apm/xgene-v2/main.c", "xge_timeout"],
["drivers/net/ethernet/apm/xgene/xgene_enet_main.c", "xgene_enet_timeout"],
["drivers/net/ethernet/apple/macmace.c", "mace_tx_timeout"],
["drivers/net/ethernet/atheros/ag71xx.c", "ag71xx_tx_timeout"],
["drivers/net/ethernet/atheros/alx/main.c", "alx_tx_timeout"],
["drivers/net/ethernet/atheros/atl1c/atl1c_main.c", "atl1c_tx_timeout"],
["drivers/net/ethernet/atheros/atl1e/atl1e_main.c", "atl1e_tx_timeout"],
["drivers/net/ethernet/atheros/atlx/atl.c", "atlx_tx_timeout"],
["drivers/net/ethernet/atheros/atlx/atl1.c", "atlx_tx_timeout"],
["drivers/net/ethernet/atheros/atlx/atl2.c", "atl2_tx_timeout"],
["drivers/net/ethernet/broadcom/b44.c", "b44_tx_timeout"],
["drivers/net/ethernet/broadcom/bcmsysport.c", "bcm_sysport_tx_timeout"],
["drivers/net/ethernet/broadcom/bnx2.c", "bnx2_tx_timeout"],
["drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h", "bnx2x_tx_timeout"],
["drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c", "bnx2x_tx_timeout"],
["drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c", "bnx2x_tx_timeout"],
["drivers/net/ethernet/broadcom/bnxt/bnxt.c", "bnxt_tx_timeout"],
["drivers/net/ethernet/broadcom/genet/bcmgenet.c", "bcmgenet_timeout"],
["drivers/net/ethernet/broadcom/sb1250-mac.c", "sbmac_tx_timeout"],
["drivers/net/ethernet/broadcom/tg3.c", "tg3_tx_timeout"],
["drivers/net/ethernet/calxeda/xgmac.c", "xgmac_tx_timeout"],
["drivers/net/ethernet/cavium/liquidio/lio_main.c", "liquidio_tx_timeout"],
["drivers/net/ethernet/cavium/liquidio/lio_vf_main.c", "liquidio_tx_timeout"],
["drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c", "lio_vf_rep_tx_timeout"],
["drivers/net/ethernet/cavium/thunder/nicvf_main.c", "nicvf_tx_timeout"],
["drivers/net/ethernet/cirrus/cs89x0.c", "net_timeout"],
["drivers/net/ethernet/cisco/enic/enic_main.c", "enic_tx_timeout"],
["drivers/net/ethernet/cisco/enic/enic_main.c", "enic_tx_timeout"],
["drivers/net/ethernet/cortina/gemini.c", "gmac_tx_timeout"],
["drivers/net/ethernet/davicom/dm9000.c", "dm9000_timeout"],
["drivers/net/ethernet/dec/tulip/de2104x.c", "de_tx_timeout"],
["drivers/net/ethernet/dec/tulip/tulip_core.c", "tulip_tx_timeout"],
["drivers/net/ethernet/dec/tulip/winbond-840.c", "tx_timeout"],
["drivers/net/ethernet/dlink/dl2k.c", "rio_tx_timeout"],
["drivers/net/ethernet/dlink/sundance.c", "tx_timeout"],
["drivers/net/ethernet/emulex/benet/be_main.c", "be_tx_timeout"],
["drivers/net/ethernet/ethoc.c", "ethoc_tx_timeout"],
["drivers/net/ethernet/faraday/ftgmac100.c", "ftgmac100_tx_timeout"],
["drivers/net/ethernet/fealnx.c", "fealnx_tx_timeout"],
["drivers/net/ethernet/freescale/dpaa/dpaa_eth.c", "dpaa_tx_timeout"],
["drivers/net/ethernet/freescale/fec_main.c", "fec_timeout"],
["drivers/net/ethernet/freescale/fec_mpc52xx.c", "mpc52xx_fec_tx_timeout"],
["drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c", "fs_timeout"],
["drivers/net/ethernet/freescale/gianfar.c", "gfar_timeout"],
["drivers/net/ethernet/freescale/ucc_geth.c", "ucc_geth_timeout"],
["drivers/net/ethernet/fujitsu/fmvj18x_cs.c", "fjn_tx_timeout"],
["drivers/net/ethernet/google/gve/gve_main.c", "gve_tx_timeout"],
["drivers/net/ethernet/hisilicon/hip04_eth.c", "hip04_timeout"],
["drivers/net/ethernet/hisilicon/hix5hd2_gmac.c", "hix5hd2_net_timeout"],
["drivers/net/ethernet/hisilicon/hns/hns_enet.c", "hns_nic_net_timeout"],
["drivers/net/ethernet/hisilicon/hns3/hns3_enet.c", "hns3_nic_net_timeout"],
["drivers/net/ethernet/huawei/hinic/hinic_main.c", "hinic_tx_timeout"],
["drivers/net/ethernet/i825xx/82596.c", "i596_tx_timeout"],
["drivers/net/ethernet/i825xx/ether1.c", "ether1_timeout"],
["drivers/net/ethernet/i825xx/lib82596.c", "i596_tx_timeout"],
["drivers/net/ethernet/i825xx/sun3_82586.c", "sun3_82586_timeout"],
["drivers/net/ethernet/ibm/ehea/ehea_main.c", "ehea_tx_watchdog"],
["drivers/net/ethernet/ibm/emac/core.c", "emac_tx_timeout"],
["drivers/net/ethernet/ibm/emac/core.c", "emac_tx_timeout"],
["drivers/net/ethernet/ibm/ibmvnic.c", "ibmvnic_tx_timeout"],
["drivers/net/ethernet/intel/e100.c", "e100_tx_timeout"],
["drivers/net/ethernet/intel/e1000/e1000_main.c", "e1000_tx_timeout"],
["drivers/net/ethernet/intel/e1000e/netdev.c", "e1000_tx_timeout"],
["drivers/net/ethernet/intel/fm10k/fm10k_netdev.c", "fm10k_tx_timeout"],
["drivers/net/ethernet/intel/i40e/i40e_main.c", "i40e_tx_timeout"],
["drivers/net/ethernet/intel/iavf/iavf_main.c", "iavf_tx_timeout"],
["drivers/net/ethernet/intel/ice/ice_main.c", "ice_tx_timeout"],
["drivers/net/ethernet/intel/ice/ice_main.c", "ice_tx_timeout"],
["drivers/net/ethernet/intel/igb/igb_main.c", "igb_tx_timeout"],
["drivers/net/ethernet/intel/igbvf/netdev.c", "igbvf_tx_timeout"],
["drivers/net/ethernet/intel/ixgb/ixgb_main.c", "ixgb_tx_timeout"],
["drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c", "adapter->netdev->netdev_ops->ndo_tx_timeout(adapter->netdev);"],
["drivers/net/ethernet/intel/ixgbe/ixgbe_main.c", "ixgbe_tx_timeout"],
["drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c", "ixgbevf_tx_timeout"],
["drivers/net/ethernet/jme.c", "jme_tx_timeout"],
["drivers/net/ethernet/korina.c", "korina_tx_timeout"],
["drivers/net/ethernet/lantiq_etop.c", "ltq_etop_tx_timeout"],
["drivers/net/ethernet/marvell/mv643xx_eth.c", "mv643xx_eth_tx_timeout"],
["drivers/net/ethernet/marvell/pxa168_eth.c", "pxa168_eth_tx_timeout"],
["drivers/net/ethernet/marvell/skge.c", "skge_tx_timeout"],
["drivers/net/ethernet/marvell/sky2.c", "sky2_tx_timeout"],
["drivers/net/ethernet/marvell/sky2.c", "sky2_tx_timeout"],
["drivers/net/ethernet/mediatek/mtk_eth_soc.c", "mtk_tx_timeout"],
["drivers/net/ethernet/mellanox/mlx4/en_netdev.c", "mlx4_en_tx_timeout"],
["drivers/net/ethernet/mellanox/mlx4/en_netdev.c", "mlx4_en_tx_timeout"],
["drivers/net/ethernet/mellanox/mlx5/core/en_main.c", "mlx5e_tx_timeout"],
["drivers/net/ethernet/micrel/ks8842.c", "ks8842_tx_timeout"],
["drivers/net/ethernet/micrel/ksz884x.c", "netdev_tx_timeout"],
["drivers/net/ethernet/microchip/enc28j60.c", "enc28j60_tx_timeout"],
["drivers/net/ethernet/microchip/encx24j600.c", "encx24j600_tx_timeout"],
["drivers/net/ethernet/natsemi/sonic.h", "sonic_tx_timeout"],
["drivers/net/ethernet/natsemi/sonic.c", "sonic_tx_timeout"],
["drivers/net/ethernet/natsemi/jazzsonic.c", "sonic_tx_timeout"],
["drivers/net/ethernet/natsemi/macsonic.c", "sonic_tx_timeout"],
["drivers/net/ethernet/natsemi/natsemi.c", "ns_tx_timeout"],
["drivers/net/ethernet/natsemi/ns83820.c", "ns83820_tx_timeout"],
["drivers/net/ethernet/natsemi/xtsonic.c", "sonic_tx_timeout"],
["drivers/net/ethernet/neterion/s2io.h", "s2io_tx_watchdog"],
["drivers/net/ethernet/neterion/s2io.c", "s2io_tx_watchdog"],
["drivers/net/ethernet/neterion/vxge/vxge-main.c", "vxge_tx_watchdog"],
["drivers/net/ethernet/netronome/nfp/nfp_net_common.c", "nfp_net_tx_timeout"],
["drivers/net/ethernet/nvidia/forcedeth.c", "nv_tx_timeout"],
["drivers/net/ethernet/nvidia/forcedeth.c", "nv_tx_timeout"],
["drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c", "pch_gbe_tx_timeout"],
["drivers/net/ethernet/packetengines/hamachi.c", "hamachi_tx_timeout"],
["drivers/net/ethernet/packetengines/yellowfin.c", "yellowfin_tx_timeout"],
["drivers/net/ethernet/pensando/ionic/ionic_lif.c", "ionic_tx_timeout"],
["drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c", "netxen_tx_timeout"],
["drivers/net/ethernet/qlogic/qla3xxx.c", "ql3xxx_tx_timeout"],
["drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c", "qlcnic_tx_timeout"],
["drivers/net/ethernet/qualcomm/emac/emac.c", "emac_tx_timeout"],
["drivers/net/ethernet/qualcomm/qca_spi.c", "qcaspi_netdev_tx_timeout"],
["drivers/net/ethernet/qualcomm/qca_uart.c", "qcauart_netdev_tx_timeout"],
["drivers/net/ethernet/rdc/r6040.c", "r6040_tx_timeout"],
["drivers/net/ethernet/realtek/8139cp.c", "cp_tx_timeout"],
["drivers/net/ethernet/realtek/8139too.c", "rtl8139_tx_timeout"],
["drivers/net/ethernet/realtek/atp.c", "tx_timeout"],
["drivers/net/ethernet/realtek/r8169_main.c", "rtl8169_tx_timeout"],
["drivers/net/ethernet/renesas/ravb_main.c", "ravb_tx_timeout"],
["drivers/net/ethernet/renesas/sh_eth.c", "sh_eth_tx_timeout"],
["drivers/net/ethernet/renesas/sh_eth.c", "sh_eth_tx_timeout"],
["drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c", "sxgbe_tx_timeout"],
["drivers/net/ethernet/seeq/ether3.c", "ether3_timeout"],
["drivers/net/ethernet/seeq/sgiseeq.c", "timeout"],
["drivers/net/ethernet/sfc/efx.c", "efx_watchdog"],
["drivers/net/ethernet/sfc/falcon/efx.c", "ef4_watchdog"],
["drivers/net/ethernet/sgi/ioc3-eth.c", "ioc3_timeout"],
["drivers/net/ethernet/sgi/meth.c", "meth_tx_timeout"],
["drivers/net/ethernet/silan/sc92031.c", "sc92031_tx_timeout"],
["drivers/net/ethernet/sis/sis190.c", "sis190_tx_timeout"],
["drivers/net/ethernet/sis/sis900.c", "sis900_tx_timeout"],
["drivers/net/ethernet/smsc/epic100.c", "epic_tx_timeout"],
["drivers/net/ethernet/smsc/smc911x.c", "smc911x_timeout"],
["drivers/net/ethernet/smsc/smc9194.c", "smc_timeout"],
["drivers/net/ethernet/smsc/smc91c92_cs.c", "smc_tx_timeout"],
["drivers/net/ethernet/smsc/smc91x.c", "smc_timeout"],
["drivers/net/ethernet/stmicro/stmmac/stmmac_main.c", "stmmac_tx_timeout"],
["drivers/net/ethernet/sun/cassini.c", "cas_tx_timeout"],
["drivers/net/ethernet/sun/ldmvsw.c", "sunvnet_tx_timeout_common"],
["drivers/net/ethernet/sun/niu.c", "niu_tx_timeout"],
["drivers/net/ethernet/sun/sunbmac.c", "bigmac_tx_timeout"],
["drivers/net/ethernet/sun/sungem.c", "gem_tx_timeout"],
["drivers/net/ethernet/sun/sunhme.c", "happy_meal_tx_timeout"],
["drivers/net/ethernet/sun/sunqe.c", "qe_tx_timeout"],
["drivers/net/ethernet/sun/sunvnet.c", "sunvnet_tx_timeout_common"],
["drivers/net/ethernet/sun/sunvnet_common.c", "sunvnet_tx_timeout_common"],
["drivers/net/ethernet/sun/sunvnet_common.h", "sunvnet_tx_timeout_common"],
["drivers/net/ethernet/synopsys/dwc-xlgmac-net.c", "xlgmac_tx_timeout"],
["drivers/net/ethernet/ti/cpmac.c", "cpmac_tx_timeout"],
["drivers/net/ethernet/ti/cpsw.c", "cpsw_ndo_tx_timeout"],
["drivers/net/ethernet/ti/cpsw_priv.c", "cpsw_ndo_tx_timeout"],
["drivers/net/ethernet/ti/cpsw_priv.h", "cpsw_ndo_tx_timeout"],
["drivers/net/ethernet/ti/davinci_emac.c", "emac_dev_tx_timeout"],
["drivers/net/ethernet/ti/netcp_core.c", "netcp_ndo_tx_timeout"],
["drivers/net/ethernet/ti/tlan.c", "tlan_tx_timeout"],
["drivers/net/ethernet/toshiba/ps3_gelic_net.h", "gelic_net_tx_timeout"],
["drivers/net/ethernet/toshiba/ps3_gelic_net.c", "gelic_net_tx_timeout"],
["drivers/net/ethernet/toshiba/ps3_gelic_wireless.c", "gelic_net_tx_timeout"],
["drivers/net/ethernet/toshiba/spider_net.c", "spider_net_tx_timeout"],
["drivers/net/ethernet/toshiba/tc35815.c", "tc35815_tx_timeout"],
["drivers/net/ethernet/via/via-rhine.c", "rhine_tx_timeout"],
["drivers/net/ethernet/wiznet/w5100.c", "w5100_tx_timeout"],
["drivers/net/ethernet/wiznet/w5300.c", "w5300_tx_timeout"],
["drivers/net/ethernet/xilinx/xilinx_emaclite.c", "xemaclite_tx_timeout"],
["drivers/net/ethernet/xircom/xirc2ps_cs.c", "xirc_tx_timeout"],
["drivers/net/fjes/fjes_main.c", "fjes_tx_retry"],
["drivers/net/slip/slip.c", "sl_tx_timeout"],
["include/linux/usb/usbnet.h", "usbnet_tx_timeout"],
["drivers/net/usb/aqc111.c", "usbnet_tx_timeout"],
["drivers/net/usb/asix_devices.c", "usbnet_tx_timeout"],
["drivers/net/usb/asix_devices.c", "usbnet_tx_timeout"],
["drivers/net/usb/asix_devices.c", "usbnet_tx_timeout"],
["drivers/net/usb/ax88172a.c", "usbnet_tx_timeout"],
["drivers/net/usb/ax88179_178a.c", "usbnet_tx_timeout"],
["drivers/net/usb/catc.c", "catc_tx_timeout"],
["drivers/net/usb/cdc_mbim.c", "usbnet_tx_timeout"],
["drivers/net/usb/cdc_ncm.c", "usbnet_tx_timeout"],
["drivers/net/usb/dm9601.c", "usbnet_tx_timeout"],
["drivers/net/usb/hso.c", "hso_net_tx_timeout"],
["drivers/net/usb/int51x1.c", "usbnet_tx_timeout"],
["drivers/net/usb/ipheth.c", "ipheth_tx_timeout"],
["drivers/net/usb/kaweth.c", "kaweth_tx_timeout"],
["drivers/net/usb/lan78xx.c", "lan78xx_tx_timeout"],
["drivers/net/usb/mcs7830.c", "usbnet_tx_timeout"],
["drivers/net/usb/pegasus.c", "pegasus_tx_timeout"],
["drivers/net/usb/qmi_wwan.c", "usbnet_tx_timeout"],
["drivers/net/usb/r8152.c", "rtl8152_tx_timeout"],
["drivers/net/usb/rndis_host.c", "usbnet_tx_timeout"],
["drivers/net/usb/rtl8150.c", "rtl8150_tx_timeout"],
["drivers/net/usb/sierra_net.c", "usbnet_tx_timeout"],
["drivers/net/usb/smsc75xx.c", "usbnet_tx_timeout"],
["drivers/net/usb/smsc95xx.c", "usbnet_tx_timeout"],
["drivers/net/usb/sr9700.c", "usbnet_tx_timeout"],
["drivers/net/usb/sr9800.c", "usbnet_tx_timeout"],
["drivers/net/usb/usbnet.c", "usbnet_tx_timeout"],
["drivers/net/vmxnet3/vmxnet3_drv.c", "vmxnet3_tx_timeout"],
["drivers/net/wan/cosa.c", "cosa_net_timeout"],
["drivers/net/wan/farsync.c", "fst_tx_timeout"],
["drivers/net/wan/fsl_ucc_hdlc.c", "uhdlc_tx_timeout"],
["drivers/net/wan/lmc/lmc_main.c", "lmc_driver_timeout"],
["drivers/net/wan/x25_asy.c", "x25_asy_timeout"],
["drivers/net/wimax/i2400m/netdev.c", "i2400m_tx_timeout"],
["drivers/net/wireless/intel/ipw2x00/ipw2100.c", "ipw2100_tx_timeout"],
["drivers/net/wireless/intersil/hostap/hostap_main.c", "prism2_tx_timeout"],
["drivers/net/wireless/intersil/hostap/hostap_main.c", "prism2_tx_timeout"],
["drivers/net/wireless/intersil/hostap/hostap_main.c", "prism2_tx_timeout"],
["drivers/net/wireless/intersil/orinoco/main.c", "orinoco_tx_timeout"],
["drivers/net/wireless/intersil/orinoco/orinoco_usb.c", "orinoco_tx_timeout"],
["drivers/net/wireless/intersil/orinoco/orinoco.h", "orinoco_tx_timeout"],
["drivers/net/wireless/intersil/prism54/islpci_dev.c", "islpci_eth_tx_timeout"],
["drivers/net/wireless/intersil/prism54/islpci_eth.c", "islpci_eth_tx_timeout"],
["drivers/net/wireless/intersil/prism54/islpci_eth.h", "islpci_eth_tx_timeout"],
["drivers/net/wireless/marvell/mwifiex/main.c", "mwifiex_tx_timeout"],
["drivers/net/wireless/quantenna/qtnfmac/core.c", "qtnf_netdev_tx_timeout"],
["drivers/net/wireless/quantenna/qtnfmac/core.h", "qtnf_netdev_tx_timeout"],
["drivers/net/wireless/rndis_wlan.c", "usbnet_tx_timeout"],
["drivers/net/wireless/wl3501_cs.c", "wl3501_tx_timeout"],
["drivers/net/wireless/zydas/zd1201.c", "zd1201_tx_timeout"],
["drivers/s390/net/qeth_core.h", "qeth_tx_timeout"],
["drivers/s390/net/qeth_core_main.c", "qeth_tx_timeout"],
["drivers/s390/net/qeth_l2_main.c", "qeth_tx_timeout"],
["drivers/s390/net/qeth_l2_main.c", "qeth_tx_timeout"],
["drivers/s390/net/qeth_l3_main.c", "qeth_tx_timeout"],
["drivers/s390/net/qeth_l3_main.c", "qeth_tx_timeout"],
["drivers/staging/ks7010/ks_wlan_net.c", "ks_wlan_tx_timeout"],
["drivers/staging/qlge/qlge_main.c", "qlge_tx_timeout"],
["drivers/staging/rtl8192e/rtl8192e/rtl_core.c", "_rtl92e_tx_timeout"],
["drivers/staging/rtl8192u/r8192U_core.c", "tx_timeout"],
["drivers/staging/unisys/visornic/visornic_main.c", "visornic_xmit_timeout"],
["drivers/staging/wlan-ng/p80211netdev.c", "p80211knetdev_tx_timeout"],
["drivers/tty/n_gsm.c", "gsm_mux_net_tx_timeout"],
["drivers/tty/synclink.c", "hdlcdev_tx_timeout"],
["drivers/tty/synclink_gt.c", "hdlcdev_tx_timeout"],
["drivers/tty/synclinkmp.c", "hdlcdev_tx_timeout"],
["net/atm/lec.c", "lec_tx_timeout"],
["net/bluetooth/bnep/netdev.c", "bnep_net_timeout"]
);
for my $p (@work) {
my @pair = @$p;
my $file = $pair[0];
my $func = $pair[1];
print STDERR $file , ": ", $func,"\n";
our @ARGV = ($file);
while (<ARGV>) {
if (m/($func\s*\(struct\s+net_device\s+\*[A-Za-z_]?[A-Za-z-0-9_]*)(\))/) {
print STDERR "found $1+$2 in $file\n";
}
if (s/($func\s*\(struct\s+net_device\s+\*[A-Za-z_]?[A-Za-z-0-9_]*)(\))/$1, unsigned int txqueue$2/) {
print STDERR "$func found in $file\n";
}
print;
}
}
where the list of files and functions is simply from:
git grep ndo_tx_timeout, with manual addition of headers
in the rare cases where the function is from a header,
then manually changing the few places which actually
call ndo_tx_timeout.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Shannon Nelson <snelson@pensando.io>
Reviewed-by: Martin Habets <mhabets@solarflare.com>
changes from v9:
fixup a forward declaration
changes from v9:
more leftovers from v3 change
changes from v8:
fix up a missing direct call to timeout
rebased on net-next
changes from v7:
fixup leftovers from v3 change
changes from v6:
fix typo in rtl driver
changes from v5:
add missing files (allow any net device argument name)
changes from v4:
add a missing driver header
changes from v3:
change queue # to unsigned
Changes from v2:
added headers
Changes from v1:
Fix errors found by kbuild:
generalize the pattern a bit, to pick up
a couple of instances missed by the previous
version.
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-10 22:23:51 +08:00
|
|
|
static void liquidio_tx_timeout(struct net_device *netdev, unsigned int txqueue)
|
2016-12-08 00:54:35 +08:00
|
|
|
{
|
|
|
|
struct lio *lio;
|
|
|
|
|
|
|
|
lio = GET_LIO(netdev);
|
|
|
|
|
|
|
|
netif_info(lio, tx_err, lio->netdev,
|
|
|
|
"Transmit timeout tx_dropped:%ld, waking up queues now!!\n",
|
|
|
|
netdev->stats.tx_dropped);
|
|
|
|
netif_trans_update(netdev);
|
2018-03-24 08:37:39 +08:00
|
|
|
wake_txqs(netdev);
|
2016-12-08 00:54:35 +08:00
|
|
|
}
|
|
|
|
|
2016-12-09 05:00:44 +08:00
|
|
|
static int
|
|
|
|
liquidio_vlan_rx_add_vid(struct net_device *netdev,
|
|
|
|
__be16 proto __attribute__((unused)), u16 vid)
|
|
|
|
{
|
|
|
|
struct lio *lio = GET_LIO(netdev);
|
|
|
|
struct octeon_device *oct = lio->oct_dev;
|
|
|
|
struct octnic_ctrl_pkt nctrl;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
memset(&nctrl, 0, sizeof(struct octnic_ctrl_pkt));
|
|
|
|
|
|
|
|
nctrl.ncmd.u64 = 0;
|
|
|
|
nctrl.ncmd.s.cmd = OCTNET_CMD_ADD_VLAN_FILTER;
|
|
|
|
nctrl.ncmd.s.param1 = vid;
|
|
|
|
nctrl.iq_no = lio->linfo.txpciq[0].s.q_no;
|
|
|
|
nctrl.netpndev = (u64)netdev;
|
|
|
|
nctrl.cb_fn = liquidio_link_ctrl_cmd_completion;
|
|
|
|
|
|
|
|
ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl);
|
2018-08-29 09:51:40 +08:00
|
|
|
if (ret) {
|
2016-12-09 05:00:44 +08:00
|
|
|
dev_err(&oct->pci_dev->dev, "Add VLAN filter failed in core (ret: 0x%x)\n",
|
|
|
|
ret);
|
2017-04-07 10:22:22 +08:00
|
|
|
return -EPERM;
|
2018-08-29 09:51:40 +08:00
|
|
|
}
|
2017-04-07 10:22:22 +08:00
|
|
|
|
|
|
|
return 0;
|
2016-12-09 05:00:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
liquidio_vlan_rx_kill_vid(struct net_device *netdev,
|
|
|
|
__be16 proto __attribute__((unused)), u16 vid)
|
|
|
|
{
|
|
|
|
struct lio *lio = GET_LIO(netdev);
|
|
|
|
struct octeon_device *oct = lio->oct_dev;
|
|
|
|
struct octnic_ctrl_pkt nctrl;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
memset(&nctrl, 0, sizeof(struct octnic_ctrl_pkt));
|
|
|
|
|
|
|
|
nctrl.ncmd.u64 = 0;
|
|
|
|
nctrl.ncmd.s.cmd = OCTNET_CMD_DEL_VLAN_FILTER;
|
|
|
|
nctrl.ncmd.s.param1 = vid;
|
|
|
|
nctrl.iq_no = lio->linfo.txpciq[0].s.q_no;
|
|
|
|
nctrl.netpndev = (u64)netdev;
|
|
|
|
nctrl.cb_fn = liquidio_link_ctrl_cmd_completion;
|
|
|
|
|
|
|
|
ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl);
|
2018-08-29 09:51:40 +08:00
|
|
|
if (ret) {
|
2018-07-17 09:06:07 +08:00
|
|
|
dev_err(&oct->pci_dev->dev, "Del VLAN filter failed in core (ret: 0x%x)\n",
|
2016-12-09 05:00:44 +08:00
|
|
|
ret);
|
2018-08-29 09:51:40 +08:00
|
|
|
if (ret > 0)
|
|
|
|
ret = -EIO;
|
2016-12-09 05:00:44 +08:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
/** Sending command to enable/disable RX checksum offload
|
|
|
|
* @param netdev pointer to network device
|
|
|
|
* @param command OCTNET_CMD_TNL_RX_CSUM_CTL
|
|
|
|
* @param rx_cmd_bit OCTNET_CMD_RXCSUM_ENABLE/
|
|
|
|
* OCTNET_CMD_RXCSUM_DISABLE
|
|
|
|
* @returns SUCCESS or FAILURE
|
|
|
|
*/
|
|
|
|
static int liquidio_set_rxcsum_command(struct net_device *netdev, int command,
|
|
|
|
u8 rx_cmd)
|
|
|
|
{
|
|
|
|
struct lio *lio = GET_LIO(netdev);
|
|
|
|
struct octeon_device *oct = lio->oct_dev;
|
|
|
|
struct octnic_ctrl_pkt nctrl;
|
|
|
|
int ret = 0;
|
|
|
|
|
2017-04-07 10:22:22 +08:00
|
|
|
memset(&nctrl, 0, sizeof(struct octnic_ctrl_pkt));
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
nctrl.ncmd.u64 = 0;
|
|
|
|
nctrl.ncmd.s.cmd = command;
|
|
|
|
nctrl.ncmd.s.param1 = rx_cmd;
|
|
|
|
nctrl.iq_no = lio->linfo.txpciq[0].s.q_no;
|
|
|
|
nctrl.netpndev = (u64)netdev;
|
|
|
|
nctrl.cb_fn = liquidio_link_ctrl_cmd_completion;
|
|
|
|
|
|
|
|
ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl);
|
2018-08-29 09:51:40 +08:00
|
|
|
if (ret) {
|
2016-12-08 00:54:31 +08:00
|
|
|
dev_err(&oct->pci_dev->dev, "DEVFLAGS RXCSUM change failed in core (ret:0x%x)\n",
|
|
|
|
ret);
|
2018-08-29 09:51:40 +08:00
|
|
|
if (ret > 0)
|
|
|
|
ret = -EIO;
|
2016-12-08 00:54:31 +08:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-12-09 05:00:45 +08:00
|
|
|
/** Sending command to add/delete VxLAN UDP port to firmware
|
|
|
|
* @param netdev pointer to network device
|
|
|
|
* @param command OCTNET_CMD_VXLAN_PORT_CONFIG
|
|
|
|
* @param vxlan_port VxLAN port to be added or deleted
|
|
|
|
* @param vxlan_cmd_bit OCTNET_CMD_VXLAN_PORT_ADD,
|
|
|
|
* OCTNET_CMD_VXLAN_PORT_DEL
|
|
|
|
* @returns SUCCESS or FAILURE
|
|
|
|
*/
|
|
|
|
static int liquidio_vxlan_port_command(struct net_device *netdev, int command,
|
|
|
|
u16 vxlan_port, u8 vxlan_cmd_bit)
|
|
|
|
{
|
|
|
|
struct lio *lio = GET_LIO(netdev);
|
|
|
|
struct octeon_device *oct = lio->oct_dev;
|
|
|
|
struct octnic_ctrl_pkt nctrl;
|
|
|
|
int ret = 0;
|
|
|
|
|
2017-04-07 10:22:22 +08:00
|
|
|
memset(&nctrl, 0, sizeof(struct octnic_ctrl_pkt));
|
|
|
|
|
2016-12-09 05:00:45 +08:00
|
|
|
nctrl.ncmd.u64 = 0;
|
|
|
|
nctrl.ncmd.s.cmd = command;
|
|
|
|
nctrl.ncmd.s.more = vxlan_cmd_bit;
|
|
|
|
nctrl.ncmd.s.param1 = vxlan_port;
|
|
|
|
nctrl.iq_no = lio->linfo.txpciq[0].s.q_no;
|
|
|
|
nctrl.netpndev = (u64)netdev;
|
|
|
|
nctrl.cb_fn = liquidio_link_ctrl_cmd_completion;
|
|
|
|
|
|
|
|
ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl);
|
2018-08-29 09:51:40 +08:00
|
|
|
if (ret) {
|
2016-12-09 05:00:45 +08:00
|
|
|
dev_err(&oct->pci_dev->dev,
|
|
|
|
"DEVFLAGS VxLAN port add/delete failed in core (ret : 0x%x)\n",
|
|
|
|
ret);
|
2018-08-29 09:51:40 +08:00
|
|
|
if (ret > 0)
|
|
|
|
ret = -EIO;
|
2016-12-09 05:00:45 +08:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2020-07-15 03:18:27 +08:00
|
|
|
static int liquidio_udp_tunnel_set_port(struct net_device *netdev,
|
|
|
|
unsigned int table, unsigned int entry,
|
|
|
|
struct udp_tunnel_info *ti)
|
|
|
|
{
|
|
|
|
return liquidio_vxlan_port_command(netdev,
|
|
|
|
OCTNET_CMD_VXLAN_PORT_CONFIG,
|
|
|
|
htons(ti->port),
|
|
|
|
OCTNET_CMD_VXLAN_PORT_ADD);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int liquidio_udp_tunnel_unset_port(struct net_device *netdev,
|
|
|
|
unsigned int table,
|
|
|
|
unsigned int entry,
|
|
|
|
struct udp_tunnel_info *ti)
|
|
|
|
{
|
|
|
|
return liquidio_vxlan_port_command(netdev,
|
|
|
|
OCTNET_CMD_VXLAN_PORT_CONFIG,
|
|
|
|
htons(ti->port),
|
|
|
|
OCTNET_CMD_VXLAN_PORT_DEL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct udp_tunnel_nic_info liquidio_udp_tunnels = {
|
|
|
|
.set_port = liquidio_udp_tunnel_set_port,
|
|
|
|
.unset_port = liquidio_udp_tunnel_unset_port,
|
|
|
|
.tables = {
|
|
|
|
{ .n_entries = 1024, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
/** \brief Net device fix features
|
|
|
|
* @param netdev pointer to network device
|
|
|
|
* @param request features requested
|
|
|
|
* @returns updated features list
|
|
|
|
*/
|
|
|
|
static netdev_features_t liquidio_fix_features(struct net_device *netdev,
|
|
|
|
netdev_features_t request)
|
|
|
|
{
|
|
|
|
struct lio *lio = netdev_priv(netdev);
|
|
|
|
|
|
|
|
if ((request & NETIF_F_RXCSUM) &&
|
|
|
|
!(lio->dev_capability & NETIF_F_RXCSUM))
|
|
|
|
request &= ~NETIF_F_RXCSUM;
|
|
|
|
|
|
|
|
if ((request & NETIF_F_HW_CSUM) &&
|
|
|
|
!(lio->dev_capability & NETIF_F_HW_CSUM))
|
|
|
|
request &= ~NETIF_F_HW_CSUM;
|
|
|
|
|
|
|
|
if ((request & NETIF_F_TSO) && !(lio->dev_capability & NETIF_F_TSO))
|
|
|
|
request &= ~NETIF_F_TSO;
|
|
|
|
|
|
|
|
if ((request & NETIF_F_TSO6) && !(lio->dev_capability & NETIF_F_TSO6))
|
|
|
|
request &= ~NETIF_F_TSO6;
|
|
|
|
|
|
|
|
if ((request & NETIF_F_LRO) && !(lio->dev_capability & NETIF_F_LRO))
|
|
|
|
request &= ~NETIF_F_LRO;
|
|
|
|
|
|
|
|
/* Disable LRO if RXCSUM is off */
|
|
|
|
if (!(request & NETIF_F_RXCSUM) && (netdev->features & NETIF_F_LRO) &&
|
|
|
|
(lio->dev_capability & NETIF_F_LRO))
|
|
|
|
request &= ~NETIF_F_LRO;
|
|
|
|
|
|
|
|
return request;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** \brief Net device set features
|
|
|
|
* @param netdev pointer to network device
|
|
|
|
* @param features features to enable/disable
|
|
|
|
*/
|
|
|
|
static int liquidio_set_features(struct net_device *netdev,
|
|
|
|
netdev_features_t features)
|
|
|
|
{
|
|
|
|
struct lio *lio = netdev_priv(netdev);
|
|
|
|
|
|
|
|
if (!((netdev->features ^ features) & NETIF_F_LRO))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if ((features & NETIF_F_LRO) && (lio->dev_capability & NETIF_F_LRO))
|
|
|
|
liquidio_set_feature(netdev, OCTNET_CMD_LRO_ENABLE,
|
|
|
|
OCTNIC_LROIPV4 | OCTNIC_LROIPV6);
|
|
|
|
else if (!(features & NETIF_F_LRO) &&
|
|
|
|
(lio->dev_capability & NETIF_F_LRO))
|
|
|
|
liquidio_set_feature(netdev, OCTNET_CMD_LRO_DISABLE,
|
|
|
|
OCTNIC_LROIPV4 | OCTNIC_LROIPV6);
|
|
|
|
if (!(netdev->features & NETIF_F_RXCSUM) &&
|
|
|
|
(lio->enc_dev_capability & NETIF_F_RXCSUM) &&
|
|
|
|
(features & NETIF_F_RXCSUM))
|
|
|
|
liquidio_set_rxcsum_command(netdev, OCTNET_CMD_TNL_RX_CSUM_CTL,
|
|
|
|
OCTNET_CMD_RXCSUM_ENABLE);
|
|
|
|
else if ((netdev->features & NETIF_F_RXCSUM) &&
|
|
|
|
(lio->enc_dev_capability & NETIF_F_RXCSUM) &&
|
|
|
|
!(features & NETIF_F_RXCSUM))
|
|
|
|
liquidio_set_rxcsum_command(netdev, OCTNET_CMD_TNL_RX_CSUM_CTL,
|
|
|
|
OCTNET_CMD_RXCSUM_DISABLE);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct net_device_ops lionetdevops = {
|
2016-12-08 00:54:32 +08:00
|
|
|
.ndo_open = liquidio_open,
|
|
|
|
.ndo_stop = liquidio_stop,
|
2016-12-08 00:54:35 +08:00
|
|
|
.ndo_start_xmit = liquidio_xmit,
|
2018-04-26 08:00:22 +08:00
|
|
|
.ndo_get_stats64 = liquidio_get_stats64,
|
2016-12-08 00:54:33 +08:00
|
|
|
.ndo_set_mac_address = liquidio_set_mac,
|
|
|
|
.ndo_set_rx_mode = liquidio_set_mcast_list,
|
2016-12-08 00:54:35 +08:00
|
|
|
.ndo_tx_timeout = liquidio_tx_timeout,
|
2016-12-09 05:00:44 +08:00
|
|
|
.ndo_vlan_rx_add_vid = liquidio_vlan_rx_add_vid,
|
|
|
|
.ndo_vlan_rx_kill_vid = liquidio_vlan_rx_kill_vid,
|
2016-12-08 00:54:33 +08:00
|
|
|
.ndo_change_mtu = liquidio_change_mtu,
|
2016-12-09 05:00:47 +08:00
|
|
|
.ndo_do_ioctl = liquidio_ioctl,
|
2016-12-08 00:54:31 +08:00
|
|
|
.ndo_fix_features = liquidio_fix_features,
|
|
|
|
.ndo_set_features = liquidio_set_features,
|
2020-07-15 03:18:27 +08:00
|
|
|
.ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
|
|
|
|
.ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
|
2016-12-08 00:54:31 +08:00
|
|
|
};
|
|
|
|
|
2016-12-08 00:54:32 +08:00
|
|
|
static int lio_nic_info(struct octeon_recv_info *recv_info, void *buf)
|
|
|
|
{
|
|
|
|
struct octeon_device *oct = (struct octeon_device *)buf;
|
|
|
|
struct octeon_recv_pkt *recv_pkt = recv_info->recv_pkt;
|
|
|
|
union oct_link_status *ls;
|
|
|
|
int gmxport = 0;
|
|
|
|
int i;
|
|
|
|
|
2017-06-18 20:04:11 +08:00
|
|
|
if (recv_pkt->buffer_size[0] != (sizeof(*ls) + OCT_DROQ_INFO_SIZE)) {
|
2016-12-08 00:54:32 +08:00
|
|
|
dev_err(&oct->pci_dev->dev, "Malformed NIC_INFO, len=%d, ifidx=%d\n",
|
|
|
|
recv_pkt->buffer_size[0],
|
|
|
|
recv_pkt->rh.r_nic_info.gmxport);
|
|
|
|
goto nic_info_err;
|
|
|
|
}
|
|
|
|
|
|
|
|
gmxport = recv_pkt->rh.r_nic_info.gmxport;
|
2017-06-18 20:04:11 +08:00
|
|
|
ls = (union oct_link_status *)(get_rbd(recv_pkt->buffer_ptr[0]) +
|
|
|
|
OCT_DROQ_INFO_SIZE);
|
2016-12-08 00:54:32 +08:00
|
|
|
|
|
|
|
octeon_swap_8B_data((u64 *)ls, (sizeof(union oct_link_status)) >> 3);
|
|
|
|
|
|
|
|
for (i = 0; i < oct->ifcount; i++) {
|
|
|
|
if (oct->props[i].gmxport == gmxport) {
|
|
|
|
update_link_status(oct->props[i].netdev, ls);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nic_info_err:
|
|
|
|
for (i = 0; i < recv_pkt->buffer_count; i++)
|
|
|
|
recv_buffer_free(recv_pkt->buffer_ptr[i]);
|
|
|
|
octeon_free_recv_info(recv_info);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* setup_nic_devices - Setup network interfaces
|
|
|
|
* @octeon_dev: octeon device
|
2016-12-08 00:54:31 +08:00
|
|
|
*
|
|
|
|
* Called during init time for each device. It assumes the NIC
|
|
|
|
* is already up and running. The link information for each
|
|
|
|
* interface is passed in link_info.
|
|
|
|
*/
|
|
|
|
static int setup_nic_devices(struct octeon_device *octeon_dev)
|
|
|
|
{
|
|
|
|
int retval, num_iqueues, num_oqueues;
|
2018-08-29 09:51:44 +08:00
|
|
|
u32 resp_size, data_size;
|
2016-12-08 00:54:31 +08:00
|
|
|
struct liquidio_if_cfg_resp *resp;
|
|
|
|
struct octeon_soft_command *sc;
|
|
|
|
union oct_nic_if_cfg if_cfg;
|
|
|
|
struct octdev_props *props;
|
|
|
|
struct net_device *netdev;
|
|
|
|
struct lio_version *vdata;
|
|
|
|
struct lio *lio = NULL;
|
|
|
|
u8 mac[ETH_ALEN], i, j;
|
|
|
|
u32 ifidx_or_pfnum;
|
|
|
|
|
|
|
|
ifidx_or_pfnum = octeon_dev->pf_num;
|
|
|
|
|
2016-12-08 00:54:32 +08:00
|
|
|
/* This is to handle link status changes */
|
|
|
|
octeon_register_dispatch_fn(octeon_dev, OPCODE_NIC, OPCODE_NIC_INFO,
|
|
|
|
lio_nic_info, octeon_dev);
|
|
|
|
|
2016-12-08 00:54:36 +08:00
|
|
|
/* REQTYPE_RESP_NET and REQTYPE_SOFT_COMMAND do not have free functions.
|
|
|
|
* They are handled directly.
|
|
|
|
*/
|
|
|
|
octeon_register_reqtype_free_fn(octeon_dev, REQTYPE_NORESP_NET,
|
|
|
|
free_netbuf);
|
|
|
|
|
|
|
|
octeon_register_reqtype_free_fn(octeon_dev, REQTYPE_NORESP_NET_SG,
|
|
|
|
free_netsgbuf);
|
|
|
|
|
|
|
|
octeon_register_reqtype_free_fn(octeon_dev, REQTYPE_RESP_NET_SG,
|
|
|
|
free_netsgbuf_with_resp);
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
for (i = 0; i < octeon_dev->ifcount; i++) {
|
|
|
|
resp_size = sizeof(struct liquidio_if_cfg_resp);
|
|
|
|
data_size = sizeof(struct lio_version);
|
|
|
|
sc = (struct octeon_soft_command *)
|
|
|
|
octeon_alloc_soft_command(octeon_dev, data_size,
|
2018-08-29 09:51:44 +08:00
|
|
|
resp_size, 0);
|
2016-12-08 00:54:31 +08:00
|
|
|
resp = (struct liquidio_if_cfg_resp *)sc->virtrptr;
|
|
|
|
vdata = (struct lio_version *)sc->virtdptr;
|
|
|
|
|
|
|
|
*((u64 *)vdata) = 0;
|
|
|
|
vdata->major = cpu_to_be16(LIQUIDIO_BASE_MAJOR_VERSION);
|
|
|
|
vdata->minor = cpu_to_be16(LIQUIDIO_BASE_MINOR_VERSION);
|
|
|
|
vdata->micro = cpu_to_be16(LIQUIDIO_BASE_MICRO_VERSION);
|
|
|
|
|
|
|
|
if_cfg.u64 = 0;
|
|
|
|
|
|
|
|
if_cfg.s.num_iqueues = octeon_dev->sriov_info.rings_per_vf;
|
|
|
|
if_cfg.s.num_oqueues = octeon_dev->sriov_info.rings_per_vf;
|
|
|
|
if_cfg.s.base_queue = 0;
|
|
|
|
|
|
|
|
sc->iq_no = 0;
|
|
|
|
|
|
|
|
octeon_prepare_soft_command(octeon_dev, sc, OPCODE_NIC,
|
|
|
|
OPCODE_NIC_IF_CFG, 0, if_cfg.u64,
|
|
|
|
0);
|
|
|
|
|
2018-08-29 09:51:44 +08:00
|
|
|
init_completion(&sc->complete);
|
|
|
|
sc->sc_status = OCTEON_REQUEST_PENDING;
|
2016-12-08 00:54:31 +08:00
|
|
|
|
|
|
|
retval = octeon_send_soft_command(octeon_dev, sc);
|
|
|
|
if (retval == IQ_SEND_FAILED) {
|
|
|
|
dev_err(&octeon_dev->pci_dev->dev,
|
|
|
|
"iq/oq config failed status: %x\n", retval);
|
|
|
|
/* Soft instr is freed by driver in case of failure. */
|
2018-08-29 09:51:44 +08:00
|
|
|
octeon_free_soft_command(octeon_dev, sc);
|
|
|
|
return(-EIO);
|
2016-12-08 00:54:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Sleep on a wait queue till the cond flag indicates that the
|
|
|
|
* response arrived or timed-out.
|
|
|
|
*/
|
2018-08-29 09:51:44 +08:00
|
|
|
retval = wait_for_sc_completion_timeout(octeon_dev, sc, 0);
|
|
|
|
if (retval)
|
|
|
|
return retval;
|
2016-12-08 00:54:31 +08:00
|
|
|
|
|
|
|
retval = resp->status;
|
|
|
|
if (retval) {
|
2018-08-29 09:51:44 +08:00
|
|
|
dev_err(&octeon_dev->pci_dev->dev,
|
|
|
|
"iq/oq config failed, retval = %d\n", retval);
|
|
|
|
WRITE_ONCE(sc->caller_is_done, true);
|
|
|
|
return -EIO;
|
2016-12-08 00:54:31 +08:00
|
|
|
}
|
|
|
|
|
2018-08-29 09:51:44 +08:00
|
|
|
snprintf(octeon_dev->fw_info.liquidio_firmware_version,
|
|
|
|
32, "%s",
|
|
|
|
resp->cfg_info.liquidio_firmware_version);
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
octeon_swap_8B_data((u64 *)(&resp->cfg_info),
|
|
|
|
(sizeof(struct liquidio_if_cfg_info)) >> 3);
|
|
|
|
|
|
|
|
num_iqueues = hweight64(resp->cfg_info.iqmask);
|
|
|
|
num_oqueues = hweight64(resp->cfg_info.oqmask);
|
|
|
|
|
|
|
|
if (!(num_iqueues) || !(num_oqueues)) {
|
|
|
|
dev_err(&octeon_dev->pci_dev->dev,
|
|
|
|
"Got bad iqueues (%016llx) or oqueues (%016llx) from firmware.\n",
|
|
|
|
resp->cfg_info.iqmask, resp->cfg_info.oqmask);
|
2018-08-29 09:51:44 +08:00
|
|
|
WRITE_ONCE(sc->caller_is_done, true);
|
|
|
|
goto setup_nic_dev_done;
|
2016-12-08 00:54:31 +08:00
|
|
|
}
|
|
|
|
dev_dbg(&octeon_dev->pci_dev->dev,
|
|
|
|
"interface %d, iqmask %016llx, oqmask %016llx, numiqueues %d, numoqueues %d\n",
|
|
|
|
i, resp->cfg_info.iqmask, resp->cfg_info.oqmask,
|
|
|
|
num_iqueues, num_oqueues);
|
|
|
|
|
|
|
|
netdev = alloc_etherdev_mq(LIO_SIZE, num_iqueues);
|
|
|
|
|
|
|
|
if (!netdev) {
|
|
|
|
dev_err(&octeon_dev->pci_dev->dev, "Device allocation failed\n");
|
2018-08-29 09:51:44 +08:00
|
|
|
WRITE_ONCE(sc->caller_is_done, true);
|
|
|
|
goto setup_nic_dev_done;
|
2016-12-08 00:54:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SET_NETDEV_DEV(netdev, &octeon_dev->pci_dev->dev);
|
|
|
|
|
|
|
|
/* Associate the routines that will handle different
|
|
|
|
* netdev tasks.
|
|
|
|
*/
|
|
|
|
netdev->netdev_ops = &lionetdevops;
|
|
|
|
|
|
|
|
lio = GET_LIO(netdev);
|
|
|
|
|
|
|
|
memset(lio, 0, sizeof(struct lio));
|
|
|
|
|
|
|
|
lio->ifidx = ifidx_or_pfnum;
|
|
|
|
|
|
|
|
props = &octeon_dev->props[i];
|
|
|
|
props->gmxport = resp->cfg_info.linfo.gmxport;
|
|
|
|
props->netdev = netdev;
|
|
|
|
|
|
|
|
lio->linfo.num_rxpciq = num_oqueues;
|
|
|
|
lio->linfo.num_txpciq = num_iqueues;
|
|
|
|
|
|
|
|
for (j = 0; j < num_oqueues; j++) {
|
|
|
|
lio->linfo.rxpciq[j].u64 =
|
|
|
|
resp->cfg_info.linfo.rxpciq[j].u64;
|
|
|
|
}
|
|
|
|
for (j = 0; j < num_iqueues; j++) {
|
|
|
|
lio->linfo.txpciq[j].u64 =
|
|
|
|
resp->cfg_info.linfo.txpciq[j].u64;
|
|
|
|
}
|
|
|
|
|
|
|
|
lio->linfo.hw_addr = resp->cfg_info.linfo.hw_addr;
|
|
|
|
lio->linfo.gmxport = resp->cfg_info.linfo.gmxport;
|
|
|
|
lio->linfo.link.u64 = resp->cfg_info.linfo.link.u64;
|
|
|
|
lio->linfo.macaddr_is_admin_asgnd =
|
|
|
|
resp->cfg_info.linfo.macaddr_is_admin_asgnd;
|
2018-09-06 09:40:56 +08:00
|
|
|
lio->linfo.macaddr_spoofchk =
|
|
|
|
resp->cfg_info.linfo.macaddr_spoofchk;
|
2016-12-08 00:54:31 +08:00
|
|
|
|
|
|
|
lio->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE);
|
|
|
|
|
|
|
|
lio->dev_capability = NETIF_F_HIGHDMA
|
|
|
|
| NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM
|
|
|
|
| NETIF_F_SG | NETIF_F_RXCSUM
|
|
|
|
| NETIF_F_TSO | NETIF_F_TSO6
|
|
|
|
| NETIF_F_GRO
|
|
|
|
| NETIF_F_LRO;
|
|
|
|
netif_set_gso_max_size(netdev, OCTNIC_GSO_MAX_SIZE);
|
|
|
|
|
2016-12-09 05:00:45 +08:00
|
|
|
/* Copy of transmit encapsulation capabilities:
|
|
|
|
* TSO, TSO6, Checksums for this device
|
|
|
|
*/
|
|
|
|
lio->enc_dev_capability = NETIF_F_IP_CSUM
|
|
|
|
| NETIF_F_IPV6_CSUM
|
|
|
|
| NETIF_F_GSO_UDP_TUNNEL
|
|
|
|
| NETIF_F_HW_CSUM | NETIF_F_SG
|
|
|
|
| NETIF_F_RXCSUM
|
|
|
|
| NETIF_F_TSO | NETIF_F_TSO6
|
|
|
|
| NETIF_F_LRO;
|
|
|
|
|
|
|
|
netdev->hw_enc_features =
|
|
|
|
(lio->enc_dev_capability & ~NETIF_F_LRO);
|
2020-07-15 03:18:27 +08:00
|
|
|
netdev->udp_tunnel_nic_info = &liquidio_udp_tunnels;
|
|
|
|
|
2016-12-09 05:00:44 +08:00
|
|
|
netdev->vlan_features = lio->dev_capability;
|
|
|
|
/* Add any unchangeable hw features */
|
|
|
|
lio->dev_capability |= NETIF_F_HW_VLAN_CTAG_FILTER |
|
|
|
|
NETIF_F_HW_VLAN_CTAG_RX |
|
|
|
|
NETIF_F_HW_VLAN_CTAG_TX;
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
netdev->features = (lio->dev_capability & ~NETIF_F_LRO);
|
|
|
|
|
|
|
|
netdev->hw_features = lio->dev_capability;
|
2018-05-02 01:32:10 +08:00
|
|
|
netdev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX;
|
2016-12-08 00:54:31 +08:00
|
|
|
|
2016-12-08 00:54:33 +08:00
|
|
|
/* MTU range: 68 - 16000 */
|
|
|
|
netdev->min_mtu = LIO_MIN_MTU_SIZE;
|
|
|
|
netdev->max_mtu = LIO_MAX_MTU_SIZE;
|
|
|
|
|
2018-08-29 09:51:44 +08:00
|
|
|
WRITE_ONCE(sc->caller_is_done, true);
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
/* Point to the properties for octeon device to which this
|
|
|
|
* interface belongs.
|
|
|
|
*/
|
|
|
|
lio->oct_dev = octeon_dev;
|
|
|
|
lio->octprops = props;
|
|
|
|
lio->netdev = netdev;
|
|
|
|
|
|
|
|
dev_dbg(&octeon_dev->pci_dev->dev,
|
|
|
|
"if%d gmx: %d hw_addr: 0x%llx\n", i,
|
|
|
|
lio->linfo.gmxport, CVM_CAST64(lio->linfo.hw_addr));
|
|
|
|
|
|
|
|
/* 64-bit swap required on LE machines */
|
|
|
|
octeon_swap_8B_data(&lio->linfo.hw_addr, 1);
|
|
|
|
for (j = 0; j < ETH_ALEN; j++)
|
|
|
|
mac[j] = *((u8 *)(((u8 *)&lio->linfo.hw_addr) + 2 + j));
|
|
|
|
|
|
|
|
/* Copy MAC Address to OS network device structure */
|
|
|
|
ether_addr_copy(netdev->dev_addr, mac);
|
|
|
|
|
2017-08-16 03:46:18 +08:00
|
|
|
if (liquidio_setup_io_queues(octeon_dev, i,
|
|
|
|
lio->linfo.num_txpciq,
|
|
|
|
lio->linfo.num_rxpciq)) {
|
2016-12-08 00:54:35 +08:00
|
|
|
dev_err(&octeon_dev->pci_dev->dev, "I/O queues creation failed\n");
|
2018-08-29 09:51:44 +08:00
|
|
|
goto setup_nic_dev_free;
|
2016-12-08 00:54:35 +08:00
|
|
|
}
|
|
|
|
|
2016-12-08 00:54:37 +08:00
|
|
|
ifstate_set(lio, LIO_IFSTATE_DROQ_OPS);
|
|
|
|
|
2016-12-08 00:54:35 +08:00
|
|
|
/* For VFs, enable Octeon device interrupts here,
|
|
|
|
* as this is contingent upon IO queue setup
|
|
|
|
*/
|
|
|
|
octeon_dev->fn_list.enable_interrupt(octeon_dev,
|
|
|
|
OCTEON_ALL_INTR);
|
|
|
|
|
|
|
|
/* By default all interfaces on a single Octeon uses the same
|
|
|
|
* tx and rx queues
|
|
|
|
*/
|
|
|
|
lio->txq = lio->linfo.txpciq[0].s.q_no;
|
2016-12-08 00:54:37 +08:00
|
|
|
lio->rxq = lio->linfo.rxpciq[0].s.q_no;
|
2016-12-08 00:54:35 +08:00
|
|
|
|
|
|
|
lio->tx_qsize = octeon_get_tx_qsize(octeon_dev, lio->txq);
|
2016-12-08 00:54:37 +08:00
|
|
|
lio->rx_qsize = octeon_get_rx_qsize(octeon_dev, lio->rxq);
|
2016-12-08 00:54:35 +08:00
|
|
|
|
2018-04-28 14:32:55 +08:00
|
|
|
if (lio_setup_glists(octeon_dev, lio, num_iqueues)) {
|
2016-12-08 00:54:34 +08:00
|
|
|
dev_err(&octeon_dev->pci_dev->dev,
|
|
|
|
"Gather list allocation failed\n");
|
2018-08-29 09:51:44 +08:00
|
|
|
goto setup_nic_dev_free;
|
2016-12-08 00:54:34 +08:00
|
|
|
}
|
|
|
|
|
2016-12-09 05:00:46 +08:00
|
|
|
/* Register ethtool support */
|
|
|
|
liquidio_set_ethtool_ops(netdev);
|
|
|
|
if (lio->oct_dev->chip_id == OCTEON_CN23XX_VF_VID)
|
|
|
|
octeon_dev->priv_flags = OCT_PRIV_FLAG_DEFAULT;
|
|
|
|
else
|
|
|
|
octeon_dev->priv_flags = 0x0;
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
if (netdev->features & NETIF_F_LRO)
|
|
|
|
liquidio_set_feature(netdev, OCTNET_CMD_LRO_ENABLE,
|
|
|
|
OCTNIC_LROIPV4 | OCTNIC_LROIPV6);
|
|
|
|
|
2016-12-08 00:54:32 +08:00
|
|
|
if (setup_link_status_change_wq(netdev))
|
2018-08-29 09:51:44 +08:00
|
|
|
goto setup_nic_dev_free;
|
2016-12-08 00:54:32 +08:00
|
|
|
|
2017-03-23 02:31:13 +08:00
|
|
|
if (setup_rx_oom_poll_fn(netdev))
|
2018-08-29 09:51:44 +08:00
|
|
|
goto setup_nic_dev_free;
|
2017-03-23 02:31:13 +08:00
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
/* Register the network device with the OS */
|
|
|
|
if (register_netdev(netdev)) {
|
|
|
|
dev_err(&octeon_dev->pci_dev->dev, "Device registration failed\n");
|
2018-08-29 09:51:44 +08:00
|
|
|
goto setup_nic_dev_free;
|
2016-12-08 00:54:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
dev_dbg(&octeon_dev->pci_dev->dev,
|
|
|
|
"Setup NIC ifidx:%d mac:%02x%02x%02x%02x%02x%02x\n",
|
|
|
|
i, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
|
|
|
netif_carrier_off(netdev);
|
|
|
|
lio->link_changes++;
|
|
|
|
|
|
|
|
ifstate_set(lio, LIO_IFSTATE_REGISTERED);
|
|
|
|
|
|
|
|
/* Sending command to firmware to enable Rx checksum offload
|
|
|
|
* by default at the time of setup of Liquidio driver for
|
|
|
|
* this device
|
|
|
|
*/
|
|
|
|
liquidio_set_rxcsum_command(netdev, OCTNET_CMD_TNL_RX_CSUM_CTL,
|
|
|
|
OCTNET_CMD_RXCSUM_ENABLE);
|
|
|
|
liquidio_set_feature(netdev, OCTNET_CMD_TNL_TX_CSUM_CTL,
|
|
|
|
OCTNET_CMD_TXCSUM_ENABLE);
|
|
|
|
|
|
|
|
dev_dbg(&octeon_dev->pci_dev->dev,
|
|
|
|
"NIC ifidx:%d Setup successful\n", i);
|
|
|
|
|
2018-05-05 02:07:19 +08:00
|
|
|
octeon_dev->no_speed_setting = 1;
|
2016-12-08 00:54:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2018-08-29 09:51:44 +08:00
|
|
|
setup_nic_dev_free:
|
2016-12-08 00:54:31 +08:00
|
|
|
|
|
|
|
while (i--) {
|
|
|
|
dev_err(&octeon_dev->pci_dev->dev,
|
|
|
|
"NIC ifidx:%d Setup failed\n", i);
|
|
|
|
liquidio_destroy_nic_device(octeon_dev, i);
|
|
|
|
}
|
2018-08-29 09:51:44 +08:00
|
|
|
|
|
|
|
setup_nic_dev_done:
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* liquidio_init_nic_module - initialize the NIC
|
|
|
|
* @oct: octeon device
|
2016-12-08 00:54:31 +08:00
|
|
|
*
|
|
|
|
* This initialization routine is called once the Octeon device application is
|
|
|
|
* up and running
|
|
|
|
*/
|
|
|
|
static int liquidio_init_nic_module(struct octeon_device *oct)
|
|
|
|
{
|
|
|
|
int num_nic_ports = 1;
|
|
|
|
int i, retval = 0;
|
|
|
|
|
|
|
|
dev_dbg(&oct->pci_dev->dev, "Initializing network interfaces\n");
|
|
|
|
|
|
|
|
/* only default iq and oq were initialized
|
|
|
|
* initialize the rest as well run port_config command for each port
|
|
|
|
*/
|
|
|
|
oct->ifcount = num_nic_ports;
|
|
|
|
memset(oct->props, 0,
|
|
|
|
sizeof(struct octdev_props) * num_nic_ports);
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_OCTEON_LINKS; i++)
|
|
|
|
oct->props[i].gmxport = -1;
|
|
|
|
|
|
|
|
retval = setup_nic_devices(oct);
|
|
|
|
if (retval) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "Setup NIC devices failed\n");
|
|
|
|
goto octnet_init_failure;
|
|
|
|
}
|
|
|
|
|
2016-12-09 05:00:46 +08:00
|
|
|
dev_dbg(&oct->pci_dev->dev, "Network interfaces ready\n");
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
octnet_init_failure:
|
|
|
|
|
|
|
|
oct->ifcount = 0;
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2016-11-29 08:54:35 +08:00
|
|
|
/**
|
drivers/net/ethernet: clean up mis-targeted comments
As part of the W=1 cleanups for ethernet, a million [*] driver
comments had to be cleaned up to get the W=1 compilation to
succeed. This change finally makes the drivers/net/ethernet tree
compile with W=1 set on the command line. NOTE: The kernel uses
kdoc style (see Documentation/process/kernel-doc.rst) when
documenting code, not doxygen or other styles.
After this patch the x86_64 build has no warnings from W=1, however
scripts/kernel-doc says there are 1545 more warnings in source files, that
I need to develop a script to fix in a followup patch.
The errors fixed here are all kdoc of a few classes, with a few outliers:
In file included from drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:10:
drivers/net/ethernet/qlogic/netxen/netxen_nic.h:1193:18: warning: ‘FW_DUMP_LEVELS’ defined but not used [-Wunused-const-variable=]
1193 | static const u32 FW_DUMP_LEVELS[] = { 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
| ^~~~~~~~~~~~~~
... repeats 4 times...
drivers/net/ethernet/sun/cassini.c:2084:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
2084 | RX_USED_ADD(page, i);
drivers/net/ethernet/natsemi/ns83820.c: In function ‘phy_intr’:
drivers/net/ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
603 | u32 tbisr, tanar, tanlpar;
| ^~~~~
drivers/net/ethernet/natsemi/ns83820.c: In function ‘ns83820_get_link_ksettings’:
drivers/net/ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
1207 | u32 cfg, tanar, tbicr;
| ^~~~~
drivers/net/ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
1063 | int data_size, yf_size;
| ^~~~~~~
Normal kdoc fixes:
warning: Function parameter or member 'x' not described in 'y'
warning: Excess function parameter 'x' description in 'y'
warning: Cannot understand <string> on line <NNN> - I thought it was a doc line
[*] - ok it wasn't quite a million, but it felt like it.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 06:24:45 +08:00
|
|
|
* octeon_device_init - Device initialization for each Octeon device that is probed
|
|
|
|
* @oct: octeon device
|
2016-11-29 08:54:35 +08:00
|
|
|
*/
|
|
|
|
static int octeon_device_init(struct octeon_device *oct)
|
|
|
|
{
|
|
|
|
u32 rev_id;
|
2016-11-29 08:54:41 +08:00
|
|
|
int j;
|
2016-11-29 08:54:35 +08:00
|
|
|
|
|
|
|
atomic_set(&oct->status, OCT_DEV_BEGIN_STATE);
|
|
|
|
|
|
|
|
/* Enable access to the octeon device and make its DMA capability
|
|
|
|
* known to the OS.
|
|
|
|
*/
|
|
|
|
if (octeon_pci_os_setup(oct))
|
|
|
|
return 1;
|
|
|
|
atomic_set(&oct->status, OCT_DEV_PCI_ENABLE_DONE);
|
|
|
|
|
|
|
|
oct->chip_id = OCTEON_CN23XX_VF_VID;
|
|
|
|
pci_read_config_dword(oct->pci_dev, 8, &rev_id);
|
|
|
|
oct->rev_id = rev_id & 0xff;
|
|
|
|
|
|
|
|
if (cn23xx_setup_octeon_vf_device(oct))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
atomic_set(&oct->status, OCT_DEV_PCI_MAP_DONE);
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
oct->app_mode = CVM_DRV_NIC_APP;
|
|
|
|
|
2016-11-29 08:54:38 +08:00
|
|
|
/* Initialize the dispatch mechanism used to push packets arriving on
|
|
|
|
* Octeon Output queues.
|
|
|
|
*/
|
|
|
|
if (octeon_init_dispatch_list(oct))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
atomic_set(&oct->status, OCT_DEV_DISPATCH_INIT_DONE);
|
|
|
|
|
2016-11-29 08:54:36 +08:00
|
|
|
if (octeon_set_io_queues_off(oct)) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "setting io queues off failed\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-11-29 08:54:37 +08:00
|
|
|
if (oct->fn_list.setup_device_regs(oct)) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "device registers configuration failed\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-11-29 08:54:38 +08:00
|
|
|
/* Initialize soft command buffer pool */
|
|
|
|
if (octeon_setup_sc_buffer_pool(oct)) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "sc buffer pool allocation failed\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
atomic_set(&oct->status, OCT_DEV_SC_BUFF_POOL_INIT_DONE);
|
|
|
|
|
|
|
|
/* Setup the data structures that manage this Octeon's Input queues. */
|
|
|
|
if (octeon_setup_instr_queues(oct)) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "instruction queue initialization failed\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
atomic_set(&oct->status, OCT_DEV_INSTR_QUEUE_INIT_DONE);
|
|
|
|
|
|
|
|
/* Initialize lists to manage the requests of different types that
|
|
|
|
* arrive from user & kernel applications for this octeon device.
|
|
|
|
*/
|
|
|
|
if (octeon_setup_response_list(oct)) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "Response list allocation failed\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
atomic_set(&oct->status, OCT_DEV_RESP_LIST_INIT_DONE);
|
|
|
|
|
|
|
|
if (octeon_setup_output_queues(oct)) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "Output queue initialization failed\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
atomic_set(&oct->status, OCT_DEV_DROQ_INIT_DONE);
|
|
|
|
|
2016-11-29 08:54:39 +08:00
|
|
|
if (oct->fn_list.setup_mbox(oct)) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "Mailbox setup failed\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
atomic_set(&oct->status, OCT_DEV_MBOX_SETUP_DONE);
|
|
|
|
|
2018-04-28 14:32:57 +08:00
|
|
|
if (octeon_allocate_ioq_vector(oct, oct->sriov_info.rings_per_vf)) {
|
2016-11-29 08:54:40 +08:00
|
|
|
dev_err(&oct->pci_dev->dev, "ioq vector allocation failed\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
atomic_set(&oct->status, OCT_DEV_MSIX_ALLOC_VECTOR_DONE);
|
|
|
|
|
2020-03-01 22:44:37 +08:00
|
|
|
dev_info(&oct->pci_dev->dev, "OCTEON_CN23XX VF: %d ioqs\n",
|
|
|
|
oct->sriov_info.rings_per_vf);
|
2016-11-29 08:54:40 +08:00
|
|
|
|
|
|
|
/* Setup the interrupt handler and record the INT SUM register address*/
|
2017-08-16 03:46:18 +08:00
|
|
|
if (octeon_setup_interrupt(oct, oct->sriov_info.rings_per_vf))
|
2016-11-29 08:54:40 +08:00
|
|
|
return 1;
|
|
|
|
|
2017-06-01 00:48:09 +08:00
|
|
|
atomic_set(&oct->status, OCT_DEV_INTR_SET_DONE);
|
|
|
|
|
|
|
|
/* ***************************************************************
|
|
|
|
* The interrupts need to be enabled for the PF<-->VF handshake.
|
|
|
|
* They are [re]-enabled after the PF<-->VF handshake so that the
|
|
|
|
* correct OQ tick value is used (i.e. the value retrieved from
|
|
|
|
* the PF as part of the handshake).
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Enable Octeon device interrupts */
|
|
|
|
oct->fn_list.enable_interrupt(oct, OCTEON_ALL_INTR);
|
|
|
|
|
2016-11-29 08:54:40 +08:00
|
|
|
if (cn23xx_octeon_pfvf_handshake(oct))
|
|
|
|
return 1;
|
|
|
|
|
2017-06-01 00:48:09 +08:00
|
|
|
/* Here we [re]-enable the interrupts so that the correct OQ tick value
|
|
|
|
* is used (i.e. the value that was retrieved during the handshake)
|
|
|
|
*/
|
|
|
|
|
2016-11-29 08:54:40 +08:00
|
|
|
/* Enable Octeon device interrupts */
|
|
|
|
oct->fn_list.enable_interrupt(oct, OCTEON_ALL_INTR);
|
2017-06-01 00:48:09 +08:00
|
|
|
/* *************************************************************** */
|
2016-11-29 08:54:40 +08:00
|
|
|
|
2016-11-29 08:54:41 +08:00
|
|
|
/* Enable the input and output queues for this Octeon device */
|
|
|
|
if (oct->fn_list.enable_io_queues(oct)) {
|
|
|
|
dev_err(&oct->pci_dev->dev, "enabling io queues failed\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
atomic_set(&oct->status, OCT_DEV_IO_QUEUES_DONE);
|
|
|
|
|
|
|
|
atomic_set(&oct->status, OCT_DEV_HOST_OK);
|
|
|
|
|
|
|
|
/* Send Credit for Octeon Output queues. Credits are always sent after
|
|
|
|
* the output queue is enabled.
|
|
|
|
*/
|
|
|
|
for (j = 0; j < oct->num_oqs; j++)
|
|
|
|
writel(oct->droq[j]->max_count, oct->droq[j]->pkts_credit_reg);
|
|
|
|
|
|
|
|
/* Packets can start arriving on the output queues from this point. */
|
|
|
|
|
|
|
|
atomic_set(&oct->status, OCT_DEV_CORE_OK);
|
|
|
|
|
|
|
|
atomic_set(&oct->status, OCT_DEV_RUNNING);
|
|
|
|
|
2016-12-08 00:54:31 +08:00
|
|
|
if (liquidio_init_nic_module(oct))
|
|
|
|
return 1;
|
|
|
|
|
2016-11-29 08:54:35 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-11-29 08:54:34 +08:00
|
|
|
static int __init liquidio_vf_init(void)
|
|
|
|
{
|
|
|
|
octeon_init_device_list(0);
|
|
|
|
return pci_register_driver(&liquidio_vf_pci_driver);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit liquidio_vf_exit(void)
|
|
|
|
{
|
|
|
|
pci_unregister_driver(&liquidio_vf_pci_driver);
|
|
|
|
|
|
|
|
pr_info("LiquidIO_VF network module is now unloaded\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
module_init(liquidio_vf_init);
|
|
|
|
module_exit(liquidio_vf_exit);
|