head 1.69; access; symbols netbsd-10-0-RELEASE:1.69 netbsd-10-0-RC6:1.69 netbsd-10-0-RC5:1.69 netbsd-10-0-RC4:1.69 netbsd-10-0-RC3:1.69 netbsd-10-0-RC2:1.69 thorpej-ifq:1.69.0.8 thorpej-ifq-base:1.69 thorpej-altq-separation:1.69.0.6 thorpej-altq-separation-base:1.69 netbsd-10-0-RC1:1.69 netbsd-10:1.69.0.4 netbsd-10-base:1.69 bouyer-sunxi-drm:1.69.0.2 bouyer-sunxi-drm-base:1.69 netbsd-9-3-RELEASE:1.65 thorpej-i2c-spi-conf2:1.66.0.16 thorpej-i2c-spi-conf2-base:1.66 thorpej-futex2:1.66.0.14 thorpej-futex2-base:1.66 thorpej-cfargs2:1.66.0.12 thorpej-cfargs2-base:1.66 cjep_sun2x-base1:1.66 cjep_sun2x:1.66.0.10 cjep_sun2x-base:1.66 cjep_staticlib_x-base1:1.66 netbsd-9-2-RELEASE:1.65 cjep_staticlib_x:1.66.0.8 cjep_staticlib_x-base:1.66 thorpej-i2c-spi-conf:1.66.0.6 thorpej-i2c-spi-conf-base:1.66 thorpej-cfargs:1.66.0.4 thorpej-cfargs-base:1.66 thorpej-futex:1.66.0.2 thorpej-futex-base:1.66 netbsd-9-1-RELEASE:1.65 bouyer-xenpvh-base2:1.65 phil-wifi-20200421:1.65 bouyer-xenpvh-base1:1.65 phil-wifi-20200411:1.65 bouyer-xenpvh:1.65.0.10 bouyer-xenpvh-base:1.65 is-mlppp:1.65.0.8 is-mlppp-base:1.65 phil-wifi-20200406:1.65 netbsd-8-2-RELEASE:1.59 ad-namecache-base3:1.65 netbsd-9-0-RELEASE:1.65 netbsd-9-0-RC2:1.65 ad-namecache-base2:1.65 ad-namecache-base1:1.65 ad-namecache:1.65.0.6 ad-namecache-base:1.65 netbsd-9-0-RC1:1.65 phil-wifi-20191119:1.65 netbsd-9:1.65.0.4 netbsd-9-base:1.65 phil-wifi-20190609:1.65 netbsd-8-1-RELEASE:1.59 netbsd-8-1-RC1:1.59 isaki-audio2:1.65.0.2 isaki-audio2-base:1.65 pgoyette-compat-merge-20190127:1.59.12.5 pgoyette-compat-20190127:1.65 pgoyette-compat-20190118:1.65 pgoyette-compat-1226:1.65 pgoyette-compat-1126:1.64 pgoyette-compat-1020:1.63 pgoyette-compat-0930:1.63 pgoyette-compat-0906:1.63 netbsd-7-2-RELEASE:1.47 pgoyette-compat-0728:1.63 netbsd-8-0-RELEASE:1.59 phil-wifi:1.63.0.2 phil-wifi-base:1.63 pgoyette-compat-0625:1.62 netbsd-8-0-RC2:1.59 pgoyette-compat-0521:1.62 pgoyette-compat-0502:1.60 pgoyette-compat-0422:1.59 netbsd-8-0-RC1:1.59 pgoyette-compat-0415:1.59 pgoyette-compat-0407:1.59 pgoyette-compat-0330:1.59 pgoyette-compat-0322:1.59 pgoyette-compat-0315:1.59 netbsd-7-1-2-RELEASE:1.47 pgoyette-compat:1.59.0.12 pgoyette-compat-base:1.59 netbsd-7-1-1-RELEASE:1.47 tls-maxphys-base-20171202:1.59 matt-nb8-mediatek:1.59.0.10 matt-nb8-mediatek-base:1.59 nick-nhusb-base-20170825:1.59 perseant-stdc-iso10646:1.59.0.8 perseant-stdc-iso10646-base:1.59 netbsd-8:1.59.0.6 netbsd-8-base:1.59 prg-localcount2-base3:1.59 prg-localcount2-base2:1.59 prg-localcount2-base1:1.59 prg-localcount2:1.59.0.4 prg-localcount2-base:1.59 pgoyette-localcount-20170426:1.59 bouyer-socketcan-base1:1.59 jdolecek-ncq:1.59.0.2 jdolecek-ncq-base:1.59 pgoyette-localcount-20170320:1.59 netbsd-7-1:1.47.0.8 netbsd-7-1-RELEASE:1.47 netbsd-7-1-RC2:1.47 nick-nhusb-base-20170204:1.58 netbsd-7-nhusb-base-20170116:1.47 bouyer-socketcan:1.58.0.2 bouyer-socketcan-base:1.58 pgoyette-localcount-20170107:1.58 netbsd-7-1-RC1:1.47 nick-nhusb-base-20161204:1.58 pgoyette-localcount-20161104:1.58 netbsd-7-0-2-RELEASE:1.47 nick-nhusb-base-20161004:1.58 localcount-20160914:1.57 netbsd-7-nhusb:1.47.0.6 netbsd-7-nhusb-base:1.47 pgoyette-localcount-20160806:1.56 pgoyette-localcount-20160726:1.56 pgoyette-localcount:1.56.0.2 pgoyette-localcount-base:1.56 nick-nhusb-base-20160907:1.56 nick-nhusb-base-20160529:1.55 netbsd-7-0-1-RELEASE:1.47 nick-nhusb-base-20160422:1.53 nick-nhusb-base-20160319:1.51 nick-nhusb-base-20151226:1.51 netbsd-7-0:1.47.0.4 netbsd-7-0-RELEASE:1.47 nick-nhusb-base-20150921:1.50 netbsd-7-0-RC3:1.47 netbsd-7-0-RC2:1.47 netbsd-7-0-RC1:1.47 nick-nhusb-base-20150606:1.49 nick-nhusb-base-20150406:1.48 nick-nhusb:1.48.0.2 nick-nhusb-base:1.48 netbsd-5-2-3-RELEASE:1.40 netbsd-5-1-5-RELEASE:1.40 netbsd-6-0-6-RELEASE:1.45 netbsd-6-1-5-RELEASE:1.45 netbsd-7:1.47.0.2 netbsd-7-base:1.47 yamt-pagecache-base9:1.45 yamt-pagecache-tag8:1.45 netbsd-6-1-4-RELEASE:1.45 netbsd-6-0-5-RELEASE:1.45 tls-earlyentropy:1.45.0.32 tls-earlyentropy-base:1.47 riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.45 riastradh-drm2-base3:1.45 netbsd-6-1-3-RELEASE:1.45 netbsd-6-0-4-RELEASE:1.45 netbsd-5-2-2-RELEASE:1.40 netbsd-5-1-4-RELEASE:1.40 netbsd-6-1-2-RELEASE:1.45 netbsd-6-0-3-RELEASE:1.45 netbsd-5-2-1-RELEASE:1.40 netbsd-5-1-3-RELEASE:1.40 rmind-smpnet-nbase:1.46 netbsd-6-1-1-RELEASE:1.45 riastradh-drm2-base2:1.45 riastradh-drm2-base1:1.45 riastradh-drm2:1.45.0.30 riastradh-drm2-base:1.45 rmind-smpnet:1.45.0.22 rmind-smpnet-base:1.46 netbsd-6-1:1.45.0.28 netbsd-6-0-2-RELEASE:1.45 netbsd-6-1-RELEASE:1.45 khorben-n900:1.45.0.26 netbsd-6-1-RC4:1.45 netbsd-6-1-RC3:1.45 agc-symver:1.45.0.24 agc-symver-base:1.45 netbsd-6-1-RC2:1.45 netbsd-6-1-RC1:1.45 yamt-pagecache-base8:1.45 netbsd-5-2:1.40.0.20 netbsd-6-0-1-RELEASE:1.45 yamt-pagecache-base7:1.45 netbsd-5-2-RELEASE:1.40 netbsd-5-2-RC1:1.40 matt-nb6-plus-nbase:1.45 yamt-pagecache-base6:1.45 netbsd-6-0:1.45.0.20 netbsd-6-0-RELEASE:1.45 netbsd-6-0-RC2:1.45 tls-maxphys:1.45.0.18 tls-maxphys-base:1.47 matt-nb6-plus:1.45.0.16 matt-nb6-plus-base:1.45 netbsd-6-0-RC1:1.45 jmcneill-usbmp-base10:1.45 yamt-pagecache-base5:1.45 jmcneill-usbmp-base9:1.45 yamt-pagecache-base4:1.45 jmcneill-usbmp-base8:1.45 jmcneill-usbmp-base7:1.45 jmcneill-usbmp-base6:1.45 jmcneill-usbmp-base5:1.45 jmcneill-usbmp-base4:1.45 jmcneill-usbmp-base3:1.45 jmcneill-usbmp-pre-base2:1.45 jmcneill-usbmp-base2:1.45 netbsd-6:1.45.0.14 netbsd-6-base:1.45 netbsd-5-1-2-RELEASE:1.40 netbsd-5-1-1-RELEASE:1.40 jmcneill-usbmp:1.45.0.12 jmcneill-usbmp-base:1.45 jmcneill-audiomp3:1.45.0.10 jmcneill-audiomp3-base:1.45 yamt-pagecache-base3:1.45 yamt-pagecache-base2:1.45 yamt-pagecache:1.45.0.8 yamt-pagecache-base:1.45 rmind-uvmplock-nbase:1.45 cherry-xenmp:1.45.0.6 cherry-xenmp-base:1.45 bouyer-quota2-nbase:1.45 bouyer-quota2:1.45.0.4 bouyer-quota2-base:1.45 jruoho-x86intr:1.45.0.2 jruoho-x86intr-base:1.45 matt-mips64-premerge-20101231:1.45 matt-nb5-mips64-premerge-20101231:1.40 matt-nb5-pq3:1.40.0.18 matt-nb5-pq3-base:1.40 netbsd-5-1:1.40.0.16 netbsd-5-1-RELEASE:1.40 uebayasi-xip-base4:1.45 uebayasi-xip-base3:1.45 yamt-nfs-mp-base11:1.45 netbsd-5-1-RC4:1.40 matt-nb5-mips64-k15:1.40 uebayasi-xip-base2:1.45 yamt-nfs-mp-base10:1.45 netbsd-5-1-RC3:1.40 netbsd-5-1-RC2:1.40 uebayasi-xip-base1:1.45 netbsd-5-1-RC1:1.40 rmind-uvmplock:1.42.0.4 rmind-uvmplock-base:1.45 yamt-nfs-mp-base9:1.42 uebayasi-xip:1.42.0.2 uebayasi-xip-base:1.42 netbsd-5-0-2-RELEASE:1.40 matt-nb5-mips64-premerge-20091211:1.40 matt-premerge-20091211:1.41 yamt-nfs-mp-base8:1.41 matt-nb5-mips64-u2-k2-k4-k7-k8-k9:1.40 matt-nb4-mips64-k7-u2a-k9b:1.40 matt-nb5-mips64-u1-k1-k5:1.40 yamt-nfs-mp-base7:1.41 matt-nb5-mips64:1.40.0.14 netbsd-5-0-1-RELEASE:1.40 jymxensuspend-base:1.41 yamt-nfs-mp-base6:1.41 yamt-nfs-mp-base5:1.41 yamt-nfs-mp-base4:1.41 jym-xensuspend-nbase:1.41 yamt-nfs-mp-base3:1.41 nick-hppapmap-base4:1.41 nick-hppapmap-base3:1.41 netbsd-5-0:1.40.0.12 netbsd-5-0-RELEASE:1.40 netbsd-5-0-RC4:1.40 netbsd-5-0-RC3:1.40 nick-hppapmap-base2:1.41 netbsd-5-0-RC2:1.40 jym-xensuspend:1.41.0.4 jym-xensuspend-base:1.41 netbsd-5-0-RC1:1.40 haad-dm-base2:1.41 haad-nbase2:1.41 ad-audiomp2:1.41.0.2 ad-audiomp2-base:1.41 netbsd-5:1.40.0.10 netbsd-5-base:1.40 nick-hppapmap:1.40.0.8 nick-hppapmap-base:1.41 matt-mips64-base2:1.40 matt-mips64:1.34.0.16 haad-dm-base1:1.40 wrstuden-revivesa-base-4:1.40 netbsd-4-0-1-RELEASE:1.32 wrstuden-revivesa-base-3:1.40 wrstuden-revivesa-base-2:1.40 wrstuden-fixsa-newbase:1.32 nick-csl-alignment-base5:1.36 haad-dm:1.40.0.6 haad-dm-base:1.41 wrstuden-revivesa-base-1:1.40 simonb-wapbl-nbase:1.40 yamt-pf42-base4:1.40 simonb-wapbl:1.40.0.4 simonb-wapbl-base:1.40 yamt-pf42-base3:1.40 hpcarm-cleanup-nbase:1.40 yamt-pf42-baseX:1.39 yamt-pf42-base2:1.40 yamt-nfs-mp-base2:1.40 wrstuden-revivesa:1.40.0.2 wrstuden-revivesa-base:1.40 yamt-nfs-mp:1.39.0.10 yamt-nfs-mp-base:1.39 yamt-pf42:1.39.0.8 yamt-pf42-base:1.39 ad-socklock-base1:1.39 yamt-lazymbuf-base15:1.39 yamt-lazymbuf-base14:1.39 keiichi-mipv6-nbase:1.39 mjf-devfs2:1.39.0.6 mjf-devfs2-base:1.41 nick-net80211-sync:1.39.0.4 nick-net80211-sync-base:1.39 keiichi-mipv6:1.39.0.2 keiichi-mipv6-base:1.39 bouyer-xeni386-merge1:1.36.12.1 matt-armv6-prevmlocking:1.35.2.1 wrstuden-fixsa-base-1:1.32 vmlocking2-base3:1.37 netbsd-4-0:1.32.0.18 netbsd-4-0-RELEASE:1.32 bouyer-xeni386-nbase:1.37 yamt-kmem-base3:1.36 cube-autoconf:1.36.0.14 cube-autoconf-base:1.36 yamt-kmem-base2:1.36 bouyer-xeni386:1.36.0.12 bouyer-xeni386-base:1.37 yamt-kmem:1.36.0.10 yamt-kmem-base:1.36 vmlocking2-base2:1.36 reinoud-bufcleanup-nbase:1.36 vmlocking2:1.36.0.8 vmlocking2-base1:1.36 netbsd-4-0-RC5:1.32 matt-nb4-arm:1.32.0.16 matt-nb4-arm-base:1.32 matt-armv6-nbase:1.39 jmcneill-base:1.36 netbsd-4-0-RC4:1.32 mjf-devfs:1.36.0.6 mjf-devfs-base:1.38 bouyer-xenamd64-base2:1.36 vmlocking-nbase:1.36 yamt-x86pmap-base4:1.36 bouyer-xenamd64:1.36.0.4 bouyer-xenamd64-base:1.36 netbsd-4-0-RC3:1.32 yamt-x86pmap-base3:1.36 yamt-x86pmap-base2:1.36 netbsd-4-0-RC2:1.32 yamt-x86pmap:1.36.0.2 yamt-x86pmap-base:1.36 netbsd-4-0-RC1:1.32 matt-armv6:1.35.0.2 matt-armv6-base:1.37 matt-mips64-base:1.34 jmcneill-pm:1.34.0.14 jmcneill-pm-base:1.36 hpcarm-cleanup:1.34.0.12 hpcarm-cleanup-base:1.39 nick-csl-alignment:1.34.0.10 nick-csl-alignment-base:1.34 netbsd-3-1-1-RELEASE:1.28 netbsd-3-0-3-RELEASE:1.28 yamt-idlelwp-base8:1.34 wrstuden-fixsa:1.32.0.14 wrstuden-fixsa-base:1.32 thorpej-atomic:1.34.0.8 thorpej-atomic-base:1.34 reinoud-bufcleanup:1.34.0.6 reinoud-bufcleanup-base:1.36 mjf-ufs-trans:1.34.0.4 mjf-ufs-trans-base:1.34 vmlocking:1.34.0.2 vmlocking-base:1.36 ad-audiomp:1.33.0.2 ad-audiomp-base:1.33 yamt-idlelwp:1.32.0.12 post-newlock2-merge:1.32 newlock2-nbase:1.32 yamt-splraiseipl-base5:1.32 yamt-splraiseipl-base4:1.32 yamt-splraiseipl-base3:1.32 abandoned-netbsd-4-base:1.32 abandoned-netbsd-4:1.32.0.4 netbsd-3-1:1.28.0.14 netbsd-3-1-RELEASE:1.28 netbsd-3-0-2-RELEASE:1.28 yamt-splraiseipl-base2:1.32 netbsd-3-1-RC4:1.28 yamt-splraiseipl:1.32.0.8 yamt-splraiseipl-base:1.32 netbsd-3-1-RC3:1.28 yamt-pdpolicy-base9:1.32 newlock2:1.32.0.6 newlock2-base:1.32 yamt-pdpolicy-base8:1.32 netbsd-3-1-RC2:1.28 netbsd-3-1-RC1:1.28 yamt-pdpolicy-base7:1.32 netbsd-4:1.32.0.10 netbsd-4-base:1.32 yamt-pdpolicy-base6:1.32 chap-midi-nbase:1.32 netbsd-3-0-1-RELEASE:1.28 gdamore-uart:1.32.0.2 gdamore-uart-base:1.32 simonb-timcounters-final:1.31.6.1 yamt-pdpolicy-base5:1.31 chap-midi:1.31.0.14 chap-midi-base:1.32 yamt-pdpolicy-base4:1.31 yamt-pdpolicy-base3:1.31 peter-altq-base:1.31 peter-altq:1.31.0.12 yamt-pdpolicy-base2:1.31 elad-kernelauth-base:1.31 elad-kernelauth:1.31.0.10 yamt-pdpolicy:1.31.0.8 yamt-pdpolicy-base:1.31 yamt-uio_vmspace-base5:1.31 simonb-timecounters:1.31.0.6 simonb-timecounters-base:1.31 rpaulo-netinet-merge-pcb:1.31.0.4 rpaulo-netinet-merge-pcb-base:1.32 yamt-uio_vmspace:1.31.0.2 netbsd-3-0:1.28.0.12 netbsd-3-0-RELEASE:1.28 netbsd-3-0-RC6:1.28 yamt-readahead-base3:1.30 netbsd-3-0-RC5:1.28 netbsd-3-0-RC4:1.28 netbsd-3-0-RC3:1.28 yamt-readahead-base2:1.30 netbsd-3-0-RC2:1.28 yamt-readahead-pervnode:1.30 yamt-readahead-perfile:1.30 yamt-readahead:1.30.0.6 yamt-readahead-base:1.30 netbsd-3-0-RC1:1.28 yamt-vop-base3:1.30 netbsd-2-0-3-RELEASE:1.25 netbsd-2-1:1.25.0.6 yamt-vop-base2:1.30 thorpej-vnode-attr:1.30.0.4 thorpej-vnode-attr-base:1.30 netbsd-2-1-RELEASE:1.25 yamt-vop:1.30.0.2 yamt-vop-base:1.30 netbsd-2-1-RC6:1.25 netbsd-2-1-RC5:1.25 netbsd-2-1-RC4:1.25 netbsd-2-1-RC3:1.25 netbsd-2-1-RC2:1.25 netbsd-2-1-RC1:1.25 yamt-lazymbuf:1.28.0.10 yamt-km-base4:1.28 netbsd-2-0-2-RELEASE:1.25 yamt-km-base3:1.28 netbsd-3:1.28.0.8 netbsd-3-base:1.28 yamt-km-base2:1.28 yamt-km:1.28.0.4 yamt-km-base:1.28 kent-audio2:1.28.0.2 kent-audio2-base:1.28 netbsd-2-0-1-RELEASE:1.25 kent-audio1-beforemerge:1.28 netbsd-2:1.25.0.4 netbsd-2-base:1.25 kent-audio1:1.27.0.2 kent-audio1-base:1.27 netbsd-2-0-RELEASE:1.25 netbsd-2-0-RC5:1.25 netbsd-2-0-RC4:1.25 netbsd-2-0-RC3:1.25 netbsd-2-0-RC2:1.25 netbsd-2-0-RC1:1.25 netbsd-2-0:1.25.0.2 netbsd-2-0-base:1.25 netbsd-1-6-PATCH002-RELEASE:1.15.2.1 netbsd-1-6-PATCH002:1.15.2.1 netbsd-1-6-PATCH002-RC4:1.15.2.1 netbsd-1-6-PATCH002-RC3:1.15.2.1 netbsd-1-6-PATCH002-RC2:1.15.2.1 netbsd-1-6-PATCH002-RC1:1.15.2.1 ktrace-lwp:1.23.0.2 ktrace-lwp-base:1.30 netbsd-1-6-PATCH001:1.15 netbsd-1-6-PATCH001-RELEASE:1.15 netbsd-1-6-PATCH001-RC3:1.15 netbsd-1-6-PATCH001-RC2:1.15 netbsd-1-6-PATCH001-RC1:1.15 nathanw_sa_end:1.9.2.7 nathanw_sa_before_merge:1.19 fvdl_fs64_base:1.19 gmcgarry_ctxsw:1.19.0.4 gmcgarry_ctxsw_base:1.19 gmcgarry_ucred:1.19.0.2 gmcgarry_ucred_base:1.19 nathanw_sa_base:1.19 kqueue-aftermerge:1.19 kqueue-beforemerge:1.19 netbsd-1-6-RELEASE:1.15 netbsd-1-6-RC3:1.15 netbsd-1-6-RC2:1.15 netbsd-1-6-RC1:1.15 netbsd-1-6:1.15.0.2 netbsd-1-6-base:1.15 gehenna-devsw:1.14.0.6 gehenna-devsw-base:1.18 eeh-devprop:1.14.0.4 eeh-devprop-base:1.14 newlock:1.14.0.2 newlock-base:1.14 ifpoll-base:1.13 thorpej-mips-cache:1.11.0.6 thorpej-mips-cache-base:1.11 thorpej-devvp-base3:1.11 thorpej-devvp-base2:1.11 post-chs-ubcperf:1.11 pre-chs-ubcperf:1.11 thorpej-devvp:1.11.0.4 thorpej-devvp-base:1.11 kqueue:1.11.0.2 kqueue-base:1.19 thorpej_scsipi_beforemerge:1.10 nathanw_sa:1.9.0.2 thorpej_scsipi_nbase:1.10 thorpej_scsipi_base:1.10 thorpej_scsipi:1.3.0.2; locks; strict; comment @ * @; 1.69 date 2022.09.03.02.47.59; author thorpej; state Exp; branches 1.69.8.1; next 1.68; commitid tQS7Hn7Gj3DaymSD; 1.68 date 2022.09.03.01.35.03; author thorpej; state Exp; branches; next 1.67; commitid cDcDpMNIDY7j7mSD; 1.67 date 2021.12.31.14.25.24; author riastradh; state Exp; branches; next 1.66; commitid pSbL4uKcr98HjOmD; 1.66 date 2020.08.28.06.23.42; author ozaki-r; state Exp; branches; next 1.65; commitid aHSCLYZY8YMZoNlC; 1.65 date 2018.12.22.14.28.56; author maxv; state Exp; branches; next 1.64; commitid P2Wftsd3Dyw1RN4B; 1.64 date 2018.11.15.10.23.56; author maxv; state Exp; branches; next 1.63; commitid EmBrfAURyVNDG10B; 1.63 date 2018.06.26.06.48.02; author msaitoh; state Exp; branches 1.63.2.1; next 1.62; commitid BGd0EgCdw1Br3LHA; 1.62 date 2018.05.09.06.35.10; author maxv; state Exp; branches; next 1.61; commitid IDukge6Bh5UQwABA; 1.61 date 2018.05.07.09.51.02; author maxv; state Exp; branches; next 1.60; commitid WstNrrX92Dp7GlBA; 1.60 date 2018.04.26.19.56.55; author maxv; state Exp; branches; next 1.59; commitid YiS80aABZadPnZzA; 1.59 date 2017.02.14.03.05.06; author ozaki-r; state Exp; branches 1.59.12.1; next 1.58; 1.58 date 2016.10.03.11.06.06; author ozaki-r; state Exp; branches 1.58.2.1; next 1.57; 1.57 date 2016.08.15.09.14.12; author maxv; state Exp; branches; next 1.56; 1.56 date 2016.06.22.10.44.32; author knakahara; state Exp; branches 1.56.2.1; next 1.55; 1.55 date 2016.04.28.01.37.17; author knakahara; state Exp; branches; next 1.54; 1.54 date 2016.04.28.00.16.56; author ozaki-r; state Exp; branches; next 1.53; 1.53 date 2016.04.20.09.01.04; author knakahara; state Exp; branches; next 1.52; 1.52 date 2016.04.07.03.22.15; author christos; state Exp; branches; next 1.51; 1.51 date 2015.10.13.12.33.07; author roy; state Exp; branches; next 1.50; 1.50 date 2015.08.24.22.21.26; author pooka; state Exp; branches; next 1.49; 1.49 date 2015.06.04.09.19.59; author ozaki-r; state Exp; branches; next 1.48; 1.48 date 2014.11.28.08.29.00; author ozaki-r; state Exp; branches 1.48.2.1; next 1.47; 1.47 date 2014.06.05.23.48.16; author rmind; state Exp; branches; next 1.46; 1.46 date 2014.05.15.09.04.03; author msaitoh; state Exp; branches; next 1.45; 1.45 date 2010.04.05.07.22.23; author joerg; state Exp; branches 1.45.18.1 1.45.22.1 1.45.32.1; next 1.44; 1.44 date 2010.03.31.12.17.01; author pgoyette; state Exp; branches; next 1.43; 1.43 date 2010.03.29.03.05.27; author kiyohara; state Exp; branches; next 1.42; 1.42 date 2010.01.19.22.08.01; author pooka; state Exp; branches 1.42.2.1 1.42.4.1; next 1.41; 1.41 date 2008.11.07.00.20.13; author dyoung; state Exp; branches; next 1.40; 1.40 date 2008.04.28.20.24.09; author martin; state Exp; branches 1.40.6.1 1.40.8.1; next 1.39; 1.39 date 2008.02.20.17.05.53; author matt; state Exp; branches 1.39.6.1 1.39.8.1 1.39.10.1; next 1.38; 1.38 date 2008.02.07.01.22.00; author dyoung; state Exp; branches; next 1.37; 1.37 date 2007.12.20.21.08.22; author dyoung; state Exp; branches; next 1.36; 1.36 date 2007.08.30.02.17.35; author dyoung; state Exp; branches 1.36.6.1 1.36.8.1 1.36.12.1; next 1.35; 1.35 date 2007.08.26.22.59.08; author dyoung; state Exp; branches 1.35.2.1; next 1.34; 1.34 date 2007.03.04.06.03.16; author christos; state Exp; branches 1.34.2.1 1.34.10.1 1.34.14.1; next 1.33; 1.33 date 2007.02.17.22.34.08; author dyoung; state Exp; branches; next 1.32; 1.32 date 2006.06.07.22.33.42; author kardel; state Exp; branches 1.32.12.1; next 1.31; 1.31 date 2005.12.11.12.24.51; author christos; state Exp; branches 1.31.4.1 1.31.6.1 1.31.8.1 1.31.14.1; next 1.30; 1.30 date 2005.08.06.14.09.54; author kiyohara; state Exp; branches; next 1.29; 1.29 date 2005.07.11.15.37.05; author kiyohara; state Exp; branches; next 1.28; 1.28 date 2005.01.08.03.18.18; author yamt; state Exp; branches 1.28.10.1; next 1.27; 1.27 date 2004.08.20.07.46.21; author tron; state Exp; branches; next 1.26; 1.26 date 2004.08.19.20.58.24; author christos; state Exp; branches; next 1.25; 1.25 date 2003.10.26.19.09.44; author christos; state Exp; branches; next 1.24; 1.24 date 2003.10.03.20.56.11; author itojun; state Exp; branches; next 1.23; 1.23 date 2003.05.23.10.06.18; author itojun; state Exp; branches 1.23.2.1; next 1.22; 1.22 date 2003.05.06.09.59.35; author enami; state Exp; branches; next 1.21; 1.21 date 2003.05.01.07.52.58; author itojun; state Exp; branches; next 1.20; 1.20 date 2003.05.01.07.41.59; author itojun; state Exp; branches; next 1.19; 1.19 date 2002.09.26.13.06.56; author onoe; state Exp; branches; next 1.18; 1.18 date 2002.06.25.03.42.28; author onoe; state Exp; branches; next 1.17; 1.17 date 2002.06.24.12.00.49; author enami; state Exp; branches; next 1.16; 1.16 date 2002.06.24.08.06.22; author itojun; state Exp; branches; next 1.15; 1.15 date 2002.05.16.09.08.33; author haya; state Exp; branches 1.15.2.1; next 1.14; 1.14 date 2002.03.05.04.13.01; author itojun; state Exp; branches 1.14.6.1; next 1.13; 1.13 date 2001.11.15.09.48.25; author lukem; state Exp; branches; next 1.12; 1.12 date 2001.11.12.23.49.39; author lukem; state Exp; branches; next 1.11; 1.11 date 2001.06.14.05.44.24; author itojun; state Exp; branches 1.11.2.1; next 1.10; 1.10 date 2001.04.13.23.30.14; author thorpej; state Exp; branches; next 1.9; 1.9 date 2001.01.17.19.08.59; author thorpej; state Exp; branches 1.9.2.1; next 1.8; 1.8 date 2001.01.17.18.44.14; author jdolecek; state Exp; branches; next 1.7; 1.7 date 2001.01.17.00.30.51; author thorpej; state Exp; branches; next 1.6; 1.6 date 2000.12.18.19.44.34; author thorpej; state Exp; branches; next 1.5; 1.5 date 2000.12.13.22.07.51; author thorpej; state Exp; branches; next 1.4; 1.4 date 2000.12.12.18.00.27; author thorpej; state Exp; branches; next 1.3; 1.3 date 2000.11.20.12.12.19; author onoe; state Exp; branches 1.3.2.1; next 1.2; 1.2 date 2000.11.14.11.14.56; author onoe; state Exp; branches; next 1.1; 1.1 date 2000.11.05.17.17.15; author onoe; state Exp; branches; next ; 1.69.8.1 date 2023.11.16.04.30.22; author thorpej; state Exp; branches; next 1.69.8.2; commitid jPOkwjTSslkk0NME; 1.69.8.2 date 2023.11.16.05.13.13; author thorpej; state Exp; branches; next ; commitid fYoTOgHKk1lJeNME; 1.63.2.1 date 2019.06.10.22.09.45; author christos; state Exp; branches; next ; commitid jtc8rnCzWiEEHGqB; 1.59.12.1 date 2018.05.02.07.20.22; author pgoyette; state Exp; branches; next 1.59.12.2; commitid o3kRuNRzl9360HAA; 1.59.12.2 date 2018.05.21.04.36.15; author pgoyette; state Exp; branches; next 1.59.12.3; commitid X5L8kSrBWQcDt7DA; 1.59.12.3 date 2018.07.28.04.38.10; author pgoyette; state Exp; branches; next 1.59.12.4; commitid 1UP1xAIUxv1ZgRLA; 1.59.12.4 date 2018.11.26.01.52.50; author pgoyette; state Exp; branches; next 1.59.12.5; commitid Zj4q5SspGdKXto1B; 1.59.12.5 date 2018.12.26.14.02.04; author pgoyette; state Exp; branches; next ; commitid xUhK8IAeBM1azj5B; 1.58.2.1 date 2017.04.21.16.54.05; author bouyer; state Exp; branches; next ; 1.56.2.1 date 2016.11.04.14.49.20; author pgoyette; state Exp; branches; next 1.56.2.2; 1.56.2.2 date 2017.03.20.06.57.49; author pgoyette; state Exp; branches; next ; 1.48.2.1 date 2015.06.06.14.40.25; author skrll; state Exp; branches; next 1.48.2.2; 1.48.2.2 date 2015.09.22.12.06.10; author skrll; state Exp; branches; next 1.48.2.3; 1.48.2.3 date 2015.12.27.12.10.06; author skrll; state Exp; branches; next 1.48.2.4; 1.48.2.4 date 2016.04.22.15.44.17; author skrll; state Exp; branches; next 1.48.2.5; 1.48.2.5 date 2016.05.29.08.44.38; author skrll; state Exp; branches; next 1.48.2.6; 1.48.2.6 date 2016.07.09.20.25.21; author skrll; state Exp; branches; next 1.48.2.7; 1.48.2.7 date 2016.10.05.20.56.08; author skrll; state Exp; branches; next 1.48.2.8; 1.48.2.8 date 2017.08.28.17.53.11; author skrll; state Exp; branches; next ; commitid UQQpnjvcNkUZn05A; 1.45.18.1 date 2014.08.20.00.04.34; author tls; state Exp; branches; next 1.45.18.2; 1.45.18.2 date 2017.12.03.11.39.02; author jdolecek; state Exp; branches; next ; commitid XcIYRZTAh1LmerhA; 1.45.22.1 date 2014.05.18.17.46.12; author rmind; state Exp; branches; next ; 1.45.32.1 date 2014.08.10.06.56.15; author tls; state Exp; branches; next ; 1.42.2.1 date 2010.04.30.14.44.19; author uebayasi; state Exp; branches; next ; 1.42.4.1 date 2010.05.30.05.18.01; author rmind; state Exp; branches; next ; 1.40.6.1 date 2008.12.13.01.15.25; author haad; state Exp; branches; next ; 1.40.8.1 date 2009.01.19.13.20.11; author skrll; state Exp; branches; next ; 1.39.6.1 date 2008.06.02.13.24.22; author mjf; state Exp; branches; next 1.39.6.2; 1.39.6.2 date 2009.01.17.13.29.31; author mjf; state Exp; branches; next ; 1.39.8.1 date 2008.05.18.12.35.27; author yamt; state Exp; branches; next ; 1.39.10.1 date 2008.05.16.02.25.40; author yamt; state Exp; branches; next 1.39.10.2; 1.39.10.2 date 2009.05.04.08.14.15; author yamt; state Exp; branches; next 1.39.10.3; 1.39.10.3 date 2010.03.11.15.04.27; author yamt; state Exp; branches; next 1.39.10.4; 1.39.10.4 date 2010.08.11.22.54.54; author yamt; state Exp; branches; next ; 1.36.6.1 date 2008.02.18.21.07.01; author mjf; state Exp; branches; next ; 1.36.8.1 date 2007.12.26.19.57.32; author ad; state Exp; branches; next ; 1.36.12.1 date 2008.01.02.21.57.07; author bouyer; state Exp; branches; next ; 1.35.2.1 date 2007.11.06.23.33.32; author matt; state Exp; branches; next 1.35.2.2; 1.35.2.2 date 2008.01.09.01.57.11; author matt; state Exp; branches; next 1.35.2.3; 1.35.2.3 date 2008.03.23.02.05.05; author matt; state Exp; branches; next ; 1.34.2.1 date 2007.10.09.13.44.41; author ad; state Exp; branches; next ; 1.34.10.1 date 2007.09.03.10.23.10; author skrll; state Exp; branches; next ; 1.34.14.1 date 2007.09.03.16.48.56; author jmcneill; state Exp; branches; next ; 1.32.12.1 date 2007.02.27.16.54.43; author yamt; state Exp; branches; next 1.32.12.2; 1.32.12.2 date 2007.03.12.05.59.12; author rmind; state Exp; branches; next ; 1.31.4.1 date 2006.09.09.02.58.06; author rpaulo; state Exp; branches; next ; 1.31.6.1 date 2006.02.04.14.18.52; author simonb; state Exp; branches; next ; 1.31.8.1 date 2006.06.26.12.53.38; author yamt; state Exp; branches; next ; 1.31.14.1 date 2006.06.19.04.09.12; author chap; state Exp; branches; next ; 1.28.10.1 date 2006.06.21.15.10.27; author yamt; state Exp; branches; next 1.28.10.2; 1.28.10.2 date 2007.02.26.09.11.34; author yamt; state Exp; branches; next 1.28.10.3; 1.28.10.3 date 2007.09.03.14.42.08; author yamt; state Exp; branches; next 1.28.10.4; 1.28.10.4 date 2008.01.21.09.47.04; author yamt; state Exp; branches; next 1.28.10.5; 1.28.10.5 date 2008.02.11.14.59.59; author yamt; state Exp; branches; next 1.28.10.6; 1.28.10.6 date 2008.02.27.08.37.00; author yamt; state Exp; branches; next ; 1.23.2.1 date 2004.08.03.10.54.14; author skrll; state Exp; branches; next 1.23.2.2; 1.23.2.2 date 2004.08.25.06.58.59; author skrll; state Exp; branches; next 1.23.2.3; 1.23.2.3 date 2004.09.18.14.54.16; author skrll; state Exp; branches; next 1.23.2.4; 1.23.2.4 date 2004.09.21.13.36.38; author skrll; state Exp; branches; next 1.23.2.5; 1.23.2.5 date 2005.01.17.19.32.38; author skrll; state Exp; branches; next 1.23.2.6; 1.23.2.6 date 2005.11.10.14.10.32; author skrll; state Exp; branches; next ; 1.15.2.1 date 2003.06.24.08.17.57; author grant; state Exp; branches; next ; 1.14.6.1 date 2002.05.30.13.52.25; author gehenna; state Exp; branches; next 1.14.6.2; 1.14.6.2 date 2002.07.15.10.36.48; author gehenna; state Exp; branches; next ; 1.11.2.1 date 2002.01.10.20.02.06; author thorpej; state Exp; branches; next 1.11.2.2; 1.11.2.2 date 2002.03.16.16.02.05; author jdolecek; state Exp; branches; next 1.11.2.3; 1.11.2.3 date 2002.06.23.17.50.25; author jdolecek; state Exp; branches; next 1.11.2.4; 1.11.2.4 date 2002.09.06.08.48.52; author jdolecek; state Exp; branches; next 1.11.2.5; 1.11.2.5 date 2002.10.10.18.43.42; author jdolecek; state Exp; branches; next ; 1.9.2.1 date 2001.06.21.20.08.05; author nathanw; state Exp; branches; next 1.9.2.2; 1.9.2.2 date 2001.11.14.19.17.22; author nathanw; state Exp; branches; next 1.9.2.3; 1.9.2.3 date 2002.01.08.00.33.52; author nathanw; state Exp; branches; next 1.9.2.4; 1.9.2.4 date 2002.04.01.07.48.21; author nathanw; state Exp; branches; next 1.9.2.5; 1.9.2.5 date 2002.06.20.03.48.15; author nathanw; state Exp; branches; next 1.9.2.6; 1.9.2.6 date 2002.08.01.02.46.38; author nathanw; state Exp; branches; next 1.9.2.7; 1.9.2.7 date 2002.10.18.02.45.10; author nathanw; state Exp; branches; next ; 1.3.2.1 date 2000.11.20.12.12.19; author bouyer; state dead; branches; next 1.3.2.2; 1.3.2.2 date 2000.11.22.16.05.53; author bouyer; state Exp; branches; next 1.3.2.3; 1.3.2.3 date 2000.12.13.15.50.31; author bouyer; state Exp; branches; next 1.3.2.4; 1.3.2.4 date 2001.01.05.17.36.51; author bouyer; state Exp; branches; next 1.3.2.5; 1.3.2.5 date 2001.01.18.09.23.51; author bouyer; state Exp; branches; next 1.3.2.6; 1.3.2.6 date 2001.02.11.19.17.09; author bouyer; state Exp; branches; next 1.3.2.7; 1.3.2.7 date 2001.04.21.17.46.39; author bouyer; state Exp; branches; next ; desc @@ 1.69 log @Garbage-collect the remaining vestiges of netisr. @ text @/* $NetBSD: if_ieee1394subr.c,v 1.68 2022/09/03 01:35:03 thorpej Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Atsushi Onoe. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.68 2022/09/03 01:35:03 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef INET #include #include #include #endif /* INET */ #ifdef INET6 #include #include #include #endif /* INET6 */ #include #include #include #include #define IEEE1394_REASS_TIMEOUT 3 /* 3 sec */ #define senderr(e) do { error = (e); goto bad; } while(0/*CONSTCOND*/) static int ieee1394_output(struct ifnet *, struct mbuf *, const struct sockaddr *, const struct rtentry *); static struct mbuf *ieee1394_reass(struct ifnet *, struct mbuf *, uint16_t); static int ieee1394_output(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst, const struct rtentry *rt) { uint16_t etype = 0; struct mbuf *m; int hdrlen, error = 0; struct mbuf *mcopy = NULL; struct ieee1394_hwaddr *hwdst, baddr; const struct ieee1394_hwaddr *myaddr; #ifdef INET struct arphdr *ah; #endif /* INET */ struct m_tag *mtag; int unicast; if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) senderr(ENETDOWN); /* * If the queueing discipline needs packet classification, * do it before prepending link headers. */ IFQ_CLASSIFY(&ifp->if_snd, m0, dst->sa_family); /* * For unicast, we make a tag to store the lladdr of the * destination. This might not be the first time we have seen * the packet (for instance, the arp code might be trying to * re-send it after receiving an arp reply) so we only * allocate a tag if there isn't one there already. For * multicast, we will eventually use a different tag to store * the channel number. */ unicast = !(m0->m_flags & (M_BCAST | M_MCAST)); if (unicast) { mtag = m_tag_find(m0, MTAG_FIREWIRE_HWADDR); if (!mtag) { mtag = m_tag_get(MTAG_FIREWIRE_HWADDR, sizeof (struct ieee1394_hwaddr), M_NOWAIT); if (!mtag) { error = ENOMEM; goto bad; } m_tag_prepend(m0, mtag); } hwdst = (struct ieee1394_hwaddr *)(mtag + 1); } else { hwdst = &baddr; } switch (dst->sa_family) { #ifdef INET case AF_INET: if (unicast && (error = arpresolve(ifp, rt, m0, dst, hwdst, sizeof(*hwdst))) != 0) return error == EWOULDBLOCK ? 0 : error; /* if broadcasting on a simplex interface, loopback a copy */ if ((m0->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX)) mcopy = m_copypacket(m0, M_DONTWAIT); etype = htons(ETHERTYPE_IP); break; case AF_ARP: ah = mtod(m0, struct arphdr *); ah->ar_hrd = htons(ARPHRD_IEEE1394); etype = htons(ETHERTYPE_ARP); break; #endif /* INET */ #ifdef INET6 case AF_INET6: #if 0 /* * XXX This code was in nd6_storelladdr, which was replaced with * nd6_resolve, but it never be used because nd6_storelladdr was * called only if unicast. Should it be enabled? */ if (m0->m_flags & M_BCAST) memcpy(hwdst->iha_uid, ifp->if_broadcastaddr, MIN(IEEE1394_ADDR_LEN, ifp->if_addrlen)); #endif if (unicast) { error = nd6_resolve(ifp, rt, m0, dst, hwdst->iha_uid, IEEE1394_ADDR_LEN); if (error != 0) return error == EWOULDBLOCK ? 0 : error; } etype = htons(ETHERTYPE_IPV6); break; #endif /* INET6 */ case pseudo_AF_HDRCMPLT: case AF_UNSPEC: /* TODO? */ default: printf("%s: can't handle af%d\n", ifp->if_xname, dst->sa_family); senderr(EAFNOSUPPORT); break; } if (mcopy) looutput(ifp, mcopy, dst, rt); myaddr = (const struct ieee1394_hwaddr *)CLLADDR(ifp->if_sadl); if (ifp->if_bpf) { struct ieee1394_bpfhdr h; if (unicast) memcpy(h.ibh_dhost, hwdst->iha_uid, 8); else memcpy(h.ibh_dhost, ((const struct ieee1394_hwaddr *) ifp->if_broadcastaddr)->iha_uid, 8); memcpy(h.ibh_shost, myaddr->iha_uid, 8); h.ibh_type = etype; bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m0, BPF_D_OUT); } if ((ifp->if_flags & IFF_SIMPLEX) && unicast && memcmp(hwdst, myaddr, IEEE1394_ADDR_LEN) == 0) return looutput(ifp, m0, dst, rt); /* * XXX: * The maximum possible rate depends on the topology. * So the determination of maxrec and fragmentation should be * called from the driver after probing the topology map. */ if (unicast) { hdrlen = IEEE1394_GASP_LEN; hwdst->iha_speed = 0; /* XXX */ } else hdrlen = 0; if (hwdst->iha_speed > myaddr->iha_speed) hwdst->iha_speed = myaddr->iha_speed; if (hwdst->iha_maxrec > myaddr->iha_maxrec) hwdst->iha_maxrec = myaddr->iha_maxrec; if (hwdst->iha_maxrec > (8 + hwdst->iha_speed)) hwdst->iha_maxrec = 8 + hwdst->iha_speed; if (hwdst->iha_maxrec < 8) hwdst->iha_maxrec = 8; m0 = ieee1394_fragment(ifp, m0, (2<iha_maxrec) - hdrlen, etype); if (m0 == NULL) senderr(ENOBUFS); while ((m = m0) != NULL) { m0 = m->m_nextpkt; error = if_transmit_lock(ifp, m); if (error) { /* mbuf is already freed */ goto bad; } } return 0; bad: while (m0 != NULL) { m = m0->m_nextpkt; m_freem(m0); m0 = m; } return error; } struct mbuf * ieee1394_fragment(struct ifnet *ifp, struct mbuf *m0, int maxsize, uint16_t etype) { struct ieee1394com *ic = (struct ieee1394com *)ifp; int totlen, fraglen, off; struct mbuf *m, **mp; struct ieee1394_fraghdr *ifh; struct ieee1394_unfraghdr *iuh; totlen = m0->m_pkthdr.len; if (totlen + sizeof(struct ieee1394_unfraghdr) <= maxsize) { M_PREPEND(m0, sizeof(struct ieee1394_unfraghdr), M_DONTWAIT); if (m0 == NULL) goto bad; iuh = mtod(m0, struct ieee1394_unfraghdr *); iuh->iuh_ft = 0; iuh->iuh_etype = etype; return m0; } fraglen = maxsize - sizeof(struct ieee1394_fraghdr); M_PREPEND(m0, sizeof(struct ieee1394_fraghdr), M_DONTWAIT); if (m0 == NULL) goto bad; ifh = mtod(m0, struct ieee1394_fraghdr *); ifh->ifh_ft_size = htons(IEEE1394_FT_MORE | (totlen - 1)); ifh->ifh_etype_off = etype; ifh->ifh_dgl = htons(ic->ic_dgl); ifh->ifh_reserved = 0; off = fraglen; mp = &m0->m_nextpkt; while (off < totlen) { if (off + fraglen > totlen) fraglen = totlen - off; MGETHDR(m, M_DONTWAIT, MT_HEADER); if (m == NULL) goto bad; m->m_flags |= m0->m_flags & (M_BCAST|M_MCAST); /* copy bcast */ m_align(m, sizeof(struct ieee1394_fraghdr)); m->m_len = sizeof(struct ieee1394_fraghdr); ifh = mtod(m, struct ieee1394_fraghdr *); ifh->ifh_ft_size = htons(IEEE1394_FT_SUBSEQ | IEEE1394_FT_MORE | (totlen - 1)); ifh->ifh_etype_off = htons(off); ifh->ifh_dgl = htons(ic->ic_dgl); ifh->ifh_reserved = 0; m->m_next = m_copym(m0, sizeof(*ifh) + off, fraglen, M_DONTWAIT); if (m->m_next == NULL) { m_freem(m); goto bad; } m->m_pkthdr.len = sizeof(*ifh) + fraglen; off += fraglen; *mp = m; mp = &m->m_nextpkt; } ifh->ifh_ft_size &= ~htons(IEEE1394_FT_MORE); /* last fragment */ m_adj(m0, -(m0->m_pkthdr.len - maxsize)); ic->ic_dgl++; return m0; bad: while ((m = m0) != NULL) { m0 = m->m_nextpkt; m->m_nextpkt = NULL; m_freem(m); } return NULL; } void ieee1394_input(struct ifnet *ifp, struct mbuf *m, uint16_t src) { pktqueue_t *pktq = NULL; uint16_t etype; struct ieee1394_unfraghdr *iuh; if ((ifp->if_flags & IFF_UP) == 0) { m_freem(m); return; } if (m->m_len < sizeof(*iuh)) { if ((m = m_pullup(m, sizeof(*iuh))) == NULL) return; } iuh = mtod(m, struct ieee1394_unfraghdr *); if (ntohs(iuh->iuh_ft) & (IEEE1394_FT_SUBSEQ | IEEE1394_FT_MORE)) { if ((m = ieee1394_reass(ifp, m, src)) == NULL) return; iuh = mtod(m, struct ieee1394_unfraghdr *); } etype = ntohs(iuh->iuh_etype); /* strip off the ieee1394 header */ m_adj(m, sizeof(*iuh)); if (ifp->if_bpf) { struct ieee1394_bpfhdr h; struct m_tag *mtag; const struct ieee1394_hwaddr *myaddr; mtag = m_tag_find(m, MTAG_FIREWIRE_SENDER_EUID); if (mtag) memcpy(h.ibh_shost, mtag + 1, 8); else memset(h.ibh_shost, 0, 8); if (m->m_flags & M_BCAST) memcpy(h.ibh_dhost, ((const struct ieee1394_hwaddr *) ifp->if_broadcastaddr)->iha_uid, 8); else { myaddr = (const struct ieee1394_hwaddr *)CLLADDR(ifp->if_sadl); memcpy(h.ibh_dhost, myaddr->iha_uid, 8); } h.ibh_type = htons(etype); bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m, BPF_D_IN); } switch (etype) { #ifdef INET case ETHERTYPE_IP: pktq = ip_pktq; break; case ETHERTYPE_ARP: pktq = arp_pktq; break; #endif /* INET */ #ifdef INET6 case ETHERTYPE_IPV6: pktq = ip6_pktq; break; #endif /* INET6 */ default: m_freem(m); return; } KASSERT(pktq != NULL); if (__predict_false(!pktq_enqueue(pktq, m, 0))) { m_freem(m); } } static struct mbuf * ieee1394_reass(struct ifnet *ifp, struct mbuf *m0, uint16_t src) { struct ieee1394com *ic = (struct ieee1394com *)ifp; struct ieee1394_fraghdr *ifh; struct ieee1394_unfraghdr *iuh; struct ieee1394_reassq *rq; struct ieee1394_reass_pkt *rp, *trp, *nrp = NULL; int len; uint16_t etype, off, ftype, size, dgl; uint32_t id; if (m0->m_len < sizeof(*ifh)) { if ((m0 = m_pullup(m0, sizeof(*ifh))) == NULL) return NULL; } ifh = mtod(m0, struct ieee1394_fraghdr *); m_adj(m0, sizeof(*ifh)); size = ntohs(ifh->ifh_ft_size); ftype = size & (IEEE1394_FT_SUBSEQ | IEEE1394_FT_MORE); size = (size & ~ftype) + 1; dgl = ntohs(ifh->ifh_dgl); len = m0->m_pkthdr.len; id = dgl | (src << 16); if (ftype & IEEE1394_FT_SUBSEQ) { m_remove_pkthdr(m0); etype = 0; off = ntohs(ifh->ifh_etype_off); } else { etype = ifh->ifh_etype_off; off = 0; } for (rq = LIST_FIRST(&ic->ic_reassq); ; rq = LIST_NEXT(rq, rq_node)) { if (rq == NULL) { /* * Create a new reassemble queue head for the node. */ rq = malloc(sizeof(*rq), M_FTABLE, M_NOWAIT); if (rq == NULL) { m_freem(m0); return NULL; } rq->fr_id = id; LIST_INIT(&rq->rq_pkt); LIST_INSERT_HEAD(&ic->ic_reassq, rq, rq_node); break; } if (rq->fr_id == id) break; } for (rp = LIST_FIRST(&rq->rq_pkt); rp != NULL; rp = nrp) { nrp = LIST_NEXT(rp, rp_next); if (rp->rp_dgl != dgl) continue; /* * sanity check: * datagram size must be same for all fragments, and * no overlap is allowed. */ if (rp->rp_size != size || (off < rp->rp_off + rp->rp_len && off + len > rp->rp_off)) { /* * This happens probably due to wrapping dgl value. * Destroy all previously received fragment and * enqueue current fragment. */ for (rp = LIST_FIRST(&rq->rq_pkt); rp != NULL; rp = nrp) { nrp = LIST_NEXT(rp, rp_next); if (rp->rp_dgl == dgl) { LIST_REMOVE(rp, rp_next); m_freem(rp->rp_m); free(rp, M_FTABLE); } } break; } if (rp->rp_off + rp->rp_len == off) { /* * All the subsequent fragments received in sequence * come here. * Concatinate mbuf to previous one instead of * allocating new reassemble queue structure, * and try to merge more with the subsequent fragment * in the queue. */ m_cat(rp->rp_m, m0); rp->rp_len += len; while (rp->rp_off + rp->rp_len < size && nrp != NULL && nrp->rp_dgl == dgl && nrp->rp_off == rp->rp_off + rp->rp_len) { LIST_REMOVE(nrp, rp_next); m_cat(rp->rp_m, nrp->rp_m); rp->rp_len += nrp->rp_len; free(nrp, M_FTABLE); nrp = LIST_NEXT(rp, rp_next); } m0 = NULL; /* mark merged */ break; } if (off + m0->m_pkthdr.len == rp->rp_off) { m_cat(m0, rp->rp_m); rp->rp_m = m0; rp->rp_off = off; rp->rp_etype = etype; /* over writing trust etype */ rp->rp_len += len; m0 = NULL; /* mark merged */ break; } if (rp->rp_off > off) { /* insert before rp */ nrp = rp; break; } if (nrp == NULL || nrp->rp_dgl != dgl) { /* insert after rp */ nrp = NULL; break; } } if (m0 == NULL) { if (rp->rp_off != 0 || rp->rp_len != size) return NULL; /* fragment done */ LIST_REMOVE(rp, rp_next); m0 = rp->rp_m; m0->m_pkthdr.len = rp->rp_len; M_PREPEND(m0, sizeof(*iuh), M_DONTWAIT); if (m0 != NULL) { iuh = mtod(m0, struct ieee1394_unfraghdr *); iuh->iuh_ft = 0; iuh->iuh_etype = rp->rp_etype; } free(rp, M_FTABLE); return m0; } /* * New fragment received. Allocate reassemble queue structure. */ trp = malloc(sizeof(*trp), M_FTABLE, M_NOWAIT); if (trp == NULL) { m_freem(m0); return NULL; } trp->rp_m = m0; trp->rp_size = size; trp->rp_etype = etype; /* valid only if off==0 */ trp->rp_off = off; trp->rp_dgl = dgl; trp->rp_len = len; trp->rp_ttl = IEEE1394_REASS_TIMEOUT; if (trp->rp_ttl <= ifp->if_timer) trp->rp_ttl = ifp->if_timer + 1; if (rp == NULL) { /* first fragment for the dgl */ LIST_INSERT_HEAD(&rq->rq_pkt, trp, rp_next); } else if (nrp == NULL) { /* no next fragment for the dgl */ LIST_INSERT_AFTER(rp, trp, rp_next); } else { /* there is a hole */ LIST_INSERT_BEFORE(nrp, trp, rp_next); } return NULL; } void ieee1394_drain(struct ifnet *ifp) { struct ieee1394com *ic = (struct ieee1394com *)ifp; struct ieee1394_reassq *rq; struct ieee1394_reass_pkt *rp; while ((rq = LIST_FIRST(&ic->ic_reassq)) != NULL) { LIST_REMOVE(rq, rq_node); while ((rp = LIST_FIRST(&rq->rq_pkt)) != NULL) { LIST_REMOVE(rp, rp_next); m_freem(rp->rp_m); free(rp, M_FTABLE); } free(rq, M_FTABLE); } } void ieee1394_watchdog(struct ifnet *ifp) { struct ieee1394com *ic = (struct ieee1394com *)ifp; struct ieee1394_reassq *rq; struct ieee1394_reass_pkt *rp, *nrp; int dec; dec = (ifp->if_timer > 0) ? ifp->if_timer : 1; for (rq = LIST_FIRST(&ic->ic_reassq); rq != NULL; rq = LIST_NEXT(rq, rq_node)) { for (rp = LIST_FIRST(&rq->rq_pkt); rp != NULL; rp = nrp) { nrp = LIST_NEXT(rp, rp_next); if (rp->rp_ttl >= dec) rp->rp_ttl -= dec; else { LIST_REMOVE(rp, rp_next); m_freem(rp->rp_m); free(rp, M_FTABLE); } } } } const char * ieee1394_sprintf(const uint8_t *laddr) { static char buf[3*8]; snprintf(buf, sizeof(buf), "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", laddr[0], laddr[1], laddr[2], laddr[3], laddr[4], laddr[5], laddr[6], laddr[7]); return buf; } void ieee1394_ifattach(struct ifnet *ifp, const struct ieee1394_hwaddr *hwaddr) { struct ieee1394_hwaddr *baddr; struct ieee1394com *ic = (struct ieee1394com *)ifp; ifp->if_type = IFT_IEEE1394; ifp->if_hdrlen = sizeof(struct ieee1394_header); ifp->if_dlt = DLT_EN10MB; /* XXX */ ifp->if_mtu = IEEE1394MTU; ifp->if_output = ieee1394_output; ifp->if_drain = ieee1394_drain; ifp->if_watchdog = ieee1394_watchdog; ifp->if_timer = 1; if (ifp->if_baudrate == 0) ifp->if_baudrate = IF_Mbps(100); if_set_sadl(ifp, hwaddr, sizeof(struct ieee1394_hwaddr), true); baddr = malloc(ifp->if_addrlen, M_DEVBUF, M_WAITOK); memset(baddr->iha_uid, 0xff, IEEE1394_ADDR_LEN); baddr->iha_speed = 0; /*XXX: how to determine the speed for bcast? */ baddr->iha_maxrec = 512 << baddr->iha_speed; memset(baddr->iha_offset, 0, sizeof(baddr->iha_offset)); ifp->if_broadcastaddr = (uint8_t *)baddr; LIST_INIT(&ic->ic_reassq); bpf_attach(ifp, DLT_APPLE_IP_OVER_IEEE1394, sizeof(struct ieee1394_hwaddr)); } void ieee1394_ifdetach(struct ifnet *ifp) { ieee1394_drain(ifp); bpf_detach(ifp); free(__UNCONST(ifp->if_broadcastaddr), M_DEVBUF); ifp->if_broadcastaddr = NULL; } int ieee1394_ioctl(struct ifnet *ifp, u_long cmd, void *data) { struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; int error = 0; switch (cmd) { case SIOCINITIFADDR: ifp->if_flags |= IFF_UP; switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: if ((error = if_init(ifp)) != 0) break; arp_ifinit(ifp, ifa); break; #endif /* INET */ default: error = if_init(ifp); break; } break; case SIOCSIFMTU: if (ifr->ifr_mtu > IEEE1394MTU) error = EINVAL; else if ((error = ifioctl_common(ifp, cmd, data)) == ENETRESET) error = 0; break; default: error = ifioctl_common(ifp, cmd, data); break; } return error; } @ 1.69.8.1 log @IFQ_CLASSIFY() -> ifq_classify_packet(). @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.69 2022/09/03 02:47:59 thorpej Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.69 2022/09/03 02:47:59 thorpej Exp $"); d107 1 a107 1 ifq_classify_packet(&ifp->if_snd, m0, dst->sa_family); @ 1.69.8.2 log @if_transmit_lock() and if_enqueue() are equivalent. if_enqueue() is a better name, so collapse everything down to that and garbage-collect if_transmit_lock(). @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.69.8.1 2023/11/16 04:30:22 thorpej Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.69.8.1 2023/11/16 04:30:22 thorpej Exp $"); d233 1 a233 1 error = if_enqueue(ifp, m); @ 1.68 log @Convert ARP from a legacy netisr to pktqueue. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.67 2021/12/31 14:25:24 riastradh Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.67 2021/12/31 14:25:24 riastradh Exp $"); a54 1 #include @ 1.67 log @sys: Use if_init wrapper function. Exception: Not in kern_pmf.c, for the kind of silly reason that it avoids having kern_pmf.c refer to symbols defined only in net; this avoids a pain in the rump. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.66 2020/08/28 06:23:42 ozaki-r Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.66 2020/08/28 06:23:42 ozaki-r Exp $"); a328 1 struct ifqueue *inq; a330 1 int isr = 0; d382 1 a382 2 isr = NETISR_ARP; inq = &arpintrq; d397 3 a399 5 if (__predict_true(pktq)) { if (__predict_false(!pktq_enqueue(pktq, m, 0))) { m_freem(m); } return; a400 2 IFQ_ENQUEUE_ISR(inq, m, isr); @ 1.66 log @net: introduce IFQ_ENQUEUE_ISR to assemble packet queuing routines (NFCI) @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.65 2018/12/22 14:28:56 maxv Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.65 2018/12/22 14:28:56 maxv Exp $"); d684 1 a684 1 if ((error = (*ifp->if_init)(ifp)) != 0) d690 1 a690 1 error = (*ifp->if_init)(ifp); @ 1.65 log @Replace M_ALIGN and MH_ALIGN by m_align. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.64 2018/11/15 10:23:56 maxv Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.64 2018/11/15 10:23:56 maxv Exp $"); d407 1 a407 10 IFQ_LOCK(inq); if (IF_QFULL(inq)) { IF_DROP(inq); IFQ_UNLOCK(inq); m_freem(m); } else { IF_ENQUEUE(inq, m); IFQ_UNLOCK(inq); schednetisr(isr); } @ 1.64 log @Remove the 't' argument from m_tag_find(). @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.63 2018/06/26 06:48:02 msaitoh Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.63 2018/06/26 06:48:02 msaitoh Exp $"); d292 1 a292 1 MH_ALIGN(m, sizeof(struct ieee1394_fraghdr)); @ 1.63 log @ Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same as FreeBSD. This change also fixes a bug that the direction is misunderstand on some environment by passing the direction to bpf_mtap*() instead of checking m->m_pkthdr.rcvif. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.62 2018/05/09 06:35:10 maxv Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.62 2018/05/09 06:35:10 maxv Exp $"); d121 1 a121 2 mtag = m_tag_find(m0, MTAG_FIREWIRE_HWADDR, NULL); d359 1 a359 1 mtag = m_tag_find(m, MTAG_FIREWIRE_SENDER_EUID, 0); @ 1.63.2.1 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.65 2018/12/22 14:28:56 maxv Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.65 2018/12/22 14:28:56 maxv Exp $"); d121 2 a122 1 mtag = m_tag_find(m0, MTAG_FIREWIRE_HWADDR); d293 1 a293 1 m_align(m, sizeof(struct ieee1394_fraghdr)); d360 1 a360 1 mtag = m_tag_find(m, MTAG_FIREWIRE_SENDER_EUID); @ 1.62 log @Replace m_copym(m, 0, M_COPYALL, M_DONTWAIT) by m_copypacket(m, M_DONTWAIT) when it is clear that we are copying a packet (that has M_PKTHDR) and not a raw mbuf chain. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.61 2018/05/07 09:51:02 maxv Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.61 2018/05/07 09:51:02 maxv Exp $"); d200 1 a200 1 bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m0); d375 1 a375 1 bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m); @ 1.61 log @Use m_remove_pkthdr. ok knakahara@@ (for L2TP) @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.60 2018/04/26 19:56:55 maxv Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.60 2018/04/26 19:56:55 maxv Exp $"); d146 1 a146 1 mcopy = m_copym(m0, 0, M_COPYALL, M_DONTWAIT); @ 1.60 log @m_copy -> m_copym @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.59 2017/02/14 03:05:06 ozaki-r Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.59 2017/02/14 03:05:06 ozaki-r Exp $"); d445 1 a445 2 m_tag_delete_chain(m0, NULL); m0->m_flags &= ~M_PKTHDR; @ 1.59 log @Do ND in L2_output in the same manner as arpresolve The benefits of this change are: - The flow is consistent with IPv4 (and FreeBSD and OpenBSD) - old: ip6_output => nd6_output (do ND if needed) => L2_output (lookup a stored cache) - new: ip6_output => L2_output (lookup a cache. Do ND if cache not found) - We can remove some workarounds in nd6_output - We can move L2 specific operations to their own place - The performance slightly improves because one cache lookup is reduced @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.58 2016/10/03 11:06:06 ozaki-r Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.58 2016/10/03 11:06:06 ozaki-r Exp $"); d146 1 a146 1 mcopy = m_copy(m0, 0, M_COPYALL); d301 1 a301 1 m->m_next = m_copy(m0, sizeof(*ifh) + off, fraglen); @ 1.59.12.1 log @Synch with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.60 2018/04/26 19:56:55 maxv Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.60 2018/04/26 19:56:55 maxv Exp $"); d146 1 a146 1 mcopy = m_copym(m0, 0, M_COPYALL, M_DONTWAIT); d301 1 a301 1 m->m_next = m_copym(m0, sizeof(*ifh) + off, fraglen, M_DONTWAIT); @ 1.59.12.2 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.62 2018/05/09 06:35:10 maxv Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.62 2018/05/09 06:35:10 maxv Exp $"); d146 1 a146 1 mcopy = m_copypacket(m0, M_DONTWAIT); d445 2 a446 1 m_remove_pkthdr(m0); @ 1.59.12.3 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.63 2018/06/26 06:48:02 msaitoh Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.63 2018/06/26 06:48:02 msaitoh Exp $"); d200 1 a200 1 bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m0, BPF_D_OUT); d375 1 a375 1 bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m, BPF_D_IN); @ 1.59.12.4 log @Sync with HEAD, resolve a couple of conflicts @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.64 2018/11/15 10:23:56 maxv Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.64 2018/11/15 10:23:56 maxv Exp $"); d121 2 a122 1 mtag = m_tag_find(m0, MTAG_FIREWIRE_HWADDR); d360 1 a360 1 mtag = m_tag_find(m, MTAG_FIREWIRE_SENDER_EUID); @ 1.59.12.5 log @Sync with HEAD, resolve a few conflicts @ text @d1 1 a1 1 /* $NetBSD$ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD$"); d292 1 a292 1 m_align(m, sizeof(struct ieee1394_fraghdr)); @ 1.58 log @Fix race condition on ifqueue used by traditional netisr If a underlying network device driver supports MSI/MSI-X, RX interrupts can be delivered to arbitrary CPUs. This means that Layer 2 subroutines such as ether_input (softint) and subsequent Layer 3 subroutines (softint) which are called via traditional netisr can be dispatched on an arbitrary CPU. Layer 2 subroutines now run without any locks (expected) and so a Layer 2 subroutine and a Layer 3 subroutine can run in parallel. There is a shared data between a Layer 2 routine and a Layer 3 routine, that is ifqueue and IF_ENQUEUE (from L2) and IF_DEQUEUE (from L3) on it are racy now. To fix the race condition, use ifqueue#ifq_lock to protect ifqueue instead of splnet that is meaningless now. The same race condition exists in route_intr. Fix it as well. Reviewed by knakahara@@ @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.57 2016/08/15 09:14:12 maxv Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.57 2016/08/15 09:14:12 maxv Exp $"); d157 15 a171 4 if (unicast && (!nd6_storelladdr(ifp, rt, m0, dst, hwdst->iha_uid, IEEE1394_ADDR_LEN))) { /* something bad happened */ return 0; @ 1.58.2.1 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.59 2017/02/14 03:05:06 ozaki-r Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.59 2017/02/14 03:05:06 ozaki-r Exp $"); d157 4 a160 15 #if 0 /* * XXX This code was in nd6_storelladdr, which was replaced with * nd6_resolve, but it never be used because nd6_storelladdr was * called only if unicast. Should it be enabled? */ if (m0->m_flags & M_BCAST) memcpy(hwdst->iha_uid, ifp->if_broadcastaddr, MIN(IEEE1394_ADDR_LEN, ifp->if_addrlen)); #endif if (unicast) { error = nd6_resolve(ifp, rt, m0, dst, hwdst->iha_uid, IEEE1394_ADDR_LEN); if (error != 0) return error == EWOULDBLOCK ? 0 : error; @ 1.57 log @Memory leak, found by brainy; not tested, but obvious enough @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.56 2016/06/22 10:44:32 knakahara Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.56 2016/06/22 10:44:32 knakahara Exp $"); a320 1 int s; d397 1 a397 1 s = splnet(); d400 1 d404 1 a406 1 splx(s); @ 1.56 log @fix: locking about IFQ_ENQUEUE and ALTQ - If NET_MPSAFE is not defined, IFQ_LOCK is nop. Currently, that means IFQ_ENQUEUE() of some paths such as bridge_enqueue() is called parallel wrongly. - If ALTQ is enabled, Tx processing should call if_transmit() (= IFQ_ENQUEUE + ifp->if_start()) instead of ifp->if_transmit() to call ALTQ_ENQUEUE() and ALTQ_DEQUEUE(). Furthermore, ALTQ processing is always required KERNEL_LOCK currently. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.55 2016/04/28 01:37:17 knakahara Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.55 2016/04/28 01:37:17 knakahara Exp $"); d291 2 a292 1 if (m->m_next == NULL) d294 1 @ 1.56.2.1 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.58 2016/10/03 11:06:06 ozaki-r Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.58 2016/10/03 11:06:06 ozaki-r Exp $"); d319 1 d396 1 a396 1 IFQ_LOCK(inq); a398 1 IFQ_UNLOCK(inq); a401 1 IFQ_UNLOCK(inq); d404 1 @ 1.56.2.2 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.59 2017/02/14 03:05:06 ozaki-r Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.59 2017/02/14 03:05:06 ozaki-r Exp $"); d157 4 a160 15 #if 0 /* * XXX This code was in nd6_storelladdr, which was replaced with * nd6_resolve, but it never be used because nd6_storelladdr was * called only if unicast. Should it be enabled? */ if (m0->m_flags & M_BCAST) memcpy(hwdst->iha_uid, ifp->if_broadcastaddr, MIN(IEEE1394_ADDR_LEN, ifp->if_addrlen)); #endif if (unicast) { error = nd6_resolve(ifp, rt, m0, dst, hwdst->iha_uid, IEEE1394_ADDR_LEN); if (error != 0) return error == EWOULDBLOCK ? 0 : error; @ 1.55 log @introduce new ifnet MP-scalable sending interface "if_transmit". @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.54 2016/04/28 00:16:56 ozaki-r Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.54 2016/04/28 00:16:56 ozaki-r Exp $"); d224 1 a224 1 error = (*ifp->if_transmit)(ifp, m); @ 1.54 log @Constify rtentry of if_output We no longer need to change rtentry below if_output. The change makes it clear where rtentries are changed (or not) and helps forthcoming locking (os psrefing) rtentries. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.53 2016/04/20 09:01:04 knakahara Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.53 2016/04/20 09:01:04 knakahara Exp $"); d91 1 a91 1 int s, hdrlen, error = 0; a220 4 s = splnet(); ifp->if_obytes += m0->m_pkthdr.len; if (m0->m_flags & M_MCAST) ifp->if_omcasts++; d223 2 a224 5 if (m == NULL) { splx(s); senderr(ENOBUFS); } IFQ_ENQUEUE(&ifp->if_snd, m, error); a226 1 splx(s); a229 3 if ((ifp->if_flags & IFF_OACTIVE) == 0) (*ifp->if_start)(ifp); splx(s); @ 1.53 log @IFQ_ENQUEUE refactor (3/3) : eliminate pktattr argument from IFQ_ENQUEUE caller @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.52 2016/04/07 03:22:15 christos Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.52 2016/04/07 03:22:15 christos Exp $"); d82 1 a82 1 const struct sockaddr *, struct rtentry *); d87 1 a87 1 struct rtentry *rt) @ 1.52 log @- tidy up error messages - add a length argument to arpresolve() - add KASSERT for overflow @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.51 2015/10/13 12:33:07 roy Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.51 2015/10/13 12:33:07 roy Exp $"); a94 1 ALTQ_DECL(struct altq_pktattr pktattr;) d108 1 a108 1 IFQ_CLASSIFY(&ifp->if_snd, m0, dst->sa_family, &pktattr); d231 1 a231 1 IFQ_ENQUEUE(&ifp->if_snd, m, &pktattr, error); @ 1.51 log @arpresolve() now returns 0 on success otherwise an error code. Callers of arpresolve() now pass the error code back to their caller, masking out EWOULDBLOCK. This allows applications such as ping(8) to display a suitable error condition. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.50 2015/08/24 22:21:26 pooka Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.50 2015/08/24 22:21:26 pooka Exp $"); d142 2 a143 1 (error = arpresolve(ifp, rt, m0, dst, (u_char *)hwdst)) !=0) @ 1.50 log @sprinkle _KERNEL_OPT @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.49 2015/06/04 09:19:59 ozaki-r Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.49 2015/06/04 09:19:59 ozaki-r Exp $"); d141 3 a143 2 if (unicast && (!arpresolve(ifp, rt, m0, dst, (u_char *)hwdst))) return 0; /* if not yet resolved */ @ 1.49 log @Pull out route lookups from L2 output routines Route lookups for routes of RTF_GATEWAY were done in L2 output routines such as ether_output, but they should be done in L3 i.e., before L2 output routines. This change places the lookups between L3 output routines (say ip_output) and the L2 output routines. The change is based on dyoung's patch submitted in the thread: https://mail-index.netbsd.org/tech-net/2013/02/01/msg003847.html You can find out detailed investigations by dyoung about the issue in there. Note that the change introduces a workaround for MPLS. ether_output knew that it needs to fill the ethertype of a frame as MPLS, based on a tag of an original route (rtentry), but now we don't pass it to ehter_output. So we have to tell that in another way. We use mtag to do so for now, which introduces some overhead. We should fix it somehow in the future. Discussed on tech-kern and tech-net. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.48 2014/11/28 08:29:00 ozaki-r Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.48 2014/11/28 08:29:00 ozaki-r Exp $"); d35 1 d37 1 @ 1.48 log @Remove dead codes and make if_free_sadl static No functional change. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.47 2014/06/05 23:48:16 rmind Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.47 2014/06/05 23:48:16 rmind Exp $"); d85 1 a85 1 struct rtentry *rt0) a89 1 struct rtentry *rt; a101 34 if ((rt = rt0) != NULL) { if ((rt->rt_flags & RTF_UP) == 0) { if ((rt0 = rt = rtalloc1(dst, 1)) != NULL) { rt->rt_refcnt--; if (rt->rt_ifp != ifp) return (*rt->rt_ifp->if_output) (ifp, m0, dst, rt); } else senderr(EHOSTUNREACH); } if (rt->rt_flags & RTF_GATEWAY) { if (rt->rt_gwroute == NULL) goto lookup; if (((rt = rt->rt_gwroute)->rt_flags & RTF_UP) == 0) { rtfree(rt); rt = rt0; lookup: rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1); if ((rt = rt->rt_gwroute) == NULL) senderr(EHOSTUNREACH); /* the "G" test below also prevents rt == rt0 */ if ((rt->rt_flags & RTF_GATEWAY) || (rt->rt_ifp != ifp)) { rt->rt_refcnt--; rt0->rt_gwroute = NULL; senderr(EHOSTUNREACH); } } } if (rt->rt_flags & RTF_REJECT) if (rt->rt_rmx.rmx_expire == 0 || time_second < rt->rt_rmx.rmx_expire) senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH); } @ 1.48.2.1 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.49 2015/06/04 09:19:59 ozaki-r Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.49 2015/06/04 09:19:59 ozaki-r Exp $"); d85 1 a85 1 struct rtentry *rt) d90 1 d103 34 @ 1.48.2.2 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.48.2.1 2015/06/06 14:40:25 skrll Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.48.2.1 2015/06/06 14:40:25 skrll Exp $"); a34 1 #ifdef _KERNEL_OPT a35 1 #endif @ 1.48.2.3 log @Sync with HEAD (as of 26th Dec) @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.48.2.2 2015/09/22 12:06:10 skrll Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.48.2.2 2015/09/22 12:06:10 skrll Exp $"); d141 2 a142 3 if (unicast && (error = arpresolve(ifp, rt, m0, dst, (u_char *)hwdst)) !=0) return error == EWOULDBLOCK ? 0 : error; @ 1.48.2.4 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.48.2.3 2015/12/27 12:10:06 skrll Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.48.2.3 2015/12/27 12:10:06 skrll Exp $"); d95 1 d109 1 a109 1 IFQ_CLASSIFY(&ifp->if_snd, m0, dst->sa_family); d142 1 a142 2 (error = arpresolve(ifp, rt, m0, dst, hwdst, sizeof(*hwdst))) != 0) d231 1 a231 1 IFQ_ENQUEUE(&ifp->if_snd, m, error); @ 1.48.2.5 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.48.2.4 2016/04/22 15:44:17 skrll Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.48.2.4 2016/04/22 15:44:17 skrll Exp $"); d82 1 a82 1 const struct sockaddr *, const struct rtentry *); d87 1 a87 1 const struct rtentry *rt) d91 1 a91 1 int hdrlen, error = 0; d221 4 d227 5 a231 2 error = (*ifp->if_transmit)(ifp, m); d234 1 d238 3 @ 1.48.2.6 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.48.2.5 2016/05/29 08:44:38 skrll Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.48.2.5 2016/05/29 08:44:38 skrll Exp $"); d224 1 a224 1 error = if_transmit_lock(ifp, m); @ 1.48.2.7 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.48.2.6 2016/07/09 20:25:21 skrll Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.48.2.6 2016/07/09 20:25:21 skrll Exp $"); d291 1 a291 2 if (m->m_next == NULL) { m_freem(m); a292 1 } d319 1 d396 1 a396 1 IFQ_LOCK(inq); a398 1 IFQ_UNLOCK(inq); a401 1 IFQ_UNLOCK(inq); d404 1 @ 1.48.2.8 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.48.2.7 2016/10/05 20:56:08 skrll Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.48.2.7 2016/10/05 20:56:08 skrll Exp $"); d157 4 a160 15 #if 0 /* * XXX This code was in nd6_storelladdr, which was replaced with * nd6_resolve, but it never be used because nd6_storelladdr was * called only if unicast. Should it be enabled? */ if (m0->m_flags & M_BCAST) memcpy(hwdst->iha_uid, ifp->if_broadcastaddr, MIN(IEEE1394_ADDR_LEN, ifp->if_addrlen)); #endif if (unicast) { error = nd6_resolve(ifp, rt, m0, dst, hwdst->iha_uid, IEEE1394_ADDR_LEN); if (error != 0) return error == EWOULDBLOCK ? 0 : error; @ 1.47 log @- Implement pktqueue interface for lockless IP input queue. - Replace ipintrq and ip6intrq with the pktqueue mechanism. - Eliminate kernel-lock from ipintr() and ip6intr(). - Some preparation work to push softnet_lock out of ipintr(). Discussed on tech-net. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.46 2014/05/15 09:04:03 msaitoh Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.46 2014/05/15 09:04:03 msaitoh Exp $"); a709 3 #if 0 /* done in if_detach() */ if_free_sadl(ifp); #endif @ 1.46 log @ Put schednetisr() into splnet()/splx() pair. This might avoids delay of processing a packet. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.45 2010/04/05 07:22:23 joerg Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.45 2010/04/05 07:22:23 joerg Exp $"); d359 1 d412 1 a412 2 isr = NETISR_IP; inq = &ipintrq; d423 1 a423 2 isr = NETISR_IPV6; inq = &ip6intrq; d432 7 @ 1.45 log @Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf check into the inline functions as well the fourth argument for bpf_attach. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.44 2010/03/31 12:17:01 pgoyette Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.44 2010/03/31 12:17:01 pgoyette Exp $"); d363 1 d411 1 a411 1 schednetisr(NETISR_IP); d416 1 a416 1 schednetisr(NETISR_ARP); d423 1 a423 1 schednetisr(NETISR_IPV6); d437 1 a437 1 } else d439 2 @ 1.45.18.1 log @Rebase to HEAD as of a few days ago. @ text @d1 1 a1 1 /* $NetBSD$ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD$"); a358 1 pktqueue_t *pktq = NULL; a362 1 int isr = 0; d410 2 a411 1 pktq = ip_pktq; d415 1 a415 1 isr = NETISR_ARP; d422 2 a423 1 pktq = ip6_pktq; a431 7 if (__predict_true(pktq)) { if (__predict_false(!pktq_enqueue(pktq, m, 0))) { m_freem(m); } return; } d436 1 a436 1 } else { a437 2 schednetisr(isr); } @ 1.45.18.2 log @update from HEAD @ text @a34 1 #ifdef _KERNEL_OPT a35 1 #endif d80 1 a80 1 const struct sockaddr *, const struct rtentry *); d85 1 a85 1 const struct rtentry *rt) d89 2 a90 1 int hdrlen, error = 0; d94 1 d103 34 d142 1 a142 1 IFQ_CLASSIFY(&ifp->if_snd, m0, dst->sa_family); d174 2 a175 4 if (unicast && (error = arpresolve(ifp, rt, m0, dst, hwdst, sizeof(*hwdst))) != 0) return error == EWOULDBLOCK ? 0 : error; d189 4 a192 15 #if 0 /* * XXX This code was in nd6_storelladdr, which was replaced with * nd6_resolve, but it never be used because nd6_storelladdr was * called only if unicast. Should it be enabled? */ if (m0->m_flags & M_BCAST) memcpy(hwdst->iha_uid, ifp->if_broadcastaddr, MIN(IEEE1394_ADDR_LEN, ifp->if_addrlen)); #endif if (unicast) { error = nd6_resolve(ifp, rt, m0, dst, hwdst->iha_uid, IEEE1394_ADDR_LEN); if (error != 0) return error == EWOULDBLOCK ? 0 : error; d253 4 d259 5 a263 2 error = if_transmit_lock(ifp, m); d266 1 d270 3 d334 1 a334 2 if (m->m_next == NULL) { m_freem(m); a335 1 } d362 1 d439 1 a439 1 IFQ_LOCK(inq); a441 1 IFQ_UNLOCK(inq); a444 1 IFQ_UNLOCK(inq); d447 1 d710 3 @ 1.45.32.1 log @Rebase. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.47 2014/06/05 23:48:16 rmind Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.47 2014/06/05 23:48:16 rmind Exp $"); a358 1 pktqueue_t *pktq = NULL; a362 1 int isr = 0; d410 2 a411 1 pktq = ip_pktq; d415 1 a415 1 isr = NETISR_ARP; d422 2 a423 1 pktq = ip6_pktq; a431 7 if (__predict_true(pktq)) { if (__predict_false(!pktq_enqueue(pktq, m, 0))) { m_freem(m); } return; } d436 1 a436 1 } else { a437 2 schednetisr(isr); } @ 1.45.22.1 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.45 2010/04/05 07:22:23 joerg Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.45 2010/04/05 07:22:23 joerg Exp $"); a362 1 int isr = 0; d410 1 a410 1 isr = NETISR_IP; d415 1 a415 1 isr = NETISR_ARP; d422 1 a422 1 isr = NETISR_IPV6; d436 1 a436 1 } else { a437 2 schednetisr(isr); } @ 1.44 log @Now that fw_port.h is gone, we need to directly include Fixes build break reported by myself. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.43 2010/03/29 03:05:27 kiyohara Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.43 2010/03/29 03:05:27 kiyohara Exp $"); d221 1 a221 1 bpf_ops->bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m0); d404 1 a404 1 bpf_ops->bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m); d690 2 a691 2 bpf_ops->bpf_attach(ifp, DLT_APPLE_IP_OVER_IEEE1394, sizeof(struct ieee1394_hwaddr), &ifp->if_bpf); d698 1 a698 1 bpf_ops->bpf_detach(ifp); @ 1.43 log @Bye-bye fw_port.h. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.42 2010/01/19 22:08:01 pooka Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.42 2010/01/19 22:08:01 pooka Exp $"); d45 1 @ 1.42 log @Redefine bpf linkage through an always present op vector, i.e. #if NBPFILTER is no longer required in the client. This change doesn't yet add support for loading bpf as a module, since drivers can register before bpf is attached. However, callers of bpf can now be modularized. Dynamically loadable bpf could probably be done fairly easily with coordination from the stub driver and the real driver by registering attachments in the stub before the real driver is loaded and doing a handoff. ... and I'm not going to ponder the depths of unload here. Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.41 2008/11/07 00:20:13 dyoung Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.41 2008/11/07 00:20:13 dyoung Exp $"); d39 4 a44 3 #include #include #include a67 1 #include d155 1 a155 1 m_tag_locate(m0, MTAG_FIREWIRE, MTAG_FIREWIRE_HWADDR, NULL); d157 1 a157 1 mtag = m_tag_alloc(MTAG_FIREWIRE, MTAG_FIREWIRE_HWADDR, d388 1 a388 2 mtag = m_tag_locate(m, MTAG_FIREWIRE, MTAG_FIREWIRE_SENDER_EUID, 0); @ 1.42.4.1 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.42 2010/01/19 22:08:01 pooka Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.42 2010/01/19 22:08:01 pooka Exp $"); d39 2 a40 2 #include #include d43 1 a43 3 #include #include #include d67 1 d155 1 a155 1 m_tag_find(m0, MTAG_FIREWIRE_HWADDR, NULL); d157 1 a157 1 mtag = m_tag_get(MTAG_FIREWIRE_HWADDR, d220 1 a220 1 bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m0); d388 2 a389 1 mtag = m_tag_find(m, MTAG_FIREWIRE_SENDER_EUID, 0); d404 1 a404 1 bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m); d690 2 a691 2 bpf_attach(ifp, DLT_APPLE_IP_OVER_IEEE1394, sizeof(struct ieee1394_hwaddr)); d698 1 a698 1 bpf_detach(ifp); @ 1.42.2.1 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD$ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD$"); d39 2 a40 2 #include #include d43 1 a43 3 #include #include #include d67 1 d155 1 a155 1 m_tag_find(m0, MTAG_FIREWIRE_HWADDR, NULL); d157 1 a157 1 mtag = m_tag_get(MTAG_FIREWIRE_HWADDR, d220 1 a220 1 bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m0); d388 2 a389 1 mtag = m_tag_find(m, MTAG_FIREWIRE_SENDER_EUID, 0); d404 1 a404 1 bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m); d690 2 a691 2 bpf_attach(ifp, DLT_APPLE_IP_OVER_IEEE1394, sizeof(struct ieee1394_hwaddr)); d698 1 a698 1 bpf_detach(ifp); @ 1.41 log @*** Summary *** When a link-layer address changes (e.g., ifconfig ex0 link 02:de:ad:be:ef:02 active), send a gratuitous ARP and/or a Neighbor Advertisement to update the network-/link-layer address bindings on our LAN peers. Refuse a change of ethernet address to the address 00:00:00:00:00:00 or to any multicast/broadcast address. (Thanks matt@@.) Reorder ifnet ioctl operations so that driver ioctls may inherit the functions of their "class"---ether_ioctl(), fddi_ioctl(), et cetera---and the class ioctls may inherit from the generic ioctl, ifioctl_common(), but both driver- and class-ioctls may override the generic behavior. Make network drivers share more code. Distinguish a "factory" link-layer address from others for the purposes of both protecting that address from deletion and computing EUI64. Return consistent, appropriate error codes from network drivers. Improve readability. KNF. *** Details *** In if_attach(), always initialize the interface ioctl routine, ifnet->if_ioctl, if the driver has not already initialized it. Delete if_ioctl == NULL tests everywhere else, because it cannot happen. In the ioctl routines of network interfaces, inherit common ioctl behaviors by calling either ifioctl_common() or whichever ioctl routine is appropriate for the class of interface---e.g., ether_ioctl() for ethernets. Stop (ab)using SIOCSIFADDR and start to use SIOCINITIFADDR. In the user->kernel interface, SIOCSIFADDR's argument was an ifreq, but on the protocol->ifnet interface, SIOCSIFADDR's argument was an ifaddr. That was confusing, and it would work against me as I make it possible for a network interface to overload most ioctls. On the protocol->ifnet interface, replace SIOCSIFADDR with SIOCINITIFADDR. In ifioctl(), return EPERM if userland tries to invoke SIOCINITIFADDR. In ifioctl(), give the interface the first shot at handling most interface ioctls, and give the protocol the second shot, instead of the other way around. Finally, let compatibility code (COMPAT_OSOCK) take a shot. Pull device initialization out of switch statements under SIOCINITIFADDR. For example, pull ..._init() out of any switch statement that looks like this: switch (...->sa_family) { case ...: ..._init(); ... break; ... default: ..._init(); ... break; } Rewrite many if-else clauses that handle all permutations of IFF_UP and IFF_RUNNING to use a switch statement, switch (x & (IFF_UP|IFF_RUNNING)) { case 0: ... break; case IFF_RUNNING: ... break; case IFF_UP: ... break; case IFF_UP|IFF_RUNNING: ... break; } unifdef lots of code containing #ifdef FreeBSD, #ifdef NetBSD, and #ifdef SIOCSIFMTU, especially in fwip(4) and in ndis(4). In ipw(4), remove an if_set_sadl() call that is out of place. In nfe(4), reuse the jumbo MTU logic in ether_ioctl(). Let ethernets register a callback for setting h/w state such as promiscuous mode and the multicast filter in accord with a change in the if_flags: ether_set_ifflags_cb() registers a callback that returns ENETRESET if the caller should reset the ethernet by calling if_init(), 0 on success, != 0 on failure. Pull common code from ex(4), gem(4), nfe(4), sip(4), tlp(4), vge(4) into ether_ioctl(), and register if_flags callbacks for those drivers. Return ENOTTY instead of EINVAL for inappropriate ioctls. In zyd(4), use ENXIO instead of ENOTTY to indicate that the device is not any longer attached. Add to if_set_sadl() a boolean 'factory' argument that indicates whether a link-layer address was assigned by the factory or some other source. In a comment, recommend using the factory address for generating an EUI64, and update in6_get_hw_ifid() to prefer a factory address to any other link-layer address. Add a routing message, RTM_LLINFO_UPD, that tells protocols to update the binding of network-layer addresses to link-layer addresses. Implement this message in IPv4 and IPv6 by sending a gratuitous ARP or a neighbor advertisement, respectively. Generate RTM_LLINFO_UPD messages on a change of an interface's link-layer address. In ether_ioctl(), do not let SIOCALIFADDR set a link-layer address that is broadcast/multicast or equal to 00:00:00:00:00:00. Make ether_ioctl() call ifioctl_common() to handle ioctls that it does not understand. In gif(4), initialize if_softc and use it, instead of assuming that the gif_softc and ifp overlap. Let ifioctl_common() handle SIOCGIFADDR. Sprinkle rtcache_invariants(), which checks on DIAGNOSTIC kernels that certain invariants on a struct route are satisfied. In agr(4), rewrite agr_ioctl_filter() to be a bit more explicit about the ioctls that we do not allow on an agr(4) member interface. bzero -> memset. Delete unnecessary casts to void *. Use sockaddr_in_init() and sockaddr_in6_init(). Compare pointers with NULL instead of "testing truth". Replace some instances of (type *)0 with NULL. Change some K&R prototypes to ANSI C, and join lines. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.40 2008/04/28 20:24:09 martin Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.40 2008/04/28 20:24:09 martin Exp $"); a35 1 #include "bpfilter.h" a53 1 #if NBPFILTER > 0 a54 1 #endif a209 1 #if NBPFILTER > 0 d220 1 a220 1 bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m0); a221 1 #endif a382 1 #if NBPFILTER > 0 d404 1 a404 1 bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m); a405 1 #endif d690 2 a691 4 #if NBPFILTER > 0 bpfattach(ifp, DLT_APPLE_IP_OVER_IEEE1394, sizeof(struct ieee1394_hwaddr)); #endif d698 1 a698 3 #if NBPFILTER > 0 bpfdetach(ifp); #endif @ 1.40 log @Remove clause 3 and 4 from TNF licenses @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.39 2008/02/20 17:05:53 matt Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.39 2008/02/20 17:05:53 matt Exp $"); d688 1 a688 1 if_set_sadl(ifp, hwaddr, sizeof(struct ieee1394_hwaddr)); a722 4 #if __NetBSD_Version__ < 105080000 int fw_init(struct ifnet *); void fw_stop(struct ifnet *, int); #endif d725 1 a725 1 case SIOCSIFADDR: a729 1 #if __NetBSD_Version__ >= 105080000 a730 3 #else if ((error = fw_init(ifp)) != 0) #endif a735 1 #if __NetBSD_Version__ >= 105080000 a736 3 #else error = fw_init(ifp); #endif a740 5 case SIOCGIFADDR: memcpy(((struct sockaddr *)&ifr->ifr_data)->sa_data, CLLADDR(ifp->if_sadl), IEEE1394_ADDR_LEN); break; a747 2 case SIOCSIFCAP: return ifioctl_common(ifp, cmd, data); d749 1 a749 1 error = ENOTTY; @ 1.40.8.1 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.41 2008/11/07 00:20:13 dyoung Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.41 2008/11/07 00:20:13 dyoung Exp $"); d688 1 a688 1 if_set_sadl(ifp, hwaddr, sizeof(struct ieee1394_hwaddr), true); d723 4 d729 1 a729 1 case SIOCINITIFADDR: d734 1 d736 3 d744 1 d746 3 d753 5 d765 2 d768 1 a768 1 error = ifioctl_common(ifp, cmd, data); @ 1.40.6.1 log @Update haad-dm branch to haad-dm-base2. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.41 2008/11/07 00:20:13 dyoung Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.41 2008/11/07 00:20:13 dyoung Exp $"); d688 1 a688 1 if_set_sadl(ifp, hwaddr, sizeof(struct ieee1394_hwaddr), true); d723 4 d729 1 a729 1 case SIOCINITIFADDR: d734 1 d736 3 d744 1 d746 3 d753 5 d765 2 d768 1 a768 1 error = ifioctl_common(ifp, cmd, data); @ 1.39 log @s/u_\(int[0-9]*_t\)/u\1/g (change u_int*_t to uint*_t) @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.38 2008/02/07 01:22:00 dyoung Exp $ */ a17 7 * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.38 2008/02/07 01:22:00 dyoung Exp $"); @ 1.39.6.1 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD$ */ d18 7 d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD$"); @ 1.39.6.2 log @Sync with HEAD. @ text @d688 1 a688 1 if_set_sadl(ifp, hwaddr, sizeof(struct ieee1394_hwaddr), true); d723 4 d729 1 a729 1 case SIOCINITIFADDR: d734 1 d736 3 d744 1 d746 3 d753 5 d765 2 d768 1 a768 1 error = ifioctl_common(ifp, cmd, data); @ 1.39.8.1 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.39 2008/02/20 17:05:53 matt Exp $ */ d18 7 d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.39 2008/02/20 17:05:53 matt Exp $"); @ 1.39.10.1 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.39 2008/02/20 17:05:53 matt Exp $ */ d18 7 d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.39 2008/02/20 17:05:53 matt Exp $"); @ 1.39.10.2 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.39.10.1 2008/05/16 02:25:40 yamt Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.39.10.1 2008/05/16 02:25:40 yamt Exp $"); d688 1 a688 1 if_set_sadl(ifp, hwaddr, sizeof(struct ieee1394_hwaddr), true); d723 4 d729 1 a729 1 case SIOCINITIFADDR: d734 1 d736 3 d744 1 d746 3 d753 5 d765 2 d768 1 a768 1 error = ifioctl_common(ifp, cmd, data); @ 1.39.10.3 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.39.10.2 2009/05/04 08:14:15 yamt Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.39.10.2 2009/05/04 08:14:15 yamt Exp $"); d36 1 d55 1 d57 1 d213 1 d224 1 a224 1 bpf_ops->bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m0); d226 1 d388 1 d410 1 a410 1 bpf_ops->bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m); d412 1 d697 4 a700 2 bpf_ops->bpf_attach(ifp, DLT_APPLE_IP_OVER_IEEE1394, sizeof(struct ieee1394_hwaddr), &ifp->if_bpf); d707 3 a709 1 bpf_ops->bpf_detach(ifp); @ 1.39.10.4 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.39.10.3 2010/03/11 15:04:27 yamt Exp $ */ d33 1 a33 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.39.10.3 2010/03/11 15:04:27 yamt Exp $"); d39 2 a40 2 #include #include d43 1 a43 3 #include #include #include d67 1 d155 1 a155 1 m_tag_find(m0, MTAG_FIREWIRE_HWADDR, NULL); d157 1 a157 1 mtag = m_tag_get(MTAG_FIREWIRE_HWADDR, d220 1 a220 1 bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m0); d388 2 a389 1 mtag = m_tag_find(m, MTAG_FIREWIRE_SENDER_EUID, 0); d404 1 a404 1 bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m); d690 2 a691 2 bpf_attach(ifp, DLT_APPLE_IP_OVER_IEEE1394, sizeof(struct ieee1394_hwaddr)); d698 1 a698 1 bpf_detach(ifp); @ 1.38 log @Start patching up the kernel so that a network driver always has the opportunity to handle an ioctl before generic ifioctl handling occurs. This will ease extending the kernel and sharing of code between drivers. First steps: Make the signature of ifioctl_common() match struct ifinet->if_ioctl. Convert SIOCSIFCAP and SIOCSIFMTU to the new ifioctl() regime, throughout the kernel. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.37 2007/12/20 21:08:22 dyoung Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.37 2007/12/20 21:08:22 dyoung Exp $"); d90 1 a90 1 static struct mbuf *ieee1394_reass(struct ifnet *, struct mbuf *, u_int16_t); d96 1 a96 1 u_int16_t etype = 0; d298 1 a298 1 u_int16_t etype) d368 1 a368 1 ieee1394_input(struct ifnet *ifp, struct mbuf *m, u_int16_t src) d371 1 a371 1 u_int16_t etype; d456 1 a456 1 ieee1394_reass(struct ifnet *ifp, struct mbuf *m0, u_int16_t src) d464 2 a465 2 u_int16_t etype, off, ftype, size, dgl; u_int32_t id; d668 1 a668 1 ieee1394_sprintf(const u_int8_t *laddr) @ 1.37 log @Constify struct ifnet->if_sadl and every use throughout the tree. Add if_set_sadl() that both sets the link-layer address length and replaces the current link-layer address with a new one, and use it throughout the tree. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.36 2007/08/30 02:17:35 dyoung Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.36 2007/08/30 02:17:35 dyoung Exp $"); d768 2 a769 2 else ifp->if_mtu = ifr->ifr_mtu; d772 2 @ 1.36 log @Use malloc(9) for sockaddrs instead of pool(9), and remove dom_sa_pool and dom_sa_len members from struct domain. Pools of fixed-size objects are too rigid for sockaddr_dls, whose size can vary over a wide range. Return sockaddr_dl to its "historical" size. Now that I'm using malloc(9) instead of pool(9) to allocate sockaddr_dl, I can create a sockaddr_dl of any size in the kernel, so expanding sockaddr_dl is useless. Avoid using sizeof(struct sockaddr_dl) in the kernel. Introduce sockaddr_dl_alloc() for allocating & initializing an arbitrary sockaddr_dl on the heap. Add an argument, the sockaddr length, to sockaddr_alloc(), sockaddr_copy(), and sockaddr_dl_setaddr(). Constify: LLADDR() -> CLLADDR(). Where the kernel overwrites LLADDR(), use sockaddr_dl_setaddr(), instead. Used properly, sockaddr_dl_setaddr() will not overrun the end of the sockaddr. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.35 2007/08/26 22:59:08 dyoung Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.35 2007/08/26 22:59:08 dyoung Exp $"); a684 1 ifp->if_addrlen = sizeof(struct ieee1394_hwaddr); d695 1 a695 3 if_alloc_sadl(ifp); (void)sockaddr_dl_setaddr(ifp->if_sadl, ifp->if_sadl->sdl_len, hwaddr, ifp->if_addrlen); @ 1.36.6.1 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.38 2008/02/07 01:22:00 dyoung Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.38 2008/02/07 01:22:00 dyoung Exp $"); d771 2 a772 2 else if ((error = ifioctl_common(ifp, cmd, data)) == ENETRESET) error = 0; a774 2 case SIOCSIFCAP: return ifioctl_common(ifp, cmd, data); @ 1.36.12.1 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD$ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD$"); d685 1 d696 3 a698 1 if_set_sadl(ifp, hwaddr, sizeof(struct ieee1394_hwaddr)); @ 1.36.8.1 log @Sync with head. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.37 2007/12/20 21:08:22 dyoung Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.37 2007/12/20 21:08:22 dyoung Exp $"); d685 1 d696 3 a698 1 if_set_sadl(ifp, hwaddr, sizeof(struct ieee1394_hwaddr)); @ 1.35 log @Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to identify sockaddr_dl abuse that remains in the kernel, especially the potential for overwriting memory past the end of a sockaddr_dl with, e.g., memcpy(LLADDR(), ...). Use sockaddr_dl_setaddr() in a few places. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.34 2007/03/04 06:03:16 christos Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.34 2007/03/04 06:03:16 christos Exp $"); d101 2 a102 1 struct ieee1394_hwaddr *hwdst, *myaddr, baddr; d219 1 a219 1 myaddr = (struct ieee1394_hwaddr *)LLADDR(ifp->if_sadl); d399 1 a399 1 struct ieee1394_hwaddr *myaddr; d412 2 a413 1 myaddr = (struct ieee1394_hwaddr *)LLADDR(ifp->if_sadl); d697 2 a698 1 memcpy(LLADDR(ifp->if_sadl), hwaddr, ifp->if_addrlen); @ 1.35.2.1 log @sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.36 2007/08/30 02:17:35 dyoung Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.36 2007/08/30 02:17:35 dyoung Exp $"); d101 1 a101 2 struct ieee1394_hwaddr *hwdst, baddr; const struct ieee1394_hwaddr *myaddr; d218 1 a218 1 myaddr = (const struct ieee1394_hwaddr *)CLLADDR(ifp->if_sadl); d398 1 a398 1 const struct ieee1394_hwaddr *myaddr; d411 1 a411 2 myaddr = (const struct ieee1394_hwaddr *)CLLADDR(ifp->if_sadl); d695 1 a695 2 (void)sockaddr_dl_setaddr(ifp->if_sadl, ifp->if_sadl->sdl_len, hwaddr, ifp->if_addrlen); @ 1.35.2.2 log @sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.35.2.1 2007/11/06 23:33:32 matt Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.35.2.1 2007/11/06 23:33:32 matt Exp $"); d685 1 d696 3 a698 1 if_set_sadl(ifp, hwaddr, sizeof(struct ieee1394_hwaddr)); @ 1.35.2.3 log @sync with HEAD @ text @d1 1 a1 1 /* if_ieee1394subr.c,v 1.35.2.2 2008/01/09 01:57:11 matt Exp */ d40 1 a40 1 __KERNEL_RCSID(0, "if_ieee1394subr.c,v 1.35.2.2 2008/01/09 01:57:11 matt Exp"); d90 1 a90 1 static struct mbuf *ieee1394_reass(struct ifnet *, struct mbuf *, uint16_t); d96 1 a96 1 uint16_t etype = 0; d298 1 a298 1 uint16_t etype) d368 1 a368 1 ieee1394_input(struct ifnet *ifp, struct mbuf *m, uint16_t src) d371 1 a371 1 uint16_t etype; d456 1 a456 1 ieee1394_reass(struct ifnet *ifp, struct mbuf *m0, uint16_t src) d464 2 a465 2 uint16_t etype, off, ftype, size, dgl; uint32_t id; d668 1 a668 1 ieee1394_sprintf(const uint8_t *laddr) d768 2 a769 2 else if ((error = ifioctl_common(ifp, cmd, data)) == ENETRESET) error = 0; a771 2 case SIOCSIFCAP: return ifioctl_common(ifp, cmd, data); @ 1.34 log @Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.33 2007/02/17 22:34:08 dyoung Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.33 2007/02/17 22:34:08 dyoung Exp $"); d762 1 a762 1 LLADDR(ifp->if_sadl), IEEE1394_ADDR_LEN); @ 1.34.2.1 log @Sync with head. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.34 2007/03/04 06:03:16 christos Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.34 2007/03/04 06:03:16 christos Exp $"); d101 1 a101 2 struct ieee1394_hwaddr *hwdst, baddr; const struct ieee1394_hwaddr *myaddr; d218 1 a218 1 myaddr = (const struct ieee1394_hwaddr *)CLLADDR(ifp->if_sadl); d398 1 a398 1 const struct ieee1394_hwaddr *myaddr; d411 1 a411 2 myaddr = (const struct ieee1394_hwaddr *)CLLADDR(ifp->if_sadl); d695 1 a695 2 (void)sockaddr_dl_setaddr(ifp->if_sadl, ifp->if_sadl->sdl_len, hwaddr, ifp->if_addrlen); d762 1 a762 1 CLLADDR(ifp->if_sadl), IEEE1394_ADDR_LEN); @ 1.34.14.1 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.36 2007/08/30 02:17:35 dyoung Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.36 2007/08/30 02:17:35 dyoung Exp $"); d101 1 a101 2 struct ieee1394_hwaddr *hwdst, baddr; const struct ieee1394_hwaddr *myaddr; d218 1 a218 1 myaddr = (const struct ieee1394_hwaddr *)CLLADDR(ifp->if_sadl); d398 1 a398 1 const struct ieee1394_hwaddr *myaddr; d411 1 a411 2 myaddr = (const struct ieee1394_hwaddr *)CLLADDR(ifp->if_sadl); d695 1 a695 2 (void)sockaddr_dl_setaddr(ifp->if_sadl, ifp->if_sadl->sdl_len, hwaddr, ifp->if_addrlen); d762 1 a762 1 CLLADDR(ifp->if_sadl), IEEE1394_ADDR_LEN); @ 1.34.10.1 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.36 2007/08/30 02:17:35 dyoung Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.36 2007/08/30 02:17:35 dyoung Exp $"); d101 1 a101 2 struct ieee1394_hwaddr *hwdst, baddr; const struct ieee1394_hwaddr *myaddr; d218 1 a218 1 myaddr = (const struct ieee1394_hwaddr *)CLLADDR(ifp->if_sadl); d398 1 a398 1 const struct ieee1394_hwaddr *myaddr; d411 1 a411 2 myaddr = (const struct ieee1394_hwaddr *)CLLADDR(ifp->if_sadl); d695 1 a695 2 (void)sockaddr_dl_setaddr(ifp->if_sadl, ifp->if_sadl->sdl_len, hwaddr, ifp->if_addrlen); d762 1 a762 1 CLLADDR(ifp->if_sadl), IEEE1394_ADDR_LEN); @ 1.33 log @KNF: de-__P, bzero -> memset, bcmp -> memcmp. Remove extraneous parentheses in return statements. Cosmetic: don't open-code TAILQ_FOREACH(). Cosmetic: change types of variables to avoid oodles of casts: in in6_src.c, avoid casts by changing several route_in6 pointers to struct route pointers. Remove unnecessary casts to caddr_t elsewhere. Pave the way for eliminating address family-specific route caches: soon, struct route will not embed a sockaddr, but it will hold a reference to an external sockaddr, instead. We will set the destination sockaddr using rtcache_setdst(). (I created a stub for it, but it isn't used anywhere, yet.) rtcache_free() will free the sockaddr. I have extracted from rtcache_free() a helper subroutine, rtcache_clear(). rtcache_clear() will "forget" a cached route, but it will not forget the destination by releasing the sockaddr. I use rtcache_clear() instead of rtcache_free() in rtcache_update(), because rtcache_update() is not supposed to forget the destination. Constify: 1 Introduce const accessor for route->ro_dst, rtcache_getdst(). 2 Constify the 'dst' argument to ifnet->if_output(). This led me to constify a lot of code called by output routines. 3 Constify the sockaddr argument to protosw->pr_ctlinput. This led me to constify a lot of code called by ctlinput routines. 4 Introduce const macros for converting from a generic sockaddr to family-specific sockaddrs, e.g., sockaddr_in: satocsin6, satocsin, et cetera. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.32 2006/06/07 22:33:42 kardel Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.32 2006/06/07 22:33:42 kardel Exp $"); d725 1 a725 1 ieee1394_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) @ 1.32 log @merge FreeBSD timecounters from branch simonb-timecounters - struct timeval time is gone time.tv_sec -> time_second - struct timeval mono_time is gone mono_time.tv_sec -> time_uptime - access to time via {get,}{micro,nano,bin}time() get* versions are fast but less precise - support NTP nanokernel implementation (NTP API 4) - further reading: Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.31 2005/12/11 12:24:51 christos Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.31 2005/12/11 12:24:51 christos Exp $"); d88 2 a89 2 static int ieee1394_output(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); d93 1 a93 1 ieee1394_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, d197 2 a198 2 if (unicast && (!nd6_storelladdr(ifp, rt, m0, dst, (u_char *)hwdst))) { @ 1.32.12.1 log @- sync with head. - move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.32 2006/06/07 22:33:42 kardel Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.32 2006/06/07 22:33:42 kardel Exp $"); d88 2 a89 2 static int ieee1394_output(struct ifnet *, struct mbuf *, const struct sockaddr *, struct rtentry *); d93 1 a93 1 ieee1394_output(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst, d197 2 a198 2 if (unicast && (!nd6_storelladdr(ifp, rt, m0, dst, hwdst->iha_uid, IEEE1394_ADDR_LEN))) { @ 1.32.12.2 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.32.12.1 2007/02/27 16:54:43 yamt Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.32.12.1 2007/02/27 16:54:43 yamt Exp $"); d725 1 a725 1 ieee1394_ioctl(struct ifnet *ifp, u_long cmd, void *data) @ 1.31 log @merge ktrace-lwp. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.23.2.6 2005/11/10 14:10:32 skrll Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.23.2.6 2005/11/10 14:10:32 skrll Exp $"); d142 1 a142 1 time.tv_sec < rt->rt_rmx.rmx_expire) @ 1.31.4.1 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.32 2006/06/07 22:33:42 kardel Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.32 2006/06/07 22:33:42 kardel Exp $"); d142 1 a142 1 time_second < rt->rt_rmx.rmx_expire) @ 1.31.8.1 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.31 2005/12/11 12:24:51 christos Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.31 2005/12/11 12:24:51 christos Exp $"); d142 1 a142 1 time_second < rt->rt_rmx.rmx_expire) @ 1.31.14.1 log @Sync with head. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.32 2006/06/07 22:33:42 kardel Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.32 2006/06/07 22:33:42 kardel Exp $"); d142 1 a142 1 time_second < rt->rt_rmx.rmx_expire) @ 1.31.6.1 log @Adapt for timecounters: mostly use get*time(), use bintime's for timeout calculations and use "time_second" instead of "time.tv_sec". @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.31 2005/12/11 12:24:51 christos Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.31 2005/12/11 12:24:51 christos Exp $"); d142 1 a142 1 time_second < rt->rt_rmx.rmx_expire) @ 1.30 log @Using DLT_APPLE_IP_OVER_IEEE1394. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.29 2005/07/11 15:37:05 kiyohara Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.29 2005/07/11 15:37:05 kiyohara Exp $"); @ 1.29 log @ieee1394 import from FreeBSD. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.28 2005/01/08 03:18:18 yamt Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.28 2005/01/08 03:18:18 yamt Exp $"); d218 1 d220 12 a231 3 /* XXX: emulate DLT_EN10MB */ if (ifp->if_bpf) bpf_mtap_et(ifp->if_bpf, etype, m0); a232 1 myaddr = (struct ieee1394_hwaddr *)LLADDR(ifp->if_sadl); d395 22 a416 3 /* XXX: emulate DLT_EN10MB */ if (ifp->if_bpf) bpf_mtap_et(ifp->if_bpf, iuh->iuh_etype, m); d705 2 a706 1 bpfattach(ifp, DLT_EN10MB, 14); /* XXX */ @ 1.28 log @constify broadcastaddr. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.27 2004/08/20 07:46:21 tron Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.27 2004/08/20 07:46:21 tron Exp $"); d77 7 d90 1 a90 2 static void ieee1394_input(struct ifnet *, struct mbuf *); static struct mbuf *ieee1394_reass(struct ifnet *, struct mbuf *); d101 1 a101 1 struct ieee1394_hwaddr hwdst, *myaddr; d106 2 d152 27 d182 1 a182 3 if (m0->m_flags & (M_BCAST | M_MCAST)) memcpy(&hwdst, ifp->if_broadcastaddr, sizeof(hwdst)); else if (!arpresolve(ifp, rt, m0, dst, (u_char *)&hwdst)) a190 1 memcpy(&hwdst, ifp->if_broadcastaddr, sizeof(hwdst)); d197 2 a198 3 if (m0->m_flags & M_MCAST) memcpy(&hwdst, ifp->if_broadcastaddr, sizeof(hwdst)); else if (!nd6_storelladdr(ifp, rt, m0, dst, (u_char *)&hwdst)) { d225 2 a226 1 memcmp(&hwdst, myaddr, IEEE1394_ADDR_LEN) == 0) d235 1 a235 1 if (m0->m_flags & (M_BCAST | M_MCAST)) { d237 1 a237 1 hwdst.iha_speed = 0; /* XXX */ a239 8 if (hwdst.iha_speed > myaddr->iha_speed) hwdst.iha_speed = myaddr->iha_speed; if (hwdst.iha_maxrec > myaddr->iha_maxrec) hwdst.iha_maxrec = myaddr->iha_maxrec; if (hwdst.iha_maxrec > (8 + hwdst.iha_speed)) hwdst.iha_maxrec = 8 + hwdst.iha_speed; if (hwdst.iha_maxrec < 8) hwdst.iha_maxrec = 8; d241 10 a250 1 m0 = ieee1394_fragment(ifp, m0, (2<m_len < sizeof(*ih) + sizeof(*iuh)) { if ((m = m_pullup(m, sizeof(*ih) + sizeof(*iuh))) == NULL) d374 1 a374 2 ih = mtod(m, struct ieee1394_header *); iuh = (struct ieee1394_unfraghdr *)&ih[1]; d377 1 a377 1 if ((m = ieee1394_reass(ifp, m)) == NULL) d379 1 a379 2 ih = mtod(m, struct ieee1394_header *); iuh = (struct ieee1394_unfraghdr *)&ih[1]; d384 1 a384 1 m_adj(m, sizeof(*ih) + sizeof(*iuh)); d426 1 a426 1 ieee1394_reass(struct ifnet *ifp, struct mbuf *m0) a428 1 struct ieee1394_header *ih; d434 2 a435 1 u_int16_t off, ftype, size, dgl; d437 2 a438 2 if (m0->m_len < sizeof(*ih) + sizeof(*ifh)) { if ((m0 = m_pullup(m0, sizeof(*ih) + sizeof(*ifh))) == NULL) d441 2 a442 3 ih = mtod(m0, struct ieee1394_header *); ifh = (struct ieee1394_fraghdr *)&ih[1]; m_adj(m0, sizeof(*ih) + sizeof(*ifh)); d446 1 a446 1 dgl = ifh->ifh_dgl; d448 1 d452 1 d454 2 a455 1 } else d457 1 d469 1 a469 1 memcpy(rq->rq_uid, ih->ih_uid, IEEE1394_ADDR_LEN); d474 1 a474 1 if (memcmp(rq->rq_uid, ih->ih_uid, IEEE1394_ADDR_LEN) == 0) d531 1 d554 1 a554 1 M_PREPEND(m0, sizeof(*ih) + sizeof(*iuh), M_DONTWAIT); d556 1 a556 3 ih = mtod(m0, struct ieee1394_header *); iuh = (struct ieee1394_unfraghdr *)&ih[1]; memcpy(ih, &rp->rp_hdr, sizeof(*ih)); a572 1 memcpy(&trp->rp_hdr, ih, sizeof(*ih)); d574 1 a574 1 trp->rp_etype = ifh->ifh_etype_off; /* valid only if off==0 */ a659 1 ifp->if_input = ieee1394_input; a742 23 case SIOCSIFFLAGS: #if __NetBSD_Version__ >= 105080000 if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) == IFF_RUNNING) (*ifp->if_stop)(ifp, 1); else if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) == IFF_UP) error = (*ifp->if_init)(ifp); else if ((ifp->if_flags & IFF_UP) != 0) error = (*ifp->if_init)(ifp); #else if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) == IFF_RUNNING) fw_stop(ifp, 1); else if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) == IFF_UP) error = fw_init(ifp); else if ((ifp->if_flags & IFF_UP) != 0) error = fw_init(ifp); #endif break; case SIOCADDMULTI: case SIOCDELMULTI: /* nothing to do */ break; @ 1.28.10.1 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.28 2005/01/08 03:18:18 yamt Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.28 2005/01/08 03:18:18 yamt Exp $"); a76 7 #include #include #include #include #include d83 2 a84 1 static struct mbuf *ieee1394_reass(struct ifnet *, struct mbuf *, u_int16_t); d95 1 a95 1 struct ieee1394_hwaddr *hwdst, *myaddr, baddr; a99 2 struct m_tag *mtag; int unicast; d134 1 a134 1 time_second < rt->rt_rmx.rmx_expire) a143 27 /* * For unicast, we make a tag to store the lladdr of the * destination. This might not be the first time we have seen * the packet (for instance, the arp code might be trying to * re-send it after receiving an arp reply) so we only * allocate a tag if there isn't one there already. For * multicast, we will eventually use a different tag to store * the channel number. */ unicast = !(m0->m_flags & (M_BCAST | M_MCAST)); if (unicast) { mtag = m_tag_locate(m0, MTAG_FIREWIRE, MTAG_FIREWIRE_HWADDR, NULL); if (!mtag) { mtag = m_tag_alloc(MTAG_FIREWIRE, MTAG_FIREWIRE_HWADDR, sizeof (struct ieee1394_hwaddr), M_NOWAIT); if (!mtag) { error = ENOMEM; goto bad; } m_tag_prepend(m0, mtag); } hwdst = (struct ieee1394_hwaddr *)(mtag + 1); } else { hwdst = &baddr; } d147 3 a149 1 if (unicast && (!arpresolve(ifp, rt, m0, dst, (u_char *)hwdst))) d158 1 d165 3 a167 2 if (unicast && (!nd6_storelladdr(ifp, rt, m0, dst, (u_char *)hwdst))) { a186 1 myaddr = (struct ieee1394_hwaddr *)LLADDR(ifp->if_sadl); d188 3 a190 12 if (ifp->if_bpf) { struct ieee1394_bpfhdr h; if (unicast) memcpy(h.ibh_dhost, hwdst->iha_uid, 8); else memcpy(h.ibh_dhost, ((const struct ieee1394_hwaddr *) ifp->if_broadcastaddr)->iha_uid, 8); memcpy(h.ibh_shost, myaddr->iha_uid, 8); h.ibh_type = etype; bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m0); } d192 1 d194 1 a194 2 unicast && memcmp(hwdst, myaddr, IEEE1394_ADDR_LEN) == 0) d203 1 a203 1 if (unicast) { d205 1 a205 1 hwdst->iha_speed = 0; /* XXX */ d208 8 d217 1 a217 10 if (hwdst->iha_speed > myaddr->iha_speed) hwdst->iha_speed = myaddr->iha_speed; if (hwdst->iha_maxrec > myaddr->iha_maxrec) hwdst->iha_maxrec = myaddr->iha_maxrec; if (hwdst->iha_maxrec > (8 + hwdst->iha_speed)) hwdst->iha_maxrec = 8 + hwdst->iha_speed; if (hwdst->iha_maxrec < 8) hwdst->iha_maxrec = 8; m0 = ieee1394_fragment(ifp, m0, (2<iha_maxrec) - hdrlen, etype); d227 1 d232 1 d326 2 a327 2 void ieee1394_input(struct ifnet *ifp, struct mbuf *m, u_int16_t src) d332 1 d339 2 a340 2 if (m->m_len < sizeof(*iuh)) { if ((m = m_pullup(m, sizeof(*iuh))) == NULL) d344 2 a345 1 iuh = mtod(m, struct ieee1394_unfraghdr *); d348 1 a348 1 if ((m = ieee1394_reass(ifp, m, src)) == NULL) d350 2 a351 1 iuh = mtod(m, struct ieee1394_unfraghdr *); d356 1 a356 1 m_adj(m, sizeof(*iuh)); d358 3 a360 22 if (ifp->if_bpf) { struct ieee1394_bpfhdr h; struct m_tag *mtag; struct ieee1394_hwaddr *myaddr; mtag = m_tag_locate(m, MTAG_FIREWIRE, MTAG_FIREWIRE_SENDER_EUID, 0); if (mtag) memcpy(h.ibh_shost, mtag + 1, 8); else memset(h.ibh_shost, 0, 8); if (m->m_flags & M_BCAST) memcpy(h.ibh_dhost, ((const struct ieee1394_hwaddr *) ifp->if_broadcastaddr)->iha_uid, 8); else { myaddr = (struct ieee1394_hwaddr *)LLADDR(ifp->if_sadl); memcpy(h.ibh_dhost, myaddr->iha_uid, 8); } h.ibh_type = htons(etype); bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m); } d398 1 a398 1 ieee1394_reass(struct ifnet *ifp, struct mbuf *m0, u_int16_t src) d401 1 d407 1 a407 2 u_int16_t etype, off, ftype, size, dgl; u_int32_t id; d409 2 a410 2 if (m0->m_len < sizeof(*ifh)) { if ((m0 = m_pullup(m0, sizeof(*ifh))) == NULL) d413 3 a415 2 ifh = mtod(m0, struct ieee1394_fraghdr *); m_adj(m0, sizeof(*ifh)); d419 1 a419 1 dgl = ntohs(ifh->ifh_dgl); a420 1 id = dgl | (src << 16); a423 1 etype = 0; d425 1 a425 2 } else { etype = ifh->ifh_etype_off; a426 1 } d438 1 a438 1 rq->fr_id = id; d443 1 a443 1 if (rq->fr_id == id) a499 1 rp->rp_etype = etype; /* over writing trust etype */ d522 1 a522 1 M_PREPEND(m0, sizeof(*iuh), M_DONTWAIT); d524 3 a526 1 iuh = mtod(m0, struct ieee1394_unfraghdr *); d543 1 d545 1 a545 1 trp->rp_etype = etype; /* valid only if off==0 */ d631 1 d649 1 a649 2 bpfattach(ifp, DLT_APPLE_IP_OVER_IEEE1394, sizeof(struct ieee1394_hwaddr)); d715 23 @ 1.28.10.2 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.28.10.1 2006/06/21 15:10:27 yamt Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.28.10.1 2006/06/21 15:10:27 yamt Exp $"); d88 2 a89 2 static int ieee1394_output(struct ifnet *, struct mbuf *, const struct sockaddr *, struct rtentry *); d93 1 a93 1 ieee1394_output(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst, d197 2 a198 2 if (unicast && (!nd6_storelladdr(ifp, rt, m0, dst, hwdst->iha_uid, IEEE1394_ADDR_LEN))) { @ 1.28.10.3 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.28.10.2 2007/02/26 09:11:34 yamt Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.28.10.2 2007/02/26 09:11:34 yamt Exp $"); d101 1 a101 2 struct ieee1394_hwaddr *hwdst, baddr; const struct ieee1394_hwaddr *myaddr; d218 1 a218 1 myaddr = (const struct ieee1394_hwaddr *)CLLADDR(ifp->if_sadl); d398 1 a398 1 const struct ieee1394_hwaddr *myaddr; d411 1 a411 2 myaddr = (const struct ieee1394_hwaddr *)CLLADDR(ifp->if_sadl); d695 1 a695 2 (void)sockaddr_dl_setaddr(ifp->if_sadl, ifp->if_sadl->sdl_len, hwaddr, ifp->if_addrlen); d725 1 a725 1 ieee1394_ioctl(struct ifnet *ifp, u_long cmd, void *data) d762 1 a762 1 CLLADDR(ifp->if_sadl), IEEE1394_ADDR_LEN); @ 1.28.10.4 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.28.10.3 2007/09/03 14:42:08 yamt Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.28.10.3 2007/09/03 14:42:08 yamt Exp $"); d685 1 d696 3 a698 1 if_set_sadl(ifp, hwaddr, sizeof(struct ieee1394_hwaddr)); @ 1.28.10.5 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.28.10.4 2008/01/21 09:47:04 yamt Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.28.10.4 2008/01/21 09:47:04 yamt Exp $"); d768 2 a769 2 else if ((error = ifioctl_common(ifp, cmd, data)) == ENETRESET) error = 0; a771 2 case SIOCSIFCAP: return ifioctl_common(ifp, cmd, data); @ 1.28.10.6 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.28.10.5 2008/02/11 14:59:59 yamt Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.28.10.5 2008/02/11 14:59:59 yamt Exp $"); d90 1 a90 1 static struct mbuf *ieee1394_reass(struct ifnet *, struct mbuf *, uint16_t); d96 1 a96 1 uint16_t etype = 0; d298 1 a298 1 uint16_t etype) d368 1 a368 1 ieee1394_input(struct ifnet *ifp, struct mbuf *m, uint16_t src) d371 1 a371 1 uint16_t etype; d456 1 a456 1 ieee1394_reass(struct ifnet *ifp, struct mbuf *m0, uint16_t src) d464 2 a465 2 uint16_t etype, off, ftype, size, dgl; uint32_t id; d668 1 a668 1 ieee1394_sprintf(const uint8_t *laddr) @ 1.27 log @Pass correct "mbuf" pointer to BPF framework. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.26 2004/08/19 20:58:24 christos Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.26 2004/08/19 20:58:24 christos Exp $"); d641 1 a641 2 ifp->if_broadcastaddr = malloc(ifp->if_addrlen, M_DEVBUF, M_WAITOK); baddr = (struct ieee1394_hwaddr *)ifp->if_broadcastaddr; d646 1 d660 1 a660 1 free(ifp->if_broadcastaddr, M_DEVBUF); @ 1.26 log @Factor out the hand-crafting of mbufs from the interface files. Reviewed by gimpy. XXX: I could have used bpf_mtap2 on some of the new functions, but I chose not to, because I just wanted to do what amounts to a code move. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.25 2003/10/26 19:09:44 christos Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.25 2003/10/26 19:09:44 christos Exp $"); d190 1 a190 1 bpf_mtap_et(ifp->if_bpf, etype, m); @ 1.25 log @Fix uninitialized variable warnings.` @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.24 2003/10/03 20:56:11 itojun Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.24 2003/10/03 20:56:11 itojun Exp $"); d189 2 a190 13 if (ifp->if_bpf) { struct mbuf mb; mb.m_flags = 0; mb.m_next = m0; mb.m_len = 14; mb.m_data = mb.m_dat; ((u_int32_t *)mb.m_data)[0] = 0; ((u_int32_t *)mb.m_data)[1] = 0; ((u_int32_t *)mb.m_data)[2] = 0; ((u_int16_t *)mb.m_data)[6] = etype; bpf_mtap(ifp->if_bpf, &mb); } d359 2 a360 13 if (ifp->if_bpf) { struct mbuf mb; mb.m_flags = 0; mb.m_next = m; mb.m_len = 14; mb.m_data = mb.m_dat; ((u_int32_t *)mb.m_data)[0] = 0; ((u_int32_t *)mb.m_data)[1] = 0; ((u_int32_t *)mb.m_data)[2] = 0; ((u_int16_t *)mb.m_data)[6] = iuh->iuh_etype; bpf_mtap(ifp->if_bpf, &mb); } @ 1.24 log @when dropping M_PKTHDR, need to free m_tag associated with it. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.23 2003/05/23 10:06:18 itojun Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.23 2003/05/23 10:06:18 itojun Exp $"); d427 1 a427 1 struct ieee1394_reass_pkt *rp, *trp, *nrp; @ 1.23 log @don't call if_free_sadl() until very end of if_detach() logic. many of routing table manipulation code assumes the presense of AF_LINK sockaddr. should fix PR 21581 @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.22 2003/05/06 09:59:35 enami Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.22 2003/05/06 09:59:35 enami Exp $"); d444 1 @ 1.23.2.1 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.25 2003/10/26 19:09:44 christos Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.25 2003/10/26 19:09:44 christos Exp $"); d427 1 a427 1 struct ieee1394_reass_pkt *rp, *trp, *nrp = NULL; a443 1 m_tag_delete_chain(m0, NULL); @ 1.23.2.2 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.23.2.1 2004/08/03 10:54:14 skrll Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.23.2.1 2004/08/03 10:54:14 skrll Exp $"); d189 13 a201 2 if (ifp->if_bpf) bpf_mtap_et(ifp->if_bpf, etype, m0); d370 13 a382 2 if (ifp->if_bpf) bpf_mtap_et(ifp->if_bpf, iuh->iuh_etype, m); @ 1.23.2.3 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.27 2004/08/20 07:46:21 tron Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.27 2004/08/20 07:46:21 tron Exp $"); @ 1.23.2.4 log @Fix the sync with head I botched. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.23.2.2 2004/08/25 06:58:59 skrll Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.23.2.2 2004/08/25 06:58:59 skrll Exp $"); @ 1.23.2.5 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.23.2.4 2004/09/21 13:36:38 skrll Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.23.2.4 2004/09/21 13:36:38 skrll Exp $"); d641 2 a642 1 baddr = malloc(ifp->if_addrlen, M_DEVBUF, M_WAITOK); a646 1 ifp->if_broadcastaddr = (uint8_t *)baddr; d660 1 a660 1 free(__UNCONST(ifp->if_broadcastaddr), M_DEVBUF); @ 1.23.2.6 log @Sync with HEAD. Here we go again... @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.23.2.5 2005/01/17 19:32:38 skrll Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.23.2.5 2005/01/17 19:32:38 skrll Exp $"); a76 7 #include #include #include #include #include d83 2 a84 1 static struct mbuf *ieee1394_reass(struct ifnet *, struct mbuf *, u_int16_t); d95 1 a95 1 struct ieee1394_hwaddr *hwdst, *myaddr, baddr; a99 2 struct m_tag *mtag; int unicast; a143 27 /* * For unicast, we make a tag to store the lladdr of the * destination. This might not be the first time we have seen * the packet (for instance, the arp code might be trying to * re-send it after receiving an arp reply) so we only * allocate a tag if there isn't one there already. For * multicast, we will eventually use a different tag to store * the channel number. */ unicast = !(m0->m_flags & (M_BCAST | M_MCAST)); if (unicast) { mtag = m_tag_locate(m0, MTAG_FIREWIRE, MTAG_FIREWIRE_HWADDR, NULL); if (!mtag) { mtag = m_tag_alloc(MTAG_FIREWIRE, MTAG_FIREWIRE_HWADDR, sizeof (struct ieee1394_hwaddr), M_NOWAIT); if (!mtag) { error = ENOMEM; goto bad; } m_tag_prepend(m0, mtag); } hwdst = (struct ieee1394_hwaddr *)(mtag + 1); } else { hwdst = &baddr; } d147 3 a149 1 if (unicast && (!arpresolve(ifp, rt, m0, dst, (u_char *)hwdst))) d158 1 d165 3 a167 2 if (unicast && (!nd6_storelladdr(ifp, rt, m0, dst, (u_char *)hwdst))) { a186 1 myaddr = (struct ieee1394_hwaddr *)LLADDR(ifp->if_sadl); d188 3 a190 12 if (ifp->if_bpf) { struct ieee1394_bpfhdr h; if (unicast) memcpy(h.ibh_dhost, hwdst->iha_uid, 8); else memcpy(h.ibh_dhost, ((const struct ieee1394_hwaddr *) ifp->if_broadcastaddr)->iha_uid, 8); memcpy(h.ibh_shost, myaddr->iha_uid, 8); h.ibh_type = etype; bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m0); } d192 1 d194 1 a194 2 unicast && memcmp(hwdst, myaddr, IEEE1394_ADDR_LEN) == 0) d203 1 a203 1 if (unicast) { d205 1 a205 1 hwdst->iha_speed = 0; /* XXX */ d208 8 d217 1 a217 10 if (hwdst->iha_speed > myaddr->iha_speed) hwdst->iha_speed = myaddr->iha_speed; if (hwdst->iha_maxrec > myaddr->iha_maxrec) hwdst->iha_maxrec = myaddr->iha_maxrec; if (hwdst->iha_maxrec > (8 + hwdst->iha_speed)) hwdst->iha_maxrec = 8 + hwdst->iha_speed; if (hwdst->iha_maxrec < 8) hwdst->iha_maxrec = 8; m0 = ieee1394_fragment(ifp, m0, (2<iha_maxrec) - hdrlen, etype); d227 1 d232 1 d326 2 a327 2 void ieee1394_input(struct ifnet *ifp, struct mbuf *m, u_int16_t src) d332 1 d339 2 a340 2 if (m->m_len < sizeof(*iuh)) { if ((m = m_pullup(m, sizeof(*iuh))) == NULL) d344 2 a345 1 iuh = mtod(m, struct ieee1394_unfraghdr *); d348 1 a348 1 if ((m = ieee1394_reass(ifp, m, src)) == NULL) d350 2 a351 1 iuh = mtod(m, struct ieee1394_unfraghdr *); d356 1 a356 1 m_adj(m, sizeof(*iuh)); d358 3 a360 22 if (ifp->if_bpf) { struct ieee1394_bpfhdr h; struct m_tag *mtag; struct ieee1394_hwaddr *myaddr; mtag = m_tag_locate(m, MTAG_FIREWIRE, MTAG_FIREWIRE_SENDER_EUID, 0); if (mtag) memcpy(h.ibh_shost, mtag + 1, 8); else memset(h.ibh_shost, 0, 8); if (m->m_flags & M_BCAST) memcpy(h.ibh_dhost, ((const struct ieee1394_hwaddr *) ifp->if_broadcastaddr)->iha_uid, 8); else { myaddr = (struct ieee1394_hwaddr *)LLADDR(ifp->if_sadl); memcpy(h.ibh_dhost, myaddr->iha_uid, 8); } h.ibh_type = htons(etype); bpf_mtap2(ifp->if_bpf, &h, sizeof(h), m); } d398 1 a398 1 ieee1394_reass(struct ifnet *ifp, struct mbuf *m0, u_int16_t src) d401 1 d407 1 a407 2 u_int16_t etype, off, ftype, size, dgl; u_int32_t id; d409 2 a410 2 if (m0->m_len < sizeof(*ifh)) { if ((m0 = m_pullup(m0, sizeof(*ifh))) == NULL) d413 3 a415 2 ifh = mtod(m0, struct ieee1394_fraghdr *); m_adj(m0, sizeof(*ifh)); d419 1 a419 1 dgl = ntohs(ifh->ifh_dgl); a420 1 id = dgl | (src << 16); a423 1 etype = 0; d425 1 a425 2 } else { etype = ifh->ifh_etype_off; a426 1 } d438 1 a438 1 rq->fr_id = id; d443 1 a443 1 if (rq->fr_id == id) a499 1 rp->rp_etype = etype; /* over writing trust etype */ d522 1 a522 1 M_PREPEND(m0, sizeof(*iuh), M_DONTWAIT); d524 3 a526 1 iuh = mtod(m0, struct ieee1394_unfraghdr *); d543 1 d545 1 a545 1 trp->rp_etype = etype; /* valid only if off==0 */ d631 1 d649 1 a649 2 bpfattach(ifp, DLT_APPLE_IP_OVER_IEEE1394, sizeof(struct ieee1394_hwaddr)); d715 23 @ 1.22 log @Initialize mb.m_data. @ text @d1 1 a1 1 /* $NetBSD$ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD$"); d683 1 d685 1 @ 1.21 log @bpf_mtap() does not care about M_PKTHDR at the top. M_COPY_PKTHDR has some consequences, so avoid it. if we need to attach dummy headers, we should use M_PREPEND instead. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.20 2003/05/01 07:41:59 itojun Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.20 2003/05/01 07:41:59 itojun Exp $"); d195 1 d376 1 @ 1.20 log @don't be too verbose on nd6_storelladdr failure @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.19 2002/09/26 13:06:56 onoe Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.19 2002/09/26 13:06:56 onoe Exp $"); d192 1 a192 1 M_COPY_PKTHDR(&mb, m0); a198 1 mb.m_pkthdr.len += mb.m_len; d372 1 a372 1 M_COPY_PKTHDR(&mb, m); a378 1 mb.m_pkthdr.len += mb.m_len; @ 1.19 log @initialize pkthdr for dummy mbuf before calling bpf_mtap(). @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.18 2002/06/25 03:42:28 onoe Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.18 2002/06/25 03:42:28 onoe Exp $"); d168 1 a168 2 /* this must be impossible, so we bark */ printf("ieee1394_output: nd6_storelladdr failed\n"); @ 1.18 log @Fill ar_hrd for AF_ARP. @ text @d1 1 a1 1 /* $NetBSD$ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD$"); d193 1 a195 1 mb.m_data = mb.m_dat; d200 1 d374 1 a376 1 mb.m_data = mb.m_dat; d381 1 @ 1.17 log @Actually inject the arp packet into softintr queue. @ text @d97 3 d142 1 a142 1 IFQ_CLASSIFY(&ifp->if_snd, m, dst->sa_family, &pktattr); d157 1 d159 1 @ 1.16 log @integrate IEEE1394 ARP into generic ARP logic. XXX there's no check at all in ar_hrd, and we don't set ar_hrd on outgoing. it seems like a bad thing. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.15 2002/05/16 09:08:33 haya Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.15 2002/05/16 09:08:33 haya Exp $"); d389 1 a389 1 return; @ 1.15 log @Bugfix: s/__NetBSD_Version/__NetBSD_Version__/. IPv4 over IEEE 1394 will work with this change. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.14 2002/03/05 04:13:01 itojun Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.14 2002/03/05 04:13:01 itojun Exp $"); d69 1 a69 1 #include a95 3 #ifdef INET struct ieee1394_arphdr *ah; #endif /* INET */ d146 1 a146 1 else if (!ieee1394arpresolve(ifp, rt, m0, dst, &hwdst)) a153 1 ah = mtod(m0, struct ieee1394_arphdr *); d387 2 a388 1 in_ieee1394arpinput(m); d703 1 a703 1 ieee1394arp_ifinit(ifp, ifa); @ 1.15.2.1 log @Pull up revision 1.23 (requested by itojun in ticket #1325): don't call if_free_sadl() until very end of if_detach() logic. many of routing table manipulation code assumes the presense of AF_LINK sockaddr. should fix PR 21581 @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.15 2002/05/16 09:08:33 haya Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.15 2002/05/16 09:08:33 haya Exp $"); a679 1 #if 0 /* done in if_detach() */ a680 1 #endif @ 1.14 log @bring in latest ALTQ from kjc. ALTQify some of the drivers. @ text @d1 1 a1 1 /* $NetBSD$ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD$"); d689 1 a689 1 #if __NetBSD_Version < 105080000 d700 1 a700 1 #if __NetBSD_Version >= 105080000 d710 1 a710 1 #if __NetBSD_Version >= 105080000 d732 1 a732 1 #if __NetBSD_Version >= 105080000 @ 1.14.6.1 log @Catch up with -current. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.15 2002/05/16 09:08:33 haya Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.15 2002/05/16 09:08:33 haya Exp $"); d689 1 a689 1 #if __NetBSD_Version__ < 105080000 d700 1 a700 1 #if __NetBSD_Version__ >= 105080000 d710 1 a710 1 #if __NetBSD_Version__ >= 105080000 d732 1 a732 1 #if __NetBSD_Version__ >= 105080000 @ 1.14.6.2 log @catch up with -current. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.18 2002/06/25 03:42:28 onoe Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.18 2002/06/25 03:42:28 onoe Exp $"); d69 1 a69 1 #include a95 1 ALTQ_DECL(struct altq_pktattr pktattr;) d97 1 a97 1 struct arphdr *ah; d99 1 d142 1 a142 1 IFQ_CLASSIFY(&ifp->if_snd, m0, dst->sa_family, &pktattr); d149 1 a149 1 else if (!arpresolve(ifp, rt, m0, dst, (u_char *)&hwdst)) d157 1 a157 1 ah = mtod(m0, struct arphdr *); a158 1 ah->ar_hrd = htons(ARPHRD_IEEE1394); d391 2 a392 3 schednetisr(NETISR_ARP); inq = &arpintrq; break; d706 1 a706 1 arp_ifinit(ifp, ifa); @ 1.13 log @don't need when including @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.12 2001/11/12 23:49:39 lukem Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.12 2001/11/12 23:49:39 lukem Exp $"); d99 1 a99 4 /* * XXX ALTQ */ d137 7 a231 5 if (IF_QFULL(&ifp->if_snd)) { IF_DROP(&ifp->if_snd); splx(s); senderr(ENOBUFS); } d243 6 a248 1 IF_ENQUEUE(&ifp->if_snd, m); @ 1.12 log @add RCSIDs @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.11 2001/06/14 05:44:24 itojun Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD$"); a46 1 #include @ 1.11 log @change the meaning of ifnet.if_lastchange to meet RFC1573 ifLastChange. follows BSD/OS practice and ucd-snmp code (FreeBSD does it for specific interfaces only). was: if_lastchange get updated on every packet transmission/receipt. now: if_lastchange get updated when IFF_UP is changed. @ text @d1 1 a1 1 /* $NetBSD$ */ d38 3 @ 1.11.2.1 log @Sync kqueue branch with -current. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.13 2001/11/15 09:48:25 lukem Exp $ */ a38 3 #include __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.13 2001/11/15 09:48:25 lukem Exp $"); d44 1 @ 1.11.2.2 log @Catch up with -current. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.11.2.1 2002/01/10 20:02:06 thorpej Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.11.2.1 2002/01/10 20:02:06 thorpej Exp $"); d99 4 a102 1 ALTQ_DECL(struct altq_pktattr pktattr;) a139 7 /* * If the queueing discipline needs packet classification, * do it before prepending link headers. */ IFQ_CLASSIFY(&ifp->if_snd, m, dst->sa_family, &pktattr); d228 5 d244 1 a244 6 IFQ_ENQUEUE(&ifp->if_snd, m, &pktattr, error); if (error) { /* mbuf is already freed */ splx(s); goto bad; } @ 1.11.2.3 log @catch up with -current on kqueue branch @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.11.2.2 2002/03/16 16:02:05 jdolecek Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.11.2.2 2002/03/16 16:02:05 jdolecek Exp $"); d689 1 a689 1 #if __NetBSD_Version__ < 105080000 d700 1 a700 1 #if __NetBSD_Version__ >= 105080000 d710 1 a710 1 #if __NetBSD_Version__ >= 105080000 d732 1 a732 1 #if __NetBSD_Version__ >= 105080000 @ 1.11.2.4 log @sync kqueue branch with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.11.2.3 2002/06/23 17:50:25 jdolecek Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.11.2.3 2002/06/23 17:50:25 jdolecek Exp $"); d69 1 a69 1 #include a95 1 ALTQ_DECL(struct altq_pktattr pktattr;) d97 1 a97 1 struct arphdr *ah; d99 1 d142 1 a142 1 IFQ_CLASSIFY(&ifp->if_snd, m0, dst->sa_family, &pktattr); d149 1 a149 1 else if (!arpresolve(ifp, rt, m0, dst, (u_char *)&hwdst)) d157 1 a157 1 ah = mtod(m0, struct arphdr *); a158 1 ah->ar_hrd = htons(ARPHRD_IEEE1394); d391 2 a392 3 schednetisr(NETISR_ARP); inq = &arpintrq; break; d706 1 a706 1 arp_ifinit(ifp, ifa); @ 1.11.2.5 log @sync kqueue with -current; this includes merge of gehenna-devsw branch, merge of i386 MP branch, and part of autoconf rototil work @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.11.2.4 2002/09/06 08:48:52 jdolecek Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.11.2.4 2002/09/06 08:48:52 jdolecek Exp $"); a192 1 M_COPY_PKTHDR(&mb, m0); d195 1 a199 1 mb.m_pkthdr.len += mb.m_len; a372 1 M_COPY_PKTHDR(&mb, m); d375 1 a379 1 mb.m_pkthdr.len += mb.m_len; @ 1.10 log @Remove the use of splimp() from the NetBSD kernel. splnet() and only splnet() is allowed for the protection of data structures used by network devices. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.9 2001/01/17 19:08:59 thorpej Exp $ */ a103 1 ifp->if_lastchange = time; @ 1.9 log @Correct last commit. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.8 2001/01/17 18:44:14 jdolecek Exp $ */ d226 1 a226 1 s = splimp(); d402 1 a402 1 s = splimp(); @ 1.9.2.1 log @Catch up to -current. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.9 2001/01/17 19:08:59 thorpej Exp $ */ d104 1 d226 1 a226 1 s = splnet(); d402 1 a402 1 s = splnet(); @ 1.9.2.2 log @Catch up to -current. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.9.2.1 2001/06/21 20:08:05 nathanw Exp $ */ a37 3 #include __KERNEL_RCSID(0, "$NetBSD$"); @ 1.9.2.3 log @Catch up to -current. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.9.2.2 2001/11/14 19:17:22 nathanw Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.9.2.2 2001/11/14 19:17:22 nathanw Exp $"); d47 1 @ 1.9.2.4 log @Catch up to -current. (CVS: It's not just a program. It's an adventure!) @ text @d1 1 a1 1 /* $NetBSD$ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD$"); d99 4 a102 1 ALTQ_DECL(struct altq_pktattr pktattr;) a139 7 /* * If the queueing discipline needs packet classification, * do it before prepending link headers. */ IFQ_CLASSIFY(&ifp->if_snd, m, dst->sa_family, &pktattr); d228 5 d244 1 a244 6 IFQ_ENQUEUE(&ifp->if_snd, m, &pktattr, error); if (error) { /* mbuf is already freed */ splx(s); goto bad; } @ 1.9.2.5 log @Catch up to -current. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.9.2.4 2002/04/01 07:48:21 nathanw Exp $ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.9.2.4 2002/04/01 07:48:21 nathanw Exp $"); d689 1 a689 1 #if __NetBSD_Version__ < 105080000 d700 1 a700 1 #if __NetBSD_Version__ >= 105080000 d710 1 a710 1 #if __NetBSD_Version__ >= 105080000 d732 1 a732 1 #if __NetBSD_Version__ >= 105080000 @ 1.9.2.6 log @Catch up to -current. @ text @d1 1 a1 1 /* $NetBSD$ */ d40 1 a40 1 __KERNEL_RCSID(0, "$NetBSD$"); d69 1 a69 1 #include a95 1 ALTQ_DECL(struct altq_pktattr pktattr;) d97 1 a97 1 struct arphdr *ah; d99 1 d142 1 a142 1 IFQ_CLASSIFY(&ifp->if_snd, m0, dst->sa_family, &pktattr); d149 1 a149 1 else if (!arpresolve(ifp, rt, m0, dst, (u_char *)&hwdst)) d157 1 a157 1 ah = mtod(m0, struct arphdr *); a158 1 ah->ar_hrd = htons(ARPHRD_IEEE1394); d391 2 a392 3 schednetisr(NETISR_ARP); inq = &arpintrq; break; d706 1 a706 1 arp_ifinit(ifp, ifa); @ 1.9.2.7 log @Catch up to -current. @ text @a192 1 M_COPY_PKTHDR(&mb, m0); d195 1 a199 1 mb.m_pkthdr.len += mb.m_len; a372 1 M_COPY_PKTHDR(&mb, m); d375 1 a379 1 mb.m_pkthdr.len += mb.m_len; @ 1.8 log @move local variable sdl from ieee1394_ifdetach() to ieee1394_ifattach(), so that this file is compilable after previous change XXX not tested @ text @d1 1 a1 1 /* $NetBSD$ */ a636 1 struct sockaddr_dl *sdl = ifp->if_sadl; d652 1 a652 1 memcpy(LLADDR(sdl), hwaddr, ifp->if_addrlen); @ 1.7 log @Fix a rather annoying problem where the sockaddr_dl which holds the link level name for the interface (ifp->if_sadl) is allocated before ifp->if_addrlen is initialized, which could lead to allocating too little space for the link level address. Do this by splitting allocation of the link level name out of if_attach() and into if_alloc_sadl(), which is normally called by functions like ether_ifattach(). Network interfaces which don't have a link-specific attach routine must call if_alloc_sadl() themselves (example: gif). Link level names are freed by if_free_sadl(), which can be called from e.g. ether_ifdetach(). Drivers never need call if_free_sadl() themselves as if_detach() will do it if it is not already done. While here, add the ability to pass an AF_LINK address to SIOCSIFADDR in ether_ioctl() (this is what caused me to notice the problem that the above fixes). @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.6 2000/12/18 19:44:34 thorpej Exp $ */ d637 1 a669 2 struct sockaddr_dl *sdl = ifp->if_sadl; @ 1.6 log @Fill in if_dlt. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.5 2000/12/13 22:07:51 thorpej Exp $ */ a634 1 struct sockaddr_dl *sdl; d650 4 a653 5 if ((sdl = ifp->if_sadl) && sdl->sdl_family == AF_LINK) { sdl->sdl_type = ifp->if_type; sdl->sdl_alen = ifp->if_addrlen; memcpy(LLADDR(sdl), hwaddr, ifp->if_addrlen); } a671 5 free(ifp->if_broadcastaddr, M_DEVBUF); ifp->if_broadcastaddr = NULL; memset(LLADDR(sdl), 0, sizeof(struct ieee1394_hwaddr)); sdl->sdl_alen = 0; sdl->sdl_type = 0; d675 3 @ 1.5 log @Add ALTQ glue. @ text @d1 1 a1 1 /* $NetBSD$ */ d642 1 @ 1.4 log @Adapt to bpfattach() changes, and further centralize the bpfattach() and bpfdetach() calls into link-type subroutines where possible. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.2 2000/11/14 11:14:56 onoe Exp $ */ d97 4 @ 1.3 log @Use DMA from mbuf instead of copy in transmit. Still use memcpy in receiving because we must use buffer fill mode and many packets may share single receive buffer. XXX: Workaround(?) for CXD3222: it fails to DMA for selfid packet according to code placement. I'm not sure about the reason (cache? timing? bug?). Fixed the bug: transmitter sometimes stop and OACTIVE bit of if_fw never be cleared. Fixed the bug: freeing free buffer. Enable ieee1394_drain and ieee1394_watchdog for loss of fragment. @ text @d658 3 d674 3 @ 1.3.2.1 log @file if_ieee1394subr.c was added on branch thorpej_scsipi on 2000-11-22 16:05:53 +0000 @ text @d1 750 @ 1.3.2.2 log @Sync with HEAD. @ text @a0 750 /* $NetBSD: if_ieee1394subr.c,v 1.3.2.1 2000/11/22 16:05:53 bouyer Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Atsushi Onoe. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include "opt_inet.h" #include "bpfilter.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if NBPFILTER > 0 #include #endif #ifdef INET #include #include #include #endif /* INET */ #ifdef INET6 #include #include #include #endif /* INET6 */ #define IEEE1394_REASS_TIMEOUT 3 /* 3 sec */ #define senderr(e) do { error = (e); goto bad; } while(0/*CONSTCOND*/) static int ieee1394_output(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); static void ieee1394_input(struct ifnet *, struct mbuf *); static struct mbuf *ieee1394_reass(struct ifnet *, struct mbuf *); static int ieee1394_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, struct rtentry *rt0) { u_int16_t etype = 0; struct mbuf *m; int s, hdrlen, error = 0; struct rtentry *rt; struct mbuf *mcopy = NULL; struct ieee1394_hwaddr hwdst, *myaddr; #ifdef INET struct ieee1394_arphdr *ah; #endif /* INET */ if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) senderr(ENETDOWN); ifp->if_lastchange = time; if ((rt = rt0) != NULL) { if ((rt->rt_flags & RTF_UP) == 0) { if ((rt0 = rt = rtalloc1(dst, 1)) != NULL) { rt->rt_refcnt--; if (rt->rt_ifp != ifp) return (*rt->rt_ifp->if_output) (ifp, m0, dst, rt); } else senderr(EHOSTUNREACH); } if (rt->rt_flags & RTF_GATEWAY) { if (rt->rt_gwroute == NULL) goto lookup; if (((rt = rt->rt_gwroute)->rt_flags & RTF_UP) == 0) { rtfree(rt); rt = rt0; lookup: rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1); if ((rt = rt->rt_gwroute) == NULL) senderr(EHOSTUNREACH); /* the "G" test below also prevents rt == rt0 */ if ((rt->rt_flags & RTF_GATEWAY) || (rt->rt_ifp != ifp)) { rt->rt_refcnt--; rt0->rt_gwroute = NULL; senderr(EHOSTUNREACH); } } } if (rt->rt_flags & RTF_REJECT) if (rt->rt_rmx.rmx_expire == 0 || time.tv_sec < rt->rt_rmx.rmx_expire) senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH); } switch (dst->sa_family) { #ifdef INET case AF_INET: if (m0->m_flags & (M_BCAST | M_MCAST)) memcpy(&hwdst, ifp->if_broadcastaddr, sizeof(hwdst)); else if (!ieee1394arpresolve(ifp, rt, m0, dst, &hwdst)) return 0; /* if not yet resolved */ /* if broadcasting on a simplex interface, loopback a copy */ if ((m0->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX)) mcopy = m_copy(m0, 0, M_COPYALL); etype = htons(ETHERTYPE_IP); break; case AF_ARP: ah = mtod(m0, struct ieee1394_arphdr *); memcpy(&hwdst, ifp->if_broadcastaddr, sizeof(hwdst)); etype = htons(ETHERTYPE_ARP); break; #endif /* INET */ #ifdef INET6 case AF_INET6: if (m0->m_flags & M_MCAST) memcpy(&hwdst, ifp->if_broadcastaddr, sizeof(hwdst)); else if (!nd6_storelladdr(ifp, rt, m0, dst, (u_char *)&hwdst)) { /* this must be impossible, so we bark */ printf("ieee1394_output: nd6_storelladdr failed\n"); return 0; } etype = htons(ETHERTYPE_IPV6); break; #endif /* INET6 */ case pseudo_AF_HDRCMPLT: case AF_UNSPEC: /* TODO? */ default: printf("%s: can't handle af%d\n", ifp->if_xname, dst->sa_family); senderr(EAFNOSUPPORT); break; } if (mcopy) looutput(ifp, mcopy, dst, rt); #if NBPFILTER > 0 /* XXX: emulate DLT_EN10MB */ if (ifp->if_bpf) { struct mbuf mb; mb.m_next = m0; mb.m_len = 14; mb.m_data = mb.m_dat; ((u_int32_t *)mb.m_data)[0] = 0; ((u_int32_t *)mb.m_data)[1] = 0; ((u_int32_t *)mb.m_data)[2] = 0; ((u_int16_t *)mb.m_data)[6] = etype; bpf_mtap(ifp->if_bpf, &mb); } #endif myaddr = (struct ieee1394_hwaddr *)LLADDR(ifp->if_sadl); if ((ifp->if_flags & IFF_SIMPLEX) && memcmp(&hwdst, myaddr, IEEE1394_ADDR_LEN) == 0) return looutput(ifp, m0, dst, rt); /* * XXX: * The maximum possible rate depends on the topology. * So the determination of maxrec and fragmentation should be * called from the driver after probing the topology map. */ if (m0->m_flags & (M_BCAST | M_MCAST)) { hdrlen = IEEE1394_GASP_LEN; hwdst.iha_speed = 0; /* XXX */ } else hdrlen = 0; if (hwdst.iha_speed > myaddr->iha_speed) hwdst.iha_speed = myaddr->iha_speed; if (hwdst.iha_maxrec > myaddr->iha_maxrec) hwdst.iha_maxrec = myaddr->iha_maxrec; if (hwdst.iha_maxrec > (8 + hwdst.iha_speed)) hwdst.iha_maxrec = 8 + hwdst.iha_speed; if (hwdst.iha_maxrec < 8) hwdst.iha_maxrec = 8; m0 = ieee1394_fragment(ifp, m0, (2<if_snd)) { IF_DROP(&ifp->if_snd); splx(s); senderr(ENOBUFS); } ifp->if_obytes += m0->m_pkthdr.len; if (m0->m_flags & M_MCAST) ifp->if_omcasts++; while ((m = m0) != NULL) { m0 = m->m_nextpkt; M_PREPEND(m, sizeof(struct ieee1394_header), M_DONTWAIT); if (m == NULL) { splx(s); senderr(ENOBUFS); } memcpy(mtod(m, caddr_t), &hwdst, sizeof(hwdst)); IF_ENQUEUE(&ifp->if_snd, m); } if ((ifp->if_flags & IFF_OACTIVE) == 0) (*ifp->if_start)(ifp); splx(s); return 0; bad: while (m0 != NULL) { m = m0->m_nextpkt; m_freem(m0); m0 = m; } return error; } struct mbuf * ieee1394_fragment(struct ifnet *ifp, struct mbuf *m0, int maxsize, u_int16_t etype) { struct ieee1394com *ic = (struct ieee1394com *)ifp; int totlen, fraglen, off; struct mbuf *m, **mp; struct ieee1394_fraghdr *ifh; struct ieee1394_unfraghdr *iuh; totlen = m0->m_pkthdr.len; if (totlen + sizeof(struct ieee1394_unfraghdr) <= maxsize) { M_PREPEND(m0, sizeof(struct ieee1394_unfraghdr), M_DONTWAIT); if (m0 == NULL) goto bad; iuh = mtod(m0, struct ieee1394_unfraghdr *); iuh->iuh_ft = 0; iuh->iuh_etype = etype; return m0; } fraglen = maxsize - sizeof(struct ieee1394_fraghdr); M_PREPEND(m0, sizeof(struct ieee1394_fraghdr), M_DONTWAIT); if (m0 == NULL) goto bad; ifh = mtod(m0, struct ieee1394_fraghdr *); ifh->ifh_ft_size = htons(IEEE1394_FT_MORE | (totlen - 1)); ifh->ifh_etype_off = etype; ifh->ifh_dgl = htons(ic->ic_dgl); ifh->ifh_reserved = 0; off = fraglen; mp = &m0->m_nextpkt; while (off < totlen) { if (off + fraglen > totlen) fraglen = totlen - off; MGETHDR(m, M_DONTWAIT, MT_HEADER); if (m == NULL) goto bad; m->m_flags |= m0->m_flags & (M_BCAST|M_MCAST); /* copy bcast */ MH_ALIGN(m, sizeof(struct ieee1394_fraghdr)); m->m_len = sizeof(struct ieee1394_fraghdr); ifh = mtod(m, struct ieee1394_fraghdr *); ifh->ifh_ft_size = htons(IEEE1394_FT_SUBSEQ | IEEE1394_FT_MORE | (totlen - 1)); ifh->ifh_etype_off = htons(off); ifh->ifh_dgl = htons(ic->ic_dgl); ifh->ifh_reserved = 0; m->m_next = m_copy(m0, sizeof(*ifh) + off, fraglen); if (m->m_next == NULL) goto bad; m->m_pkthdr.len = sizeof(*ifh) + fraglen; off += fraglen; *mp = m; mp = &m->m_nextpkt; } ifh->ifh_ft_size &= ~htons(IEEE1394_FT_MORE); /* last fragment */ m_adj(m0, -(m0->m_pkthdr.len - maxsize)); ic->ic_dgl++; return m0; bad: while ((m = m0) != NULL) { m0 = m->m_nextpkt; m->m_nextpkt = NULL; m_freem(m); } return NULL; } static void ieee1394_input(struct ifnet *ifp, struct mbuf *m) { struct ifqueue *inq; u_int16_t etype; int s; struct ieee1394_header *ih; struct ieee1394_unfraghdr *iuh; if ((ifp->if_flags & IFF_UP) == 0) { m_freem(m); return; } if (m->m_len < sizeof(*ih) + sizeof(*iuh)) { if ((m = m_pullup(m, sizeof(*ih) + sizeof(*iuh))) == NULL) return; } ih = mtod(m, struct ieee1394_header *); iuh = (struct ieee1394_unfraghdr *)&ih[1]; if (ntohs(iuh->iuh_ft) & (IEEE1394_FT_SUBSEQ | IEEE1394_FT_MORE)) { if ((m = ieee1394_reass(ifp, m)) == NULL) return; ih = mtod(m, struct ieee1394_header *); iuh = (struct ieee1394_unfraghdr *)&ih[1]; } etype = ntohs(iuh->iuh_etype); /* strip off the ieee1394 header */ m_adj(m, sizeof(*ih) + sizeof(*iuh)); #if NBPFILTER > 0 /* XXX: emulate DLT_EN10MB */ if (ifp->if_bpf) { struct mbuf mb; mb.m_next = m; mb.m_len = 14; mb.m_data = mb.m_dat; ((u_int32_t *)mb.m_data)[0] = 0; ((u_int32_t *)mb.m_data)[1] = 0; ((u_int32_t *)mb.m_data)[2] = 0; ((u_int16_t *)mb.m_data)[6] = iuh->iuh_etype; bpf_mtap(ifp->if_bpf, &mb); } #endif switch (etype) { #ifdef INET case ETHERTYPE_IP: schednetisr(NETISR_IP); inq = &ipintrq; break; case ETHERTYPE_ARP: in_ieee1394arpinput(m); return; #endif /* INET */ #ifdef INET6 case ETHERTYPE_IPV6: schednetisr(NETISR_IPV6); inq = &ip6intrq; break; #endif /* INET6 */ default: m_freem(m); return; } s = splimp(); if (IF_QFULL(inq)) { IF_DROP(inq); m_freem(m); } else IF_ENQUEUE(inq, m); splx(s); } static struct mbuf * ieee1394_reass(struct ifnet *ifp, struct mbuf *m0) { struct ieee1394com *ic = (struct ieee1394com *)ifp; struct ieee1394_header *ih; struct ieee1394_fraghdr *ifh; struct ieee1394_unfraghdr *iuh; struct ieee1394_reassq *rq; struct ieee1394_reass_pkt *rp, *trp, *nrp; int len; u_int16_t off, ftype, size, dgl; if (m0->m_len < sizeof(*ih) + sizeof(*ifh)) { if ((m0 = m_pullup(m0, sizeof(*ih) + sizeof(*ifh))) == NULL) return NULL; } ih = mtod(m0, struct ieee1394_header *); ifh = (struct ieee1394_fraghdr *)&ih[1]; m_adj(m0, sizeof(*ih) + sizeof(*ifh)); size = ntohs(ifh->ifh_ft_size); ftype = size & (IEEE1394_FT_SUBSEQ | IEEE1394_FT_MORE); size = (size & ~ftype) + 1; dgl = ifh->ifh_dgl; len = m0->m_pkthdr.len; if (ftype & IEEE1394_FT_SUBSEQ) { m0->m_flags &= ~M_PKTHDR; off = ntohs(ifh->ifh_etype_off); } else off = 0; for (rq = LIST_FIRST(&ic->ic_reassq); ; rq = LIST_NEXT(rq, rq_node)) { if (rq == NULL) { /* * Create a new reassemble queue head for the node. */ rq = malloc(sizeof(*rq), M_FTABLE, M_NOWAIT); if (rq == NULL) { m_freem(m0); return NULL; } memcpy(rq->rq_uid, ih->ih_uid, IEEE1394_ADDR_LEN); LIST_INIT(&rq->rq_pkt); LIST_INSERT_HEAD(&ic->ic_reassq, rq, rq_node); break; } if (memcmp(rq->rq_uid, ih->ih_uid, IEEE1394_ADDR_LEN) == 0) break; } for (rp = LIST_FIRST(&rq->rq_pkt); rp != NULL; rp = nrp) { nrp = LIST_NEXT(rp, rp_next); if (rp->rp_dgl != dgl) continue; /* * sanity check: * datagram size must be same for all fragments, and * no overlap is allowed. */ if (rp->rp_size != size || (off < rp->rp_off + rp->rp_len && off + len > rp->rp_off)) { /* * This happens probably due to wrapping dgl value. * Destroy all previously received fragment and * enqueue current fragment. */ for (rp = LIST_FIRST(&rq->rq_pkt); rp != NULL; rp = nrp) { nrp = LIST_NEXT(rp, rp_next); if (rp->rp_dgl == dgl) { LIST_REMOVE(rp, rp_next); m_freem(rp->rp_m); free(rp, M_FTABLE); } } break; } if (rp->rp_off + rp->rp_len == off) { /* * All the subsequent fragments received in sequence * come here. * Concatinate mbuf to previous one instead of * allocating new reassemble queue structure, * and try to merge more with the subsequent fragment * in the queue. */ m_cat(rp->rp_m, m0); rp->rp_len += len; while (rp->rp_off + rp->rp_len < size && nrp != NULL && nrp->rp_dgl == dgl && nrp->rp_off == rp->rp_off + rp->rp_len) { LIST_REMOVE(nrp, rp_next); m_cat(rp->rp_m, nrp->rp_m); rp->rp_len += nrp->rp_len; free(nrp, M_FTABLE); nrp = LIST_NEXT(rp, rp_next); } m0 = NULL; /* mark merged */ break; } if (off + m0->m_pkthdr.len == rp->rp_off) { m_cat(m0, rp->rp_m); rp->rp_m = m0; rp->rp_off = off; rp->rp_len += len; m0 = NULL; /* mark merged */ break; } if (rp->rp_off > off) { /* insert before rp */ nrp = rp; break; } if (nrp == NULL || nrp->rp_dgl != dgl) { /* insert after rp */ nrp = NULL; break; } } if (m0 == NULL) { if (rp->rp_off != 0 || rp->rp_len != size) return NULL; /* fragment done */ LIST_REMOVE(rp, rp_next); m0 = rp->rp_m; m0->m_pkthdr.len = rp->rp_len; M_PREPEND(m0, sizeof(*ih) + sizeof(*iuh), M_DONTWAIT); if (m0 != NULL) { ih = mtod(m0, struct ieee1394_header *); iuh = (struct ieee1394_unfraghdr *)&ih[1]; memcpy(ih, &rp->rp_hdr, sizeof(*ih)); iuh->iuh_ft = 0; iuh->iuh_etype = rp->rp_etype; } free(rp, M_FTABLE); return m0; } /* * New fragment received. Allocate reassemble queue structure. */ trp = malloc(sizeof(*trp), M_FTABLE, M_NOWAIT); if (trp == NULL) { m_freem(m0); return NULL; } trp->rp_m = m0; memcpy(&trp->rp_hdr, ih, sizeof(*ih)); trp->rp_size = size; trp->rp_etype = ifh->ifh_etype_off; /* valid only if off==0 */ trp->rp_off = off; trp->rp_dgl = dgl; trp->rp_len = len; trp->rp_ttl = IEEE1394_REASS_TIMEOUT; if (trp->rp_ttl <= ifp->if_timer) trp->rp_ttl = ifp->if_timer + 1; if (rp == NULL) { /* first fragment for the dgl */ LIST_INSERT_HEAD(&rq->rq_pkt, trp, rp_next); } else if (nrp == NULL) { /* no next fragment for the dgl */ LIST_INSERT_AFTER(rp, trp, rp_next); } else { /* there is a hole */ LIST_INSERT_BEFORE(nrp, trp, rp_next); } return NULL; } void ieee1394_drain(struct ifnet *ifp) { struct ieee1394com *ic = (struct ieee1394com *)ifp; struct ieee1394_reassq *rq; struct ieee1394_reass_pkt *rp; while ((rq = LIST_FIRST(&ic->ic_reassq)) != NULL) { LIST_REMOVE(rq, rq_node); while ((rp = LIST_FIRST(&rq->rq_pkt)) != NULL) { LIST_REMOVE(rp, rp_next); m_freem(rp->rp_m); free(rp, M_FTABLE); } free(rq, M_FTABLE); } } void ieee1394_watchdog(struct ifnet *ifp) { struct ieee1394com *ic = (struct ieee1394com *)ifp; struct ieee1394_reassq *rq; struct ieee1394_reass_pkt *rp, *nrp; int dec; dec = (ifp->if_timer > 0) ? ifp->if_timer : 1; for (rq = LIST_FIRST(&ic->ic_reassq); rq != NULL; rq = LIST_NEXT(rq, rq_node)) { for (rp = LIST_FIRST(&rq->rq_pkt); rp != NULL; rp = nrp) { nrp = LIST_NEXT(rp, rp_next); if (rp->rp_ttl >= dec) rp->rp_ttl -= dec; else { LIST_REMOVE(rp, rp_next); m_freem(rp->rp_m); free(rp, M_FTABLE); } } } } const char * ieee1394_sprintf(const u_int8_t *laddr) { static char buf[3*8]; snprintf(buf, sizeof(buf), "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", laddr[0], laddr[1], laddr[2], laddr[3], laddr[4], laddr[5], laddr[6], laddr[7]); return buf; } void ieee1394_ifattach(struct ifnet *ifp, const struct ieee1394_hwaddr *hwaddr) { struct sockaddr_dl *sdl; struct ieee1394_hwaddr *baddr; struct ieee1394com *ic = (struct ieee1394com *)ifp; ifp->if_type = IFT_IEEE1394; ifp->if_addrlen = sizeof(struct ieee1394_hwaddr); ifp->if_hdrlen = sizeof(struct ieee1394_header); ifp->if_mtu = IEEE1394MTU; ifp->if_output = ieee1394_output; ifp->if_input = ieee1394_input; ifp->if_drain = ieee1394_drain; ifp->if_watchdog = ieee1394_watchdog; ifp->if_timer = 1; if (ifp->if_baudrate == 0) ifp->if_baudrate = IF_Mbps(100); if ((sdl = ifp->if_sadl) && sdl->sdl_family == AF_LINK) { sdl->sdl_type = ifp->if_type; sdl->sdl_alen = ifp->if_addrlen; memcpy(LLADDR(sdl), hwaddr, ifp->if_addrlen); } ifp->if_broadcastaddr = malloc(ifp->if_addrlen, M_DEVBUF, M_WAITOK); baddr = (struct ieee1394_hwaddr *)ifp->if_broadcastaddr; memset(baddr->iha_uid, 0xff, IEEE1394_ADDR_LEN); baddr->iha_speed = 0; /*XXX: how to determine the speed for bcast? */ baddr->iha_maxrec = 512 << baddr->iha_speed; memset(baddr->iha_offset, 0, sizeof(baddr->iha_offset)); LIST_INIT(&ic->ic_reassq); } void ieee1394_ifdetach(struct ifnet *ifp) { struct sockaddr_dl *sdl = ifp->if_sadl; ieee1394_drain(ifp); free(ifp->if_broadcastaddr, M_DEVBUF); ifp->if_broadcastaddr = NULL; memset(LLADDR(sdl), 0, sizeof(struct ieee1394_hwaddr)); sdl->sdl_alen = 0; sdl->sdl_type = 0; } int ieee1394_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; int error = 0; #if __NetBSD_Version < 105080000 int fw_init(struct ifnet *); void fw_stop(struct ifnet *, int); #endif switch (cmd) { case SIOCSIFADDR: ifp->if_flags |= IFF_UP; switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: #if __NetBSD_Version >= 105080000 if ((error = (*ifp->if_init)(ifp)) != 0) #else if ((error = fw_init(ifp)) != 0) #endif break; ieee1394arp_ifinit(ifp, ifa); break; #endif /* INET */ default: #if __NetBSD_Version >= 105080000 error = (*ifp->if_init)(ifp); #else error = fw_init(ifp); #endif break; } break; case SIOCGIFADDR: memcpy(((struct sockaddr *)&ifr->ifr_data)->sa_data, LLADDR(ifp->if_sadl), IEEE1394_ADDR_LEN); break; case SIOCSIFMTU: if (ifr->ifr_mtu > IEEE1394MTU) error = EINVAL; else ifp->if_mtu = ifr->ifr_mtu; break; case SIOCSIFFLAGS: #if __NetBSD_Version >= 105080000 if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) == IFF_RUNNING) (*ifp->if_stop)(ifp, 1); else if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) == IFF_UP) error = (*ifp->if_init)(ifp); else if ((ifp->if_flags & IFF_UP) != 0) error = (*ifp->if_init)(ifp); #else if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) == IFF_RUNNING) fw_stop(ifp, 1); else if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) == IFF_UP) error = fw_init(ifp); else if ((ifp->if_flags & IFF_UP) != 0) error = fw_init(ifp); #endif break; case SIOCADDMULTI: case SIOCDELMULTI: /* nothing to do */ break; default: error = ENOTTY; break; } return error; } @ 1.3.2.3 log @Sync with HEAD (for UBC fixes). @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.3.2.2 2000/12/13 15:50:31 bouyer Exp $ */ a657 3 #if NBPFILTER > 0 bpfattach(ifp, DLT_EN10MB, 14); /* XXX */ #endif a670 3 #if NBPFILTER > 0 bpfdetach(ifp); #endif @ 1.3.2.4 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.3.2.3 2001/01/05 17:36:51 bouyer Exp $ */ a97 4 /* * XXX ALTQ */ a637 1 ifp->if_dlt = DLT_EN10MB; /* XXX */ @ 1.3.2.5 log @Sync with head (for UBC+NFS fixes, mostly). @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.3.2.4 2001/01/18 09:23:51 bouyer Exp $ */ d635 1 d651 5 a655 4 if_alloc_sadl(ifp); memcpy(LLADDR(sdl), hwaddr, ifp->if_addrlen); d674 5 a681 3 free(ifp->if_broadcastaddr, M_DEVBUF); ifp->if_broadcastaddr = NULL; if_free_sadl(ifp); @ 1.3.2.6 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.3.2.5 2001/02/11 19:17:09 bouyer Exp $ */ d652 1 a652 1 memcpy(LLADDR(ifp->if_sadl), hwaddr, ifp->if_addrlen); d669 2 @ 1.3.2.7 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.3.2.6 2001/04/21 17:46:39 bouyer Exp $ */ d226 1 a226 1 s = splnet(); d402 1 a402 1 s = splnet(); @ 1.2 log @Add support for link fragmentation and reassemble for IEEE-1394. XXX: drain is still not yet implemented, thus memory leak will occur in case of any of fragment lost. @ text @d1 1 a1 1 /* $NetBSD: if_ieee1394subr.c,v 1.1 2000/11/05 17:17:15 onoe Exp $ */ d75 2 d112 1 a112 1 if (rt->rt_gwroute == 0) d119 1 a119 1 if ((rt = rt->rt_gwroute) == 0) d125 1 a125 1 rt0->rt_gwroute = 0; d198 6 d206 1 a206 5 /* * XXX: There should be sophisticated way to determine * maximum available rate for all IP capable nodes. */ hwdst.iha_speed = 0; a208 4 /* * XXX: The maximum possible rate depends on the topology. */ d221 1 d304 1 a304 2 m->m_next = m_copy(m0, off + sizeof(struct ieee1394_fraghdr), fraglen); d307 1 a307 1 m->m_pkthdr.len = sizeof(struct ieee1394_fraghdr) + fraglen; d341 1 a341 2 m = m_pullup(m, sizeof(*ih) + sizeof(*iuh)); if (m == NULL) d349 1 a349 2 m = ieee1394_reass(ifp, m); if (m == NULL) d357 1 a357 2 m_adj(m, sizeof(struct ieee1394_header) + sizeof(struct ieee1394_unfraghdr)); d420 1 a420 2 m0 = m_pullup(m0, sizeof(*ih) + sizeof(*ifh)); if (m0 == NULL) d459 7 a465 2 /* sanity check: datagram size must be same for all fragments */ if (rp->rp_size != size) { d467 3 a469 2 * This is possibly by wrapping dgl value. * Destroy previous received fragment. d471 10 a480 4 LIST_REMOVE(rp, rp_next); m_freem(rp->rp_m); free(rp, M_FTABLE); continue; d499 1 d558 3 d575 42 d641 3 d654 1 a654 1 baddr->iha_speed = 0; /*XXX*/ d665 1 @ 1.1 log @First Prototype implementation of network interface part for IEEE1394 (if_fw). Current status: Only OHCI chip is supported (fwohci). ping (IPv4) works with Sony's implementation (SmartConnect) on Win98. sometimes works but not stable. Not implemented yet: IRM (Isochronous Resource Manager) functionality. Link layer fragmentation. Topology map. More to do: clean ups MCAP charactor device part dhcp There is no entry in GENERIC config file yet. Follow sys/dev/ieee1394/IMPLEMENTATION to enable if_fw. @ text @d1 1 a1 1 /* $NetBSD: $ */ d80 1 d87 2 a88 2 int s, hdrlen, maxrec, len, off, tlen, error = 0; struct mbuf *m = m0, **mp; d91 1 a91 1 struct ieee1394com *ic = (struct ieee1394com *)ifp; a94 3 struct ieee1394_unfraghdr *iuh; struct ieee1394_fraghdr *ifh; struct ieee1394_hwaddr hwdst; d136 1 a136 1 if (m->m_flags & (M_BCAST|M_MCAST)) d138 1 a138 1 else if (!ieee1394arpresolve(ifp, rt, m, dst, &hwdst)) d141 2 a142 2 if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX)) mcopy = m_copy(m, 0, (int)M_COPYALL); a144 1 d146 1 a146 1 ah = mtod(m, struct ieee1394_arphdr *); d153 1 a153 1 if (m->m_flags & M_MCAST) d155 1 a155 1 else if (!nd6_storelladdr(ifp, rt, m, dst, (u_char *)&hwdst)) { d177 1 d181 1 a181 1 mb.m_next = m; d191 14 d206 11 a216 68 /* determine fragmented or not */ maxrec = 1 << (hwdst.iha_maxrec + 1); if (m->m_flags & (M_BCAST|M_MCAST)) hdrlen = IEEE1394_STRHDRLEN + sizeof(*iuh); else hdrlen = IEEE1394_AWBHDRLEN + sizeof(*iuh); if (m->m_pkthdr.len < maxrec - hdrlen) { M_PREPEND(m, sizeof(hwdst) + sizeof(*iuh), M_DONTWAIT); if (m == 0) senderr(ENOBUFS); memcpy(mtod(m, caddr_t), &hwdst, sizeof(hwdst)); iuh = (struct ieee1394_unfraghdr *) (mtod(m, caddr_t) + sizeof(hwdst)); iuh->iuh_ft = 0; iuh->iuh_etype = etype; s = splimp(); if (IF_QFULL(&ifp->if_snd)) { IF_DROP(&ifp->if_snd); splx(s); senderr(ENOBUFS); } IF_ENQUEUE(&ifp->if_snd, m); ifp->if_obytes += m0->m_pkthdr.len; goto done; } printf("ieee1304_output: fragment packet\n"); hdrlen += sizeof(*ifh) - sizeof(*iuh); len = maxrec - hdrlen; off = len; mp = &m0->m_nextpkt; while (off < m0->m_pkthdr.len) { MGETHDR(m, M_DONTWAIT, MT_HEADER); if (m == NULL) senderr(ENOBUFS); m->m_flags |= m0->m_flags & (M_BCAST|M_MCAST); tlen = len; if (tlen > m0->m_pkthdr.len - off) tlen = m0->m_pkthdr.len - off; m->m_data += hdrlen - sizeof(hwdst); m->m_len = sizeof(hwdst) + sizeof(*ifh); memcpy(mtod(m, caddr_t), &hwdst, sizeof(hwdst)); ifh = (struct ieee1394_fraghdr *) (mtod(m, caddr_t) + sizeof(hwdst)); ifh->ifh_ft_size = htons(0xc000 | tlen); ifh->ifh_etype_off = htons(off); ifh->ifh_dgl = htons(ic->ic_dgl); ifh->ifh_reserved = 0; m->m_next = m_copy(m0, off, tlen); if (m->m_next == NULL) senderr(ENOBUFS); off += tlen; *mp = m; mp = &m->m_nextpkt; } ifh->ifh_ft_size &= ~htons(0x4000); /* note last fragment */ /* first fragment */ m = m0; M_PREPEND(m, sizeof(hwdst) + sizeof(*ifh), M_DONTWAIT); memcpy(mtod(m, caddr_t), &hwdst, sizeof(hwdst)); ifh = (struct ieee1394_fraghdr *)(mtod(m, caddr_t) + sizeof(hwdst)); ifh->ifh_ft_size = htons(0x4000 | (maxrec - hdrlen)); ifh->ifh_etype_off = etype; ifh->ifh_dgl = htons(ic->ic_dgl++); ifh->ifh_reserved = 0; /* send off */ d218 3 d227 1 a227 9 while (m0 != NULL) { m = m0->m_nextpkt; m0->m_nextpkt = NULL; IF_ENQUEUE(&ifp->if_snd, m0); ifp->if_obytes += m0->m_pkthdr.len; m0 = m; } done: d230 10 d243 1 a243 1 return error; d255 72 d333 1 d340 5 d346 9 a354 6 iuh = mtod(m, struct ieee1394_unfraghdr *); if (iuh->iuh_ft != 0) { printf("%s: ieee1394_input: fragment not implemented yet\n", ifp->if_xname); m_freem(m); return; d359 2 a360 1 m_adj(m, sizeof(struct ieee1394_unfraghdr)); d362 1 d410 153 d578 2 d595 6 a600 2 memcpy(ifp->if_broadcastaddr, hwaddr, ifp->if_addrlen); memset(ifp->if_broadcastaddr, 0xff, IEEE1394_ADDR_LEN); @