.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * lec.c: Lan Emulation driver |
---|
3 | 4 | * |
---|
.. | .. |
---|
193 | 194 | dev->stats.tx_bytes += skb->len; |
---|
194 | 195 | } |
---|
195 | 196 | |
---|
196 | | -static void lec_tx_timeout(struct net_device *dev) |
---|
| 197 | +static void lec_tx_timeout(struct net_device *dev, unsigned int txqueue) |
---|
197 | 198 | { |
---|
198 | 199 | pr_info("%s\n", dev->name); |
---|
199 | 200 | netif_trans_update(dev); |
---|
.. | .. |
---|
379 | 380 | |
---|
380 | 381 | if (mesg->content.normal.no_source_le_narp) |
---|
381 | 382 | break; |
---|
382 | | - /* FALL THROUGH */ |
---|
| 383 | + fallthrough; |
---|
383 | 384 | case l_arp_update: |
---|
384 | 385 | lec_arp_update(priv, mesg->content.normal.mac_addr, |
---|
385 | 386 | mesg->content.normal.atm_addr, |
---|
.. | .. |
---|
726 | 727 | struct lec_priv *priv; |
---|
727 | 728 | |
---|
728 | 729 | if (arg < 0) |
---|
729 | | - i = 0; |
---|
730 | | - else |
---|
731 | | - i = arg; |
---|
| 730 | + arg = 0; |
---|
732 | 731 | if (arg >= MAX_LEC_ITF) |
---|
733 | 732 | return -EINVAL; |
---|
734 | 733 | i = array_index_nospec(arg, MAX_LEC_ITF); |
---|
.. | .. |
---|
800 | 799 | |
---|
801 | 800 | static void lec_info(struct seq_file *seq, struct lec_arp_table *entry) |
---|
802 | 801 | { |
---|
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), |
---|
811 | 805 | entry->flags & 0xffff); |
---|
812 | 806 | if (entry->vcc) |
---|
813 | 807 | seq_printf(seq, "%3d %3d ", entry->vcc->vpi, entry->vcc->vci); |
---|
.. | .. |
---|
960 | 954 | { |
---|
961 | 955 | struct lec_state *state = seq->private; |
---|
962 | 956 | |
---|
963 | | - v = lec_get_idx(state, 1); |
---|
964 | | - *pos += !!PTR_ERR(v); |
---|
965 | | - return v; |
---|
| 957 | + ++*pos; |
---|
| 958 | + return lec_get_idx(state, 1); |
---|
966 | 959 | } |
---|
967 | 960 | |
---|
968 | 961 | static int lec_seq_show(struct seq_file *seq, void *v) |
---|
.. | .. |
---|
1076 | 1069 | /* |
---|
1077 | 1070 | * LANE2: 3.1.3, LE_RESOLVE.request |
---|
1078 | 1071 | * 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 |
---|
1080 | 1073 | * lec will be used. |
---|
1081 | 1074 | * If dst_mac == NULL, targetless LE_ARP will be sent |
---|
1082 | 1075 | */ |
---|
.. | .. |
---|
1361 | 1354 | { |
---|
1362 | 1355 | struct lec_arp_table *rulla; |
---|
1363 | 1356 | char buf[256]; |
---|
1364 | | - int i, j, offset; |
---|
| 1357 | + int i, offset; |
---|
1365 | 1358 | |
---|
1366 | 1359 | pr_info("Dump %p:\n", priv); |
---|
1367 | 1360 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { |
---|
.. | .. |
---|
1369 | 1362 | &priv->lec_arp_tables[i], next) { |
---|
1370 | 1363 | offset = 0; |
---|
1371 | 1364 | offset += sprintf(buf, "%d: %p\n", i, rulla); |
---|
1372 | | - offset += sprintf(buf + offset, "Mac: %pM", |
---|
| 1365 | + offset += sprintf(buf + offset, "Mac: %pM ", |
---|
1373 | 1366 | 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); |
---|
1380 | 1369 | offset += sprintf(buf + offset, |
---|
1381 | 1370 | "Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ", |
---|
1382 | 1371 | rulla->vcc ? rulla->vcc->vpi : 0, |
---|
.. | .. |
---|
1399 | 1388 | pr_info("No forward\n"); |
---|
1400 | 1389 | hlist_for_each_entry(rulla, &priv->lec_no_forward, next) { |
---|
1401 | 1390 | 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); |
---|
1408 | 1394 | offset += sprintf(buf + offset, |
---|
1409 | 1395 | "Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ", |
---|
1410 | 1396 | rulla->vcc ? rulla->vcc->vpi : 0, |
---|
.. | .. |
---|
1424 | 1410 | pr_info("Empty ones\n"); |
---|
1425 | 1411 | hlist_for_each_entry(rulla, &priv->lec_arp_empty_ones, next) { |
---|
1426 | 1412 | 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); |
---|
1433 | 1416 | offset += sprintf(buf + offset, |
---|
1434 | 1417 | "Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ", |
---|
1435 | 1418 | rulla->vcc ? rulla->vcc->vpi : 0, |
---|
.. | .. |
---|
1449 | 1432 | pr_info("Multicast Forward VCCs\n"); |
---|
1450 | 1433 | hlist_for_each_entry(rulla, &priv->mcast_fwds, next) { |
---|
1451 | 1434 | 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); |
---|
1458 | 1438 | offset += sprintf(buf + offset, |
---|
1459 | 1439 | "Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ", |
---|
1460 | 1440 | rulla->vcc ? rulla->vcc->vpi : 0, |
---|
.. | .. |
---|
1555 | 1535 | struct lec_arp_table *to_return; |
---|
1556 | 1536 | |
---|
1557 | 1537 | 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) |
---|
1560 | 1539 | return NULL; |
---|
1561 | | - } |
---|
1562 | 1540 | ether_addr_copy(to_return->mac_addr, mac_addr); |
---|
1563 | 1541 | INIT_HLIST_NODE(&to_return->next); |
---|
1564 | 1542 | timer_setup(&to_return->timer, lec_arp_expire_arp, 0); |
---|
.. | .. |
---|
1980 | 1958 | * Vcc which we don't want to make default vcc, |
---|
1981 | 1959 | * attach it anyway. |
---|
1982 | 1960 | */ |
---|
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); |
---|
1994 | 1963 | entry = make_entry(priv, bus_mac); |
---|
1995 | 1964 | if (entry == NULL) |
---|
1996 | 1965 | goto out; |
---|
.. | .. |
---|
2006 | 1975 | dump_arp_table(priv); |
---|
2007 | 1976 | goto out; |
---|
2008 | 1977 | } |
---|
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); |
---|
2020 | 1980 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { |
---|
2021 | 1981 | hlist_for_each_entry(entry, |
---|
2022 | 1982 | &priv->lec_arp_tables[i], next) { |
---|