blob: 4d72ec4604383df35a5a156088a0b7f4e76b9e4a [file] [log] [blame]
/*
* NSS Interface Messages
*/
#ifndef __NSS_IF_H
#define __NSS_IF_H
/*
* Message numbers
*/
enum nss_if_message_types {
NSS_IF_OPEN,
NSS_IF_CLOSE,
NSS_IF_LINK_STATE_NOTIFY,
NSS_IF_MTU_CHANGE,
NSS_IF_MAC_ADDR_SET,
NSS_IF_MSS_SET,
NSS_IF_STATS_SYNC,
NSS_IF_ISHAPER_ASSIGN,
NSS_IF_BSHAPER_ASSIGN,
NSS_IF_ISHAPER_UNASSIGN,
NSS_IF_BSHAPER_UNASSIGN,
NSS_IF_ISHAPER_CONFIG,
NSS_IF_BSHAPER_CONFIG,
NSS_IF_MAX_MSG_TYPES
};
enum nss_if_error_types {
NSS_IF_ERROR_NO_ISHAPERS,
NSS_IF_ERROR_NO_BSHAPERS,
NSS_IF_ERROR_NO_ISHAPER,
NSS_IF_ERROR_NO_BSHAPER,
NSS_IF_ERROR_ISHAPER_OLD,
NSS_IF_ERROR_B_SHAPER_OLD,
NSS_IF_ERROR_I_SHAPER_CONFIG_FAILED,
NSS_IF_ERROR_B_SHAPER_CONFIG_FAILED,
NSS_IF_ERROR_TYPE_UNKNOWN,
NSS_IF_ERROR_TYPE_EOPEN,
};
/*
* Interface open command
*/
struct nss_if_open {
uint32_t tx_desc_ring; /* Tx descriptor ring address */
uint32_t rx_desc_ring; /* Rx descriptor ring address */
};
/*
* Interface close command
*/
struct nss_if_close {
uint32_t reserved; /* Place holder */
};
/*
* Link state notification to NSS
*/
struct nss_if_link_state_notify {
uint32_t state; /* Link State (UP/DOWN), speed/duplex settings */
};
/*
* Interface mtu change
*/
struct nss_if_mtu_change {
uint16_t min_buf_size; /* Changed min buf size value */
};
/*
* The MSS (Maximum Segment Size) structure.
*/
struct nss_if_mss_set {
uint16_t mss; /* MSS value */
};
/*
* The NSS MAC address structure.
*/
struct nss_if_mac_address_set {
uint8_t mac_addr[ETH_ALEN]; /* MAC address */
};
/*
* The NSS per-GMAC statistics sync structure.
*/
struct nss_if_stats_sync {
uint32_t rx_bytes; /* Number of RX bytes */
uint32_t rx_packets; /* Number of RX packets */
uint32_t rx_errors; /* Number of RX errors */
uint32_t rx_receive_errors; /* Number of RX receive errors */
uint32_t rx_overflow_errors; /* Number of RX overflow errors */
uint32_t rx_descriptor_errors; /* Number of RX descriptor errors */
uint32_t rx_watchdog_timeout_errors;
/* Number of RX watchdog timeout errors */
uint32_t rx_crc_errors; /* Number of RX CRC errors */
uint32_t rx_late_collision_errors;
/* Number of RX late collision errors */
uint32_t rx_dribble_bit_errors; /* Number of RX dribble bit errors */
uint32_t rx_length_errors; /* Number of RX length errors */
uint32_t rx_ip_header_errors; /* Number of RX IP header errors */
uint32_t rx_ip_payload_errors; /* Number of RX IP payload errors */
uint32_t rx_no_buffer_errors; /* Number of RX no-buffer errors */
uint32_t rx_transport_csum_bypassed;
/* Number of RX packets where the transport checksum was bypassed */
uint32_t tx_bytes; /* Number of TX bytes */
uint32_t tx_packets; /* Number of TX packets */
uint32_t tx_collisions; /* Number of TX collisions */
uint32_t tx_errors; /* Number of TX errors */
uint32_t tx_jabber_timeout_errors;
/* Number of TX jabber timeout errors */
uint32_t tx_frame_flushed_errors;
/* Number of TX frame flushed errors */
uint32_t tx_loss_of_carrier_errors;
/* Number of TX loss of carrier errors */
uint32_t tx_no_carrier_errors; /* Number of TX no carrier errors */
uint32_t tx_late_collision_errors;
/* Number of TX late collision errors */
uint32_t tx_excessive_collision_errors;
/* Number of TX excessive collision errors */
uint32_t tx_excessive_deferral_errors;
/* Number of TX excessive deferral errors */
uint32_t tx_underflow_errors; /* Number of TX underflow errors */
uint32_t tx_ip_header_errors; /* Number of TX IP header errors */
uint32_t tx_ip_payload_errors; /* Number of TX IP payload errors */
uint32_t tx_dropped; /* Number of TX dropped packets */
uint32_t hw_errs[10]; /* GMAC DMA error counters */
uint32_t rx_missed; /* Number of RX packets missed by the DMA */
uint32_t fifo_overflows; /* Number of RX FIFO overflows signalled by the DMA */
uint32_t rx_scatter_errors; /* Number of scattered frames received by the DMA */
uint32_t gmac_total_ticks; /* Total clock ticks spend inside the GMAC */
uint32_t gmac_worst_case_ticks; /* Worst case iteration of the GMAC in ticks */
uint32_t gmac_iterations; /* Number of iterations around the GMAC */
};
/*
* Message structure to send/receive phys i/f commands
*/
struct nss_if_msg {
struct nss_cmn_msg cm; /* Message Header */
union {
struct nss_if_link_state_notify link_state_notify; /* Message: notify link status */
struct nss_if_open open; /* Message: open interface */
struct nss_if_close close; /* Message: close interface */
struct nss_if_mtu_change mtu_change; /* Message: MTU change notification */
struct nss_if_mss_set mss_set; /* Message: set MSS */
struct nss_if_mac_address_set mac_address_set; /* Message: set MAC address for i/f */
struct nss_if_stats_sync stats_sync; /* Message: statistics sync */
} msg;
};
struct nss_ctx_instance;
typedef void (*nss_if_msg_callback_t)(void *app_data, struct nss_if_msg *msg);
typedef void (*nss_if_data_callback_t)(void *app_data, struct sk_buff *nbuf);
extern nss_tx_status_t nss_if_tx(struct nss_ctx_instance *nss_ctx, struct nss_if_msg *msg);
extern void *nss_if_notify_register(uint32_t if_num, nss_if_msg_callback_t msg_cb, void *app_data);
extern void *nss_if_data_register(uint32_t if_num, struct net_device *netdev, nss_if_data_callback_t cb, void *app_data);
#endif /* __NSS_IF_H */