netdev.c (355a47ae7ebcf9d605aa809b259d380422e81b8d) netdev.c (4e95bc268b915c3a19ec8b9110f61e4ea41a1ed0)
1/*
2 * Copyright (C) 2017 Netronome Systems, Inc.
3 *
4 * This software is licensed under the GNU General License Version 2,
5 * June 1991 as shown in the file COPYING in the top-level directory of this
6 * source tree.
7 *
8 * THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS"

--- 64 unchanged lines hidden (view full) ---

73}
74
75static int
76nsim_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_priv)
77{
78 return nsim_bpf_setup_tc_block_cb(type, type_data, cb_priv);
79}
80
1/*
2 * Copyright (C) 2017 Netronome Systems, Inc.
3 *
4 * This software is licensed under the GNU General License Version 2,
5 * June 1991 as shown in the file COPYING in the top-level directory of this
6 * source tree.
7 *
8 * THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS"

--- 64 unchanged lines hidden (view full) ---

73}
74
75static int
76nsim_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_priv)
77{
78 return nsim_bpf_setup_tc_block_cb(type, type_data, cb_priv);
79}
80
81static int
82nsim_setup_tc_block(struct net_device *dev, struct tc_block_offload *f)
83{
84 struct netdevsim *ns = netdev_priv(dev);
85
86 if (f->binder_type != TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS)
87 return -EOPNOTSUPP;
88
89 switch (f->command) {
90 case TC_BLOCK_BIND:
91 return tcf_block_cb_register(f->block, nsim_setup_tc_block_cb,
92 ns, ns, f->extack);
93 case TC_BLOCK_UNBIND:
94 tcf_block_cb_unregister(f->block, nsim_setup_tc_block_cb, ns);
95 return 0;
96 default:
97 return -EOPNOTSUPP;
98 }
99}
100
101static int nsim_set_vf_mac(struct net_device *dev, int vf, u8 *mac)
102{
103 struct netdevsim *ns = netdev_priv(dev);
104 struct nsim_bus_dev *nsim_bus_dev = ns->nsim_bus_dev;
105
106 /* Only refuse multicast addresses, zero address can mean unset/any. */
107 if (vf >= nsim_bus_dev->num_vfs || is_multicast_ether_addr(mac))
108 return -EINVAL;

--- 112 unchanged lines hidden (view full) ---

221 nsim_bus_dev->vfconfigs[vf].link_state = state;
222
223 return 0;
224}
225
226static int
227nsim_setup_tc(struct net_device *dev, enum tc_setup_type type, void *type_data)
228{
81static int nsim_set_vf_mac(struct net_device *dev, int vf, u8 *mac)
82{
83 struct netdevsim *ns = netdev_priv(dev);
84 struct nsim_bus_dev *nsim_bus_dev = ns->nsim_bus_dev;
85
86 /* Only refuse multicast addresses, zero address can mean unset/any. */
87 if (vf >= nsim_bus_dev->num_vfs || is_multicast_ether_addr(mac))
88 return -EINVAL;

--- 112 unchanged lines hidden (view full) ---

201 nsim_bus_dev->vfconfigs[vf].link_state = state;
202
203 return 0;
204}
205
206static int
207nsim_setup_tc(struct net_device *dev, enum tc_setup_type type, void *type_data)
208{
209 struct netdevsim *ns = netdev_priv(dev);
210
229 switch (type) {
230 case TC_SETUP_BLOCK:
211 switch (type) {
212 case TC_SETUP_BLOCK:
231 return nsim_setup_tc_block(dev, type_data);
213 return flow_block_cb_setup_simple(type_data, NULL,
214 nsim_setup_tc_block_cb,
215 ns, ns, true);
232 default:
233 return -EOPNOTSUPP;
234 }
235}
236
237static int
238nsim_set_features(struct net_device *dev, netdev_features_t features)
239{

--- 157 unchanged lines hidden ---
216 default:
217 return -EOPNOTSUPP;
218 }
219}
220
221static int
222nsim_set_features(struct net_device *dev, netdev_features_t features)
223{

--- 157 unchanged lines hidden ---