/src/openvswitch/lib/userspace-tso.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2020 Red Hat, Inc. |
3 | | * |
4 | | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | | * you may not use this file except in compliance with the License. |
6 | | * You may obtain a copy of the License at: |
7 | | * |
8 | | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | | * |
10 | | * Unless required by applicable law or agreed to in writing, software |
11 | | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | | * See the License for the specific language governing permissions and |
14 | | * limitations under the License. |
15 | | */ |
16 | | |
17 | | #include <config.h> |
18 | | |
19 | | #include "smap.h" |
20 | | #include "ovs-thread.h" |
21 | | #include "openvswitch/vlog.h" |
22 | | #include "dpdk.h" |
23 | | #include "userspace-tso.h" |
24 | | #include "vswitch-idl.h" |
25 | | |
26 | | VLOG_DEFINE_THIS_MODULE(userspace_tso); |
27 | | |
28 | | static bool userspace_tso = false; |
29 | | |
30 | | void |
31 | | userspace_tso_init(const struct smap *ovs_other_config) |
32 | 0 | { |
33 | 0 | if (smap_get_bool(ovs_other_config, "userspace-tso-enable", false)) { |
34 | 0 | static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; |
35 | |
|
36 | 0 | if (ovsthread_once_start(&once)) { |
37 | 0 | VLOG_INFO("Userspace TCP Segmentation Offloading support enabled"); |
38 | 0 | userspace_tso = true; |
39 | 0 | ovsthread_once_done(&once); |
40 | 0 | } |
41 | 0 | } |
42 | 0 | } |
43 | | |
44 | | bool |
45 | | userspace_tso_enabled(void) |
46 | 0 | { |
47 | 0 | return userspace_tso; |
48 | 0 | } |