]> git.proxmox.com Git - ovs.git/blob - lib/netdev-tc-offloads.c
netdev: Adding a new netdev API to be used for offloading flows
[ovs.git] / lib / netdev-tc-offloads.c
1 /*
2 * Copyright (c) 2016 Mellanox Technologies, Ltd.
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 #include "netdev-tc-offloads.h"
19 #include <errno.h>
20 #include <linux/if_ether.h>
21 #include "openvswitch/hmap.h"
22 #include "openvswitch/match.h"
23 #include "openvswitch/ofpbuf.h"
24 #include "openvswitch/thread.h"
25 #include "openvswitch/types.h"
26 #include "openvswitch/vlog.h"
27 #include "netdev-provider.h"
28 #include "netlink.h"
29 #include "netlink-socket.h"
30 #include "odp-netlink.h"
31 #include "unaligned.h"
32 #include "util.h"
33 #include "hash.h"
34 #include "dpif.h"
35 #include "tc.h"
36
37 VLOG_DEFINE_THIS_MODULE(netdev_tc_offloads);
38
39 int
40 netdev_tc_flow_flush(struct netdev *netdev OVS_UNUSED)
41 {
42 return EOPNOTSUPP;
43 }
44
45 int
46 netdev_tc_flow_dump_create(struct netdev *netdev,
47 struct netdev_flow_dump **dump_out)
48 {
49 struct netdev_flow_dump *dump = xzalloc(sizeof *dump);
50
51 dump->netdev = netdev_ref(netdev);
52
53 *dump_out = dump;
54
55 return 0;
56 }
57
58 int
59 netdev_tc_flow_dump_destroy(struct netdev_flow_dump *dump)
60 {
61 netdev_close(dump->netdev);
62 free(dump);
63
64 return 0;
65 }
66
67 bool
68 netdev_tc_flow_dump_next(struct netdev_flow_dump *dump OVS_UNUSED,
69 struct match *match OVS_UNUSED,
70 struct nlattr **actions OVS_UNUSED,
71 struct dpif_flow_stats *stats OVS_UNUSED,
72 ovs_u128 *ufid OVS_UNUSED,
73 struct ofpbuf *rbuffer OVS_UNUSED,
74 struct ofpbuf *wbuffer OVS_UNUSED)
75 {
76 return false;
77 }
78
79 int
80 netdev_tc_flow_put(struct netdev *netdev OVS_UNUSED,
81 struct match *match OVS_UNUSED,
82 struct nlattr *actions OVS_UNUSED,
83 size_t actions_len OVS_UNUSED,
84 const ovs_u128 *ufid OVS_UNUSED,
85 struct offload_info *info OVS_UNUSED,
86 struct dpif_flow_stats *stats OVS_UNUSED)
87 {
88 return EOPNOTSUPP;
89 }
90
91 int
92 netdev_tc_flow_get(struct netdev *netdev OVS_UNUSED,
93 struct match *match OVS_UNUSED,
94 struct nlattr **actions OVS_UNUSED,
95 const ovs_u128 *ufid OVS_UNUSED,
96 struct dpif_flow_stats *stats OVS_UNUSED,
97 struct ofpbuf *buf OVS_UNUSED)
98 {
99 return EOPNOTSUPP;
100 }
101
102 int
103 netdev_tc_flow_del(struct netdev *netdev OVS_UNUSED,
104 const ovs_u128 *ufid OVS_UNUSED,
105 struct dpif_flow_stats *stats OVS_UNUSED)
106 {
107 return EOPNOTSUPP;
108 }
109
110 int
111 netdev_tc_init_flow_api(struct netdev *netdev OVS_UNUSED)
112 {
113 return 0;
114 }