linux/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Marvell Octeon EP (EndPoint) Ethernet Driver
 *
 * Copyright (C) 2020 Marvell.
 *
 */
#ifndef __OCTEP_CTRL_NET_H__
#define __OCTEP_CTRL_NET_H__

#include "octep_cp_version.h"

#define OCTEP_CTRL_NET_INVALID_VFID

/* Supported commands */
enum octep_ctrl_net_cmd {};

/* Supported states */
enum octep_ctrl_net_state {};

/* Supported replies */
enum octep_ctrl_net_reply {};

/* Supported host to fw commands */
enum octep_ctrl_net_h2f_cmd {};

/* Supported fw to host commands */
enum octep_ctrl_net_f2h_cmd {};

octep_ctrl_net_req_hdr;

/* get/set mtu request */
struct octep_ctrl_net_h2f_req_cmd_mtu {};

/* get/set mac request */
struct octep_ctrl_net_h2f_req_cmd_mac {};

/* get/set link state, rx state */
struct octep_ctrl_net_h2f_req_cmd_state {};

/* link info */
struct octep_ctrl_net_link_info {};

/* get/set link info */
struct octep_ctrl_net_h2f_req_cmd_link_info {};

/* offloads */
struct octep_ctrl_net_offloads {};

/* get/set offloads */
struct octep_ctrl_net_h2f_req_cmd_offloads {};

/* Host to fw request data */
struct octep_ctrl_net_h2f_req {} __packed;

octep_ctrl_net_resp_hdr;

/* get mtu response */
struct octep_ctrl_net_h2f_resp_cmd_mtu {};

/* get mac response */
struct octep_ctrl_net_h2f_resp_cmd_mac {};

/* get if_stats, xstats, q_stats request */
struct octep_ctrl_net_h2f_resp_cmd_get_stats {};

/* get link state, rx state response */
struct octep_ctrl_net_h2f_resp_cmd_state {};

/* get info request */
struct octep_ctrl_net_h2f_resp_cmd_get_info {};

/* Host to fw response data */
struct octep_ctrl_net_h2f_resp {} __packed;

/* link state notofication */
struct octep_ctrl_net_f2h_req_cmd_state {};

/* Fw to host request data */
struct octep_ctrl_net_f2h_req {};

/* Fw to host response data */
struct octep_ctrl_net_f2h_resp {};

/* Max data size to be transferred over mbox */
octep_ctrl_net_max_data;

struct octep_ctrl_net_wait_data {};

/**
 * octep_ctrl_net_init() - Initialize data for ctrl net.
 *
 * @oct: non-null pointer to struct octep_device.
 *
 * return value: 0 on success, -errno on error.
 */
int octep_ctrl_net_init(struct octep_device *oct);

/** 
 * octep_ctrl_net_get_link_status() - Get link status from firmware.
 *
 * @oct: non-null pointer to struct octep_device.
 * @vfid: Index of virtual function.
 *
 * return value: link status 0=down, 1=up.
 */
int octep_ctrl_net_get_link_status(struct octep_device *oct, int vfid);

/**
 * octep_ctrl_net_set_link_status() - Set link status in firmware.
 *
 * @oct: non-null pointer to struct octep_device.
 * @vfid: Index of virtual function.
 * @up: boolean status.
 * @wait_for_response: poll for response.
 *
 * return value: 0 on success, -errno on failure
 */
int octep_ctrl_net_set_link_status(struct octep_device *oct, int vfid, bool up,
				   bool wait_for_response);

/**
 * octep_ctrl_net_set_rx_state() - Set rx state in firmware.
 *
 * @oct: non-null pointer to struct octep_device.
 * @vfid: Index of virtual function.
 * @up: boolean status.
 * @wait_for_response: poll for response.
 *
 * return value: 0 on success, -errno on failure.
 */
int octep_ctrl_net_set_rx_state(struct octep_device *oct, int vfid, bool up,
				bool wait_for_response);

/** 
 * octep_ctrl_net_get_mac_addr() - Get mac address from firmware.
 *
 * @oct: non-null pointer to struct octep_device.
 * @vfid: Index of virtual function.
 * @addr: non-null pointer to mac address.
 *
 * return value: 0 on success, -errno on failure.
 */
int octep_ctrl_net_get_mac_addr(struct octep_device *oct, int vfid, u8 *addr);

/**
 * octep_ctrl_net_set_mac_addr() - Set mac address in firmware.
 *
 * @oct: non-null pointer to struct octep_device.
 * @vfid: Index of virtual function.
 * @addr: non-null pointer to mac address.
 * @wait_for_response: poll for response.
 *
 * return value: 0 on success, -errno on failure.
 */
