hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/net/l2tp/l2tp_eth.c
....@@ -1,12 +1,7 @@
1
-/*
2
- * L2TPv3 ethernet pseudowire driver
1
+// SPDX-License-Identifier: GPL-2.0-or-later
2
+/* L2TPv3 ethernet pseudowire driver
33 *
44 * 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.
105 */
116
127 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -55,7 +50,6 @@
5550 struct net_device __rcu *dev;
5651 };
5752
58
-
5953 static int l2tp_eth_dev_init(struct net_device *dev)
6054 {
6155 eth_hw_addr_random(dev);
....@@ -77,12 +71,12 @@
7771 */
7872 }
7973
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)
8175 {
8276 struct l2tp_eth *priv = netdev_priv(dev);
8377 struct l2tp_session *session = priv->session;
8478 unsigned int len = skb->len;
85
- int ret = l2tp_xmit_skb(session, skb, session->hdr_len);
79
+ int ret = l2tp_xmit_skb(session, skb);
8680
8781 if (likely(ret == NET_XMIT_SUCCESS)) {
8882 atomic_long_add(len, &priv->tx_bytes);
....@@ -98,13 +92,12 @@
9892 {
9993 struct l2tp_eth *priv = netdev_priv(dev);
10094
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);
108101 }
109102
110103 static const struct net_device_ops l2tp_eth_netdev_ops = {
....@@ -135,17 +128,6 @@
135128 struct net_device *dev;
136129 struct l2tp_eth *priv;
137130
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
-
149131 if (!pskb_may_pull(skb, ETH_HLEN))
150132 goto error;
151133
....@@ -155,7 +137,7 @@
155137 skb->ip_summed = CHECKSUM_NONE;
156138
157139 skb_dst_drop(skb);
158
- nf_reset(skb);
140
+ nf_reset_ct(skb);
159141
160142 rcu_read_lock();
161143 dev = rcu_dereference(spriv->dev);
....@@ -352,12 +334,10 @@
352334 return rc;
353335 }
354336
355
-
356337 static const struct l2tp_nl_cmd_ops l2tp_eth_nl_cmd_ops = {
357338 .session_create = l2tp_eth_create,
358339 .session_delete = l2tp_session_delete,
359340 };
360
-
361341
362342 static int __init l2tp_eth_init(void)
363343 {