MFREE -> m_freediff -r1.39 -r1.40 src/sys/dev/kttcp.c
(christos)
--- src/sys/dev/kttcp.c 2016/06/10 13:27:13 1.39
+++ src/sys/dev/kttcp.c 2016/10/02 14:16:02 1.40
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: kttcp.c,v 1.39 2016/06/10 13:27:13 ozaki-r Exp $ */ | 1 | /* $NetBSD: kttcp.c,v 1.40 2016/10/02 14:16:02 christos Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2002 Wasabi Systems, Inc. | 4 | * Copyright (c) 2002 Wasabi Systems, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Written by Frank van der Linden and Jason R. Thorpe for | 7 | * Written by Frank van der Linden and Jason R. Thorpe for | |
8 | * Wasabi Systems, Inc. | 8 | * Wasabi Systems, Inc. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -32,27 +32,27 @@ | @@ -32,27 +32,27 @@ | |||
32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
36 | * POSSIBILITY OF SUCH DAMAGE. | 36 | * POSSIBILITY OF SUCH DAMAGE. | |
37 | */ | 37 | */ | |
38 | 38 | |||
39 | /* | 39 | /* | |
40 | * kttcp.c -- provides kernel support for testing network testing, | 40 | * kttcp.c -- provides kernel support for testing network testing, | |
41 | * see kttcp(4) | 41 | * see kttcp(4) | |
42 | */ | 42 | */ | |
43 | 43 | |||
44 | #include <sys/cdefs.h> | 44 | #include <sys/cdefs.h> | |
45 | __KERNEL_RCSID(0, "$NetBSD: kttcp.c,v 1.39 2016/06/10 13:27:13 ozaki-r Exp $"); | 45 | __KERNEL_RCSID(0, "$NetBSD: kttcp.c,v 1.40 2016/10/02 14:16:02 christos Exp $"); | |
46 | 46 | |||
47 | #include <sys/param.h> | 47 | #include <sys/param.h> | |
48 | #include <sys/types.h> | 48 | #include <sys/types.h> | |
49 | #include <sys/ioctl.h> | 49 | #include <sys/ioctl.h> | |
50 | #include <sys/file.h> | 50 | #include <sys/file.h> | |
51 | #include <sys/filedesc.h> | 51 | #include <sys/filedesc.h> | |
52 | #include <sys/conf.h> | 52 | #include <sys/conf.h> | |
53 | #include <sys/systm.h> | 53 | #include <sys/systm.h> | |
54 | #include <sys/protosw.h> | 54 | #include <sys/protosw.h> | |
55 | #include <sys/proc.h> | 55 | #include <sys/proc.h> | |
56 | #include <sys/resourcevar.h> | 56 | #include <sys/resourcevar.h> | |
57 | #include <sys/signal.h> | 57 | #include <sys/signal.h> | |
58 | #include <sys/socketvar.h> | 58 | #include <sys/socketvar.h> | |
@@ -464,37 +464,35 @@ kttcp_soreceive(struct socket *so, unsig | @@ -464,37 +464,35 @@ kttcp_soreceive(struct socket *so, unsig | |||
464 | SBLASTRECORDCHK(&so->so_rcv, "kttcp_soreceive 1"); | 464 | SBLASTRECORDCHK(&so->so_rcv, "kttcp_soreceive 1"); | |
465 | SBLASTMBUFCHK(&so->so_rcv, "kttcp_soreceive 1"); | 465 | SBLASTMBUFCHK(&so->so_rcv, "kttcp_soreceive 1"); | |
466 | nextrecord = m->m_nextpkt; | 466 | nextrecord = m->m_nextpkt; | |
467 | if (pr->pr_flags & PR_ADDR) { | 467 | if (pr->pr_flags & PR_ADDR) { | |
468 | #ifdef DIAGNOSTIC | 468 | #ifdef DIAGNOSTIC | |
469 | if (m->m_type != MT_SONAME) | 469 | if (m->m_type != MT_SONAME) | |
470 | panic("receive 1a"); | 470 | panic("receive 1a"); | |
471 | #endif | 471 | #endif | |
472 | orig_resid = 0; | 472 | orig_resid = 0; | |
473 | if (flags & MSG_PEEK) { | 473 | if (flags & MSG_PEEK) { | |
474 | m = m->m_next; | 474 | m = m->m_next; | |
475 | } else { | 475 | } else { | |
476 | sbfree(&so->so_rcv, m); | 476 | sbfree(&so->so_rcv, m); | |
477 | MFREE(m, so->so_rcv.sb_mb); | 477 | m = so->so_rcv.sb_mb = m_free(m); | |
478 | m = so->so_rcv.sb_mb; | |||
479 | } | 478 | } | |
480 | } | 479 | } | |
481 | while (m && m->m_type == MT_CONTROL && error == 0) { | 480 | while (m && m->m_type == MT_CONTROL && error == 0) { | |
482 | if (flags & MSG_PEEK) { | 481 | if (flags & MSG_PEEK) { | |
483 | m = m->m_next; | 482 | m = m->m_next; | |
484 | } else { | 483 | } else { | |
485 | sbfree(&so->so_rcv, m); | 484 | sbfree(&so->so_rcv, m); | |
486 | MFREE(m, so->so_rcv.sb_mb); | 485 | m = so->so_rcv.sb_mb = m_free(m); | |
487 | m = so->so_rcv.sb_mb; | |||
488 | } | 486 | } | |
489 | } | 487 | } | |
490 | 488 | |||
491 | /* | 489 | /* | |
492 | * If m is non-NULL, we have some data to read. From now on, | 490 | * If m is non-NULL, we have some data to read. From now on, | |
493 | * make sure to keep sb_lastrecord consistent when working on | 491 | * make sure to keep sb_lastrecord consistent when working on | |
494 | * the last packet on the chain (nextrecord == NULL) and we | 492 | * the last packet on the chain (nextrecord == NULL) and we | |
495 | * change m->m_nextpkt. | 493 | * change m->m_nextpkt. | |
496 | */ | 494 | */ | |
497 | if (m) { | 495 | if (m) { | |
498 | if ((flags & MSG_PEEK) == 0) { | 496 | if ((flags & MSG_PEEK) == 0) { | |
499 | m->m_nextpkt = nextrecord; | 497 | m->m_nextpkt = nextrecord; | |
500 | /* | 498 | /* | |
@@ -552,28 +550,27 @@ kttcp_soreceive(struct socket *so, unsig | @@ -552,28 +550,27 @@ kttcp_soreceive(struct socket *so, unsig | |||
552 | flags |= MSG_EOR; | 550 | flags |= MSG_EOR; | |
553 | if (flags & MSG_PEEK) { | 551 | if (flags & MSG_PEEK) { | |
554 | m = m->m_next; | 552 | m = m->m_next; | |
555 | moff = 0; | 553 | moff = 0; | |
556 | } else { | 554 | } else { | |
557 | nextrecord = m->m_nextpkt; | 555 | nextrecord = m->m_nextpkt; | |
558 | sbfree(&so->so_rcv, m); | 556 | sbfree(&so->so_rcv, m); | |
559 | if (mp) { | 557 | if (mp) { | |
560 | *mp = m; | 558 | *mp = m; | |
561 | mp = &m->m_next; | 559 | mp = &m->m_next; | |
562 | so->so_rcv.sb_mb = m = m->m_next; | 560 | so->so_rcv.sb_mb = m = m->m_next; | |
563 | *mp = NULL; | 561 | *mp = NULL; | |
564 | } else { | 562 | } else { | |
565 | MFREE(m, so->so_rcv.sb_mb); | 563 | m = so->so_rcv.sb_mb = m_free(m); | |
566 | m = so->so_rcv.sb_mb; | |||
567 | } | 564 | } | |
568 | /* | 565 | /* | |
569 | * If m != NULL, we also know that | 566 | * If m != NULL, we also know that | |
570 | * so->so_rcv.sb_mb != NULL. | 567 | * so->so_rcv.sb_mb != NULL. | |
571 | */ | 568 | */ | |
572 | KASSERT(so->so_rcv.sb_mb == m); | 569 | KASSERT(so->so_rcv.sb_mb == m); | |
573 | if (m) { | 570 | if (m) { | |
574 | m->m_nextpkt = nextrecord; | 571 | m->m_nextpkt = nextrecord; | |
575 | if (nextrecord == NULL) | 572 | if (nextrecord == NULL) | |
576 | so->so_rcv.sb_lastrecord = m; | 573 | so->so_rcv.sb_lastrecord = m; | |
577 | } else { | 574 | } else { | |
578 | so->so_rcv.sb_mb = nextrecord; | 575 | so->so_rcv.sb_mb = nextrecord; | |
579 | SB_EMPTY_FIXUP(&so->so_rcv); | 576 | SB_EMPTY_FIXUP(&so->so_rcv); |
--- src/sys/dev/ic/elink3.c 2016/06/10 13:27:13 1.138
+++ src/sys/dev/ic/elink3.c 2016/10/02 14:16:02 1.139
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: elink3.c,v 1.138 2016/06/10 13:27:13 ozaki-r Exp $ */ | 1 | /* $NetBSD: elink3.c,v 1.139 2016/10/02 14:16:02 christos Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | |
9 | * NASA Ames Research Center. | 9 | * NASA Ames Research Center. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -52,27 +52,27 @@ | @@ -52,27 +52,27 @@ | |||
52 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 52 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
53 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 53 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
54 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 54 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
55 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 55 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
56 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 56 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
57 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 57 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
58 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 58 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
59 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 59 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
60 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 60 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
61 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 61 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
62 | */ | 62 | */ | |
63 | 63 | |||
64 | #include <sys/cdefs.h> | 64 | #include <sys/cdefs.h> | |
65 | __KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.138 2016/06/10 13:27:13 ozaki-r Exp $"); | 65 | __KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.139 2016/10/02 14:16:02 christos Exp $"); | |
66 | 66 | |||
67 | #include "opt_inet.h" | 67 | #include "opt_inet.h" | |
68 | 68 | |||
69 | #include <sys/param.h> | 69 | #include <sys/param.h> | |
70 | #include <sys/systm.h> | 70 | #include <sys/systm.h> | |
71 | #include <sys/callout.h> | 71 | #include <sys/callout.h> | |
72 | #include <sys/kernel.h> | 72 | #include <sys/kernel.h> | |
73 | #include <sys/mbuf.h> | 73 | #include <sys/mbuf.h> | |
74 | #include <sys/socket.h> | 74 | #include <sys/socket.h> | |
75 | #include <sys/ioctl.h> | 75 | #include <sys/ioctl.h> | |
76 | #include <sys/errno.h> | 76 | #include <sys/errno.h> | |
77 | #include <sys/syslog.h> | 77 | #include <sys/syslog.h> | |
78 | #include <sys/select.h> | 78 | #include <sys/select.h> | |
@@ -1192,49 +1192,47 @@ startagain: | @@ -1192,49 +1192,47 @@ startagain: | |||
1192 | (void *)(mtod(m, u_long) + count); | 1192 | (void *)(mtod(m, u_long) + count); | |
1193 | m->m_len -= count; | 1193 | m->m_len -= count; | |
1194 | } | 1194 | } | |
1195 | bus_space_write_multi_stream_4(iot, ioh, | 1195 | bus_space_write_multi_stream_4(iot, ioh, | |
1196 | txreg, mtod(m, u_int32_t *), m->m_len >> 2); | 1196 | txreg, mtod(m, u_int32_t *), m->m_len >> 2); | |
1197 | m->m_data = (void *)(mtod(m, u_long) + | 1197 | m->m_data = (void *)(mtod(m, u_long) + | |
1198 | (u_long)(m->m_len & ~3)); | 1198 | (u_long)(m->m_len & ~3)); | |
1199 | m->m_len -= m->m_len & ~3; | 1199 | m->m_len -= m->m_len & ~3; | |
1200 | } | 1200 | } | |
1201 | if (m->m_len) { | 1201 | if (m->m_len) { | |
1202 | bus_space_write_multi_1(iot, ioh, | 1202 | bus_space_write_multi_1(iot, ioh, | |
1203 | txreg, mtod(m, u_int8_t *), m->m_len); | 1203 | txreg, mtod(m, u_int8_t *), m->m_len); | |
1204 | } | 1204 | } | |
1205 | MFREE(m, m0); | 1205 | m = m0 = m_free(m); | |
1206 | m = m0; | |||
1207 | } | 1206 | } | |
1208 | } else { | 1207 | } else { | |
1209 | for (m = m0; m;) { | 1208 | for (m = m0; m;) { | |
1210 | if (m->m_len > 1) { | 1209 | if (m->m_len > 1) { | |
1211 | if (mtod(m, u_long) & 1) { | 1210 | if (mtod(m, u_long) & 1) { | |
1212 | bus_space_write_1(iot, ioh, | 1211 | bus_space_write_1(iot, ioh, | |
1213 | txreg, *(mtod(m, u_int8_t *))); | 1212 | txreg, *(mtod(m, u_int8_t *))); | |
1214 | m->m_data = | 1213 | m->m_data = | |
1215 | (void *)(mtod(m, u_long) + 1); | 1214 | (void *)(mtod(m, u_long) + 1); | |
1216 | m->m_len -= 1; | 1215 | m->m_len -= 1; | |
1217 | } | 1216 | } | |
1218 | bus_space_write_multi_stream_2(iot, ioh, | 1217 | bus_space_write_multi_stream_2(iot, ioh, | |
1219 | txreg, mtod(m, u_int16_t *), | 1218 | txreg, mtod(m, u_int16_t *), | |
1220 | m->m_len >> 1); | 1219 | m->m_len >> 1); | |
1221 | } | 1220 | } | |
1222 | if (m->m_len & 1) { | 1221 | if (m->m_len & 1) { | |
1223 | bus_space_write_1(iot, ioh, txreg, | 1222 | bus_space_write_1(iot, ioh, txreg, | |
1224 | *(mtod(m, u_int8_t *) + m->m_len - 1)); | 1223 | *(mtod(m, u_int8_t *) + m->m_len - 1)); | |
1225 | } | 1224 | } | |
1226 | MFREE(m, m0); | 1225 | m = m0 = m_free(m); | |
1227 | m = m0; | |||
1228 | } | 1226 | } | |
1229 | } | 1227 | } | |
1230 | while (pad--) | 1228 | while (pad--) | |
1231 | bus_space_write_1(iot, ioh, txreg, 0); | 1229 | bus_space_write_1(iot, ioh, txreg, 0); | |
1232 | 1230 | |||
1233 | splx(sh); | 1231 | splx(sh); | |
1234 | 1232 | |||
1235 | ++ifp->if_opackets; | 1233 | ++ifp->if_opackets; | |
1236 | 1234 | |||
1237 | readcheck: | 1235 | readcheck: | |
1238 | if ((bus_space_read_2(iot, ioh, ep_w1_reg(sc, ELINK_W1_RX_STATUS)) & | 1236 | if ((bus_space_read_2(iot, ioh, ep_w1_reg(sc, ELINK_W1_RX_STATUS)) & | |
1239 | ERR_INCOMPLETE) == 0) { | 1237 | ERR_INCOMPLETE) == 0) { | |
1240 | /* We received a complete packet. */ | 1238 | /* We received a complete packet. */ |
--- src/sys/dev/ic/hme.c 2016/06/10 13:27:13 1.93
+++ src/sys/dev/ic/hme.c 2016/10/02 14:16:02 1.94
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: hme.c,v 1.93 2016/06/10 13:27:13 ozaki-r Exp $ */ | 1 | /* $NetBSD: hme.c,v 1.94 2016/10/02 14:16:02 christos Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1999 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1999 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Paul Kranenburg. | 8 | * by Paul Kranenburg. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -24,27 +24,27 @@ | @@ -24,27 +24,27 @@ | |||
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | /* | 32 | /* | |
33 | * HME Ethernet module driver. | 33 | * HME Ethernet module driver. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #include <sys/cdefs.h> | 36 | #include <sys/cdefs.h> | |
37 | __KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.93 2016/06/10 13:27:13 ozaki-r Exp $"); | 37 | __KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.94 2016/10/02 14:16:02 christos Exp $"); | |
38 | 38 | |||
39 | /* #define HMEDEBUG */ | 39 | /* #define HMEDEBUG */ | |
40 | 40 | |||
41 | #include "opt_inet.h" | 41 | #include "opt_inet.h" | |
42 | 42 | |||
43 | #include <sys/param.h> | 43 | #include <sys/param.h> | |
44 | #include <sys/systm.h> | 44 | #include <sys/systm.h> | |
45 | #include <sys/kernel.h> | 45 | #include <sys/kernel.h> | |
46 | #include <sys/mbuf.h> | 46 | #include <sys/mbuf.h> | |
47 | #include <sys/syslog.h> | 47 | #include <sys/syslog.h> | |
48 | #include <sys/socket.h> | 48 | #include <sys/socket.h> | |
49 | #include <sys/device.h> | 49 | #include <sys/device.h> | |
50 | #include <sys/malloc.h> | 50 | #include <sys/malloc.h> | |
@@ -655,33 +655,33 @@ hme_init(struct ifnet *ifp) | @@ -655,33 +655,33 @@ hme_init(struct ifnet *ifp) | |||
655 | */ | 655 | */ | |
656 | int | 656 | int | |
657 | hme_put(struct hme_softc *sc, int ri, struct mbuf *m) | 657 | hme_put(struct hme_softc *sc, int ri, struct mbuf *m) | |
658 | /* ri: Ring index */ | 658 | /* ri: Ring index */ | |
659 | { | 659 | { | |
660 | struct mbuf *n; | 660 | struct mbuf *n; | |
661 | int len, tlen = 0; | 661 | int len, tlen = 0; | |
662 | char *bp; | 662 | char *bp; | |
663 | 663 | |||
664 | bp = (char *)sc->sc_rb.rb_txbuf + (ri % sc->sc_rb.rb_ntbuf) * _HME_BUFSZ; | 664 | bp = (char *)sc->sc_rb.rb_txbuf + (ri % sc->sc_rb.rb_ntbuf) * _HME_BUFSZ; | |
665 | for (; m; m = n) { | 665 | for (; m; m = n) { | |
666 | len = m->m_len; | 666 | len = m->m_len; | |
667 | if (len == 0) { | 667 | if (len == 0) { | |
668 | MFREE(m, n); | 668 | n = m_free(m); | |
669 | continue; | 669 | continue; | |
670 | } | 670 | } | |
671 | memcpy(bp, mtod(m, void *), len); | 671 | memcpy(bp, mtod(m, void *), len); | |
672 | bp += len; | 672 | bp += len; | |
673 | tlen += len; | 673 | tlen += len; | |
674 | MFREE(m, n); | 674 | n = m_free(m); | |
675 | } | 675 | } | |
676 | return (tlen); | 676 | return (tlen); | |
677 | } | 677 | } | |
678 | 678 | |||
679 | /* | 679 | /* | |
680 | * Pull data off an interface. | 680 | * Pull data off an interface. | |
681 | * Len is length of data, with local net header stripped. | 681 | * Len is length of data, with local net header stripped. | |
682 | * We copy the data into mbufs. When full cluster sized units are present | 682 | * We copy the data into mbufs. When full cluster sized units are present | |
683 | * we copy into clusters. | 683 | * we copy into clusters. | |
684 | */ | 684 | */ | |
685 | struct mbuf * | 685 | struct mbuf * | |
686 | hme_get(struct hme_softc *sc, int ri, uint32_t flags) | 686 | hme_get(struct hme_softc *sc, int ri, uint32_t flags) | |
687 | { | 687 | { |
--- src/sys/dev/ic/lance.c 2016/06/10 13:27:13 1.50
+++ src/sys/dev/ic/lance.c 2016/10/02 14:16:02 1.51
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: lance.c,v 1.50 2016/06/10 13:27:13 ozaki-r Exp $ */ | 1 | /* $NetBSD: lance.c,v 1.51 2016/10/02 14:16:02 christos Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace | 8 | * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace | |
9 | * Simulation Facility, NASA Ames Research Center. | 9 | * Simulation Facility, NASA Ames Research Center. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -55,27 +55,27 @@ | @@ -55,27 +55,27 @@ | |||
55 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 55 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
56 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 56 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
57 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 57 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
58 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 58 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
59 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 59 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
60 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 60 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
61 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 61 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
62 | * SUCH DAMAGE. | 62 | * SUCH DAMAGE. | |
63 | * | 63 | * | |
64 | * @(#)if_le.c 8.2 (Berkeley) 11/16/93 | 64 | * @(#)if_le.c 8.2 (Berkeley) 11/16/93 | |
65 | */ | 65 | */ | |
66 | 66 | |||
67 | #include <sys/cdefs.h> | 67 | #include <sys/cdefs.h> | |
68 | __KERNEL_RCSID(0, "$NetBSD: lance.c,v 1.50 2016/06/10 13:27:13 ozaki-r Exp $"); | 68 | __KERNEL_RCSID(0, "$NetBSD: lance.c,v 1.51 2016/10/02 14:16:02 christos Exp $"); | |
69 | 69 | |||
70 | #include <sys/param.h> | 70 | #include <sys/param.h> | |
71 | #include <sys/systm.h> | 71 | #include <sys/systm.h> | |
72 | #include <sys/mbuf.h> | 72 | #include <sys/mbuf.h> | |
73 | #include <sys/syslog.h> | 73 | #include <sys/syslog.h> | |
74 | #include <sys/socket.h> | 74 | #include <sys/socket.h> | |
75 | #include <sys/device.h> | 75 | #include <sys/device.h> | |
76 | #include <sys/malloc.h> | 76 | #include <sys/malloc.h> | |
77 | #include <sys/ioctl.h> | 77 | #include <sys/ioctl.h> | |
78 | #include <sys/errno.h> | 78 | #include <sys/errno.h> | |
79 | #include <sys/rndsource.h> | 79 | #include <sys/rndsource.h> | |
80 | 80 | |||
81 | #include <net/if.h> | 81 | #include <net/if.h> | |
@@ -333,33 +333,33 @@ lance_init(struct ifnet *ifp) | @@ -333,33 +333,33 @@ lance_init(struct ifnet *ifp) | |||
333 | /* | 333 | /* | |
334 | * Routine to copy from mbuf chain to transmit buffer in | 334 | * Routine to copy from mbuf chain to transmit buffer in | |
335 | * network buffer memory. | 335 | * network buffer memory. | |
336 | */ | 336 | */ | |
337 | int | 337 | int | |
338 | lance_put(struct lance_softc *sc, int boff, struct mbuf *m) | 338 | lance_put(struct lance_softc *sc, int boff, struct mbuf *m) | |
339 | { | 339 | { | |
340 | struct mbuf *n; | 340 | struct mbuf *n; | |
341 | int len, tlen = 0; | 341 | int len, tlen = 0; | |
342 | 342 | |||
343 | for (; m; m = n) { | 343 | for (; m; m = n) { | |
344 | len = m->m_len; | 344 | len = m->m_len; | |
345 | if (len == 0) { | 345 | if (len == 0) { | |
346 | MFREE(m, n); | 346 | n = m_free(m); | |
347 | continue; | 347 | continue; | |
348 | } | 348 | } | |
349 | (*sc->sc_copytobuf)(sc, mtod(m, void *), boff, len); | 349 | (*sc->sc_copytobuf)(sc, mtod(m, void *), boff, len); | |
350 | boff += len; | 350 | boff += len; | |
351 | tlen += len; | 351 | tlen += len; | |
352 | MFREE(m, n); | 352 | n = m_free(m); | |
353 | } | 353 | } | |
354 | if (tlen < LEMINSIZE) { | 354 | if (tlen < LEMINSIZE) { | |
355 | (*sc->sc_zerobuf)(sc, boff, LEMINSIZE - tlen); | 355 | (*sc->sc_zerobuf)(sc, boff, LEMINSIZE - tlen); | |
356 | tlen = LEMINSIZE; | 356 | tlen = LEMINSIZE; | |
357 | } | 357 | } | |
358 | return (tlen); | 358 | return (tlen); | |
359 | } | 359 | } | |
360 | 360 | |||
361 | /* | 361 | /* | |
362 | * Pull data off an interface. | 362 | * Pull data off an interface. | |
363 | * Len is length of data, with local net header stripped. | 363 | * Len is length of data, with local net header stripped. | |
364 | * We copy the data into mbufs. When full cluster sized units are present | 364 | * We copy the data into mbufs. When full cluster sized units are present | |
365 | * we copy into clusters. | 365 | * we copy into clusters. |
--- src/sys/dev/ic/mtd803.c 2016/06/10 13:27:13 1.31
+++ src/sys/dev/ic/mtd803.c 2016/10/02 14:16:02 1.32
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: mtd803.c,v 1.31 2016/06/10 13:27:13 ozaki-r Exp $ */ | 1 | /* $NetBSD: mtd803.c,v 1.32 2016/10/02 14:16:02 christos Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * | 4 | * | |
5 | * Copyright (c) 2002 The NetBSD Foundation, Inc. | 5 | * Copyright (c) 2002 The NetBSD Foundation, Inc. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to The NetBSD Foundation | 8 | * This code is derived from software contributed to The NetBSD Foundation | |
9 | * by Peter Bex <Peter.Bex@student.kun.nl>. | 9 | * by Peter Bex <Peter.Bex@student.kun.nl>. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -34,27 +34,27 @@ | @@ -34,27 +34,27 @@ | |||
34 | * TODO: | 34 | * TODO: | |
35 | * - Most importantly, get some bus_dmamap_syncs in the correct places. | 35 | * - Most importantly, get some bus_dmamap_syncs in the correct places. | |
36 | * I don't have access to a computer with PCI other than i386, and i386 | 36 | * I don't have access to a computer with PCI other than i386, and i386 | |
37 | * is just such a machine where dmamap_syncs don't do anything. | 37 | * is just such a machine where dmamap_syncs don't do anything. | |
38 | * - Powerhook for when resuming after standby. | 38 | * - Powerhook for when resuming after standby. | |
39 | * - Watchdog stuff doesn't work yet, the system crashes. | 39 | * - Watchdog stuff doesn't work yet, the system crashes. | |
40 | * - There seems to be a CardBus version of the card. (see datasheet) | 40 | * - There seems to be a CardBus version of the card. (see datasheet) | |
41 | * Perhaps a detach function is necessary then? (free buffs, stop rx/tx etc) | 41 | * Perhaps a detach function is necessary then? (free buffs, stop rx/tx etc) | |
42 | * - When you enable the TXBUN (Tx buffer unavailable) interrupt, it gets | 42 | * - When you enable the TXBUN (Tx buffer unavailable) interrupt, it gets | |
43 | * raised every time a packet is sent. Strange, since everything works anyway | 43 | * raised every time a packet is sent. Strange, since everything works anyway | |
44 | */ | 44 | */ | |
45 | 45 | |||
46 | #include <sys/cdefs.h> | 46 | #include <sys/cdefs.h> | |
47 | __KERNEL_RCSID(0, "$NetBSD: mtd803.c,v 1.31 2016/06/10 13:27:13 ozaki-r Exp $"); | 47 | __KERNEL_RCSID(0, "$NetBSD: mtd803.c,v 1.32 2016/10/02 14:16:02 christos Exp $"); | |
48 | 48 | |||
49 | 49 | |||
50 | #include <sys/param.h> | 50 | #include <sys/param.h> | |
51 | #include <sys/mbuf.h> | 51 | #include <sys/mbuf.h> | |
52 | #include <sys/systm.h> | 52 | #include <sys/systm.h> | |
53 | #include <sys/device.h> | 53 | #include <sys/device.h> | |
54 | #include <sys/socket.h> | 54 | #include <sys/socket.h> | |
55 | #include <sys/ioctl.h> | 55 | #include <sys/ioctl.h> | |
56 | #include <sys/syslog.h> | 56 | #include <sys/syslog.h> | |
57 | 57 | |||
58 | #include <net/if.h> | 58 | #include <net/if.h> | |
59 | #include <net/if_ether.h> | 59 | #include <net/if_ether.h> | |
60 | #include <net/if_media.h> | 60 | #include <net/if_media.h> | |
@@ -422,39 +422,39 @@ mtd_mii_writereg(device_t self, int phy, | @@ -422,39 +422,39 @@ mtd_mii_writereg(device_t self, int phy, | |||
422 | 422 | |||
423 | 423 | |||
424 | int | 424 | int | |
425 | mtd_put(struct mtd_softc *sc, int index, struct mbuf *m) | 425 | mtd_put(struct mtd_softc *sc, int index, struct mbuf *m) | |
426 | { | 426 | { | |
427 | int len, tlen; | 427 | int len, tlen; | |
428 | char *buf = (char *)sc->buf + MTD_NUM_RXD * MTD_RXBUF_SIZE | 428 | char *buf = (char *)sc->buf + MTD_NUM_RXD * MTD_RXBUF_SIZE | |
429 | + index * MTD_TXBUF_SIZE; | 429 | + index * MTD_TXBUF_SIZE; | |
430 | struct mbuf *n; | 430 | struct mbuf *n; | |
431 | 431 | |||
432 | for (tlen = 0; m != NULL; m = n) { | 432 | for (tlen = 0; m != NULL; m = n) { | |
433 | len = m->m_len; | 433 | len = m->m_len; | |
434 | if (len == 0) { | 434 | if (len == 0) { | |
435 | MFREE(m, n); | 435 | n = m_free(m); | |
436 | continue; | 436 | continue; | |
437 | } else if (tlen > MTD_TXBUF_SIZE) { | 437 | } else if (tlen > MTD_TXBUF_SIZE) { | |
438 | /* XXX FIXME: No idea what to do here. */ | 438 | /* XXX FIXME: No idea what to do here. */ | |
439 | aprint_error_dev(sc->dev, "packet too large! Size = %i\n", | 439 | aprint_error_dev(sc->dev, "packet too large! Size = %i\n", | |
440 | tlen); | 440 | tlen); | |
441 | MFREE(m, n); | 441 | n = m_free(m); | |
442 | continue; | 442 | continue; | |
443 | } | 443 | } | |
444 | memcpy(buf, mtod(m, void *), len); | 444 | memcpy(buf, mtod(m, void *), len); | |
445 | buf += len; | 445 | buf += len; | |
446 | tlen += len; | 446 | tlen += len; | |
447 | MFREE(m, n); | 447 | n = m_free(m); | |
448 | } | 448 | } | |
449 | sc->desc[MTD_NUM_RXD + index].conf = MTD_TXD_CONF_PAD | MTD_TXD_CONF_CRC | 449 | sc->desc[MTD_NUM_RXD + index].conf = MTD_TXD_CONF_PAD | MTD_TXD_CONF_CRC | |
450 | | MTD_TXD_CONF_IRQC | 450 | | MTD_TXD_CONF_IRQC | |
451 | | ((tlen << MTD_TXD_PKTS_SHIFT) & MTD_TXD_CONF_PKTS) | 451 | | ((tlen << MTD_TXD_PKTS_SHIFT) & MTD_TXD_CONF_PKTS) | |
452 | | (tlen & MTD_TXD_CONF_BUFS); | 452 | | (tlen & MTD_TXD_CONF_BUFS); | |
453 | 453 | |||
454 | return tlen; | 454 | return tlen; | |
455 | } | 455 | } | |
456 | 456 | |||
457 | 457 | |||
458 | void | 458 | void | |
459 | mtd_start(struct ifnet *ifp) | 459 | mtd_start(struct ifnet *ifp) | |
460 | { | 460 | { |
--- src/sys/dev/ic/Attic/rrunner.c 2016/06/10 13:27:13 1.81
+++ src/sys/dev/ic/Attic/rrunner.c 2016/10/02 14:16:02 1.82
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: rrunner.c,v 1.81 2016/06/10 13:27:13 ozaki-r Exp $ */ | 1 | /* $NetBSD: rrunner.c,v 1.82 2016/10/02 14:16:02 christos Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code contributed to The NetBSD Foundation by Kevin M. Lahey | 7 | * This code contributed to The NetBSD Foundation by Kevin M. Lahey | |
8 | * of the Numerical Aerospace Simulation Facility, NASA Ames Research | 8 | * of the Numerical Aerospace Simulation Facility, NASA Ames Research | |
9 | * Center. | 9 | * Center. | |
10 | * | 10 | * | |
11 | * Partially based on a HIPPI driver written by Essential Communications | 11 | * Partially based on a HIPPI driver written by Essential Communications | |
12 | * Corporation. Thanks to Jason Thorpe, Matt Jacob, and Fred Templin | 12 | * Corporation. Thanks to Jason Thorpe, Matt Jacob, and Fred Templin | |
13 | * for invaluable advice and encouragement! | 13 | * for invaluable advice and encouragement! | |
14 | * | 14 | * | |
@@ -25,27 +25,27 @@ | @@ -25,27 +25,27 @@ | |||
25 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 25 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
26 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 26 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
27 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 27 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
28 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 28 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
34 | * POSSIBILITY OF SUCH DAMAGE. | 34 | * POSSIBILITY OF SUCH DAMAGE. | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | #include <sys/cdefs.h> | 37 | #include <sys/cdefs.h> | |
38 | __KERNEL_RCSID(0, "$NetBSD: rrunner.c,v 1.81 2016/06/10 13:27:13 ozaki-r Exp $"); | 38 | __KERNEL_RCSID(0, "$NetBSD: rrunner.c,v 1.82 2016/10/02 14:16:02 christos Exp $"); | |
39 | 39 | |||
40 | #include "opt_inet.h" | 40 | #include "opt_inet.h" | |
41 | 41 | |||
42 | #include "esh.h" | 42 | #include "esh.h" | |
43 | 43 | |||
44 | #include <sys/param.h> | 44 | #include <sys/param.h> | |
45 | #include <sys/systm.h> | 45 | #include <sys/systm.h> | |
46 | #include <sys/mbuf.h> | 46 | #include <sys/mbuf.h> | |
47 | #include <sys/buf.h> | 47 | #include <sys/buf.h> | |
48 | #include <sys/bufq.h> | 48 | #include <sys/bufq.h> | |
49 | #include <sys/socket.h> | 49 | #include <sys/socket.h> | |
50 | #include <sys/ioctl.h> | 50 | #include <sys/ioctl.h> | |
51 | #include <sys/errno.h> | 51 | #include <sys/errno.h> | |
@@ -2212,48 +2212,48 @@ static struct mbuf * | @@ -2212,48 +2212,48 @@ static struct mbuf * | |||
2212 | esh_adjust_mbufs(struct esh_softc *sc, struct mbuf *m) | 2212 | esh_adjust_mbufs(struct esh_softc *sc, struct mbuf *m) | |
2213 | { | 2213 | { | |
2214 | struct mbuf *m0, *n, *n0; | 2214 | struct mbuf *m0, *n, *n0; | |
2215 | u_int32_t write_len; | 2215 | u_int32_t write_len; | |
2216 | 2216 | |||
2217 | write_len = m->m_pkthdr.len; | 2217 | write_len = m->m_pkthdr.len; | |
2218 | #ifdef DIAGNOSTIC | 2218 | #ifdef DIAGNOSTIC | |
2219 | if (write_len > max_write_len) | 2219 | if (write_len > max_write_len) | |
2220 | max_write_len = write_len; | 2220 | max_write_len = write_len; | |
2221 | #endif | 2221 | #endif | |
2222 | 2222 | |||
2223 | for (n0 = n = m; n; n = n->m_next) { | 2223 | for (n0 = n = m; n; n = n->m_next) { | |
2224 | while (n && n->m_len == 0) { | 2224 | while (n && n->m_len == 0) { | |
2225 | MFREE(n, m0); | 2225 | m0 = m_free(n); | |
2226 | if (n == m) | 2226 | if (n == m) | |
2227 | n = n0 = m = m0; | 2227 | n = n0 = m = m0; | |
2228 | else | 2228 | else | |
2229 | n = n0->m_next = m0; | 2229 | n = n0->m_next = m0; | |
2230 | } | 2230 | } | |
2231 | if (n == NULL) | 2231 | if (n == NULL) | |
2232 | break; | 2232 | break; | |
2233 | 2233 | |||
2234 | if (mtod(n, long) & 3 || (n->m_next && n->m_len & 3)) { | 2234 | if (mtod(n, long) & 3 || (n->m_next && n->m_len & 3)) { | |
2235 | /* Gotta clean it up */ | 2235 | /* Gotta clean it up */ | |
2236 | struct mbuf *o; | 2236 | struct mbuf *o; | |
2237 | u_int32_t len; | 2237 | u_int32_t len; | |
2238 | 2238 | |||
2239 | sc->sc_misaligned_bufs++; | 2239 | sc->sc_misaligned_bufs++; | |
2240 | MGETHDR(o, M_DONTWAIT, MT_DATA); | 2240 | MGETHDR(o, M_DONTWAIT, MT_DATA); | |
2241 | if (!o) | 2241 | if (!o) | |
2242 | goto bogosity; | 2242 | goto bogosity; | |
2243 | 2243 | |||
2244 | MCLGET(o, M_DONTWAIT); | 2244 | MCLGET(o, M_DONTWAIT); | |
2245 | if (!(o->m_flags & M_EXT)) { | 2245 | if (!(o->m_flags & M_EXT)) { | |
2246 | MFREE(o, m0); | 2246 | m0 = m_free(o); | |
2247 | goto bogosity; | 2247 | goto bogosity; | |
2248 | } | 2248 | } | |
2249 | 2249 | |||
2250 | /* | 2250 | /* | |
2251 | * XXX: Copy as much as we can into the | 2251 | * XXX: Copy as much as we can into the | |
2252 | * cluster. For now we can't have more | 2252 | * cluster. For now we can't have more | |
2253 | * than a cluster in there. May change. | 2253 | * than a cluster in there. May change. | |
2254 | * I'd prefer not to get this | 2254 | * I'd prefer not to get this | |
2255 | * down-n-dirty, but we have to be able | 2255 | * down-n-dirty, but we have to be able | |
2256 | * to do this kind of funky copy. | 2256 | * to do this kind of funky copy. | |
2257 | */ | 2257 | */ | |
2258 | 2258 | |||
2259 | len = min(MCLBYTES, write_len); | 2259 | len = min(MCLBYTES, write_len); |
--- src/sys/dev/isa/if_iy.c 2016/07/14 10:19:06 1.97
+++ src/sys/dev/isa/if_iy.c 2016/10/02 14:16:02 1.98
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_iy.c,v 1.97 2016/07/14 10:19:06 msaitoh Exp $ */ | 1 | /* $NetBSD: if_iy.c,v 1.98 2016/10/02 14:16:02 christos Exp $ */ | |
2 | /* #define IYDEBUG */ | 2 | /* #define IYDEBUG */ | |
3 | /* #define IYMEMDEBUG */ | 3 | /* #define IYMEMDEBUG */ | |
4 | 4 | |||
5 | /*- | 5 | /*- | |
6 | * Copyright (c) 1996,2001 The NetBSD Foundation, Inc. | 6 | * Copyright (c) 1996,2001 The NetBSD Foundation, Inc. | |
7 | * All rights reserved. | 7 | * All rights reserved. | |
8 | * | 8 | * | |
9 | * This code is derived from software contributed to The NetBSD Foundation | 9 | * This code is derived from software contributed to The NetBSD Foundation | |
10 | * by Ignatios Souvatzis. | 10 | * by Ignatios Souvatzis. | |
11 | * | 11 | * | |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
@@ -29,27 +29,27 @@ | @@ -29,27 +29,27 @@ | |||
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
31 | * POSSIBILITY OF SUCH DAMAGE. | 31 | * POSSIBILITY OF SUCH DAMAGE. | |
32 | */ | 32 | */ | |
33 | 33 | |||
34 | /* | 34 | /* | |
35 | * Supported hardware: | 35 | * Supported hardware: | |
36 | * | 36 | * | |
37 | * - Intel EtherExpress Pro/10. | 37 | * - Intel EtherExpress Pro/10. | |
38 | * - possibly other boards using the i82595 chip and no special tweaks. | 38 | * - possibly other boards using the i82595 chip and no special tweaks. | |
39 | */ | 39 | */ | |
40 | 40 | |||
41 | #include <sys/cdefs.h> | 41 | #include <sys/cdefs.h> | |
42 | __KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.97 2016/07/14 10:19:06 msaitoh Exp $"); | 42 | __KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.98 2016/10/02 14:16:02 christos Exp $"); | |
43 | 43 | |||
44 | #include "opt_inet.h" | 44 | #include "opt_inet.h" | |
45 | 45 | |||
46 | #include <sys/param.h> | 46 | #include <sys/param.h> | |
47 | #include <sys/systm.h> | 47 | #include <sys/systm.h> | |
48 | #include <sys/mbuf.h> | 48 | #include <sys/mbuf.h> | |
49 | #include <sys/buf.h> | 49 | #include <sys/buf.h> | |
50 | #include <sys/protosw.h> | 50 | #include <sys/protosw.h> | |
51 | #include <sys/socket.h> | 51 | #include <sys/socket.h> | |
52 | #include <sys/ioctl.h> | 52 | #include <sys/ioctl.h> | |
53 | #include <sys/errno.h> | 53 | #include <sys/errno.h> | |
54 | #include <sys/syslog.h> | 54 | #include <sys/syslog.h> | |
55 | #include <sys/device.h> | 55 | #include <sys/device.h> | |
@@ -764,27 +764,27 @@ iystart(struct ifnet *ifp) | @@ -764,27 +764,27 @@ iystart(struct ifnet *ifp) | |||
764 | if (llen > 1) | 764 | if (llen > 1) | |
765 | bus_space_write_multi_stream_2(iot, ioh, | 765 | bus_space_write_multi_stream_2(iot, ioh, | |
766 | MEM_PORT_REG, (u_int16_t *) data, | 766 | MEM_PORT_REG, (u_int16_t *) data, | |
767 | llen>>1); | 767 | llen>>1); | |
768 | residual = llen & 1; | 768 | residual = llen & 1; | |
769 | if (residual) { | 769 | if (residual) { | |
770 | resval = *(data + llen - 1); | 770 | resval = *(data + llen - 1); | |
771 | #ifdef IYDEBUG | 771 | #ifdef IYDEBUG | |
772 | printf("%s: got odd mbuf to send.\n", | 772 | printf("%s: got odd mbuf to send.\n", | |
773 | device_xname(sc->sc_dev)); | 773 | device_xname(sc->sc_dev)); | |
774 | #endif | 774 | #endif | |
775 | } | 775 | } | |
776 | 776 | |||
777 | MFREE(m, m0); | 777 | m0 = m_free(m); | |
778 | } | 778 | } | |
779 | 779 | |||
780 | if (residual) | 780 | if (residual) | |
781 | bus_space_write_stream_2(iot, ioh, MEM_PORT_REG, | 781 | bus_space_write_stream_2(iot, ioh, MEM_PORT_REG, | |
782 | resval); | 782 | resval); | |
783 | 783 | |||
784 | pad >>= 1; | 784 | pad >>= 1; | |
785 | while (pad-- > 0) | 785 | while (pad-- > 0) | |
786 | bus_space_write_stream_2(iot, ioh, MEM_PORT_REG, 0); | 786 | bus_space_write_stream_2(iot, ioh, MEM_PORT_REG, 0); | |
787 | 787 | |||
788 | #ifdef IYDEBUG | 788 | #ifdef IYDEBUG | |
789 | printf("%s: new last = 0x%x, end = 0x%x.\n", | 789 | printf("%s: new last = 0x%x, end = 0x%x.\n", | |
790 | device_xname(sc->sc_dev), last, end); | 790 | device_xname(sc->sc_dev), last, end); |
--- src/sys/dev/ofw/ofnet.c 2016/06/10 13:27:14 1.55
+++ src/sys/dev/ofw/ofnet.c 2016/10/02 14:16:03 1.56
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ofnet.c,v 1.55 2016/06/10 13:27:14 ozaki-r Exp $ */ | 1 | /* $NetBSD: ofnet.c,v 1.56 2016/10/02 14:16:03 christos Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
5 | * Copyright (C) 1995, 1996 TooLs GmbH. | 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -22,27 +22,27 @@ | @@ -22,27 +22,27 @@ | |||
22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
32 | */ | 32 | */ | |
33 | 33 | |||
34 | #include <sys/cdefs.h> | 34 | #include <sys/cdefs.h> | |
35 | __KERNEL_RCSID(0, "$NetBSD: ofnet.c,v 1.55 2016/06/10 13:27:14 ozaki-r Exp $"); | 35 | __KERNEL_RCSID(0, "$NetBSD: ofnet.c,v 1.56 2016/10/02 14:16:03 christos Exp $"); | |
36 | 36 | |||
37 | #include "ofnet.h" | 37 | #include "ofnet.h" | |
38 | #include "opt_inet.h" | 38 | #include "opt_inet.h" | |
39 | 39 | |||
40 | #include <sys/param.h> | 40 | #include <sys/param.h> | |
41 | #include <sys/systm.h> | 41 | #include <sys/systm.h> | |
42 | #include <sys/callout.h> | 42 | #include <sys/callout.h> | |
43 | #include <sys/device.h> | 43 | #include <sys/device.h> | |
44 | #include <sys/disk.h> | 44 | #include <sys/disk.h> | |
45 | #include <sys/ioctl.h> | 45 | #include <sys/ioctl.h> | |
46 | #include <sys/mbuf.h> | 46 | #include <sys/mbuf.h> | |
47 | #include <sys/socket.h> | 47 | #include <sys/socket.h> | |
48 | #include <sys/syslog.h> | 48 | #include <sys/syslog.h> | |
@@ -325,27 +325,27 @@ ofnet_start(struct ifnet *ifp) | @@ -325,27 +325,27 @@ ofnet_start(struct ifnet *ifp) | |||
325 | 325 | |||
326 | bpf_mtap(ifp, m0); | 326 | bpf_mtap(ifp, m0); | |
327 | 327 | |||
328 | if (len > ETHERMTU + sizeof(struct ether_header)) { | 328 | if (len > ETHERMTU + sizeof(struct ether_header)) { | |
329 | /* packet too large, toss it */ | 329 | /* packet too large, toss it */ | |
330 | ifp->if_oerrors++; | 330 | ifp->if_oerrors++; | |
331 | m_freem(m0); | 331 | m_freem(m0); | |
332 | continue; | 332 | continue; | |
333 | } | 333 | } | |
334 | 334 | |||
335 | for (bufp = buf; (m = m0) != NULL;) { | 335 | for (bufp = buf; (m = m0) != NULL;) { | |
336 | memcpy(bufp, mtod(m, char *), m->m_len); | 336 | memcpy(bufp, mtod(m, char *), m->m_len); | |
337 | bufp += m->m_len; | 337 | bufp += m->m_len; | |
338 | MFREE(m, m0); | 338 | m0 = m_free(m); | |
339 | } | 339 | } | |
340 | 340 | |||
341 | /* | 341 | /* | |
342 | * We don't know if the interface will auto-pad for | 342 | * We don't know if the interface will auto-pad for | |
343 | * us, so make sure it's at least as large as a | 343 | * us, so make sure it's at least as large as a | |
344 | * minimum size Ethernet packet. | 344 | * minimum size Ethernet packet. | |
345 | */ | 345 | */ | |
346 | 346 | |||
347 | if (len < (ETHER_MIN_LEN - ETHER_CRC_LEN)) { | 347 | if (len < (ETHER_MIN_LEN - ETHER_CRC_LEN)) { | |
348 | memset(bufp, 0, ETHER_MIN_LEN - ETHER_CRC_LEN - len); | 348 | memset(bufp, 0, ETHER_MIN_LEN - ETHER_CRC_LEN - len); | |
349 | bufp += ETHER_MIN_LEN - ETHER_CRC_LEN - len; | 349 | bufp += ETHER_MIN_LEN - ETHER_CRC_LEN - len; | |
350 | } else | 350 | } else | |
351 | len = bufp - buf; | 351 | len = bufp - buf; |
--- src/sys/dev/pci/cxgb/cxgb_mvec.h 2010/03/21 21:11:13 1.1
+++ src/sys/dev/pci/cxgb/cxgb_mvec.h 2016/10/02 14:16:03 1.2
@@ -114,30 +114,27 @@ m_collapse(struct mbuf *m, int maxbufs, | @@ -114,30 +114,27 @@ m_collapse(struct mbuf *m, int maxbufs, | |||
114 | #if (!defined(__sparc64__) && !defined(__sun4v__)) | 114 | #if (!defined(__sparc64__) && !defined(__sun4v__)) | |
115 | if (m->m_next == NULL) | 115 | if (m->m_next == NULL) | |
116 | #endif | 116 | #endif | |
117 | { | 117 | { | |
118 | *mnew = m; | 118 | *mnew = m; | |
119 | return (0); | 119 | return (0); | |
120 | } | 120 | } | |
121 | return _m_collapse(m, maxbufs, mnew); | 121 | return _m_collapse(m, maxbufs, mnew); | |
122 | } | 122 | } | |
123 | 123 | |||
124 | static inline struct mbuf * | 124 | static inline struct mbuf * | |
125 | m_free_vec(struct mbuf *m) | 125 | m_free_vec(struct mbuf *m) | |
126 | { | 126 | { | |
127 | struct mbuf *n = NULL; | 127 | return m_free(m); | |
128 | ||||
129 | MFREE(m, n); | |||
130 | return (n); | |||
131 | } | 128 | } | |
132 | 129 | |||
133 | static inline void | 130 | static inline void | |
134 | m_freem_vec(struct mbuf *m) | 131 | m_freem_vec(struct mbuf *m) | |
135 | { | 132 | { | |
136 | while (m != NULL) | 133 | while (m != NULL) | |
137 | m = m_free_vec(m); | 134 | m = m_free_vec(m); | |
138 | } | 135 | } | |
139 | 136 | |||
140 | #if (!defined(__sparc64__) && !defined(__sun4v__)) | 137 | #if (!defined(__sparc64__) && !defined(__sun4v__)) | |
141 | int | 138 | int | |
142 | bus_dmamap_load_mvec_sg(bus_dma_tag_t dmat, bus_dmamap_t map, struct mbuf *m0, | 139 | bus_dmamap_load_mvec_sg(bus_dma_tag_t dmat, bus_dmamap_t map, struct mbuf *m0, | |
143 | bus_dma_segment_t *segs, int *nsegs, int flags); | 140 | bus_dma_segment_t *segs, int *nsegs, int flags); |
--- src/sys/dev/pcmcia/if_cnw.c 2016/06/10 13:27:15 1.58
+++ src/sys/dev/pcmcia/if_cnw.c 2016/10/02 14:16:03 1.59
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_cnw.c,v 1.58 2016/06/10 13:27:15 ozaki-r Exp $ */ | 1 | /* $NetBSD: if_cnw.c,v 1.59 2016/10/02 14:16:03 christos Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Michael Eriksson. | 8 | * by Michael Eriksson. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -95,27 +95,27 @@ | @@ -95,27 +95,27 @@ | |||
95 | * | 95 | * | |
96 | * Unfortunately, a lot of explicit numeric constants were used in the | 96 | * Unfortunately, a lot of explicit numeric constants were used in the | |
97 | * Linux driver. I have tried to use symbolic names whenever possible, | 97 | * Linux driver. I have tried to use symbolic names whenever possible, | |
98 | * but since I don't have any real hardware documentation, there's | 98 | * but since I don't have any real hardware documentation, there's | |
99 | * still one or two "magic numbers" :-(. | 99 | * still one or two "magic numbers" :-(. | |
100 | * | 100 | * | |
101 | * Driver limitations: This driver doesn't do multicasting or receiver | 101 | * Driver limitations: This driver doesn't do multicasting or receiver | |
102 | * promiscuity, because of missing hardware documentation. I couldn't | 102 | * promiscuity, because of missing hardware documentation. I couldn't | |
103 | * get receiver promiscuity to work, and I haven't even tried | 103 | * get receiver promiscuity to work, and I haven't even tried | |
104 | * multicast. Volunteers are welcome, of course :-). | 104 | * multicast. Volunteers are welcome, of course :-). | |
105 | */ | 105 | */ | |
106 | 106 | |||
107 | #include <sys/cdefs.h> | 107 | #include <sys/cdefs.h> | |
108 | __KERNEL_RCSID(0, "$NetBSD: if_cnw.c,v 1.58 2016/06/10 13:27:15 ozaki-r Exp $"); | 108 | __KERNEL_RCSID(0, "$NetBSD: if_cnw.c,v 1.59 2016/10/02 14:16:03 christos Exp $"); | |
109 | 109 | |||
110 | #include "opt_inet.h" | 110 | #include "opt_inet.h" | |
111 | 111 | |||
112 | #include <sys/param.h> | 112 | #include <sys/param.h> | |
113 | #include <sys/systm.h> | 113 | #include <sys/systm.h> | |
114 | #include <sys/device.h> | 114 | #include <sys/device.h> | |
115 | #include <sys/socket.h> | 115 | #include <sys/socket.h> | |
116 | #include <sys/mbuf.h> | 116 | #include <sys/mbuf.h> | |
117 | #include <sys/ioctl.h> | 117 | #include <sys/ioctl.h> | |
118 | #include <sys/proc.h> | 118 | #include <sys/proc.h> | |
119 | #include <sys/kauth.h> | 119 | #include <sys/kauth.h> | |
120 | 120 | |||
121 | #include <net/if.h> | 121 | #include <net/if.h> | |
@@ -718,28 +718,27 @@ cnw_transmit(struct cnw_softc *sc, struc | @@ -718,28 +718,27 @@ cnw_transmit(struct cnw_softc *sc, struc | |||
718 | if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG) | 718 | if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG) | |
719 | printf("%s: next buffer @0x%x\n", | 719 | printf("%s: next buffer @0x%x\n", | |
720 | device_xname(sc->sc_dev), buffer); | 720 | device_xname(sc->sc_dev), buffer); | |
721 | #endif | 721 | #endif | |
722 | } | 722 | } | |
723 | n = mbytes <= bufspace ? mbytes : bufspace; | 723 | n = mbytes <= bufspace ? mbytes : bufspace; | |
724 | bus_space_write_region_1(sc->sc_memt, sc->sc_memh, | 724 | bus_space_write_region_1(sc->sc_memt, sc->sc_memh, | |
725 | bufptr, mptr, n); | 725 | bufptr, mptr, n); | |
726 | bufptr += n; | 726 | bufptr += n; | |
727 | bufspace -= n; | 727 | bufspace -= n; | |
728 | mptr += n; | 728 | mptr += n; | |
729 | mbytes -= n; | 729 | mbytes -= n; | |
730 | } | 730 | } | |
731 | MFREE(m, m0); | 731 | m = m0 = m_free(m); | |
732 | m = m0; | |||
733 | } | 732 | } | |
734 | 733 | |||
735 | /* Issue transmit command */ | 734 | /* Issue transmit command */ | |
736 | CNW_CMD2(sc, CNW_CMD_TL, len, len >> 8); | 735 | CNW_CMD2(sc, CNW_CMD_TL, len, len >> 8); | |
737 | } | 736 | } | |
738 | 737 | |||
739 | 738 | |||
740 | /* | 739 | /* | |
741 | * Pull a packet from the card into an mbuf chain. | 740 | * Pull a packet from the card into an mbuf chain. | |
742 | */ | 741 | */ | |
743 | struct mbuf * | 742 | struct mbuf * | |
744 | cnw_read(struct cnw_softc *sc) | 743 | cnw_read(struct cnw_softc *sc) | |
745 | { | 744 | { |
--- src/sys/dev/pcmcia/if_xi.c 2016/06/10 13:27:15 1.77
+++ src/sys/dev/pcmcia/if_xi.c 2016/10/02 14:16:03 1.78
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_xi.c,v 1.77 2016/06/10 13:27:15 ozaki-r Exp $ */ | 1 | /* $NetBSD: if_xi.c,v 1.78 2016/10/02 14:16:03 christos Exp $ */ | |
2 | /* OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp */ | 2 | /* OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2004 Charles M. Hannum. All rights reserved. | 5 | * Copyright (c) 2004 Charles M. Hannum. All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -45,27 +45,27 @@ | @@ -45,27 +45,27 @@ | |||
45 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 45 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
47 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 47 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
48 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 48 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
49 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 49 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
50 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
51 | */ | 51 | */ | |
52 | 52 | |||
53 | /* | 53 | /* | |
54 | * A driver for Xircom CreditCard PCMCIA Ethernet adapters. | 54 | * A driver for Xircom CreditCard PCMCIA Ethernet adapters. | |
55 | */ | 55 | */ | |
56 | 56 | |||
57 | #include <sys/cdefs.h> | 57 | #include <sys/cdefs.h> | |
58 | __KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.77 2016/06/10 13:27:15 ozaki-r Exp $"); | 58 | __KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.78 2016/10/02 14:16:03 christos Exp $"); | |
59 | 59 | |||
60 | #include "opt_inet.h" | 60 | #include "opt_inet.h" | |
61 | 61 | |||
62 | #include <sys/param.h> | 62 | #include <sys/param.h> | |
63 | #include <sys/systm.h> | 63 | #include <sys/systm.h> | |
64 | #include <sys/device.h> | 64 | #include <sys/device.h> | |
65 | #include <sys/ioctl.h> | 65 | #include <sys/ioctl.h> | |
66 | #include <sys/mbuf.h> | 66 | #include <sys/mbuf.h> | |
67 | #include <sys/malloc.h> | 67 | #include <sys/malloc.h> | |
68 | #include <sys/socket.h> | 68 | #include <sys/socket.h> | |
69 | #include <sys/kernel.h> | 69 | #include <sys/kernel.h> | |
70 | #include <sys/proc.h> | 70 | #include <sys/proc.h> | |
71 | 71 | |||
@@ -801,28 +801,27 @@ xi_start(struct ifnet *ifp) | @@ -801,28 +801,27 @@ xi_start(struct ifnet *ifp) | |||
801 | */ | 801 | */ | |
802 | s = splhigh(); | 802 | s = splhigh(); | |
803 | 803 | |||
804 | bus_space_write_2(bst, bsh, EDP, (u_int16_t)len + pad); | 804 | bus_space_write_2(bst, bsh, EDP, (u_int16_t)len + pad); | |
805 | for (m = m0; m; ) { | 805 | for (m = m0; m; ) { | |
806 | if (m->m_len > 1) | 806 | if (m->m_len > 1) | |
807 | bus_space_write_multi_2(bst, bsh, EDP, | 807 | bus_space_write_multi_2(bst, bsh, EDP, | |
808 | mtod(m, u_int16_t *), m->m_len>>1); | 808 | mtod(m, u_int16_t *), m->m_len>>1); | |
809 | if (m->m_len & 1) { | 809 | if (m->m_len & 1) { | |
810 | DPRINTF(XID_CONFIG, ("xi: XXX odd!\n")); | 810 | DPRINTF(XID_CONFIG, ("xi: XXX odd!\n")); | |
811 | bus_space_write_1(bst, bsh, EDP, | 811 | bus_space_write_1(bst, bsh, EDP, | |
812 | *(mtod(m, u_int8_t *) + m->m_len - 1)); | 812 | *(mtod(m, u_int8_t *) + m->m_len - 1)); | |
813 | } | 813 | } | |
814 | MFREE(m, m0); | 814 | m = m0 = m_free(m); | |
815 | m = m0; | |||
816 | } | 815 | } | |
817 | DPRINTF(XID_CONFIG, ("xi: len=%d pad=%d total=%d\n", len, pad, len+pad+4)); | 816 | DPRINTF(XID_CONFIG, ("xi: len=%d pad=%d total=%d\n", len, pad, len+pad+4)); | |
818 | if (sc->sc_chipset >= XI_CHIPSET_MOHAWK) | 817 | if (sc->sc_chipset >= XI_CHIPSET_MOHAWK) | |
819 | bus_space_write_1(bst, bsh, CR, TX_PKT | ENABLE_INT); | 818 | bus_space_write_1(bst, bsh, CR, TX_PKT | ENABLE_INT); | |
820 | else { | 819 | else { | |
821 | for (; pad > 1; pad -= 2) | 820 | for (; pad > 1; pad -= 2) | |
822 | bus_space_write_2(bst, bsh, EDP, 0); | 821 | bus_space_write_2(bst, bsh, EDP, 0); | |
823 | if (pad == 1) | 822 | if (pad == 1) | |
824 | bus_space_write_1(bst, bsh, EDP, 0); | 823 | bus_space_write_1(bst, bsh, EDP, 0); | |
825 | } | 824 | } | |
826 | 825 | |||
827 | splx(s); | 826 | splx(s); | |
828 | 827 |
--- src/sys/dev/sbus/be.c 2016/06/10 13:27:15 1.83
+++ src/sys/dev/sbus/be.c 2016/10/02 14:16:03 1.84
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: be.c,v 1.83 2016/06/10 13:27:15 ozaki-r Exp $ */ | 1 | /* $NetBSD: be.c,v 1.84 2016/10/02 14:16:03 christos Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1999 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1999 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Paul Kranenburg. | 8 | * by Paul Kranenburg. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -47,27 +47,27 @@ | @@ -47,27 +47,27 @@ | |||
47 | * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR | 47 | * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR | |
48 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 48 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
49 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 49 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
50 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, | 50 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
51 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 51 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
52 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 52 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
53 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 53 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
54 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 54 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
55 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 55 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
56 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 56 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
57 | */ | 57 | */ | |
58 | 58 | |||
59 | #include <sys/cdefs.h> | 59 | #include <sys/cdefs.h> | |
60 | __KERNEL_RCSID(0, "$NetBSD: be.c,v 1.83 2016/06/10 13:27:15 ozaki-r Exp $"); | 60 | __KERNEL_RCSID(0, "$NetBSD: be.c,v 1.84 2016/10/02 14:16:03 christos Exp $"); | |
61 | 61 | |||
62 | #include "opt_ddb.h" | 62 | #include "opt_ddb.h" | |
63 | #include "opt_inet.h" | 63 | #include "opt_inet.h" | |
64 | 64 | |||
65 | #include <sys/param.h> | 65 | #include <sys/param.h> | |
66 | #include <sys/systm.h> | 66 | #include <sys/systm.h> | |
67 | #include <sys/callout.h> | 67 | #include <sys/callout.h> | |
68 | #include <sys/kernel.h> | 68 | #include <sys/kernel.h> | |
69 | #include <sys/errno.h> | 69 | #include <sys/errno.h> | |
70 | #include <sys/ioctl.h> | 70 | #include <sys/ioctl.h> | |
71 | #include <sys/mbuf.h> | 71 | #include <sys/mbuf.h> | |
72 | #include <sys/socket.h> | 72 | #include <sys/socket.h> | |
73 | #include <sys/syslog.h> | 73 | #include <sys/syslog.h> | |
@@ -463,33 +463,33 @@ beattach(device_t parent, device_t self, | @@ -463,33 +463,33 @@ beattach(device_t parent, device_t self, | |||
463 | */ | 463 | */ | |
464 | static inline int | 464 | static inline int | |
465 | be_put(struct be_softc *sc, int idx, struct mbuf *m) | 465 | be_put(struct be_softc *sc, int idx, struct mbuf *m) | |
466 | { | 466 | { | |
467 | struct mbuf *n; | 467 | struct mbuf *n; | |
468 | int len, tlen = 0, boff = 0; | 468 | int len, tlen = 0, boff = 0; | |
469 | uint8_t *bp; | 469 | uint8_t *bp; | |
470 | 470 | |||
471 | bp = sc->sc_rb.rb_txbuf + (idx % sc->sc_rb.rb_ntbuf) * BE_PKT_BUF_SZ; | 471 | bp = sc->sc_rb.rb_txbuf + (idx % sc->sc_rb.rb_ntbuf) * BE_PKT_BUF_SZ; | |
472 | 472 | |||
473 | for (; m; m = n) { | 473 | for (; m; m = n) { | |
474 | len = m->m_len; | 474 | len = m->m_len; | |
475 | if (len == 0) { | 475 | if (len == 0) { | |
476 | MFREE(m, n); | 476 | n = m_free(m); | |
477 | continue; | 477 | continue; | |
478 | } | 478 | } | |
479 | memcpy(bp + boff, mtod(m, void *), len); | 479 | memcpy(bp + boff, mtod(m, void *), len); | |
480 | boff += len; | 480 | boff += len; | |
481 | tlen += len; | 481 | tlen += len; | |
482 | MFREE(m, n); | 482 | n = m_free(m); | |
483 | } | 483 | } | |
484 | return tlen; | 484 | return tlen; | |
485 | } | 485 | } | |
486 | 486 | |||
487 | /* | 487 | /* | |
488 | * Pull data off an interface. | 488 | * Pull data off an interface. | |
489 | * Len is the length of data, with local net header stripped. | 489 | * Len is the length of data, with local net header stripped. | |
490 | * We copy the data into mbufs. When full cluster sized units are present, | 490 | * We copy the data into mbufs. When full cluster sized units are present, | |
491 | * we copy into clusters. | 491 | * we copy into clusters. | |
492 | */ | 492 | */ | |
493 | static inline struct mbuf * | 493 | static inline struct mbuf * | |
494 | be_get(struct be_softc *sc, int idx, int totlen) | 494 | be_get(struct be_softc *sc, int idx, int totlen) | |
495 | { | 495 | { |
--- src/sys/dev/sbus/qe.c 2016/06/10 13:27:15 1.65
+++ src/sys/dev/sbus/qe.c 2016/10/02 14:16:03 1.66
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: qe.c,v 1.65 2016/06/10 13:27:15 ozaki-r Exp $ */ | 1 | /* $NetBSD: qe.c,v 1.66 2016/10/02 14:16:03 christos Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1999 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1999 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Paul Kranenburg. | 8 | * by Paul Kranenburg. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -56,27 +56,27 @@ | @@ -56,27 +56,27 @@ | |||
56 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 56 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
57 | */ | 57 | */ | |
58 | 58 | |||
59 | /* | 59 | /* | |
60 | * Driver for the SBus qec+qe QuadEthernet board. | 60 | * Driver for the SBus qec+qe QuadEthernet board. | |
61 | * | 61 | * | |
62 | * This driver was written using the AMD MACE Am79C940 documentation, some | 62 | * This driver was written using the AMD MACE Am79C940 documentation, some | |
63 | * ideas gleaned from the S/Linux driver for this card, Solaris header files, | 63 | * ideas gleaned from the S/Linux driver for this card, Solaris header files, | |
64 | * and a loan of a card from Paul Southworth of the Internet Engineering | 64 | * and a loan of a card from Paul Southworth of the Internet Engineering | |
65 | * Group (www.ieng.com). | 65 | * Group (www.ieng.com). | |
66 | */ | 66 | */ | |
67 | 67 | |||
68 | #include <sys/cdefs.h> | 68 | #include <sys/cdefs.h> | |
69 | __KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.65 2016/06/10 13:27:15 ozaki-r Exp $"); | 69 | __KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.66 2016/10/02 14:16:03 christos Exp $"); | |
70 | 70 | |||
71 | #define QEDEBUG | 71 | #define QEDEBUG | |
72 | 72 | |||
73 | #include "opt_ddb.h" | 73 | #include "opt_ddb.h" | |
74 | #include "opt_inet.h" | 74 | #include "opt_inet.h" | |
75 | 75 | |||
76 | #include <sys/param.h> | 76 | #include <sys/param.h> | |
77 | #include <sys/systm.h> | 77 | #include <sys/systm.h> | |
78 | #include <sys/kernel.h> | 78 | #include <sys/kernel.h> | |
79 | #include <sys/errno.h> | 79 | #include <sys/errno.h> | |
80 | #include <sys/ioctl.h> | 80 | #include <sys/ioctl.h> | |
81 | #include <sys/mbuf.h> | 81 | #include <sys/mbuf.h> | |
82 | #include <sys/socket.h> | 82 | #include <sys/socket.h> | |
@@ -373,33 +373,33 @@ qe_get(struct qe_softc *sc, int idx, int | @@ -373,33 +373,33 @@ qe_get(struct qe_softc *sc, int idx, int | |||
373 | */ | 373 | */ | |
374 | inline int | 374 | inline int | |
375 | qe_put(struct qe_softc *sc, int idx, struct mbuf *m) | 375 | qe_put(struct qe_softc *sc, int idx, struct mbuf *m) | |
376 | { | 376 | { | |
377 | struct mbuf *n; | 377 | struct mbuf *n; | |
378 | int len, tlen = 0, boff = 0; | 378 | int len, tlen = 0, boff = 0; | |
379 | uint8_t *bp; | 379 | uint8_t *bp; | |
380 | 380 | |||
381 | bp = sc->sc_rb.rb_txbuf + (idx % sc->sc_rb.rb_ntbuf) * QE_PKT_BUF_SZ; | 381 | bp = sc->sc_rb.rb_txbuf + (idx % sc->sc_rb.rb_ntbuf) * QE_PKT_BUF_SZ; | |
382 | 382 | |||
383 | for (; m; m = n) { | 383 | for (; m; m = n) { | |
384 | len = m->m_len; | 384 | len = m->m_len; | |
385 | if (len == 0) { | 385 | if (len == 0) { | |
386 | MFREE(m, n); | 386 | n = m_free(m); | |
387 | continue; | 387 | continue; | |
388 | } | 388 | } | |
389 | memcpy(bp + boff, mtod(m, void *), len); | 389 | memcpy(bp + boff, mtod(m, void *), len); | |
390 | boff += len; | 390 | boff += len; | |
391 | tlen += len; | 391 | tlen += len; | |
392 | MFREE(m, n); | 392 | n = m_free(m); | |
393 | } | 393 | } | |
394 | return (tlen); | 394 | return (tlen); | |
395 | } | 395 | } | |
396 | 396 | |||
397 | /* | 397 | /* | |
398 | * Pass a packet to the higher levels. | 398 | * Pass a packet to the higher levels. | |
399 | */ | 399 | */ | |
400 | inline void | 400 | inline void | |
401 | qe_read(struct qe_softc *sc, int idx, int len) | 401 | qe_read(struct qe_softc *sc, int idx, int len) | |
402 | { | 402 | { | |
403 | struct ifnet *ifp = &sc->sc_ethercom.ec_if; | 403 | struct ifnet *ifp = &sc->sc_ethercom.ec_if; | |
404 | struct mbuf *m; | 404 | struct mbuf *m; | |
405 | 405 |
--- src/sys/dev/scsipi/if_se.c 2016/09/07 14:21:01 1.91
+++ src/sys/dev/scsipi/if_se.c 2016/10/02 14:16:03 1.92
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_se.c,v 1.91 2016/09/07 14:21:01 jakllsch Exp $ */ | 1 | /* $NetBSD: if_se.c,v 1.92 2016/10/02 14:16:03 christos Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1997 Ian W. Dall <ian.dall@dsto.defence.gov.au> | 4 | * Copyright (c) 1997 Ian W. Dall <ian.dall@dsto.defence.gov.au> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -49,27 +49,27 @@ | @@ -49,27 +49,27 @@ | |||
49 | * This driver is also a bit unusual. It must look like a network | 49 | * This driver is also a bit unusual. It must look like a network | |
50 | * interface and it must also appear to be a scsi device to the scsi | 50 | * interface and it must also appear to be a scsi device to the scsi | |
51 | * system. Hence there are cases where there are two entry points. eg | 51 | * system. Hence there are cases where there are two entry points. eg | |
52 | * sestart is to be called from the scsi subsytem and se_ifstart from | 52 | * sestart is to be called from the scsi subsytem and se_ifstart from | |
53 | * the network interface subsystem. In addition, to facilitate scsi | 53 | * the network interface subsystem. In addition, to facilitate scsi | |
54 | * commands issued by userland programs, there are open, close and | 54 | * commands issued by userland programs, there are open, close and | |
55 | * ioctl entry points. This allows a user program to, for example, | 55 | * ioctl entry points. This allows a user program to, for example, | |
56 | * display the ea41x stats and download new code into the adaptor --- | 56 | * display the ea41x stats and download new code into the adaptor --- | |
57 | * functions which can't be performed through the ifconfig interface. | 57 | * functions which can't be performed through the ifconfig interface. | |
58 | * Normal operation does not require any special userland program. | 58 | * Normal operation does not require any special userland program. | |
59 | */ | 59 | */ | |
60 | 60 | |||
61 | #include <sys/cdefs.h> | 61 | #include <sys/cdefs.h> | |
62 | __KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.91 2016/09/07 14:21:01 jakllsch Exp $"); | 62 | __KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.92 2016/10/02 14:16:03 christos Exp $"); | |
63 | 63 | |||
64 | #ifdef _KERNEL_OPT | 64 | #ifdef _KERNEL_OPT | |
65 | #include "opt_inet.h" | 65 | #include "opt_inet.h" | |
66 | #include "opt_atalk.h" | 66 | #include "opt_atalk.h" | |
67 | #endif | 67 | #endif | |
68 | 68 | |||
69 | #include <sys/param.h> | 69 | #include <sys/param.h> | |
70 | #include <sys/systm.h> | 70 | #include <sys/systm.h> | |
71 | #include <sys/callout.h> | 71 | #include <sys/callout.h> | |
72 | #include <sys/syslog.h> | 72 | #include <sys/syslog.h> | |
73 | #include <sys/kernel.h> | 73 | #include <sys/kernel.h> | |
74 | #include <sys/file.h> | 74 | #include <sys/file.h> | |
75 | #include <sys/stat.h> | 75 | #include <sys/stat.h> | |
@@ -438,28 +438,27 @@ se_ifstart(struct ifnet *ifp) | @@ -438,28 +438,27 @@ se_ifstart(struct ifnet *ifp) | |||
438 | /* We need to use m->m_pkthdr.len, so require the header */ | 438 | /* We need to use m->m_pkthdr.len, so require the header */ | |
439 | if ((m0->m_flags & M_PKTHDR) == 0) | 439 | if ((m0->m_flags & M_PKTHDR) == 0) | |
440 | panic("ctscstart: no header mbuf"); | 440 | panic("ctscstart: no header mbuf"); | |
441 | len = m0->m_pkthdr.len; | 441 | len = m0->m_pkthdr.len; | |
442 | 442 | |||
443 | /* Mark the interface busy. */ | 443 | /* Mark the interface busy. */ | |
444 | ifp->if_flags |= IFF_OACTIVE; | 444 | ifp->if_flags |= IFF_OACTIVE; | |
445 | 445 | |||
446 | /* Chain; copy into linear buffer we allocated at attach time. */ | 446 | /* Chain; copy into linear buffer we allocated at attach time. */ | |
447 | cp = sc->sc_tbuf; | 447 | cp = sc->sc_tbuf; | |
448 | for (m = m0; m != NULL; ) { | 448 | for (m = m0; m != NULL; ) { | |
449 | memcpy(cp, mtod(m, u_char *), m->m_len); | 449 | memcpy(cp, mtod(m, u_char *), m->m_len); | |
450 | cp += m->m_len; | 450 | cp += m->m_len; | |
451 | MFREE(m, m0); | 451 | m = m0 = m_free(m); | |
452 | m = m0; | |||
453 | } | 452 | } | |
454 | if (len < SEMINSIZE) { | 453 | if (len < SEMINSIZE) { | |
455 | #ifdef SEDEBUG | 454 | #ifdef SEDEBUG | |
456 | if (sc->sc_debug) | 455 | if (sc->sc_debug) | |
457 | printf("se: packet size %d (%zu) < %d\n", len, | 456 | printf("se: packet size %d (%zu) < %d\n", len, | |
458 | cp - (u_char *)sc->sc_tbuf, SEMINSIZE); | 457 | cp - (u_char *)sc->sc_tbuf, SEMINSIZE); | |
459 | #endif | 458 | #endif | |
460 | memset(cp, 0, SEMINSIZE - len); | 459 | memset(cp, 0, SEMINSIZE - len); | |
461 | len = SEMINSIZE; | 460 | len = SEMINSIZE; | |
462 | } | 461 | } | |
463 | 462 | |||
464 | /* Fill out SCSI command. */ | 463 | /* Fill out SCSI command. */ | |
465 | PROTOCMD(ctron_ether_send, send_cmd); | 464 | PROTOCMD(ctron_ether_send, send_cmd); |