mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
netdev: Clean up class initialization.
The macros are hard to read. This makes it a little more readable. Signed-off-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
This commit is contained in:
@@ -4696,161 +4696,85 @@ netdev_dpdk_flow_del(struct netdev *netdev, const ovs_u128 *ufid,
|
||||
ufid, rte_flow);
|
||||
}
|
||||
|
||||
#define DPDK_FLOW_OFFLOAD_API \
|
||||
NULL, /* flow_flush */ \
|
||||
NULL, /* flow_dump_create */ \
|
||||
NULL, /* flow_dump_destroy */ \
|
||||
NULL, /* flow_dump_next */ \
|
||||
netdev_dpdk_flow_put, \
|
||||
NULL, /* flow_get */ \
|
||||
netdev_dpdk_flow_del, \
|
||||
NULL /* init_flow_api */
|
||||
#define NETDEV_DPDK_CLASS_COMMON \
|
||||
.is_pmd = true, \
|
||||
.alloc = netdev_dpdk_alloc, \
|
||||
.dealloc = netdev_dpdk_dealloc, \
|
||||
.get_config = netdev_dpdk_get_config, \
|
||||
.get_numa_id = netdev_dpdk_get_numa_id, \
|
||||
.set_etheraddr = netdev_dpdk_set_etheraddr, \
|
||||
.get_etheraddr = netdev_dpdk_get_etheraddr, \
|
||||
.get_mtu = netdev_dpdk_get_mtu, \
|
||||
.set_mtu = netdev_dpdk_set_mtu, \
|
||||
.get_ifindex = netdev_dpdk_get_ifindex, \
|
||||
.get_carrier_resets = netdev_dpdk_get_carrier_resets, \
|
||||
.set_miimon_interval = netdev_dpdk_set_miimon, \
|
||||
.set_policing = netdev_dpdk_set_policing, \
|
||||
.get_qos_types = netdev_dpdk_get_qos_types, \
|
||||
.get_qos = netdev_dpdk_get_qos, \
|
||||
.set_qos = netdev_dpdk_set_qos, \
|
||||
.update_flags = netdev_dpdk_update_flags, \
|
||||
.rxq_alloc = netdev_dpdk_rxq_alloc, \
|
||||
.rxq_construct = netdev_dpdk_rxq_construct, \
|
||||
.rxq_destruct = netdev_dpdk_rxq_destruct, \
|
||||
.rxq_dealloc = netdev_dpdk_rxq_dealloc, \
|
||||
DPDK_FLOW_OFFLOAD_API
|
||||
|
||||
#define NETDEV_DPDK_CLASS_BASE \
|
||||
NETDEV_DPDK_CLASS_COMMON, \
|
||||
.init = netdev_dpdk_class_init, \
|
||||
.destruct = netdev_dpdk_destruct, \
|
||||
.set_tx_multiq = netdev_dpdk_set_tx_multiq, \
|
||||
.get_carrier = netdev_dpdk_get_carrier, \
|
||||
.get_stats = netdev_dpdk_get_stats, \
|
||||
.get_custom_stats = netdev_dpdk_get_custom_stats, \
|
||||
.get_features = netdev_dpdk_get_features, \
|
||||
.get_status = netdev_dpdk_get_status, \
|
||||
.reconfigure = netdev_dpdk_reconfigure, \
|
||||
.rxq_recv = netdev_dpdk_rxq_recv
|
||||
|
||||
#define NETDEV_DPDK_CLASS(NAME, INIT, CONSTRUCT, DESTRUCT, \
|
||||
SET_CONFIG, SET_TX_MULTIQ, SEND, \
|
||||
GET_CARRIER, GET_STATS, \
|
||||
GET_CUSTOM_STATS, \
|
||||
GET_FEATURES, GET_STATUS, \
|
||||
RECONFIGURE, RXQ_RECV) \
|
||||
{ \
|
||||
NAME, \
|
||||
true, /* is_pmd */ \
|
||||
INIT, /* init */ \
|
||||
NULL, /* netdev_dpdk_run */ \
|
||||
NULL, /* netdev_dpdk_wait */ \
|
||||
\
|
||||
netdev_dpdk_alloc, \
|
||||
CONSTRUCT, \
|
||||
DESTRUCT, \
|
||||
netdev_dpdk_dealloc, \
|
||||
netdev_dpdk_get_config, \
|
||||
SET_CONFIG, \
|
||||
NULL, /* get_tunnel_config */ \
|
||||
NULL, /* build header */ \
|
||||
NULL, /* push header */ \
|
||||
NULL, /* pop header */ \
|
||||
netdev_dpdk_get_numa_id, /* get_numa_id */ \
|
||||
SET_TX_MULTIQ, \
|
||||
\
|
||||
SEND, /* send */ \
|
||||
NULL, /* send_wait */ \
|
||||
\
|
||||
netdev_dpdk_set_etheraddr, \
|
||||
netdev_dpdk_get_etheraddr, \
|
||||
netdev_dpdk_get_mtu, \
|
||||
netdev_dpdk_set_mtu, \
|
||||
netdev_dpdk_get_ifindex, \
|
||||
GET_CARRIER, \
|
||||
netdev_dpdk_get_carrier_resets, \
|
||||
netdev_dpdk_set_miimon, \
|
||||
GET_STATS, \
|
||||
GET_CUSTOM_STATS, \
|
||||
GET_FEATURES, \
|
||||
NULL, /* set_advertisements */ \
|
||||
NULL, /* get_pt_mode */ \
|
||||
\
|
||||
netdev_dpdk_set_policing, \
|
||||
netdev_dpdk_get_qos_types, \
|
||||
NULL, /* get_qos_capabilities */ \
|
||||
netdev_dpdk_get_qos, \
|
||||
netdev_dpdk_set_qos, \
|
||||
NULL, /* get_queue */ \
|
||||
NULL, /* set_queue */ \
|
||||
NULL, /* delete_queue */ \
|
||||
NULL, /* get_queue_stats */ \
|
||||
NULL, /* queue_dump_start */ \
|
||||
NULL, /* queue_dump_next */ \
|
||||
NULL, /* queue_dump_done */ \
|
||||
NULL, /* dump_queue_stats */ \
|
||||
\
|
||||
NULL, /* set_in4 */ \
|
||||
NULL, /* get_addr_list */ \
|
||||
NULL, /* add_router */ \
|
||||
NULL, /* get_next_hop */ \
|
||||
GET_STATUS, \
|
||||
NULL, /* arp_lookup */ \
|
||||
\
|
||||
netdev_dpdk_update_flags, \
|
||||
RECONFIGURE, \
|
||||
\
|
||||
netdev_dpdk_rxq_alloc, \
|
||||
netdev_dpdk_rxq_construct, \
|
||||
netdev_dpdk_rxq_destruct, \
|
||||
netdev_dpdk_rxq_dealloc, \
|
||||
RXQ_RECV, \
|
||||
NULL, /* rx_wait */ \
|
||||
NULL, /* rxq_drain */ \
|
||||
DPDK_FLOW_OFFLOAD_API, \
|
||||
NULL /* get_block_id */ \
|
||||
}
|
||||
static const struct netdev_class dpdk_class = {
|
||||
.type = "dpdk",
|
||||
NETDEV_DPDK_CLASS_BASE,
|
||||
.construct = netdev_dpdk_construct,
|
||||
.set_config = netdev_dpdk_set_config,
|
||||
.send = netdev_dpdk_eth_send,
|
||||
};
|
||||
|
||||
static const struct netdev_class dpdk_class =
|
||||
NETDEV_DPDK_CLASS(
|
||||
"dpdk",
|
||||
netdev_dpdk_class_init,
|
||||
netdev_dpdk_construct,
|
||||
netdev_dpdk_destruct,
|
||||
netdev_dpdk_set_config,
|
||||
netdev_dpdk_set_tx_multiq,
|
||||
netdev_dpdk_eth_send,
|
||||
netdev_dpdk_get_carrier,
|
||||
netdev_dpdk_get_stats,
|
||||
netdev_dpdk_get_custom_stats,
|
||||
netdev_dpdk_get_features,
|
||||
netdev_dpdk_get_status,
|
||||
netdev_dpdk_reconfigure,
|
||||
netdev_dpdk_rxq_recv);
|
||||
static const struct netdev_class dpdk_ring_class = {
|
||||
.type = "dpdkr",
|
||||
NETDEV_DPDK_CLASS_BASE,
|
||||
.construct = netdev_dpdk_ring_construct,
|
||||
.set_config = netdev_dpdk_ring_set_config,
|
||||
.send = netdev_dpdk_ring_send,
|
||||
};
|
||||
|
||||
static const struct netdev_class dpdk_ring_class =
|
||||
NETDEV_DPDK_CLASS(
|
||||
"dpdkr",
|
||||
netdev_dpdk_class_init,
|
||||
netdev_dpdk_ring_construct,
|
||||
netdev_dpdk_destruct,
|
||||
netdev_dpdk_ring_set_config,
|
||||
netdev_dpdk_set_tx_multiq,
|
||||
netdev_dpdk_ring_send,
|
||||
netdev_dpdk_get_carrier,
|
||||
netdev_dpdk_get_stats,
|
||||
netdev_dpdk_get_custom_stats,
|
||||
netdev_dpdk_get_features,
|
||||
netdev_dpdk_get_status,
|
||||
netdev_dpdk_reconfigure,
|
||||
netdev_dpdk_rxq_recv);
|
||||
static const struct netdev_class dpdk_vhost_class = {
|
||||
.type = "dpdkvhostuser",
|
||||
NETDEV_DPDK_CLASS_COMMON,
|
||||
.construct = netdev_dpdk_vhost_construct,
|
||||
.destruct = netdev_dpdk_vhost_destruct,
|
||||
.send = netdev_dpdk_vhost_send,
|
||||
.get_carrier = netdev_dpdk_vhost_get_carrier,
|
||||
.get_stats = netdev_dpdk_vhost_get_stats,
|
||||
.get_status = netdev_dpdk_vhost_user_get_status,
|
||||
.reconfigure = netdev_dpdk_vhost_reconfigure,
|
||||
.rxq_recv = netdev_dpdk_vhost_rxq_recv
|
||||
};
|
||||
|
||||
static const struct netdev_class dpdk_vhost_class =
|
||||
NETDEV_DPDK_CLASS(
|
||||
"dpdkvhostuser",
|
||||
NULL,
|
||||
netdev_dpdk_vhost_construct,
|
||||
netdev_dpdk_vhost_destruct,
|
||||
NULL,
|
||||
NULL,
|
||||
netdev_dpdk_vhost_send,
|
||||
netdev_dpdk_vhost_get_carrier,
|
||||
netdev_dpdk_vhost_get_stats,
|
||||
NULL,
|
||||
NULL,
|
||||
netdev_dpdk_vhost_user_get_status,
|
||||
netdev_dpdk_vhost_reconfigure,
|
||||
netdev_dpdk_vhost_rxq_recv);
|
||||
static const struct netdev_class dpdk_vhost_client_class =
|
||||
NETDEV_DPDK_CLASS(
|
||||
"dpdkvhostuserclient",
|
||||
NULL,
|
||||
netdev_dpdk_vhost_client_construct,
|
||||
netdev_dpdk_vhost_destruct,
|
||||
netdev_dpdk_vhost_client_set_config,
|
||||
NULL,
|
||||
netdev_dpdk_vhost_send,
|
||||
netdev_dpdk_vhost_get_carrier,
|
||||
netdev_dpdk_vhost_get_stats,
|
||||
NULL,
|
||||
NULL,
|
||||
netdev_dpdk_vhost_user_get_status,
|
||||
netdev_dpdk_vhost_client_reconfigure,
|
||||
netdev_dpdk_vhost_rxq_recv);
|
||||
static const struct netdev_class dpdk_vhost_client_class = {
|
||||
.type = "dpdkvhostuserclient",
|
||||
NETDEV_DPDK_CLASS_COMMON,
|
||||
.construct = netdev_dpdk_vhost_client_construct,
|
||||
.destruct = netdev_dpdk_vhost_destruct,
|
||||
.set_config = netdev_dpdk_vhost_client_set_config,
|
||||
.send = netdev_dpdk_vhost_send,
|
||||
.get_carrier = netdev_dpdk_vhost_get_carrier,
|
||||
.get_stats = netdev_dpdk_vhost_get_stats,
|
||||
.get_status = netdev_dpdk_vhost_user_get_status,
|
||||
.reconfigure = netdev_dpdk_vhost_client_reconfigure,
|
||||
.rxq_recv = netdev_dpdk_vhost_rxq_recv
|
||||
};
|
||||
|
||||
void
|
||||
netdev_dpdk_register(void)
|
||||
|
Reference in New Issue
Block a user