netdev.c (a6e65e5d2ca4b1d3ff4ac03e056f82b6854ed50e) netdev.c (7699353da875c2ae0d87a4f5a995c144115b31bb)
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"

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

166 goto err_bpf_uninit;
167
168 SET_NETDEV_DEV(dev, &ns->dev);
169
170 err = nsim_devlink_setup(ns);
171 if (err)
172 goto err_unreg_dev;
173
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"

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

166 goto err_bpf_uninit;
167
168 SET_NETDEV_DEV(dev, &ns->dev);
169
170 err = nsim_devlink_setup(ns);
171 if (err)
172 goto err_unreg_dev;
173
174 nsim_ipsec_init(ns);
175
174 return 0;
175
176err_unreg_dev:
177 device_unregister(&ns->dev);
178err_bpf_uninit:
179 nsim_bpf_uninit(ns);
180err_debugfs_destroy:
181 debugfs_remove_recursive(ns->ddir);
182 return err;
183}
184
185static void nsim_uninit(struct net_device *dev)
186{
187 struct netdevsim *ns = netdev_priv(dev);
188
176 return 0;
177
178err_unreg_dev:
179 device_unregister(&ns->dev);
180err_bpf_uninit:
181 nsim_bpf_uninit(ns);
182err_debugfs_destroy:
183 debugfs_remove_recursive(ns->ddir);
184 return err;
185}
186
187static void nsim_uninit(struct net_device *dev)
188{
189 struct netdevsim *ns = netdev_priv(dev);
190
191 nsim_ipsec_teardown(ns);
189 nsim_devlink_teardown(ns);
190 debugfs_remove_recursive(ns->ddir);
191 nsim_bpf_uninit(ns);
192}
193
194static void nsim_free(struct net_device *dev)
195{
196 struct netdevsim *ns = netdev_priv(dev);
197
198 device_unregister(&ns->dev);
199 /* netdev and vf state will be freed out of device_release() */
200}
201
202static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev)
203{
204 struct netdevsim *ns = netdev_priv(dev);
205
192 nsim_devlink_teardown(ns);
193 debugfs_remove_recursive(ns->ddir);
194 nsim_bpf_uninit(ns);
195}
196
197static void nsim_free(struct net_device *dev)
198{
199 struct netdevsim *ns = netdev_priv(dev);
200
201 device_unregister(&ns->dev);
202 /* netdev and vf state will be freed out of device_release() */
203}
204
205static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev)
206{
207 struct netdevsim *ns = netdev_priv(dev);
208
209 if (!nsim_ipsec_tx(ns, skb))
210 goto out;
211
206 u64_stats_update_begin(&ns->syncp);
207 ns->tx_packets++;
208 ns->tx_bytes += skb->len;
209 u64_stats_update_end(&ns->syncp);
210
212 u64_stats_update_begin(&ns->syncp);
213 ns->tx_packets++;
214 ns->tx_bytes += skb->len;
215 u64_stats_update_end(&ns->syncp);
216
217out:
211 dev_kfree_skb(skb);
212
213 return NETDEV_TX_OK;
214}
215
216static void nsim_set_rx_mode(struct net_device *dev)
217{
218}

--- 300 unchanged lines hidden ---
218 dev_kfree_skb(skb);
219
220 return NETDEV_TX_OK;
221}
222
223static void nsim_set_rx_mode(struct net_device *dev)
224{
225}

--- 300 unchanged lines hidden ---