hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/drivers/net/ethernet/toshiba/spider_net.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Network device driver for Cell Processor-Based Blade and Celleb platform
34 *
....@@ -6,20 +7,6 @@
67 *
78 * Authors : Utz Bacher <utz.bacher@de.ibm.com>
89 * Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License as published by
12
- * the Free Software Foundation; either version 2, or (at your option)
13
- * any later version.
14
- *
15
- * This program is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
- * GNU General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU General Public License
21
- * along with this program; if not, write to the Free Software
22
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2310 */
2411
2512 #include <linux/compiler.h>
....@@ -326,8 +313,6 @@
326313 &chain->dma_addr, GFP_KERNEL);
327314 if (!chain->hwring)
328315 return -ENOMEM;
329
-
330
- memset(chain->ring, 0, chain->num_desc * sizeof(struct spider_net_descr));
331316
332317 /* Set up the hardware pointers in each descriptor */
333318 descr = chain->ring;
....@@ -801,6 +786,7 @@
801786 /* fallthrough, if we release the descriptors
802787 * brutally (then we don't care about
803788 * SPIDER_NET_DESCR_CARDOWNED) */
789
+ fallthrough;
804790
805791 case SPIDER_NET_DESCR_RESPONSE_ERROR:
806792 case SPIDER_NET_DESCR_PROTECTION_ERROR:
....@@ -1411,9 +1397,9 @@
14111397 show_error = 0;
14121398 break;
14131399
1414
- case SPIDER_NET_GDDDEN0INT: /* fallthrough */
1415
- case SPIDER_NET_GDCDEN0INT: /* fallthrough */
1416
- case SPIDER_NET_GDBDEN0INT: /* fallthrough */
1400
+ case SPIDER_NET_GDDDEN0INT:
1401
+ case SPIDER_NET_GDCDEN0INT:
1402
+ case SPIDER_NET_GDBDEN0INT:
14171403 case SPIDER_NET_GDADEN0INT:
14181404 /* someone has set RX_DMA_EN to 0 */
14191405 show_error = 0;
....@@ -1463,10 +1449,10 @@
14631449 * Logging is not needed. */
14641450 show_error = 0;
14651451 break;
1466
- case SPIDER_NET_GRFDFLLINT: /* fallthrough */
1467
- case SPIDER_NET_GRFCFLLINT: /* fallthrough */
1468
- case SPIDER_NET_GRFBFLLINT: /* fallthrough */
1469
- case SPIDER_NET_GRFAFLLINT: /* fallthrough */
1452
+ case SPIDER_NET_GRFDFLLINT:
1453
+ case SPIDER_NET_GRFCFLLINT:
1454
+ case SPIDER_NET_GRFBFLLINT:
1455
+ case SPIDER_NET_GRFAFLLINT:
14701456 case SPIDER_NET_GRMFLLINT:
14711457 /* Could happen when rx chain is full */
14721458 if (card->ignore_rx_ramfull == 0) {
....@@ -1487,9 +1473,9 @@
14871473 break;
14881474
14891475 /* chain end */
1490
- case SPIDER_NET_GDDDCEINT: /* fallthrough */
1491
- case SPIDER_NET_GDCDCEINT: /* fallthrough */
1492
- case SPIDER_NET_GDBDCEINT: /* fallthrough */
1476
+ case SPIDER_NET_GDDDCEINT:
1477
+ case SPIDER_NET_GDCDCEINT:
1478
+ case SPIDER_NET_GDBDCEINT:
14931479 case SPIDER_NET_GDADCEINT:
14941480 spider_net_resync_head_ptr(card);
14951481 spider_net_refill_rx_chain(card);
....@@ -1500,9 +1486,9 @@
15001486 break;
15011487
15021488 /* invalid descriptor */
1503
- case SPIDER_NET_GDDINVDINT: /* fallthrough */
1504
- case SPIDER_NET_GDCINVDINT: /* fallthrough */
1505
- case SPIDER_NET_GDBINVDINT: /* fallthrough */
1489
+ case SPIDER_NET_GDDINVDINT:
1490
+ case SPIDER_NET_GDCINVDINT:
1491
+ case SPIDER_NET_GDBINVDINT:
15061492 case SPIDER_NET_GDAINVDINT:
15071493 /* Could happen when rx chain is full */
15081494 spider_net_resync_head_ptr(card);
....@@ -1627,7 +1613,7 @@
16271613 * spider_net_poll_controller - artificial interrupt for netconsole etc.
16281614 * @netdev: interface device structure
16291615 *
1630
- * see Documentation/networking/netconsole.txt
1616
+ * see Documentation/networking/netconsole.rst
16311617 */
16321618 static void
16331619 spider_net_poll_controller(struct net_device *netdev)
....@@ -2192,7 +2178,7 @@
21922178 * called, if tx hangs. Schedules a task that resets the interface
21932179 */
21942180 static void
2195
-spider_net_tx_timeout(struct net_device *netdev)
2181
+spider_net_tx_timeout(struct net_device *netdev, unsigned int txqueue)
21962182 {
21972183 struct spider_net_card *card;
21982184
....@@ -2323,11 +2309,9 @@
23232309 {
23242310 struct net_device *netdev;
23252311 struct spider_net_card *card;
2326
- size_t alloc_size;
23272312
2328
- alloc_size = sizeof(struct spider_net_card) +
2329
- (tx_descriptors + rx_descriptors) * sizeof(struct spider_net_descr);
2330
- netdev = alloc_etherdev(alloc_size);
2313
+ netdev = alloc_etherdev(struct_size(card, darray,
2314
+ tx_descriptors + rx_descriptors));
23312315 if (!netdev)
23322316 return NULL;
23332317