Thanks for the patch, I had almost the exact same change in one of my local branches!
Applied to master On 14/03/2016 08:18, "Ilya Maximets" <i.maxim...@samsung.com> wrote: >Made to simplify creation of derived classes. > >Signed-off-by: Ilya Maximets <i.maxim...@samsung.com> >--- > lib/netdev-bsd.c | 1 + > lib/netdev-dpdk.c | 1 + > lib/netdev-dummy.c | 1 + > lib/netdev-linux.c | 1 + > lib/netdev-provider.h | 3 +++ > lib/netdev-vport.c | 20 +++++++++++--------- > lib/netdev-windows.c | 1 + > lib/netdev.c | 5 +---- > 8 files changed, 20 insertions(+), 13 deletions(-) > >diff --git a/lib/netdev-bsd.c b/lib/netdev-bsd.c >index edf04bf..b148714 100644 >--- a/lib/netdev-bsd.c >+++ b/lib/netdev-bsd.c >@@ -1547,6 +1547,7 @@ netdev_bsd_update_flags(struct netdev *netdev_, >enum netdev_flags off, > GET_FEATURES) \ > { \ > NAME, \ >+ false, /* is_pmd */ \ > \ > NULL, /* init */ \ > netdev_bsd_run, \ >diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c >index f402354..6ac0eec 100644 >--- a/lib/netdev-dpdk.c >+++ b/lib/netdev-dpdk.c >@@ -2641,6 +2641,7 @@ static const struct dpdk_qos_ops egress_policer_ops >= { > GET_CARRIER, GET_STATS, GET_FEATURES, GET_STATUS, RXQ_RECV) >\ > { \ > NAME, \ >+ true, /* is_pmd */ \ > INIT, /* init */ \ > NULL, /* netdev_dpdk_run */ \ > NULL, /* netdev_dpdk_wait */ \ >diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c >index ccd4a0a..6fa1169 100644 >--- a/lib/netdev-dummy.c >+++ b/lib/netdev-dummy.c >@@ -1195,6 +1195,7 @@ netdev_dummy_update_flags(struct netdev *netdev_, > > static const struct netdev_class dummy_class = { > "dummy", >+ false, /* is_pmd */ > NULL, /* init */ > netdev_dummy_run, > netdev_dummy_wait, >diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c >index 570677e..dd39f0e 100644 >--- a/lib/netdev-linux.c >+++ b/lib/netdev-linux.c >@@ -2840,6 +2840,7 @@ netdev_linux_update_flags(struct netdev *netdev_, >enum netdev_flags off, > GET_FEATURES, GET_STATUS) \ > { \ > NAME, \ >+ false, /* is_pmd */ \ > \ > NULL, \ > netdev_linux_run, \ >diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h >index 1952a02..77aec4e 100644 >--- a/lib/netdev-provider.h >+++ b/lib/netdev-provider.h >@@ -205,6 +205,9 @@ struct netdev_class { > * the system. */ > const char *type; > >+ /* If 'true' then this netdev should be polled by PMD threads. */ >+ bool is_pmd; >+ > /* ## ------------------- ## */ > /* ## Top-Level Functions ## */ > /* ## ------------------- ## */ >diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c >index df6d8cf..4ba146d 100644 >--- a/lib/netdev-vport.c >+++ b/lib/netdev-vport.c >@@ -1549,11 +1549,12 @@ netdev_vport_range(struct unixctl_conn *conn, int >argc, > > #define TUNNEL_CLASS(NAME, DPIF_PORT, BUILD_HEADER, PUSH_HEADER, >POP_HEADER) \ > { DPIF_PORT, > \ >- { NAME, VPORT_FUNCTIONS(get_tunnel_config, > \ >- set_tunnel_config, > \ >- get_netdev_tunnel_config, > \ >- tunnel_get_status, > \ >- BUILD_HEADER, PUSH_HEADER, POP_HEADER) }} >+ { NAME, false, > \ >+ VPORT_FUNCTIONS(get_tunnel_config, > \ >+ set_tunnel_config, > \ >+ get_netdev_tunnel_config, > \ >+ tunnel_get_status, > \ >+ BUILD_HEADER, PUSH_HEADER, POP_HEADER) }} > > void > netdev_vport_tunnel_register(void) >@@ -1595,9 +1596,10 @@ netdev_vport_patch_register(void) > { > static const struct vport_class patch_class = > { NULL, >- { "patch", VPORT_FUNCTIONS(get_patch_config, >- set_patch_config, >- NULL, >- NULL, NULL, NULL, NULL) }}; >+ { "patch", false, >+ VPORT_FUNCTIONS(get_patch_config, >+ set_patch_config, >+ NULL, >+ NULL, NULL, NULL, NULL) }}; > netdev_register_provider(&patch_class.netdev_class); > } >diff --git a/lib/netdev-windows.c b/lib/netdev-windows.c >index 093175f..ab91632 100644 >--- a/lib/netdev-windows.c >+++ b/lib/netdev-windows.c >@@ -490,6 +490,7 @@ netdev_windows_internal_construct(struct netdev >*netdev_) > #define NETDEV_WINDOWS_CLASS(NAME, CONSTRUCT) \ > { \ > .type = NAME, \ >+ .is_pmd = false, \ > .alloc = netdev_windows_alloc, \ > .construct = CONSTRUCT, \ > .destruct = netdev_windows_destruct, \ >diff --git a/lib/netdev.c b/lib/netdev.c >index 150f8d8..83b0300 100644 >--- a/lib/netdev.c >+++ b/lib/netdev.c >@@ -115,10 +115,7 @@ netdev_requested_n_rxq(const struct netdev *netdev) > bool > netdev_is_pmd(const struct netdev *netdev) > { >- return (!strcmp(netdev->netdev_class->type, "dpdk") || >- !strcmp(netdev->netdev_class->type, "dpdkr") || >- !strcmp(netdev->netdev_class->type, "dpdkvhostcuse") || >- !strcmp(netdev->netdev_class->type, "dpdkvhostuser")); >+ return netdev->netdev_class->is_pmd; > } > > static void >-- >2.5.0 > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev