.. | .. |
---|
1 | | -/* |
---|
2 | | - * L2TPv3 ethernet pseudowire driver |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
| 2 | +/* L2TPv3 ethernet pseudowire driver |
---|
3 | 3 | * |
---|
4 | 4 | * Copyright (c) 2008,2009,2010 Katalix Systems Ltd |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or |
---|
7 | | - * modify it under the terms of the GNU General Public License |
---|
8 | | - * as published by the Free Software Foundation; either version |
---|
9 | | - * 2 of the License, or (at your option) any later version. |
---|
10 | 5 | */ |
---|
11 | 6 | |
---|
12 | 7 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
---|
.. | .. |
---|
55 | 50 | struct net_device __rcu *dev; |
---|
56 | 51 | }; |
---|
57 | 52 | |
---|
58 | | - |
---|
59 | 53 | static int l2tp_eth_dev_init(struct net_device *dev) |
---|
60 | 54 | { |
---|
61 | 55 | eth_hw_addr_random(dev); |
---|
.. | .. |
---|
77 | 71 | */ |
---|
78 | 72 | } |
---|
79 | 73 | |
---|
80 | | -static int l2tp_eth_dev_xmit(struct sk_buff *skb, struct net_device *dev) |
---|
| 74 | +static netdev_tx_t l2tp_eth_dev_xmit(struct sk_buff *skb, struct net_device *dev) |
---|
81 | 75 | { |
---|
82 | 76 | struct l2tp_eth *priv = netdev_priv(dev); |
---|
83 | 77 | struct l2tp_session *session = priv->session; |
---|
84 | 78 | unsigned int len = skb->len; |
---|
85 | | - int ret = l2tp_xmit_skb(session, skb, session->hdr_len); |
---|
| 79 | + int ret = l2tp_xmit_skb(session, skb); |
---|
86 | 80 | |
---|
87 | 81 | if (likely(ret == NET_XMIT_SUCCESS)) { |
---|
88 | 82 | atomic_long_add(len, &priv->tx_bytes); |
---|
.. | .. |
---|
98 | 92 | { |
---|
99 | 93 | struct l2tp_eth *priv = netdev_priv(dev); |
---|
100 | 94 | |
---|
101 | | - stats->tx_bytes = (unsigned long) atomic_long_read(&priv->tx_bytes); |
---|
102 | | - stats->tx_packets = (unsigned long) atomic_long_read(&priv->tx_packets); |
---|
103 | | - stats->tx_dropped = (unsigned long) atomic_long_read(&priv->tx_dropped); |
---|
104 | | - stats->rx_bytes = (unsigned long) atomic_long_read(&priv->rx_bytes); |
---|
105 | | - stats->rx_packets = (unsigned long) atomic_long_read(&priv->rx_packets); |
---|
106 | | - stats->rx_errors = (unsigned long) atomic_long_read(&priv->rx_errors); |
---|
107 | | - |
---|
| 95 | + stats->tx_bytes = (unsigned long)atomic_long_read(&priv->tx_bytes); |
---|
| 96 | + stats->tx_packets = (unsigned long)atomic_long_read(&priv->tx_packets); |
---|
| 97 | + stats->tx_dropped = (unsigned long)atomic_long_read(&priv->tx_dropped); |
---|
| 98 | + stats->rx_bytes = (unsigned long)atomic_long_read(&priv->rx_bytes); |
---|
| 99 | + stats->rx_packets = (unsigned long)atomic_long_read(&priv->rx_packets); |
---|
| 100 | + stats->rx_errors = (unsigned long)atomic_long_read(&priv->rx_errors); |
---|
108 | 101 | } |
---|
109 | 102 | |
---|
110 | 103 | static const struct net_device_ops l2tp_eth_netdev_ops = { |
---|
.. | .. |
---|
135 | 128 | struct net_device *dev; |
---|
136 | 129 | struct l2tp_eth *priv; |
---|
137 | 130 | |
---|
138 | | - if (session->debug & L2TP_MSG_DATA) { |
---|
139 | | - unsigned int length; |
---|
140 | | - |
---|
141 | | - length = min(32u, skb->len); |
---|
142 | | - if (!pskb_may_pull(skb, length)) |
---|
143 | | - goto error; |
---|
144 | | - |
---|
145 | | - pr_debug("%s: eth recv\n", session->name); |
---|
146 | | - print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, skb->data, length); |
---|
147 | | - } |
---|
148 | | - |
---|
149 | 131 | if (!pskb_may_pull(skb, ETH_HLEN)) |
---|
150 | 132 | goto error; |
---|
151 | 133 | |
---|
.. | .. |
---|
155 | 137 | skb->ip_summed = CHECKSUM_NONE; |
---|
156 | 138 | |
---|
157 | 139 | skb_dst_drop(skb); |
---|
158 | | - nf_reset(skb); |
---|
| 140 | + nf_reset_ct(skb); |
---|
159 | 141 | |
---|
160 | 142 | rcu_read_lock(); |
---|
161 | 143 | dev = rcu_dereference(spriv->dev); |
---|
.. | .. |
---|
352 | 334 | return rc; |
---|
353 | 335 | } |
---|
354 | 336 | |
---|
355 | | - |
---|
356 | 337 | static const struct l2tp_nl_cmd_ops l2tp_eth_nl_cmd_ops = { |
---|
357 | 338 | .session_create = l2tp_eth_create, |
---|
358 | 339 | .session_delete = l2tp_session_delete, |
---|
359 | 340 | }; |
---|
360 | | - |
---|
361 | 341 | |
---|
362 | 342 | static int __init l2tp_eth_init(void) |
---|
363 | 343 | { |
---|