diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2019-12-03 18:56:26 +0100 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2019-12-04 15:54:48 +0000 |
commit | 3f5594d89f583d12c0fcf586f2c3c7e2b008ea7d (patch) | |
tree | 034075745cdadd0ffa46da95ae8c7df6acd87229 | |
parent | deb268febb3a06102f55259e57c54f0e02b1613e (diff) |
gso: remove the interface count
Type: refactor
Change-Id: I51405b9d09fb6fb03d08569369fdd4e11c647908
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
-rw-r--r-- | src/plugins/dpdk/device/init.c | 2 | ||||
-rw-r--r-- | src/plugins/vmxnet3/vmxnet3.c | 4 | ||||
-rw-r--r-- | src/vnet/devices/tap/tap.c | 7 | ||||
-rw-r--r-- | src/vnet/devices/virtio/device.c | 3 | ||||
-rw-r--r-- | src/vnet/devices/virtio/pci.c | 4 | ||||
-rw-r--r-- | src/vnet/devices/virtio/vhost_user_inline.h | 4 | ||||
-rw-r--r-- | src/vnet/interface.c | 1 | ||||
-rw-r--r-- | src/vnet/interface.h | 3 | ||||
-rw-r--r-- | src/vnet/ip/ip4_forward.c | 22 | ||||
-rw-r--r-- | src/vnet/ip/ip6_forward.c | 20 | ||||
-rw-r--r-- | src/vnet/pg/stream.c | 1 |
11 files changed, 14 insertions, 57 deletions
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c index 3b2eaa668ca..5a6262c30a1 100644 --- a/src/plugins/dpdk/device/init.c +++ b/src/plugins/dpdk/device/init.c @@ -207,7 +207,6 @@ dpdk_lib_init (dpdk_main_t * dm) int i; clib_error_t *error; vlib_main_t *vm = vlib_get_main (); - vnet_main_t *vnm = vnet_get_main (); vlib_thread_main_t *tm = vlib_get_thread_main (); vnet_device_main_t *vdm = &vnet_device_main; vnet_sw_interface_t *sw; @@ -756,7 +755,6 @@ dpdk_lib_init (dpdk_main_t * dm) (hi->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD)) { hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO; - vnm->interface_main.gso_interface_count++; xd->port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_TSO | DEV_TX_OFFLOAD_UDP_TSO; } diff --git a/src/plugins/vmxnet3/vmxnet3.c b/src/plugins/vmxnet3/vmxnet3.c index bddf8b49006..43e5b58cc4c 100644 --- a/src/plugins/vmxnet3/vmxnet3.c +++ b/src/plugins/vmxnet3/vmxnet3.c @@ -405,7 +405,6 @@ static clib_error_t * vmxnet3_device_init (vlib_main_t * vm, vmxnet3_device_t * vd, vmxnet3_create_if_args_t * args) { - vnet_main_t *vnm = vnet_get_main (); clib_error_t *error = 0; u32 ret, i, size; vlib_thread_main_t *tm = vlib_get_thread_main (); @@ -456,7 +455,6 @@ vmxnet3_device_init (vlib_main_t * vm, vmxnet3_device_t * vd, if (args->enable_gso && (vd->version >= 3)) { vd->gso_enable = 1; - vnm->interface_main.gso_interface_count++; } vmxnet3_reg_write (vd, 1, VMXNET3_REG_CMD, VMXNET3_CMD_GET_LINK); @@ -918,8 +916,6 @@ vmxnet3_delete_if (vlib_main_t * vm, vmxnet3_device_t * vd) clib_memset (vd, 0, sizeof (*vd)); pool_put (vmxm->devices, vd); - if (vd->gso_enable) - vnm->interface_main.gso_interface_count--; } /* diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c index 288099e2685..38f0605277d 100644 --- a/src/vnet/devices/tap/tap.c +++ b/src/vnet/devices/tap/tap.c @@ -583,7 +583,6 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args) if (args->tap_flags & TAP_FLAG_GSO) { hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO; - vnm->interface_main.gso_interface_count++; } vnet_hw_interface_set_input_node (vnm, vif->hw_if_index, virtio_input_node.index); @@ -640,10 +639,6 @@ tap_delete_if (vlib_main_t * vm, u32 sw_if_index) if (vif->type != VIRTIO_IF_TYPE_TAP) return VNET_API_ERROR_INVALID_INTERFACE; - /* decrement if this was a GSO interface */ - if (hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) - vnm->interface_main.gso_interface_count--; - /* bring down the interface */ vnet_hw_interface_set_flags (vnm, vif->hw_if_index, 0); vnet_sw_interface_set_flags (vnm, vif->sw_if_index, 0); @@ -683,7 +678,6 @@ tap_gso_enable_disable (vlib_main_t * vm, u32 sw_if_index, int enable_disable) { if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) == 0) { - vnm->interface_main.gso_interface_count++; hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO; } } @@ -691,7 +685,6 @@ tap_gso_enable_disable (vlib_main_t * vm, u32 sw_if_index, int enable_disable) { if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) != 0) { - vnm->interface_main.gso_interface_count--; hw->flags &= ~VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO; } } diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c index f9a1677f53f..16d1c808643 100644 --- a/src/vnet/devices/virtio/device.c +++ b/src/vnet/devices/virtio/device.c @@ -313,9 +313,8 @@ VNET_DEVICE_CLASS_TX_FN (virtio_device_class) (vlib_main_t * vm, virtio_main_t *nm = &virtio_main; vnet_interface_output_runtime_t *rund = (void *) node->runtime_data; virtio_if_t *vif = pool_elt_at_index (nm->interfaces, rund->dev_instance); - vnet_main_t *vnm = vnet_get_main (); - if (vnm->interface_main.gso_interface_count > 0) + if (vif->gso_enabled > 0) return virtio_interface_tx_inline (vm, node, frame, vif, 1 /* do_gso */ ); else return virtio_interface_tx_inline (vm, node, frame, vif, diff --git a/src/vnet/devices/virtio/pci.c b/src/vnet/devices/virtio/pci.c index 5cbf75f6187..925c6f5cb87 100644 --- a/src/vnet/devices/virtio/pci.c +++ b/src/vnet/devices/virtio/pci.c @@ -1207,7 +1207,6 @@ virtio_pci_create_if (vlib_main_t * vm, virtio_pci_create_if_args_t * args) { vif->gso_enabled = 1; hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO; - vnm->interface_main.gso_interface_count++; } } if (vif->features & VIRTIO_FEATURE (VIRTIO_NET_F_MQ)) @@ -1248,9 +1247,6 @@ virtio_pci_delete_if (vlib_main_t * vm, virtio_if_t * vif) virtio_pci_legacy_reset (vm, vif); - if (vif->gso_enabled) - vnm->interface_main.gso_interface_count--; - if (vif->hw_if_index) { vnet_hw_interface_set_flags (vnm, vif->hw_if_index, 0); diff --git a/src/vnet/devices/virtio/vhost_user_inline.h b/src/vnet/devices/virtio/vhost_user_inline.h index 8725c969046..e4a1d596040 100644 --- a/src/vnet/devices/virtio/vhost_user_inline.h +++ b/src/vnet/devices/virtio/vhost_user_inline.h @@ -277,20 +277,16 @@ vui_is_link_up (vhost_user_intf_t * vui) static_always_inline void vhost_user_update_gso_interface_count (vhost_user_intf_t * vui, u8 add) { - vnet_main_t *vnm = vnet_get_main (); vhost_user_main_t *vum = &vhost_user_main; if (vui->enable_gso) { if (add) { - vnm->interface_main.gso_interface_count++; vum->gso_count++; } else { - ASSERT (vnm->interface_main.gso_interface_count > 0); - vnm->interface_main.gso_interface_count--; ASSERT (vum->gso_count > 0); vum->gso_count--; } diff --git a/src/vnet/interface.c b/src/vnet/interface.c index 0b4d78afbde..51c5d825812 100644 --- a/src/vnet/interface.c +++ b/src/vnet/interface.c @@ -1341,7 +1341,6 @@ vnet_interface_init (vlib_main_t * vm) } } - im->gso_interface_count = 0; /* init per-thread data */ vec_validate_aligned (im->per_thread_data, vlib_num_workers (), CLIB_CACHE_LINE_BYTES); diff --git a/src/vnet/interface.h b/src/vnet/interface.h index e6450f5bf59..2bfb8db7444 100644 --- a/src/vnet/interface.h +++ b/src/vnet/interface.h @@ -871,9 +871,6 @@ typedef struct /* per-thread data */ vnet_interface_per_thread_data_t *per_thread_data; - /* enable GSO processing in packet path if this count is > 0 */ - u32 gso_interface_count; - /* feature_arc_index */ u8 output_feature_arc_index; } vnet_interface_main_t; diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c index a67b0618f86..bb036c8e969 100644 --- a/src/vnet/ip/ip4_forward.c +++ b/src/vnet/ip/ip4_forward.c @@ -2394,8 +2394,7 @@ always_inline uword ip4_rewrite_inline_with_gso (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame, - int do_counters, int is_midchain, int is_mcast, - int do_gso) + int do_counters, int is_midchain, int is_mcast) { ip_lookup_main_t *lm = &ip4_main.lookup_main; u32 *from = vlib_frame_vector_args (frame); @@ -2477,9 +2476,9 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm, u16 ip0_len = clib_net_to_host_u16 (ip0->length); u16 ip1_len = clib_net_to_host_u16 (ip1->length); - if (do_gso && (b[0]->flags & VNET_BUFFER_F_GSO)) + if (b[0]->flags & VNET_BUFFER_F_GSO) ip0_len = gso_mtu_sz (b[0]); - if (do_gso && (b[1]->flags & VNET_BUFFER_F_GSO)) + if (b[1]->flags & VNET_BUFFER_F_GSO) ip1_len = gso_mtu_sz (b[1]); ip4_mtu_check (b[0], ip0_len, @@ -2653,7 +2652,7 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm, /* Check MTU of outgoing interface. */ u16 ip0_len = clib_net_to_host_u16 (ip0->length); - if (do_gso && (b[0]->flags & VNET_BUFFER_F_GSO)) + if (b[0]->flags & VNET_BUFFER_F_GSO) ip0_len = gso_mtu_sz (b[0]); ip4_mtu_check (b[0], ip0_len, @@ -2751,7 +2750,7 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm, /* Check MTU of outgoing interface. */ u16 ip0_len = clib_net_to_host_u16 (ip0->length); - if (do_gso && (b[0]->flags & VNET_BUFFER_F_GSO)) + if (b[0]->flags & VNET_BUFFER_F_GSO) ip0_len = gso_mtu_sz (b[0]); ip4_mtu_check (b[0], ip0_len, @@ -2833,15 +2832,8 @@ ip4_rewrite_inline (vlib_main_t * vm, vlib_frame_t * frame, int do_counters, int is_midchain, int is_mcast) { - vnet_main_t *vnm = vnet_get_main (); - if (PREDICT_FALSE (vnm->interface_main.gso_interface_count > 0)) - return ip4_rewrite_inline_with_gso (vm, node, frame, do_counters, - is_midchain, is_mcast, - 1 /* do_gso */ ); - else - return ip4_rewrite_inline_with_gso (vm, node, frame, do_counters, - is_midchain, is_mcast, - 0 /* no do_gso */ ); + return ip4_rewrite_inline_with_gso (vm, node, frame, do_counters, + is_midchain, is_mcast); } diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c index acf650189dd..ae7083ba27b 100644 --- a/src/vnet/ip/ip6_forward.c +++ b/src/vnet/ip/ip6_forward.c @@ -1680,8 +1680,7 @@ always_inline uword ip6_rewrite_inline_with_gso (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame, - int do_counters, int is_midchain, int is_mcast, - int do_gso) + int do_counters, int is_midchain, int is_mcast) { ip_lookup_main_t *lm = &ip6_main.lookup_main; u32 *from = vlib_frame_vector_args (frame); @@ -1833,9 +1832,9 @@ ip6_rewrite_inline_with_gso (vlib_main_t * vm, u16 ip1_len = clib_net_to_host_u16 (ip1->payload_length) + sizeof (ip6_header_t); - if (do_gso && (p0->flags & VNET_BUFFER_F_GSO)) + if (p0->flags & VNET_BUFFER_F_GSO) ip0_len = gso_mtu_sz (p0); - if (do_gso && (p1->flags & VNET_BUFFER_F_GSO)) + if (p1->flags & VNET_BUFFER_F_GSO) ip1_len = gso_mtu_sz (p1); @@ -2010,7 +2009,7 @@ ip6_rewrite_inline_with_gso (vlib_main_t * vm, u16 ip0_len = clib_net_to_host_u16 (ip0->payload_length) + sizeof (ip6_header_t); - if (do_gso && (p0->flags & VNET_BUFFER_F_GSO)) + if (p0->flags & VNET_BUFFER_F_GSO) ip0_len = gso_mtu_sz (p0); ip6_mtu_check (p0, ip0_len, @@ -2081,15 +2080,8 @@ ip6_rewrite_inline (vlib_main_t * vm, vlib_frame_t * frame, int do_counters, int is_midchain, int is_mcast) { - vnet_main_t *vnm = vnet_get_main (); - if (PREDICT_FALSE (vnm->interface_main.gso_interface_count > 0)) - return ip6_rewrite_inline_with_gso (vm, node, frame, do_counters, - is_midchain, is_mcast, - 1 /* do_gso */ ); - else - return ip6_rewrite_inline_with_gso (vm, node, frame, do_counters, - is_midchain, is_mcast, - 0 /* no do_gso */ ); + return ip6_rewrite_inline_with_gso (vm, node, frame, do_counters, + is_midchain, is_mcast); } VLIB_NODE_FN (ip6_rewrite_node) (vlib_main_t * vm, diff --git a/src/vnet/pg/stream.c b/src/vnet/pg/stream.c index c4a57ea702d..f09e9a44398 100644 --- a/src/vnet/pg/stream.c +++ b/src/vnet/pg/stream.c @@ -217,7 +217,6 @@ pg_interface_add_or_get (pg_main_t * pg, uword if_id, u8 gso_enabled, if (gso_enabled) { hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO; - vnm->interface_main.gso_interface_count++; pi->gso_enabled = 1; pi->gso_size = gso_size; } |