int octep_ctrl_net_set_mac_addr(struct octep_device *oct, int vfid, u8 *addr,
				bool wait_for_response);

/**
 * octep_ctrl_net_get_mtu() - Get max MTU from firmware.
 *
 * @oct: non-null pointer to struct octep_device.
 * @vfid: Index of virtual function.
 *
 * return value: mtu on success, -errno on failure.
 */
int octep_ctrl_net_get_mtu(struct octep_device *oct, int vfid);

/** 
 * octep_ctrl_net_set_mtu() - Set mtu in firmware.
 *
 * @oct: non-null pointer to struct octep_device.
 * @vfid: Index of virtual function.
 * @mtu: mtu.
 * @wait_for_response: poll for response.
 *
 * return value: 0 on success, -errno on failure.
 */
int octep_ctrl_net_set_mtu(struct octep_device *oct, int vfid, int mtu,
			   bool wait_for_response);

/**
 * octep_ctrl_net_get_if_stats() - Get interface statistics from firmware.
 *
 * @oct: non-null pointer to struct octep_device.
 * @vfid: Index of virtual function.
 * @rx_stats: non-null pointer struct octep_iface_rx_stats.
 * @tx_stats: non-null pointer struct octep_iface_tx_stats.
 *
 * return value: 0 on success, -errno on failure.
 */
int octep_ctrl_net_get_if_stats(struct octep_device *oct, int vfid,
				struct octep_iface_rx_stats *rx_stats,
				struct octep_iface_tx_stats *tx_stats);

/**
 * octep_ctrl_net_get_link_info() - Get link info from firmware.
 *
 * @oct: non-null pointer to struct octep_device.
 * @vfid: Index of virtual function.
 * @link_info: non-null pointer to struct octep_iface_link_info.
 *
 * return value: 0 on success, -errno on failure.
 */
int octep_ctrl_net_get_link_info(struct octep_device *oct, int vfid,
				 struct octep_iface_link_info *link_info);

/**
 * octep_ctrl_net_set_link_info() - Set link info in firmware.
 *
 * @oct: non-null pointer to struct octep_device.
 * @vfid: Index of virtual function.
 * @link_info: non-null pointer to struct octep_iface_link_info.
 * @wait_for_response: poll for response.
 *
 * return value: 0 on success, -errno on failure.
 */
int octep_ctrl_net_set_link_info(struct octep_device *oct,
				 int vfid,
				 struct octep_iface_link_info *link_info,
				 bool wait_for_response);

/**
 * octep_ctrl_net_recv_fw_messages() - Poll for firmware messages and process them.
 *
 * @oct: non-null pointer to struct octep_device.
 */
void octep_ctrl_net_recv_fw_messages(struct octep_device *oct);

/**
 * octep_ctrl_net_get_info() - Get info from firmware.
 *
 * @oct: non-null pointer to struct octep_device.
 * @vfid: Index of virtual function.
 * @info: non-null pointer to struct octep_fw_info.
 *
 * return value: 0 on success, -errno on failure.
 */
int octep_ctrl_net_get_info(struct octep_device *oct, int vfid,
			    struct octep_fw_info *info);

/**
 * octep_ctrl_net_dev_remove() - Indicate to firmware that a device unload has happened.
 *
 * @oct: non-null pointer to struct octep_device.
 * @vfid: Index of virtual function.
 *
 * return value: 0 on success, -errno on failure.
 */
int octep_ctrl_net_dev_remove(struct octep_device *oct, int vfid);

/**
 * octep_ctrl_net_set_offloads() - Set offloads in firmware.
 *
 * @oct: non-null pointer to struct octep_device.
 * @vfid: Index of virtual function.
 * @offloads: non-null pointer to struct octep_ctrl_net_offloads.
 * @wait_for_response: poll for response.
 *
 * return value: 0 on success, -errno on failure.
 */
int octep_ctrl_net_set_offloads(struct octep_device *oct, int vfid,
				struct octep_ctrl_net_offloads *offloads,
				bool wait_for_response);

/**
 * octep_ctrl_net_uninit() - Uninitialize data for ctrl net.
 *
 * @oct: non-null pointer to struct octep_device.
 *
 * return value: 0 on success, -errno on error.
 */
int octep_ctrl_net_uninit(struct octep_device *oct);

#endif /* __OCTEP_CTRL_NET_H__ */