X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Flibrte_ether%2Frte_ethdev.h;h=e4ad9a7ad906fcec3fe92095a0e6faff8af88c03;hb=db5b65301ddee88d2e093e45ed90511c96ffe3a5;hp=524ef4fee3665835e289ba340935cf4f6fb87608;hpb=88ac4396ad290a0287f6c533bd022d0cebcd8374;p=dpdk.git diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 524ef4fee3..e4ad9a7ad9 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2013 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -192,6 +192,10 @@ struct rte_eth_stats { uint64_t rx_nombuf; /**< Total number of RX mbuf allocation failures. */ uint64_t fdirmatch; /**< Total number of RX packets matching a filter. */ uint64_t fdirmiss; /**< Total number of RX packets not matching any filter. */ + uint64_t tx_pause_xon; /**< Total nb. of XON pause frame sent. */ + uint64_t rx_pause_xon; /**< Total nb. of XON pause frame received. */ + uint64_t tx_pause_xoff; /**< Total nb. of XOFF pause frame sent. */ + uint64_t rx_pause_xoff; /**< Total nb. of XOFF pause frame received. */ uint64_t q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS]; /**< Total number of queue RX packets. */ uint64_t q_opackets[RTE_ETHDEV_QUEUE_STAT_CNTRS]; @@ -327,6 +331,8 @@ struct rte_eth_rss_conf { #define ETH_RSS_IPV4_UDP 0x0040 /**< IPv4/UDP packet. */ #define ETH_RSS_IPV6_UDP 0x0080 /**< IPv6/UDP packet. */ #define ETH_RSS_IPV6_UDP_EX 0x0100 /**< IPv6/UDP with extension headers. */ + +#define ETH_RSS_PROTO_MASK 0x01FF /**< Mask of valid RSS hash protocols */ /* Definitions used for redirection table entry size */ #define ETH_RSS_RETA_NUM_ENTRIES 128 #define ETH_RSS_RETA_MAX_QUEUE 16 @@ -540,6 +546,7 @@ struct rte_eth_fc_conf { uint16_t pause_time; /**< Pause quota in the Pause frame */ uint16_t send_xon; /**< Is XON frame need be sent */ enum rte_eth_fc_mode mode; /**< Link flow control mode */ + uint8_t mac_ctrl_frame_fwd; /**< Forward MAC control frames */ }; /** @@ -724,6 +731,11 @@ struct rte_eth_conf { /**< ETH_LINK_[HALF_DUPLEX|FULL_DUPLEX], or 0 for autonegotation */ struct rte_eth_rxmode rxmode; /**< Port RX configuration. */ struct rte_eth_txmode txmode; /**< Port TX configuration. */ + uint32_t lpbk_mode; /**< Loopback operation mode. By default the value + is 0, meaning the loopback mode is disabled. + Read the datasheet of given ethernet controller + for details. The possible values of this field + are defined in implementation of each driver. */ union { struct rte_eth_rss_conf rss_conf; /**< Port RSS configuration */ struct rte_eth_vmdq_dcb_conf vmdq_dcb_conf; @@ -753,9 +765,32 @@ struct rte_eth_conf { * an Ethernet device, such as the controlling driver of the device, * its PCI context, etc... */ + +/** + * RX offload capabilities of a device. + */ +#define DEV_RX_OFFLOAD_VLAN_STRIP 0x00000001 +#define DEV_RX_OFFLOAD_IPV4_CKSUM 0x00000002 +#define DEV_RX_OFFLOAD_UDP_CKSUM 0x00000004 +#define DEV_RX_OFFLOAD_TCP_CKSUM 0x00000008 +#define DEV_RX_OFFLOAD_TCP_LRO 0x00000010 + +/** + * TX offload capabilities of a device. + */ +#define DEV_TX_OFFLOAD_VLAN_INSERT 0x00000001 +#define DEV_TX_OFFLOAD_IPV4_CKSUM 0x00000002 +#define DEV_TX_OFFLOAD_UDP_CKSUM 0x00000004 +#define DEV_TX_OFFLOAD_TCP_CKSUM 0x00000008 +#define DEV_TX_OFFLOAD_SCTP_CKSUM 0x00000010 +#define DEV_TX_OFFLOAD_TCP_TSO 0x00000020 +#define DEV_TX_OFFLOAD_UDP_TSO 0x00000040 + struct rte_eth_dev_info { struct rte_pci_device *pci_dev; /**< Device PCI information. */ const char *driver_name; /**< Device Driver name. */ + unsigned int if_index; /**< Index to bound host interface, or 0 if none. + Use if_indextoname() to translate into an interface name. */ uint32_t min_rx_bufsize; /**< Minimum size of RX buffer. */ uint32_t max_rx_pktlen; /**< Maximum configurable length of RX pkt. */ uint16_t max_rx_queues; /**< Maximum number of RX queues. */ @@ -765,6 +800,8 @@ struct rte_eth_dev_info { /** Maximum number of hash MAC addresses for MTA and UTA. */ uint16_t max_vfs; /**< Maximum number of VFs. */ uint16_t max_vmdq_pools; /**< Maximum number of VMDq pools. */ + uint32_t rx_offload_capa; /**< Device RX offload capabilities. */ + uint32_t tx_offload_capa; /**< Device TX offload capabilities. */ }; struct rte_eth_dev; @@ -931,6 +968,10 @@ typedef int (*reta_query_t)(struct rte_eth_dev *dev, struct rte_eth_rss_reta *reta_conf); /**< @internal Query RSS redirection table on an Ethernet device */ +typedef int (*rss_hash_update_t)(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf); +/**< @internal Update RSS hash configuration of an Ethernet device */ + typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev); /**< @internal Turn on SW controllable LED on an Ethernet device */ @@ -987,6 +1028,61 @@ typedef int (*eth_mirror_rule_reset_t)(struct rte_eth_dev *dev, uint8_t rule_id); /**< @internal Remove a traffic mirroring rule on an Ethernet device */ +#ifdef RTE_NIC_BYPASS + +enum { + RTE_BYPASS_MODE_NONE, + RTE_BYPASS_MODE_NORMAL, + RTE_BYPASS_MODE_BYPASS, + RTE_BYPASS_MODE_ISOLATE, + RTE_BYPASS_MODE_NUM, +}; + +#define RTE_BYPASS_MODE_VALID(x) \ + ((x) > RTE_BYPASS_MODE_NONE && (x) < RTE_BYPASS_MODE_NUM) + +enum { + RTE_BYPASS_EVENT_NONE, + RTE_BYPASS_EVENT_START, + RTE_BYPASS_EVENT_OS_ON = RTE_BYPASS_EVENT_START, + RTE_BYPASS_EVENT_POWER_ON, + RTE_BYPASS_EVENT_OS_OFF, + RTE_BYPASS_EVENT_POWER_OFF, + RTE_BYPASS_EVENT_TIMEOUT, + RTE_BYPASS_EVENT_NUM +}; + +#define RTE_BYPASS_EVENT_VALID(x) \ + ((x) > RTE_BYPASS_EVENT_NONE && (x) < RTE_BYPASS_MODE_NUM) + +enum { + RTE_BYPASS_TMT_OFF, /* timeout disabled. */ + RTE_BYPASS_TMT_1_5_SEC, /* timeout for 1.5 seconds */ + RTE_BYPASS_TMT_2_SEC, /* timeout for 2 seconds */ + RTE_BYPASS_TMT_3_SEC, /* timeout for 3 seconds */ + RTE_BYPASS_TMT_4_SEC, /* timeout for 4 seconds */ + RTE_BYPASS_TMT_8_SEC, /* timeout for 8 seconds */ + RTE_BYPASS_TMT_16_SEC, /* timeout for 16 seconds */ + RTE_BYPASS_TMT_32_SEC, /* timeout for 32 seconds */ + RTE_BYPASS_TMT_NUM +}; + +#define RTE_BYPASS_TMT_VALID(x) \ + ((x) == RTE_BYPASS_TMT_OFF || \ + ((x) > RTE_BYPASS_TMT_OFF && (x) < RTE_BYPASS_TMT_NUM)) + +typedef void (*bypass_init_t)(struct rte_eth_dev *dev); +typedef int32_t (*bypass_state_set_t)(struct rte_eth_dev *dev, uint32_t *new_state); +typedef int32_t (*bypass_state_show_t)(struct rte_eth_dev *dev, uint32_t *state); +typedef int32_t (*bypass_event_set_t)(struct rte_eth_dev *dev, uint32_t state, uint32_t event); +typedef int32_t (*bypass_event_show_t)(struct rte_eth_dev *dev, uint32_t event_shift, uint32_t *event); +typedef int32_t (*bypass_wd_timeout_set_t)(struct rte_eth_dev *dev, uint32_t timeout); +typedef int32_t (*bypass_wd_timeout_show_t)(struct rte_eth_dev *dev, uint32_t *wd_timeout); +typedef int32_t (*bypass_ver_show_t)(struct rte_eth_dev *dev, uint32_t *ver); +typedef int32_t (*bypass_wd_reset_t)(struct rte_eth_dev *dev); +#endif + + /** * @internal A structure containing the functions exported by an Ethernet driver. */ @@ -1050,6 +1146,21 @@ struct eth_dev_ops { reta_update_t reta_update; /** Query redirection table. */ reta_query_t reta_query; + /* bypass control */ +#ifdef RTE_NIC_BYPASS + bypass_init_t bypass_init; + bypass_state_set_t bypass_state_set; + bypass_state_show_t bypass_state_show; + bypass_event_set_t bypass_event_set; + bypass_event_show_t bypass_event_show; + bypass_wd_timeout_set_t bypass_wd_timeout_set; + bypass_wd_timeout_show_t bypass_wd_timeout_show; + bypass_ver_show_t bypass_ver_show; + bypass_wd_reset_t bypass_wd_reset; +#endif + + /** Configure RSS hash protocols. */ + rss_hash_update_t rss_hash_update; }; /** @@ -1134,6 +1245,17 @@ extern struct rte_eth_dev rte_eth_devices[]; */ extern uint8_t rte_eth_dev_count(void); +/** + * Function for internal use by dummy drivers primarily, e.g. ring-based + * driver. + * Allocates a new ethdev slot for an ethernet device and returns the pointer + * to that slot for the driver to use. + * + * @return + * - Slot in the rte_dev_devices array for a new device; + */ +struct rte_eth_dev *rte_eth_dev_allocate(void); + struct eth_driver; /** * @internal @@ -1201,105 +1323,6 @@ struct eth_driver { */ extern void rte_eth_driver_register(struct eth_driver *eth_drv); -/** - * The initialization function of the driver for - * Intel(r) IGB Gigabit Ethernet Controller devices. - * This function is invoked once at EAL start time. - * @return - * 0 on success - */ -extern int rte_igb_pmd_init(void); - -/** - * The initialization function of the driver for - * Intel(r) EM Gigabit Ethernet Controller devices. - * This function is invoked once at EAL start time. - * @return - * 0 on success - */ -extern int rte_em_pmd_init(void); - -/** - * The initialization function of the driver for 1Gbps Intel IGB_VF - * Ethernet devices. - * Invoked once at EAL start time. - * @return - * 0 on success - */ -extern int rte_igbvf_pmd_init(void); - -/** - * The initialization function of the driver for 10Gbps Intel IXGBE - * Ethernet devices. - * Invoked once at EAL start time. - * @return - * 0 on success - */ -extern int rte_ixgbe_pmd_init(void); - -/** - * The initialization function of the driver for 10Gbps Intel IXGBE_VF - * Ethernet devices. - * Invoked once at EAL start time. - * @return - * 0 on success - */ -extern int rte_ixgbevf_pmd_init(void); - -/** - * The initialization function of *all* supported and enabled drivers. - * Right now, the following PMDs are supported: - * - igb - * - igbvf - * - em - * - ixgbe - * - ixgbevf - * This function is invoked once at EAL start time. - * @return - * 0 on success. - * Error code of the device initialization failure, - * -ENODEV if there are no drivers available - * (e.g. if all driver config options are = n). - */ -static inline -int rte_pmd_init_all(void) -{ - int ret = -ENODEV; - -#ifdef RTE_LIBRTE_IGB_PMD - if ((ret = rte_igb_pmd_init()) != 0) { - RTE_LOG(ERR, PMD, "Cannot init igb PMD\n"); - return (ret); - } - if ((ret = rte_igbvf_pmd_init()) != 0) { - RTE_LOG(ERR, PMD, "Cannot init igbvf PMD\n"); - return (ret); - } -#endif /* RTE_LIBRTE_IGB_PMD */ - -#ifdef RTE_LIBRTE_EM_PMD - if ((ret = rte_em_pmd_init()) != 0) { - RTE_LOG(ERR, PMD, "Cannot init em PMD\n"); - return (ret); - } -#endif /* RTE_LIBRTE_EM_PMD */ - -#ifdef RTE_LIBRTE_IXGBE_PMD - if ((ret = rte_ixgbe_pmd_init()) != 0) { - RTE_LOG(ERR, PMD, "Cannot init ixgbe PMD\n"); - return (ret); - } - if ((ret = rte_ixgbevf_pmd_init()) != 0) { - RTE_LOG(ERR, PMD, "Cannot init ixgbevf PMD\n"); - return (ret); - } -#endif /* RTE_LIBRTE_IXGBE_PMD */ - - if (ret == -ENODEV) - RTE_LOG(ERR, PMD, "No PMD(s) are configured\n"); - return (ret); -} - /** * Configure an Ethernet device. * This function must be invoked first before any other function in the @@ -2377,7 +2400,7 @@ int rte_eth_dev_rss_reta_query(uint8_t port, struct rte_eth_rss_reta *reta_conf); /** - * Updates unicast hash table for receiving packet with the given destionation + * Updates unicast hash table for receiving packet with the given destination * MAC address, and the packet is routed to all VFs for which the RX mode is * accept packets that match the unicast hash table. * @@ -2545,6 +2568,187 @@ int rte_eth_mirror_rule_set(uint8_t port_id, int rte_eth_mirror_rule_reset(uint8_t port_id, uint8_t rule_id); +/** + * Initialize bypass logic. This function needs to be called before + * executing any other bypass API. + * + * @param port + * The port identifier of the Ethernet device. + * @return + * - (0) if successful. + * - (-ENOTSUP) if hardware doesn't support. + * - (-EINVAL) if bad parameter. + */ +int rte_eth_dev_bypass_init(uint8_t port); + +/** + * Return bypass state. + * + * @param port + * The port identifier of the Ethernet device. + * @param state + * The return bypass state. + * - (1) Normal mode + * - (2) Bypass mode + * - (3) Isolate mode + * @return + * - (0) if successful. + * - (-ENOTSUP) if hardware doesn't support. + * - (-EINVAL) if bad parameter. + */ +int rte_eth_dev_bypass_state_show(uint8_t port, uint32_t *state); + +/** + * Set bypass state + * + * @param port + * The port identifier of the Ethernet device. + * @param state + * The current bypass state. + * - (1) Normal mode + * - (2) Bypass mode + * - (3) Isolate mode + * @return + * - (0) if successful. + * - (-ENOTSUP) if hardware doesn't support. + * - (-EINVAL) if bad parameter. + */ +int rte_eth_dev_bypass_state_set(uint8_t port, uint32_t *new_state); + +/** + * Return bypass state when given event occurs. + * + * @param port + * The port identifier of the Ethernet device. + * @param event + * The bypass event + * - (1) Main power on (power button is pushed) + * - (2) Auxiliary power on (power supply is being plugged) + * - (3) Main power off (system shutdown and power supply is left plugged in) + * - (4) Auxiliary power off (power supply is being unplugged) + * - (5) Display or set the watchdog timer + * @param state + * The bypass state when given event occurred. + * - (1) Normal mode + * - (2) Bypass mode + * - (3) Isolate mode + * @return + * - (0) if successful. + * - (-ENOTSUP) if hardware doesn't support. + * - (-EINVAL) if bad parameter. + */ +int rte_eth_dev_bypass_event_show(uint8_t port, uint32_t event, uint32_t *state); + +/** + * Set bypass state when given event occurs. + * + * @param port + * The port identifier of the Ethernet device. + * @param event + * The bypass event + * - (1) Main power on (power button is pushed) + * - (2) Auxiliary power on (power supply is being plugged) + * - (3) Main power off (system shutdown and power supply is left plugged in) + * - (4) Auxiliary power off (power supply is being unplugged) + * - (5) Display or set the watchdog timer + * @param state + * The assigned state when given event occurs. + * - (1) Normal mode + * - (2) Bypass mode + * - (3) Isolate mode + * @return + * - (0) if successful. + * - (-ENOTSUP) if hardware doesn't support. + * - (-EINVAL) if bad parameter. + */ +int rte_eth_dev_bypass_event_store(uint8_t port, uint32_t event, uint32_t state); + +/** + * Set bypass watchdog timeout count. + * + * @param port + * The port identifier of the Ethernet device. + * @param state + * The timeout to be set. + * - (0) 0 seconds (timer is off) + * - (1) 1.5 seconds + * - (2) 2 seconds + * - (3) 3 seconds + * - (4) 4 seconds + * - (5) 8 seconds + * - (6) 16 seconds + * - (7) 32 seconds + * @return + * - (0) if successful. + * - (-ENOTSUP) if hardware doesn't support. + * - (-EINVAL) if bad parameter. + */ +int rte_eth_dev_wd_timeout_store(uint8_t port, uint32_t timeout); + +/** + * Get bypass firmware version. + * + * @param port + * The port identifier of the Ethernet device. + * @param ver + * The firmware version + * @return + * - (0) if successful. + * - (-ENOTSUP) if hardware doesn't support. + * - (-EINVAL) if bad parameter. + */ +int rte_eth_dev_bypass_ver_show(uint8_t port, uint32_t *ver); + +/** + * Return bypass watchdog timeout in seconds + * + * @param port + * The port identifier of the Ethernet device. + * @param wd_timeout + * The return watchdog timeout. "0" represents timer expired + * - (0) 0 seconds (timer is off) + * - (1) 1.5 seconds + * - (2) 2 seconds + * - (3) 3 seconds + * - (4) 4 seconds + * - (5) 8 seconds + * - (6) 16 seconds + * - (7) 32 seconds + * @return + * - (0) if successful. + * - (-ENOTSUP) if hardware doesn't support. + * - (-EINVAL) if bad parameter. + */ +int rte_eth_dev_bypass_wd_timeout_show(uint8_t port, uint32_t *wd_timeout); + +/** + * Reset bypass watchdog timer + * + * @param port + * The port identifier of the Ethernet device. + * @return + * - (0) if successful. + * - (-ENOTSUP) if hardware doesn't support. + * - (-EINVAL) if bad parameter. + */ +int rte_eth_dev_bypass_wd_reset(uint8_t port); + + /** + * Configuration of Receive Side Scaling hash computation of Ethernet device. + * + * @param port + * The port identifier of the Ethernet device. + * @param rss_conf + * The new configuration to use for RSS hash computation on the port. + * @return + * - (0) if successful. + * - (-ENODEV) if port identifier is invalid. + * - (-ENOTSUP) if hardware doesn't support. + * - (-EINVAL) if bad parameter. + */ +int rte_eth_dev_rss_hash_update(uint8_t port_id, + struct rte_eth_rss_conf *rss_conf); + #ifdef __cplusplus } #endif