linux/drivers/net/ethernet/freescale/fman/fman_port.h

/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
/*
 * Copyright 2008 - 2015 Freescale Semiconductor Inc.
 */

#ifndef __FMAN_PORT_H
#define __FMAN_PORT_H

#include "fman.h"

/* FM Port API
 * The FM uses a general module called "port" to represent a Tx port (MAC),
 * an Rx port (MAC).
 * The number of ports in an FM varies between SOCs.
 * The SW driver manages these ports as sub-modules of the FM,i.e. after an
 * FM is initialized, its ports may be initialized and operated upon.
 * The port is initialized aware of its type, but other functions on a port
 * may be indifferent to its type. When necessary, the driver verifies
 * coherence and returns error if applicable.
 * On initialization, user specifies the port type and it's index (relative
 * to the port's type) - always starting at 0.
 */

/* FM Frame error */
/* Frame Descriptor errors */
/* Not for Rx-Port! Unsupported Format */
#define FM_PORT_FRM_ERR_UNSUPPORTED_FORMAT
/* Not for Rx-Port! Length Error */
#define FM_PORT_FRM_ERR_LENGTH
/* DMA Data error */
#define FM_PORT_FRM_ERR_DMA
/* non Frame-Manager error; probably come from SEC that was chained to FM */
#define FM_PORT_FRM_ERR_NON_FM
 /* IPR error */
#define FM_PORT_FRM_ERR_IPRE
/* IPR non-consistent-sp */
#define FM_PORT_FRM_ERR_IPR_NCSP

/* Rx FIFO overflow, FCS error, code error, running disparity
 * error (SGMII and TBI modes), FIFO parity error.
 * PHY Sequence error, PHY error control character detected.
 */
#define FM_PORT_FRM_ERR_PHYSICAL
/* Frame too long OR Frame size exceeds max_length_frame  */
#define FM_PORT_FRM_ERR_SIZE
/* indicates a classifier "drop" operation */
#define FM_PORT_FRM_ERR_CLS_DISCARD
/* Extract Out of Frame */
#define FM_PORT_FRM_ERR_EXTRACTION
/* No Scheme Selected */
#define FM_PORT_FRM_ERR_NO_SCHEME
/* Keysize Overflow */
#define FM_PORT_FRM_ERR_KEYSIZE_OVERFLOW
/* Frame color is red */
#define FM_PORT_FRM_ERR_COLOR_RED
/* Frame color is yellow */
#define FM_PORT_FRM_ERR_COLOR_YELLOW
/* Parser Time out Exceed */
#define FM_PORT_FRM_ERR_PRS_TIMEOUT
/* Invalid Soft Parser instruction */
#define FM_PORT_FRM_ERR_PRS_ILL_INSTRUCT
/* Header error was identified during parsing */
#define FM_PORT_FRM_ERR_PRS_HDR_ERR
/* Frame parsed beyind 256 first bytes */
#define FM_PORT_FRM_ERR_BLOCK_LIMIT_EXCEEDED
/* FPM Frame Processing Timeout Exceeded */
#define FM_PORT_FRM_ERR_PROCESS_TIMEOUT

struct fman_port;

/* A structure for additional Rx port parameters */
struct fman_port_rx_params {};

/* A structure for additional non-Rx port parameters */
struct fman_port_non_rx_params {};

/* A union for additional parameters depending on port type */
fman_port_specific_params;

/* A structure representing FM initialization parameters */
struct fman_port_params {};

int fman_port_config(struct fman_port *port, struct fman_port_params *params);

void fman_port_use_kg_hash(struct fman_port *port, bool enable);

int fman_port_init(struct fman_port *port);

int fman_port_cfg_buf_prefix_content(struct fman_port *port,
				     struct fman_buffer_prefix_content
				     *buffer_prefix_content);

int fman_port_disable(struct fman_port *port);

int fman_port_enable(struct fman_port *port);

u32 fman_port_get_qman_channel_id(struct fman_port *port);

int fman_port_get_hash_result_offset(struct fman_port *port, u32 *offset);

int fman_port_get_tstamp(struct fman_port *port, const void *data, u64 *tstamp);

struct fman_port *fman_port_bind(struct device *dev);

struct device *fman_port_get_device(struct fman_port *port);

#endif /* __FMAN_PORT_H */