2019-09-03 15:28:07 -07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
|
|
|
|
|
|
|
|
#ifndef _IONIC_LIF_H_
|
|
|
|
#define _IONIC_LIF_H_
|
|
|
|
|
2021-04-01 10:56:04 -07:00
|
|
|
#include <linux/ptp_clock_kernel.h>
|
|
|
|
#include <linux/timecounter.h>
|
|
|
|
#include <uapi/linux/net_tstamp.h>
|
2020-09-15 16:59:03 -07:00
|
|
|
#include <linux/dim.h>
|
2019-09-03 15:28:07 -07:00
|
|
|
#include <linux/pci.h>
|
2019-09-03 15:28:13 -07:00
|
|
|
#include "ionic_rx_filter.h"
|
2019-09-03 15:28:07 -07:00
|
|
|
|
2019-09-03 15:28:09 -07:00
|
|
|
#define IONIC_ADMINQ_LENGTH 16 /* must be a power of two */
|
2019-09-03 15:28:11 -07:00
|
|
|
#define IONIC_NOTIFYQ_LENGTH 64 /* must be a power of two */
|
2019-09-03 15:28:09 -07:00
|
|
|
|
2020-11-12 10:22:08 -08:00
|
|
|
#define ADD_ADDR true
|
|
|
|
#define DEL_ADDR false
|
|
|
|
#define CAN_SLEEP true
|
|
|
|
#define CAN_NOT_SLEEP false
|
|
|
|
|
2019-09-03 15:28:19 -07:00
|
|
|
#define IONIC_RX_COPYBREAK_DEFAULT 256
|
2020-07-31 13:15:35 -07:00
|
|
|
#define IONIC_TX_BUDGET_DEFAULT 256
|
2019-09-03 15:28:09 -07:00
|
|
|
|
|
|
|
struct ionic_tx_stats {
|
|
|
|
u64 pkts;
|
|
|
|
u64 bytes;
|
2020-05-11 17:59:35 -07:00
|
|
|
u64 csum_none;
|
2019-09-03 15:28:17 -07:00
|
|
|
u64 csum;
|
|
|
|
u64 tso;
|
2020-05-11 17:59:35 -07:00
|
|
|
u64 tso_bytes;
|
2019-09-03 15:28:17 -07:00
|
|
|
u64 frags;
|
2020-05-11 17:59:35 -07:00
|
|
|
u64 vlan_inserted;
|
2020-09-01 11:20:20 -07:00
|
|
|
u64 clean;
|
|
|
|
u64 linearize;
|
|
|
|
u64 crc32_csum;
|
|
|
|
u64 dma_map_err;
|
2021-04-01 10:56:04 -07:00
|
|
|
u64 hwstamp_valid;
|
|
|
|
u64 hwstamp_invalid;
|
2024-02-14 09:59:06 -08:00
|
|
|
u64 xdp_frames;
|
2019-09-03 15:28:09 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ionic_rx_stats {
|
|
|
|
u64 pkts;
|
|
|
|
u64 bytes;
|
2019-09-03 15:28:17 -07:00
|
|
|
u64 csum_none;
|
|
|
|
u64 csum_complete;
|
2020-01-06 19:43:47 -08:00
|
|
|
u64 dropped;
|
2020-05-11 17:59:35 -07:00
|
|
|
u64 vlan_stripped;
|
2020-09-01 11:20:20 -07:00
|
|
|
u64 csum_error;
|
|
|
|
u64 dma_map_err;
|
|
|
|
u64 alloc_err;
|
2021-04-01 10:56:04 -07:00
|
|
|
u64 hwstamp_valid;
|
|
|
|
u64 hwstamp_invalid;
|
2024-02-14 09:59:04 -08:00
|
|
|
u64 xdp_drop;
|
|
|
|
u64 xdp_aborted;
|
|
|
|
u64 xdp_pass;
|
2024-02-14 09:59:06 -08:00
|
|
|
u64 xdp_tx;
|
2024-02-14 09:59:07 -08:00
|
|
|
u64 xdp_redirect;
|
2019-09-03 15:28:09 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#define IONIC_QCQ_F_INITED BIT(0)
|
|
|
|
#define IONIC_QCQ_F_SG BIT(1)
|
|
|
|
#define IONIC_QCQ_F_INTR BIT(2)
|
2019-09-03 15:28:17 -07:00
|
|
|
#define IONIC_QCQ_F_TX_STATS BIT(3)
|
|
|
|
#define IONIC_QCQ_F_RX_STATS BIT(4)
|
2019-09-03 15:28:11 -07:00
|
|
|
#define IONIC_QCQ_F_NOTIFYQ BIT(5)
|
2023-02-10 16:50:17 -08:00
|
|
|
#define IONIC_QCQ_F_CMB_RINGS BIT(6)
|
2019-09-03 15:28:09 -07:00
|
|
|
|
|
|
|
struct ionic_qcq {
|
2020-08-27 16:00:25 -07:00
|
|
|
void *q_base;
|
|
|
|
dma_addr_t q_base_pa;
|
|
|
|
u32 q_size;
|
2024-03-06 15:29:55 -08:00
|
|
|
u32 cq_size;
|
2020-08-27 16:00:25 -07:00
|
|
|
void *cq_base;
|
|
|
|
dma_addr_t cq_base_pa;
|
|
|
|
void *sg_base;
|
|
|
|
dma_addr_t sg_base_pa;
|
|
|
|
u32 sg_size;
|
2024-03-06 15:29:55 -08:00
|
|
|
unsigned int flags;
|
2023-02-10 16:50:17 -08:00
|
|
|
void __iomem *cmb_q_base;
|
|
|
|
phys_addr_t cmb_q_base_pa;
|
|
|
|
u32 cmb_q_size;
|
|
|
|
u32 cmb_pgid;
|
|
|
|
u32 cmb_order;
|
2020-09-15 16:59:03 -07:00
|
|
|
struct dim dim;
|
2019-09-03 15:28:09 -07:00
|
|
|
struct ionic_queue q;
|
|
|
|
struct ionic_cq cq;
|
|
|
|
struct napi_struct napi;
|
2024-03-06 15:29:55 -08:00
|
|
|
struct ionic_intr_info intr;
|
2024-06-18 17:32:54 -07:00
|
|
|
struct work_struct doorbell_napi_work;
|
2019-09-03 15:28:09 -07:00
|
|
|
struct dentry *dentry;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define q_to_qcq(q) container_of(q, struct ionic_qcq, q)
|
2020-08-27 16:00:23 -07:00
|
|
|
#define q_to_tx_stats(q) (&(q)->lif->txqstats[(q)->index])
|
|
|
|
#define q_to_rx_stats(q) (&(q)->lif->rxqstats[(q)->index])
|
2019-09-03 15:28:09 -07:00
|
|
|
#define napi_to_qcq(napi) container_of(napi, struct ionic_qcq, napi)
|
|
|
|
#define napi_to_cq(napi) (&napi_to_qcq(napi)->cq)
|
|
|
|
|
2019-09-03 15:28:14 -07:00
|
|
|
enum ionic_deferred_work_type {
|
|
|
|
IONIC_DW_TYPE_RX_MODE,
|
|
|
|
IONIC_DW_TYPE_LINK_STATUS,
|
|
|
|
IONIC_DW_TYPE_LIF_RESET,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ionic_deferred_work {
|
|
|
|
struct list_head list;
|
|
|
|
enum ionic_deferred_work_type type;
|
|
|
|
union {
|
|
|
|
u8 addr[ETH_ALEN];
|
2020-03-27 20:14:48 -07:00
|
|
|
u8 fw_status;
|
2019-09-03 15:28:14 -07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ionic_deferred {
|
|
|
|
spinlock_t lock; /* lock for deferred work list */
|
|
|
|
struct list_head list;
|
|
|
|
struct work_struct work;
|
|
|
|
};
|
|
|
|
|
2019-09-03 15:28:19 -07:00
|
|
|
struct ionic_lif_sw_stats {
|
|
|
|
u64 tx_packets;
|
|
|
|
u64 tx_bytes;
|
|
|
|
u64 rx_packets;
|
|
|
|
u64 rx_bytes;
|
|
|
|
u64 tx_tso;
|
2020-05-11 17:59:35 -07:00
|
|
|
u64 tx_tso_bytes;
|
|
|
|
u64 tx_csum_none;
|
2019-09-03 15:28:19 -07:00
|
|
|
u64 tx_csum;
|
|
|
|
u64 rx_csum_none;
|
|
|
|
u64 rx_csum_complete;
|
|
|
|
u64 rx_csum_error;
|
2021-04-01 10:56:04 -07:00
|
|
|
u64 tx_hwstamp_valid;
|
|
|
|
u64 tx_hwstamp_invalid;
|
|
|
|
u64 rx_hwstamp_valid;
|
|
|
|
u64 rx_hwstamp_invalid;
|
2020-05-11 17:59:35 -07:00
|
|
|
u64 hw_tx_dropped;
|
|
|
|
u64 hw_rx_dropped;
|
|
|
|
u64 hw_rx_over_errors;
|
|
|
|
u64 hw_rx_missed_errors;
|
|
|
|
u64 hw_tx_aborted_errors;
|
2024-02-14 09:59:04 -08:00
|
|
|
u64 xdp_drop;
|
|
|
|
u64 xdp_aborted;
|
|
|
|
u64 xdp_pass;
|
2024-02-14 09:59:06 -08:00
|
|
|
u64 xdp_tx;
|
2024-02-14 09:59:07 -08:00
|
|
|
u64 xdp_redirect;
|
2024-02-14 09:59:06 -08:00
|
|
|
u64 xdp_frames;
|
2019-09-03 15:28:19 -07:00
|
|
|
};
|
|
|
|
|
2019-09-03 15:28:07 -07:00
|
|
|
enum ionic_lif_state_flags {
|
2020-03-06 17:04:04 -08:00
|
|
|
IONIC_LIF_F_INITED,
|
|
|
|
IONIC_LIF_F_UP,
|
|
|
|
IONIC_LIF_F_LINK_CHECK_REQUESTED,
|
ionic: sync the filters in the work task
In order to separate the atomic needs of __dev_uc_sync()
and __dev_mc_sync() from the safe rx_mode handling, we need
to have the ndo handler manipulate the driver's filter list,
and later have the driver sync the filters to the firmware,
outside of the atomic context.
Here we put __dev_mc_sync() and __dev_uc_sync() back into the
ndo callback to give them their netif_addr_lock context and
have them update the driver's filter list, flagging changes
that should be made to the device filter list. Later, in the
rx_mode handler, we read those hints and sync up the device's
list as needed.
It is possible for multiple add/delete requests to come from
the stack before the rx_mode task processes the list, but the
handling of the sync status flag should keep everything sorted
correctly. For example, if a delete of an existing filter is
followed by another add before the rx_mode task is run, as can
happen when going in and out of a bond, the add will cancel
the delete and no actual changes will be sent to the device.
We also add a check in the watchdog to see if there are any
stray unsync'd filters, possibly left over from a filter
overflow and waiting to get sync'd after some other filter
gets removed to make room.
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-08-25 18:24:48 -07:00
|
|
|
IONIC_LIF_F_FILTER_SYNC_NEEDED,
|
2020-03-27 20:14:48 -07:00
|
|
|
IONIC_LIF_F_FW_RESET,
|
2022-01-24 10:53:01 -08:00
|
|
|
IONIC_LIF_F_FW_STOPPING,
|
2020-07-31 13:15:36 -07:00
|
|
|
IONIC_LIF_F_SPLIT_INTR,
|
2021-03-18 17:48:09 -07:00
|
|
|
IONIC_LIF_F_BROKEN,
|
2020-09-15 16:59:03 -07:00
|
|
|
IONIC_LIF_F_TX_DIM_INTR,
|
|
|
|
IONIC_LIF_F_RX_DIM_INTR,
|
2023-02-10 16:50:17 -08:00
|
|
|
IONIC_LIF_F_CMB_TX_RINGS,
|
|
|
|
IONIC_LIF_F_CMB_RX_RINGS,
|
2019-09-03 15:28:07 -07:00
|
|
|
|
|
|
|
/* leave this as last */
|
2020-03-06 17:04:04 -08:00
|
|
|
IONIC_LIF_F_STATE_SIZE
|
2019-09-03 15:28:07 -07:00
|
|
|
};
|
|
|
|
|
2020-05-11 17:59:27 -07:00
|
|
|
struct ionic_qtype_info {
|
|
|
|
u8 version;
|
|
|
|
u8 supported;
|
|
|
|
u64 features;
|
|
|
|
u16 desc_sz;
|
|
|
|
u16 comp_sz;
|
|
|
|
u16 sg_desc_sz;
|
|
|
|
u16 max_sg_elems;
|
|
|
|
u16 sg_desc_stride;
|
|
|
|
};
|
|
|
|
|
2021-04-01 10:56:04 -07:00
|
|
|
struct ionic_phc;
|
|
|
|
|
2019-09-03 15:28:07 -07:00
|
|
|
#define IONIC_LIF_NAME_MAX_SZ 32
|
|
|
|
struct ionic_lif {
|
|
|
|
struct net_device *netdev;
|
2020-03-06 17:04:04 -08:00
|
|
|
DECLARE_BITMAP(state, IONIC_LIF_F_STATE_SIZE);
|
2019-09-03 15:28:07 -07:00
|
|
|
struct ionic *ionic;
|
|
|
|
unsigned int index;
|
|
|
|
unsigned int hw_index;
|
2020-07-20 16:00:17 -07:00
|
|
|
struct mutex queue_lock; /* lock for queue structures */
|
2021-07-23 11:02:45 -07:00
|
|
|
struct mutex config_lock; /* lock for config actions */
|
2019-09-03 15:28:09 -07:00
|
|
|
spinlock_t adminq_lock; /* lock for AdminQ operations */
|
|
|
|
struct ionic_qcq *adminqcq;
|
2019-09-03 15:28:11 -07:00
|
|
|
struct ionic_qcq *notifyqcq;
|
2020-08-27 16:00:23 -07:00
|
|
|
struct ionic_qcq **txqcqs;
|
2021-04-01 10:56:04 -07:00
|
|
|
struct ionic_qcq *hwstamp_txq;
|
2020-08-27 16:00:23 -07:00
|
|
|
struct ionic_tx_stats *txqstats;
|
|
|
|
struct ionic_qcq **rxqcqs;
|
2021-04-01 10:56:04 -07:00
|
|
|
struct ionic_qcq *hwstamp_rxq;
|
2020-08-27 16:00:23 -07:00
|
|
|
struct ionic_rx_stats *rxqstats;
|
2021-03-10 11:26:28 -08:00
|
|
|
struct ionic_deferred deferred;
|
|
|
|
struct work_struct tx_timeout_work;
|
2019-09-03 15:28:11 -07:00
|
|
|
u64 last_eid;
|
2021-03-10 11:26:28 -08:00
|
|
|
unsigned int kern_pid;
|
|
|
|
u64 __iomem *kern_dbpage;
|
2019-09-03 15:28:07 -07:00
|
|
|
unsigned int neqs;
|
|
|
|
unsigned int nxqs;
|
2019-09-03 15:28:16 -07:00
|
|
|
unsigned int ntxq_descs;
|
|
|
|
unsigned int nrxq_descs;
|
2021-04-01 10:56:00 -07:00
|
|
|
u64 rxq_features;
|
2019-09-03 15:28:12 -07:00
|
|
|
u64 hw_features;
|
2024-06-18 17:32:56 -07:00
|
|
|
u16 rx_copybreak;
|
|
|
|
u16 rx_mode;
|
2021-03-10 11:26:28 -08:00
|
|
|
bool registered;
|
2024-06-18 17:32:57 -07:00
|
|
|
bool doorbell_wa;
|
2020-05-11 17:59:27 -07:00
|
|
|
u16 lif_type;
|
2023-06-08 22:50:16 -07:00
|
|
|
unsigned int link_down_count;
|
2021-03-10 11:26:28 -08:00
|
|
|
unsigned int nmcast;
|
2019-09-03 15:28:14 -07:00
|
|
|
unsigned int nucast;
|
ionic: handle vlan id overflow
Add vlans to the existing rx_filter_sync mechanics currently
used for managing mac filters.
Older versions of our firmware had no enforced limits on the
number of vlans that the LIF could request, but requesting large
numbers of vlans caused issues in FW memory management, so an
arbitrary limit was added in the FW. The FW now returns -ENOSPC
when it hits that limit, which the driver needs to handle.
Unfortunately, the FW doesn't advertise the vlan id limit,
as it does with mac filters, so the driver won't know the
limit until it bumps into it. We'll grab the current vlan id
count and use that as the limit from there on and thus prevent
getting any more -ENOSPC errors.
Just as is done for the mac filters, the device puts the device
into promiscuous mode when -ENOSPC is seen for vlan ids, and
the driver will track the vlans that aren't synced to the FW.
When vlans are removed, the driver will retry the un-synced
vlans. If all outstanding vlans are synced, the promiscuous
mode will be disabled.
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-10-09 11:45:21 -07:00
|
|
|
unsigned int nvlans;
|
|
|
|
unsigned int max_vlans;
|
2021-03-10 11:26:28 -08:00
|
|
|
char name[IONIC_LIF_NAME_MAX_SZ];
|
2019-09-03 15:28:07 -07:00
|
|
|
|
2020-07-21 13:34:04 -07:00
|
|
|
union ionic_lif_identity *identity;
|
2019-09-03 15:28:07 -07:00
|
|
|
struct ionic_lif_info *info;
|
|
|
|
dma_addr_t info_pa;
|
|
|
|
u32 info_sz;
|
2020-05-11 17:59:27 -07:00
|
|
|
struct ionic_qtype_info qtype_info[IONIC_QTYPE_MAX];
|
2019-09-03 15:28:07 -07:00
|
|
|
|
2019-09-03 15:28:20 -07:00
|
|
|
u8 rss_hash_key[IONIC_RSS_HASH_KEY_SIZE];
|
|
|
|
u8 *rss_ind_tbl;
|
|
|
|
dma_addr_t rss_ind_tbl_pa;
|
|
|
|
u32 rss_ind_tbl_sz;
|
2024-06-18 17:32:56 -07:00
|
|
|
u16 rss_types;
|
2019-09-03 15:28:20 -07:00
|
|
|
|
2019-09-03 15:28:13 -07:00
|
|
|
struct ionic_rx_filters rx_filters;
|
2019-09-30 20:03:24 -07:00
|
|
|
u32 rx_coalesce_usecs; /* what the user asked for */
|
|
|
|
u32 rx_coalesce_hw; /* what the hw is using */
|
2020-07-31 13:15:36 -07:00
|
|
|
u32 tx_coalesce_usecs; /* what the user asked for */
|
|
|
|
u32 tx_coalesce_hw; /* what the hw is using */
|
2021-03-10 11:26:28 -08:00
|
|
|
unsigned int dbid_count;
|
2019-09-30 20:03:24 -07:00
|
|
|
|
2021-04-01 10:56:04 -07:00
|
|
|
struct ionic_phc *phc;
|
|
|
|
|
2021-03-10 11:26:28 -08:00
|
|
|
struct dentry *dentry;
|
2024-02-14 09:59:04 -08:00
|
|
|
struct bpf_prog *xdp_prog;
|
2019-09-03 15:28:07 -07:00
|
|
|
};
|
|
|
|
|
2021-04-01 10:56:04 -07:00
|
|
|
struct ionic_phc {
|
|
|
|
spinlock_t lock; /* lock for cc and tc */
|
|
|
|
struct cyclecounter cc;
|
|
|
|
struct timecounter tc;
|
|
|
|
|
|
|
|
struct mutex config_lock; /* lock for ts_config */
|
|
|
|
struct hwtstamp_config ts_config;
|
|
|
|
u64 ts_config_rx_filt;
|
|
|
|
u32 ts_config_tx_mode;
|
|
|
|
|
|
|
|
u32 init_cc_mult;
|
|
|
|
long aux_work_delay;
|
|
|
|
|
|
|
|
struct ptp_clock_info ptp_info;
|
|
|
|
struct ptp_clock *ptp;
|
|
|
|
struct ionic_lif *lif;
|
|
|
|
};
|
|
|
|
|
2020-08-27 16:00:28 -07:00
|
|
|
struct ionic_queue_params {
|
|
|
|
unsigned int nxqs;
|
|
|
|
unsigned int ntxq_descs;
|
|
|
|
unsigned int nrxq_descs;
|
2021-04-01 10:56:00 -07:00
|
|
|
u64 rxq_features;
|
2024-09-06 16:26:21 -07:00
|
|
|
struct bpf_prog *xdp_prog;
|
2023-02-10 16:50:17 -08:00
|
|
|
bool intr_split;
|
|
|
|
bool cmb_tx;
|
|
|
|
bool cmb_rx;
|
2020-08-27 16:00:28 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline void ionic_init_queue_params(struct ionic_lif *lif,
|
|
|
|
struct ionic_queue_params *qparam)
|
|
|
|
{
|
|
|
|
qparam->nxqs = lif->nxqs;
|
|
|
|
qparam->ntxq_descs = lif->ntxq_descs;
|
|
|
|
qparam->nrxq_descs = lif->nrxq_descs;
|
2021-04-01 10:56:00 -07:00
|
|
|
qparam->rxq_features = lif->rxq_features;
|
2024-09-06 16:26:21 -07:00
|
|
|
qparam->xdp_prog = lif->xdp_prog;
|
2023-02-10 16:50:17 -08:00
|
|
|
qparam->intr_split = test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state);
|
|
|
|
qparam->cmb_tx = test_bit(IONIC_LIF_F_CMB_TX_RINGS, lif->state);
|
|
|
|
qparam->cmb_rx = test_bit(IONIC_LIF_F_CMB_RX_RINGS, lif->state);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ionic_set_queue_params(struct ionic_lif *lif,
|
|
|
|
struct ionic_queue_params *qparam)
|
|
|
|
{
|
|
|
|
lif->nxqs = qparam->nxqs;
|
|
|
|
lif->ntxq_descs = qparam->ntxq_descs;
|
|
|
|
lif->nrxq_descs = qparam->nrxq_descs;
|
|
|
|
lif->rxq_features = qparam->rxq_features;
|
|
|
|
|
|
|
|
if (qparam->intr_split)
|
|
|
|
set_bit(IONIC_LIF_F_SPLIT_INTR, lif->state);
|
|
|
|
else
|
|
|
|
clear_bit(IONIC_LIF_F_SPLIT_INTR, lif->state);
|
|
|
|
|
|
|
|
if (qparam->cmb_tx)
|
|
|
|
set_bit(IONIC_LIF_F_CMB_TX_RINGS, lif->state);
|
|
|
|
else
|
|
|
|
clear_bit(IONIC_LIF_F_CMB_TX_RINGS, lif->state);
|
|
|
|
|
|
|
|
if (qparam->cmb_rx)
|
|
|
|
set_bit(IONIC_LIF_F_CMB_RX_RINGS, lif->state);
|
|
|
|
else
|
|
|
|
clear_bit(IONIC_LIF_F_CMB_RX_RINGS, lif->state);
|
2020-08-27 16:00:28 -07:00
|
|
|
}
|
|
|
|
|
2019-09-03 15:28:21 -07:00
|
|
|
static inline u32 ionic_coal_usec_to_hw(struct ionic *ionic, u32 usecs)
|
|
|
|
{
|
|
|
|
u32 mult = le32_to_cpu(ionic->ident.dev.intr_coal_mult);
|
|
|
|
u32 div = le32_to_cpu(ionic->ident.dev.intr_coal_div);
|
|
|
|
|
|
|
|
/* Div-by-zero should never be an issue, but check anyway */
|
|
|
|
if (!div || !mult)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Round up in case usecs is close to the next hw unit */
|
|
|
|
usecs += (div / mult) >> 1;
|
|
|
|
|
|
|
|
/* Convert from usecs to device units */
|
|
|
|
return (usecs * mult) / div;
|
|
|
|
}
|
|
|
|
|
2023-12-04 13:09:35 -08:00
|
|
|
static inline bool ionic_txq_hwstamp_enabled(struct ionic_queue *q)
|
|
|
|
{
|
2024-02-29 11:39:32 -08:00
|
|
|
return q->features & IONIC_TXQ_F_HWSTAMP;
|
2023-12-04 13:09:35 -08:00
|
|
|
}
|
|
|
|
|
2020-09-29 22:25:20 +02:00
|
|
|
void ionic_link_status_check_request(struct ionic_lif *lif, bool can_sleep);
|
2020-05-11 17:59:35 -07:00
|
|
|
void ionic_get_stats64(struct net_device *netdev,
|
|
|
|
struct rtnl_link_stats64 *ns);
|
2024-06-18 17:32:52 -07:00
|
|
|
void ionic_lif_deferred_enqueue(struct ionic_lif *lif,
|
2020-03-27 20:14:48 -07:00
|
|
|
struct ionic_deferred_work *work);
|
2020-08-27 16:00:22 -07:00
|
|
|
int ionic_lif_alloc(struct ionic *ionic);
|
|
|
|
int ionic_lif_init(struct ionic_lif *lif);
|
|
|
|
void ionic_lif_free(struct ionic_lif *lif);
|
|
|
|
void ionic_lif_deinit(struct ionic_lif *lif);
|
ionic: sync the filters in the work task
In order to separate the atomic needs of __dev_uc_sync()
and __dev_mc_sync() from the safe rx_mode handling, we need
to have the ndo handler manipulate the driver's filter list,
and later have the driver sync the filters to the firmware,
outside of the atomic context.
Here we put __dev_mc_sync() and __dev_uc_sync() back into the
ndo callback to give them their netif_addr_lock context and
have them update the driver's filter list, flagging changes
that should be made to the device filter list. Later, in the
rx_mode handler, we read those hints and sync up the device's
list as needed.
It is possible for multiple add/delete requests to come from
the stack before the rx_mode task processes the list, but the
handling of the sync status flag should keep everything sorted
correctly. For example, if a delete of an existing filter is
followed by another add before the rx_mode task is run, as can
happen when going in and out of a bond, the add will cancel
the delete and no actual changes will be sent to the device.
We also add a check in the watchdog to see if there are any
stray unsync'd filters, possibly left over from a filter
overflow and waiting to get sync'd after some other filter
gets removed to make room.
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-08-25 18:24:48 -07:00
|
|
|
|
|
|
|
int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr);
|
|
|
|
int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr);
|
|
|
|
|
2023-07-20 12:08:16 -07:00
|
|
|
void ionic_stop_queues_reconfig(struct ionic_lif *lif);
|
|
|
|
void ionic_txrx_free(struct ionic_lif *lif);
|
|
|
|
void ionic_qcqs_free(struct ionic_lif *lif);
|
|
|
|
int ionic_restart_lif(struct ionic_lif *lif);
|
|
|
|
|
2020-08-27 16:00:22 -07:00
|
|
|
int ionic_lif_register(struct ionic_lif *lif);
|
|
|
|
void ionic_lif_unregister(struct ionic_lif *lif);
|
2019-09-03 15:28:07 -07:00
|
|
|
int ionic_lif_identify(struct ionic *ionic, u8 lif_type,
|
|
|
|
union ionic_lif_identity *lif_ident);
|
2020-08-27 16:00:22 -07:00
|
|
|
int ionic_lif_size(struct ionic *ionic);
|
2021-04-01 10:56:04 -07:00
|
|
|
|
|
|
|
#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
|
2021-07-23 11:02:46 -07:00
|
|
|
void ionic_lif_hwstamp_replay(struct ionic_lif *lif);
|
2021-08-27 11:55:12 -07:00
|
|
|
void ionic_lif_hwstamp_recreate_queues(struct ionic_lif *lif);
|
2021-04-01 10:56:04 -07:00
|
|
|
int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr);
|
|
|
|
int ionic_lif_hwstamp_get(struct ionic_lif *lif, struct ifreq *ifr);
|
|
|
|
ktime_t ionic_lif_phc_ktime(struct ionic_lif *lif, u64 counter);
|
|
|
|
void ionic_lif_register_phc(struct ionic_lif *lif);
|
|
|
|
void ionic_lif_unregister_phc(struct ionic_lif *lif);
|
|
|
|
void ionic_lif_alloc_phc(struct ionic_lif *lif);
|
|
|
|
void ionic_lif_free_phc(struct ionic_lif *lif);
|
|
|
|
#else
|
2021-07-23 11:02:46 -07:00
|
|
|
static inline void ionic_lif_hwstamp_replay(struct ionic_lif *lif) {}
|
2021-08-27 11:55:12 -07:00
|
|
|
static inline void ionic_lif_hwstamp_recreate_queues(struct ionic_lif *lif) {}
|
2021-04-07 16:20:00 -07:00
|
|
|
|
2021-04-01 10:56:04 -07:00
|
|
|
static inline int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int ionic_lif_hwstamp_get(struct ionic_lif *lif, struct ifreq *ifr)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline ktime_t ionic_lif_phc_ktime(struct ionic_lif *lif, u64 counter)
|
|
|
|
{
|
|
|
|
return ns_to_ktime(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ionic_lif_register_phc(struct ionic_lif *lif) {}
|
|
|
|
static inline void ionic_lif_unregister_phc(struct ionic_lif *lif) {}
|
|
|
|
static inline void ionic_lif_alloc_phc(struct ionic_lif *lif) {}
|
|
|
|
static inline void ionic_lif_free_phc(struct ionic_lif *lif) {}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int ionic_lif_create_hwstamp_txq(struct ionic_lif *lif);
|
|
|
|
int ionic_lif_create_hwstamp_rxq(struct ionic_lif *lif);
|
|
|
|
int ionic_lif_config_hwstamp_rxq_all(struct ionic_lif *lif, bool rx_all);
|
|
|
|
int ionic_lif_set_hwstamp_txmode(struct ionic_lif *lif, u16 txstamp_mode);
|
|
|
|
int ionic_lif_set_hwstamp_rxfilt(struct ionic_lif *lif, u64 pkt_class);
|
|
|
|
|
2019-09-03 15:28:20 -07:00
|
|
|
int ionic_lif_rss_config(struct ionic_lif *lif, u16 types,
|
|
|
|
const u8 *key, const u32 *indir);
|
ionic: sync the filters in the work task
In order to separate the atomic needs of __dev_uc_sync()
and __dev_mc_sync() from the safe rx_mode handling, we need
to have the ndo handler manipulate the driver's filter list,
and later have the driver sync the filters to the firmware,
outside of the atomic context.
Here we put __dev_mc_sync() and __dev_uc_sync() back into the
ndo callback to give them their netif_addr_lock context and
have them update the driver's filter list, flagging changes
that should be made to the device filter list. Later, in the
rx_mode handler, we read those hints and sync up the device's
list as needed.
It is possible for multiple add/delete requests to come from
the stack before the rx_mode task processes the list, but the
handling of the sync status flag should keep everything sorted
correctly. For example, if a delete of an existing filter is
followed by another add before the rx_mode task is run, as can
happen when going in and out of a bond, the add will cancel
the delete and no actual changes will be sent to the device.
We also add a check in the watchdog to see if there are any
stray unsync'd filters, possibly left over from a filter
overflow and waiting to get sync'd after some other filter
gets removed to make room.
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-08-25 18:24:48 -07:00
|
|
|
void ionic_lif_rx_mode(struct ionic_lif *lif);
|
2020-08-27 16:00:28 -07:00
|
|
|
int ionic_reconfigure_queues(struct ionic_lif *lif,
|
|
|
|
struct ionic_queue_params *qparam);
|
2019-09-03 15:28:07 -07:00
|
|
|
#endif /* _IONIC_LIF_H_ */
|