typedef enum
{
- VNET_HW_INTERFACE_RX_MODE_UNKNOWN,
- VNET_HW_INTERFACE_RX_MODE_POLLING,
- VNET_HW_INTERFACE_RX_MODE_INTERRUPT,
- VNET_HW_INTERFACE_RX_MODE_ADAPTIVE,
- VNET_HW_INTERFACE_RX_MODE_DEFAULT,
- VNET_HW_INTERFACE_NUM_RX_MODES,
-} vnet_hw_interface_rx_mode;
+ VNET_HW_IF_RX_MODE_UNKNOWN,
+ VNET_HW_IF_RX_MODE_POLLING,
+ VNET_HW_IF_RX_MODE_INTERRUPT,
+ VNET_HW_IF_RX_MODE_ADAPTIVE,
+ VNET_HW_IF_RX_MODE_DEFAULT,
+ VNET_HW_IF_NUM_RX_MODES,
+} vnet_hw_if_rx_mode;
/* Interface up/down callback. */
typedef clib_error_t *(vnet_interface_function_t)
/* Interface set rx mode callback. */
typedef clib_error_t *(vnet_interface_set_rx_mode_function_t)
(struct vnet_main_t * vnm, u32 if_index, u32 queue_id,
- vnet_hw_interface_rx_mode mode);
+ vnet_hw_if_rx_mode mode);
/* Interface set l2 mode callback. */
typedef clib_error_t *(vnet_interface_set_l2_mode_function_t)
(struct vnet_main_t * vnm, struct vnet_hw_interface_t * hi,
i32 l2_if_adjust);
+/* Interface to set rss queues of the interface */
+typedef clib_error_t *(vnet_interface_rss_queues_set_t)
+ (struct vnet_main_t * vnm, struct vnet_hw_interface_t * hi,
+ clib_bitmap_t * bitmap);
+
typedef enum
{
VNET_FLOW_DEV_OP_ADD_FLOW,
_VNET_INTERFACE_FUNCTION_DECL(f,sw_interface_mtu_change)
#define VNET_SW_INTERFACE_ADD_DEL_FUNCTION(f) \
_VNET_INTERFACE_FUNCTION_DECL(f,sw_interface_add_del)
+#define VNET_SW_INTERFACE_ADD_DEL_FUNCTION_PRIO(f,p) \
+ _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,sw_interface_add_del,p)
#define VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION(f) \
_VNET_INTERFACE_FUNCTION_DECL(f,sw_interface_admin_up_down)
#define VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION_PRIO(f,p) \
/* Function to add/delete additional MAC addresses */
vnet_interface_add_del_mac_address_function_t *mac_addr_add_del_function;
+
+ /* Interface to set rss queues of the interface */
+ vnet_interface_rss_queues_set_t *set_rss_queues_function;
+
} vnet_device_class_t;
#ifndef CLIB_MARCH_VARIANT
static __clib_unused vnet_device_class_t __clib_unused_##x
#endif
-#define VNET_DEVICE_CLASS_TX_FN(devclass) \
-uword CLIB_MARCH_SFX (devclass##_tx_fn)(); \
-static vlib_node_fn_registration_t \
- CLIB_MARCH_SFX(devclass##_tx_fn_registration) = \
- { .function = &CLIB_MARCH_SFX (devclass##_tx_fn), }; \
- \
-static void __clib_constructor \
-CLIB_MARCH_SFX (devclass##_tx_fn_multiarch_register) (void) \
-{ \
- extern vnet_device_class_t devclass; \
- vlib_node_fn_registration_t *r; \
- r = &CLIB_MARCH_SFX (devclass##_tx_fn_registration); \
- r->priority = CLIB_MARCH_FN_PRIORITY(); \
- r->next_registration = devclass.tx_fn_registrations; \
- devclass.tx_fn_registrations = r; \
-} \
-uword CLIB_CPU_OPTIMIZED CLIB_MARCH_SFX (devclass##_tx_fn)
+#define VNET_DEVICE_CLASS_TX_FN(devclass) \
+ uword CLIB_MARCH_SFX (devclass##_tx_fn) (); \
+ static vlib_node_fn_registration_t CLIB_MARCH_SFX ( \
+ devclass##_tx_fn_registration) = { \
+ .function = &CLIB_MARCH_SFX (devclass##_tx_fn), \
+ }; \
+ \
+ static void __clib_constructor CLIB_MARCH_SFX ( \
+ devclass##_tx_fn_multiarch_register) (void) \
+ { \
+ extern vnet_device_class_t devclass; \
+ vlib_node_fn_registration_t *r; \
+ r = &CLIB_MARCH_SFX (devclass##_tx_fn_registration); \
+ r->march_variant = CLIB_MARCH_SFX (CLIB_MARCH_VARIANT_TYPE); \
+ r->next_registration = devclass.tx_fn_registrations; \
+ devclass.tx_fn_registrations = r; \
+ } \
+ uword CLIB_CPU_OPTIMIZED CLIB_MARCH_SFX (devclass##_tx_fn)
/**
* Link Type: A description of the protocol of packets on the link.
_link <= VNET_LINK_NSH; \
_link++)
+#define FOR_EACH_VNET_IP_LINK(_link) \
+ for (_link = VNET_LINK_IP4; \
+ _link <= VNET_LINK_IP6; \
+ _link++)
+
/**
- * @brief Number of link types. Not part of the enum so it does not have to be included in
- * switch statements
+ * @brief Number of link types. Not part of the enum so it does not have to be
+ * included in switch statements
*/
#define VNET_LINK_NUM (VNET_LINK_NSH+1)
+#define VNET_N_LINKS VNET_LINK_NUM
/**
* @brief Convert a link to to an Ethertype
} vnet_hw_interface_class_t;
/**
- * @brief Return a complete, zero-length (aka dummy) rewrite
+ * @brief Return a complete, zero-length (aka placeholder) rewrite
*/
extern u8 *default_build_rewrite (struct vnet_main_t *vnm,
u32 sw_if_index,
(VNET_HW_INTERFACE_FLAG_HALF_DUPLEX | \
VNET_HW_INTERFACE_FLAG_FULL_DUPLEX)
+typedef struct
+{
+ /* hw interface index */
+ u32 hw_if_index;
+
+ /* device instance */
+ u32 dev_instance;
+
+ /* index of thread pollling this queue */
+ u32 thread_index;
+
+ /* file index of queue interrupt line */
+ u32 file_index;
+
+ /* hardware queue identifier */
+ u32 queue_id;
+
+ /* mode */
+ vnet_hw_if_rx_mode mode : 8;
+#define VNET_HW_IF_RXQ_THREAD_ANY ~0
+#define VNET_HW_IF_RXQ_NO_RX_INTERRUPT ~0
+} vnet_hw_if_rx_queue_t;
+
/* Hardware-interface. This corresponds to a physical wire
that packets flow over. */
typedef struct vnet_hw_interface_t
/* input node cpu index by queue */
u32 *input_node_thread_index_by_queue;
- /* vnet_hw_interface_rx_mode by queue */
- u8 *rx_mode_by_queue;
- vnet_hw_interface_rx_mode default_rx_mode;
+ vnet_hw_if_rx_mode default_rx_mode;
- /* device input device_and_queue runtime index */
- uword *dq_runtime_index_by_queue;
+ /* rx queues */
+ u32 *rx_queue_indices;
/* numa node that hardware device connects to */
u8 numa_node;
+ /* rss queues bitmap */
+ clib_bitmap_t *rss_queues;
+
/* trace */
i32 n_trace;
u32 trace_classify_table_index;
} vnet_hw_interface_t;
+typedef struct
+{
+ u32 dev_instance;
+ u32 queue_id;
+} vnet_hw_if_rxq_poll_vector_t;
+
+typedef struct
+{
+ vnet_hw_if_rxq_poll_vector_t *rxq_poll_vector;
+ void *rxq_interrupts;
+} vnet_hw_if_rx_node_runtime_t;
+
extern vnet_device_class_t vnet_local_interface_device_class;
typedef enum
/* Hardware interfaces. */
vnet_hw_interface_t *hw_interfaces;
+ /* Hardware interface RX queues */
+ vnet_hw_if_rx_queue_t *hw_if_rx_queues;
+ uword *rxq_index_by_hw_if_index_and_queue_id;
+
/* Hash table mapping HW interface name to index. */
uword *hw_interface_by_name;
int vnet_interface_name_renumber (u32 sw_if_index, u32 new_show_dev_instance);
-uword vnet_interface_output_node (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame);
-
void vnet_register_format_buffer_opaque_helper
(vnet_buffer_opquae_formatter_t fn);
u8 rx_enable;
u8 tx_enable;
u8 drop_enable;
+ u8 preallocate_data;
+ u8 free_data;
u32 sw_if_index;
int filter;
} vnet_pcap_dispatch_trace_args_t;
int vnet_pcap_dispatch_trace_configure (vnet_pcap_dispatch_trace_args_t *);
+extern vlib_node_registration_t vnet_interface_output_node;
+
#endif /* included_vnet_interface_h */
/*