update Intel copyright years to 2014
[dpdk.git] / lib / librte_ether / rte_ethdev.h
index 524ef4f..01b93bb 100644 (file)
@@ -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
@@ -540,6 +540,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 */
 };
 
 /**
@@ -987,6 +988,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 +1106,19 @@ 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
+
 };
 
 /**
@@ -1134,6 +1203,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
@@ -1246,6 +1326,15 @@ extern int rte_ixgbe_pmd_init(void);
  */
 extern int rte_ixgbevf_pmd_init(void);
 
+/**
+ * The initialization function of the driver for Qumranet virtio-net
+ * Ethernet devices.
+ * Invoked once at EAL start time.
+ * @return
+ *   0 on success
+ */
+extern int rte_virtio_pmd_init(void);
+
 /**
  * The initialization function of *all* supported and enabled drivers.
  * Right now, the following PMDs are supported:
@@ -1295,6 +1384,13 @@ int rte_pmd_init_all(void)
        }
 #endif /* RTE_LIBRTE_IXGBE_PMD */
 
+#ifdef RTE_LIBRTE_VIRTIO_PMD
+       if ((ret = rte_virtio_pmd_init()) != 0) {
+               RTE_LOG(ERR, PMD, "Cannot init virtio PMD\n");
+               return (ret);
+       }
+#endif /* RTE_LIBRTE_VIRTIO_PMD */
+
        if (ret == -ENODEV)
                RTE_LOG(ERR, PMD, "No PMD(s) are configured\n");
        return (ret);
@@ -2377,7 +2473,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 +2641,171 @@ 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);
+
 #ifdef __cplusplus
 }
 #endif