linux/drivers/net/ethernet/pensando/ionic/ionic_lif.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */

#ifndef _IONIC_LIF_H_
#define _IONIC_LIF_H_

#include <linux/ptp_clock_kernel.h>
#include <linux/timecounter.h>
#include <uapi/linux/net_tstamp.h>
#include <linux/dim.h>
#include <linux/pci.h>
#include "ionic_rx_filter.h"

#define IONIC_ADMINQ_LENGTH
#define IONIC_NOTIFYQ_LENGTH

#define ADD_ADDR
#define DEL_ADDR
#define CAN_SLEEP
#define CAN_NOT_SLEEP

#define IONIC_RX_COPYBREAK_DEFAULT
#define IONIC_TX_BUDGET_DEFAULT

struct ionic_tx_stats {};

struct ionic_rx_stats {};

#define IONIC_QCQ_F_INITED
#define IONIC_QCQ_F_SG
#define IONIC_QCQ_F_INTR
#define IONIC_QCQ_F_TX_STATS
#define IONIC_QCQ_F_RX_STATS
#define IONIC_QCQ_F_NOTIFYQ
#define IONIC_QCQ_F_CMB_RINGS

struct ionic_qcq {};

#define q_to_qcq(q)
#define q_to_tx_stats(q)
#define q_to_rx_stats(q)
#define napi_to_qcq(napi)
#define napi_to_cq(napi)

enum ionic_deferred_work_type {};

struct ionic_deferred_work {};

struct ionic_deferred {};

struct ionic_lif_sw_stats {};

enum ionic_lif_state_flags {};

struct ionic_qtype_info {};

struct ionic_phc;

#define IONIC_LIF_NAME_MAX_SZ
struct ionic_lif {};

struct ionic_phc {};

struct ionic_queue_params {};

static inline void ionic_init_queue_params(struct ionic_lif *lif,
					   struct ionic_queue_params *qparam)
{}

static inline void ionic_set_queue_params(struct ionic_lif *lif,
					  struct ionic_queue_params *qparam)
{}

static inline u32 ionic_coal_usec_to_hw(struct ionic *ionic, u32 usecs)
{}

static inline bool ionic_txq_hwstamp_enabled(struct ionic_queue *q)
{}

void ionic_link_status_check_request(struct ionic_lif *lif, bool can_sleep);
void ionic_get_stats64(struct net_device *netdev,
		       struct rtnl_link_stats64 *ns);
void ionic_lif_deferred_enqueue(struct ionic_lif *lif,
				struct ionic_deferred_work *work);
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);

int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr);
int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr);

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);

int ionic_lif_register(struct ionic_lif *lif);
void ionic_lif_unregister(struct ionic_lif *lif);
int ionic_lif_identify(struct ionic *ionic, u8 lif_type,
		       union ionic_lif_identity *lif_ident);
int ionic_lif_size(struct ionic *ionic);

#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
void ionic_lif_hwstamp_replay(struct ionic_lif *lif);
void ionic_lif_hwstamp_recreate_queues(struct ionic_lif *lif);
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
static inline void ionic_lif_hwstamp_replay(struct ionic_lif *lif) {}
static inline void ionic_lif_hwstamp_recreate_queues(struct ionic_lif *lif) {}

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);

int ionic_lif_rss_config(struct ionic_lif *lif, u16 types,
			 const u8 *key, const u32 *indir);
void ionic_lif_rx_mode(struct ionic_lif *lif);
int ionic_reconfigure_queues(struct ionic_lif *lif,
			     struct ionic_queue_params *qparam);
#endif /* _IONIC_LIF_H_ */