hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/atm/lec.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * lec.c: Lan Emulation driver
34 *
....@@ -193,7 +194,7 @@
193194 dev->stats.tx_bytes += skb->len;
194195 }
195196
196
-static void lec_tx_timeout(struct net_device *dev)
197
+static void lec_tx_timeout(struct net_device *dev, unsigned int txqueue)
197198 {
198199 pr_info("%s\n", dev->name);
199200 netif_trans_update(dev);
....@@ -379,7 +380,7 @@
379380
380381 if (mesg->content.normal.no_source_le_narp)
381382 break;
382
- /* FALL THROUGH */
383
+ fallthrough;
383384 case l_arp_update:
384385 lec_arp_update(priv, mesg->content.normal.mac_addr,
385386 mesg->content.normal.atm_addr,
....@@ -726,9 +727,7 @@
726727 struct lec_priv *priv;
727728
728729 if (arg < 0)
729
- i = 0;
730
- else
731
- i = arg;
730
+ arg = 0;
732731 if (arg >= MAX_LEC_ITF)
733732 return -EINVAL;
734733 i = array_index_nospec(arg, MAX_LEC_ITF);
....@@ -800,14 +799,9 @@
800799
801800 static void lec_info(struct seq_file *seq, struct lec_arp_table *entry)
802801 {
803
- int i;
804
-
805
- for (i = 0; i < ETH_ALEN; i++)
806
- seq_printf(seq, "%2.2x", entry->mac_addr[i] & 0xff);
807
- seq_printf(seq, " ");
808
- for (i = 0; i < ATM_ESA_LEN; i++)
809
- seq_printf(seq, "%2.2x", entry->atm_addr[i] & 0xff);
810
- seq_printf(seq, " %s %4.4x", lec_arp_get_status_string(entry->status),
802
+ seq_printf(seq, "%pM ", entry->mac_addr);
803
+ seq_printf(seq, "%*phN ", ATM_ESA_LEN, entry->atm_addr);
804
+ seq_printf(seq, "%s %4.4x", lec_arp_get_status_string(entry->status),
811805 entry->flags & 0xffff);
812806 if (entry->vcc)
813807 seq_printf(seq, "%3d %3d ", entry->vcc->vpi, entry->vcc->vci);
....@@ -960,9 +954,8 @@
960954 {
961955 struct lec_state *state = seq->private;
962956
963
- v = lec_get_idx(state, 1);
964
- *pos += !!PTR_ERR(v);
965
- return v;
957
+ ++*pos;
958
+ return lec_get_idx(state, 1);
966959 }
967960
968961 static int lec_seq_show(struct seq_file *seq, void *v)
....@@ -1076,7 +1069,7 @@
10761069 /*
10771070 * LANE2: 3.1.3, LE_RESOLVE.request
10781071 * Non force allocates memory and fills in *tlvs, fills in *sizeoftlvs.
1079
- * If sizeoftlvs == NULL the default TLVs associated with with this
1072
+ * If sizeoftlvs == NULL the default TLVs associated with this
10801073 * lec will be used.
10811074 * If dst_mac == NULL, targetless LE_ARP will be sent
10821075 */
....@@ -1361,7 +1354,7 @@
13611354 {
13621355 struct lec_arp_table *rulla;
13631356 char buf[256];
1364
- int i, j, offset;
1357
+ int i, offset;
13651358
13661359 pr_info("Dump %p:\n", priv);
13671360 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
....@@ -1369,14 +1362,10 @@
13691362 &priv->lec_arp_tables[i], next) {
13701363 offset = 0;
13711364 offset += sprintf(buf, "%d: %p\n", i, rulla);
1372
- offset += sprintf(buf + offset, "Mac: %pM",
1365
+ offset += sprintf(buf + offset, "Mac: %pM ",
13731366 rulla->mac_addr);
1374
- offset += sprintf(buf + offset, " Atm:");
1375
- for (j = 0; j < ATM_ESA_LEN; j++) {
1376
- offset += sprintf(buf + offset,
1377
- "%2.2x ",
1378
- rulla->atm_addr[j] & 0xff);
1379
- }
1367
+ offset += sprintf(buf + offset, "Atm: %*ph ", ATM_ESA_LEN,
1368
+ rulla->atm_addr);
13801369 offset += sprintf(buf + offset,
13811370 "Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ",
13821371 rulla->vcc ? rulla->vcc->vpi : 0,
....@@ -1399,12 +1388,9 @@
13991388 pr_info("No forward\n");
14001389 hlist_for_each_entry(rulla, &priv->lec_no_forward, next) {
14011390 offset = 0;
1402
- offset += sprintf(buf + offset, "Mac: %pM", rulla->mac_addr);
1403
- offset += sprintf(buf + offset, " Atm:");
1404
- for (j = 0; j < ATM_ESA_LEN; j++) {
1405
- offset += sprintf(buf + offset, "%2.2x ",
1406
- rulla->atm_addr[j] & 0xff);
1407
- }
1391
+ offset += sprintf(buf + offset, "Mac: %pM ", rulla->mac_addr);
1392
+ offset += sprintf(buf + offset, "Atm: %*ph ", ATM_ESA_LEN,
1393
+ rulla->atm_addr);
14081394 offset += sprintf(buf + offset,
14091395 "Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ",
14101396 rulla->vcc ? rulla->vcc->vpi : 0,
....@@ -1424,12 +1410,9 @@
14241410 pr_info("Empty ones\n");
14251411 hlist_for_each_entry(rulla, &priv->lec_arp_empty_ones, next) {
14261412 offset = 0;
1427
- offset += sprintf(buf + offset, "Mac: %pM", rulla->mac_addr);
1428
- offset += sprintf(buf + offset, " Atm:");
1429
- for (j = 0; j < ATM_ESA_LEN; j++) {
1430
- offset += sprintf(buf + offset, "%2.2x ",
1431
- rulla->atm_addr[j] & 0xff);
1432
- }
1413
+ offset += sprintf(buf + offset, "Mac: %pM ", rulla->mac_addr);
1414
+ offset += sprintf(buf + offset, "Atm: %*ph ", ATM_ESA_LEN,
1415
+ rulla->atm_addr);
14331416 offset += sprintf(buf + offset,
14341417 "Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ",
14351418 rulla->vcc ? rulla->vcc->vpi : 0,
....@@ -1449,12 +1432,9 @@
14491432 pr_info("Multicast Forward VCCs\n");
14501433 hlist_for_each_entry(rulla, &priv->mcast_fwds, next) {
14511434 offset = 0;
1452
- offset += sprintf(buf + offset, "Mac: %pM", rulla->mac_addr);
1453
- offset += sprintf(buf + offset, " Atm:");
1454
- for (j = 0; j < ATM_ESA_LEN; j++) {
1455
- offset += sprintf(buf + offset, "%2.2x ",
1456
- rulla->atm_addr[j] & 0xff);
1457
- }
1435
+ offset += sprintf(buf + offset, "Mac: %pM ", rulla->mac_addr);
1436
+ offset += sprintf(buf + offset, "Atm: %*ph ", ATM_ESA_LEN,
1437
+ rulla->atm_addr);
14581438 offset += sprintf(buf + offset,
14591439 "Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ",
14601440 rulla->vcc ? rulla->vcc->vpi : 0,
....@@ -1555,10 +1535,8 @@
15551535 struct lec_arp_table *to_return;
15561536
15571537 to_return = kzalloc(sizeof(struct lec_arp_table), GFP_ATOMIC);
1558
- if (!to_return) {
1559
- pr_info("LEC: Arp entry kmalloc failed\n");
1538
+ if (!to_return)
15601539 return NULL;
1561
- }
15621540 ether_addr_copy(to_return->mac_addr, mac_addr);
15631541 INIT_HLIST_NODE(&to_return->next);
15641542 timer_setup(&to_return->timer, lec_arp_expire_arp, 0);
....@@ -1980,17 +1958,8 @@
19801958 * Vcc which we don't want to make default vcc,
19811959 * attach it anyway.
19821960 */
1983
- pr_debug("LEC_ARP:Attaching data direct, not default: %2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n",
1984
- ioc_data->atm_addr[0], ioc_data->atm_addr[1],
1985
- ioc_data->atm_addr[2], ioc_data->atm_addr[3],
1986
- ioc_data->atm_addr[4], ioc_data->atm_addr[5],
1987
- ioc_data->atm_addr[6], ioc_data->atm_addr[7],
1988
- ioc_data->atm_addr[8], ioc_data->atm_addr[9],
1989
- ioc_data->atm_addr[10], ioc_data->atm_addr[11],
1990
- ioc_data->atm_addr[12], ioc_data->atm_addr[13],
1991
- ioc_data->atm_addr[14], ioc_data->atm_addr[15],
1992
- ioc_data->atm_addr[16], ioc_data->atm_addr[17],
1993
- ioc_data->atm_addr[18], ioc_data->atm_addr[19]);
1961
+ pr_debug("LEC_ARP:Attaching data direct, not default: %*phN\n",
1962
+ ATM_ESA_LEN, ioc_data->atm_addr);
19941963 entry = make_entry(priv, bus_mac);
19951964 if (entry == NULL)
19961965 goto out;
....@@ -2006,17 +1975,8 @@
20061975 dump_arp_table(priv);
20071976 goto out;
20081977 }
2009
- pr_debug("LEC_ARP:Attaching data direct, default: %2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n",
2010
- ioc_data->atm_addr[0], ioc_data->atm_addr[1],
2011
- ioc_data->atm_addr[2], ioc_data->atm_addr[3],
2012
- ioc_data->atm_addr[4], ioc_data->atm_addr[5],
2013
- ioc_data->atm_addr[6], ioc_data->atm_addr[7],
2014
- ioc_data->atm_addr[8], ioc_data->atm_addr[9],
2015
- ioc_data->atm_addr[10], ioc_data->atm_addr[11],
2016
- ioc_data->atm_addr[12], ioc_data->atm_addr[13],
2017
- ioc_data->atm_addr[14], ioc_data->atm_addr[15],
2018
- ioc_data->atm_addr[16], ioc_data->atm_addr[17],
2019
- ioc_data->atm_addr[18], ioc_data->atm_addr[19]);
1978
+ pr_debug("LEC_ARP:Attaching data direct, default: %*phN\n",
1979
+ ATM_ESA_LEN, ioc_data->atm_addr);
20201980 for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
20211981 hlist_for_each_entry(entry,
20221982 &priv->lec_arp_tables[i], next) {