Re: network performance fun
> On 25 Oct 2016, at 16:31, Mike Belopuhov wrote: > > On 25 October 2016 at 08:25, Mike Belopuhov wrote: >> On 25 October 2016 at 02:34, David Gwynne wrote: I see. I will double check this tomorrow but your approach looks solid. >>> >>> it's obviously an interaction between intel nics that do not align >>> their ethernet headers correctly, and the M_PREPEND which i just >>> changed (and you oked) in src/sys/net/if_ethersubr.c r1.240). >>> >>> basically the stack strips the 6 byte ethernet header before pushing >>> the packet into the ip stack, and forwarding causes it to be output >>> as an ethernet packet. the M_PREPEND of 8 bytes in ether_output >>> causes an mbuf to be prefixed cos the frame has 6 bytes free, not >>> 8. >>> >> >> Ah right, it's the same cluster we're transmitting as we have Rx'ed... >> > > You need to get your mcl2k2 change in then. ill put it in tonight. cheers, dlg > >>> the good news is that at least the prepended mbuf gets its ethernet >>> header correctly aligned. >>> >>> dlg
Re: request for test: mfii
On Wed, 26 Oct 2016 10:26:19 +1100 Jonathan Gray wrote: > On Tue, Oct 25, 2016 at 05:29:55PM +0900, YASUOKA Masahiko wrote: >> I'm working on making mfii(4) bio(4) capable. >> >> If you have a machine which has mfii(4), I'd like you to test the diff >> following. (It might be risky for production machines for this >> moment.) >> >> After the diff applied, bioctl(8) against the disk (eg. sd0) starts >> working and also "sysctl hw.sensors.mfii0" will appear. >> >> Especially if you can configure a hotspare, testing it is very >> helpful for me since I can't use a hotspare on my test machine. (snip) >> +case BIOC_SATEST: >> +cmd = MR_DCMD_SPEAKER_TEST; >> +break; >> +default: >> +return (EINVAL); >> +} >> + >> +ccb = scsi_io_get(&sc->sc_iopool, 0); >> +rv = mfii_mgmt(sc, ccb, MR_DCMD_PD_SET_STATE, NULL, >> +&spkr, sizeof(spkr), flags | SCSI_NOSLEEP); > > Should this be cmd rather than MR_DCMD_PD_SET_STATE? > The cmd values from the switch statement are not used. Oops. Yes, that's right. >> +int >> +mfii_ioctl_blink(struct mfii_softc *sc, struct bioc_blink *bb) (snip) >> +case BIOC_SBBLINK: >> +case BIOC_SBALARM: >> +cmd = MR_DCMD_PD_BLINK; >> +break; >> +default: >> +rv = EINVAL; >> +goto done; >> +} >> + >> +ccb = scsi_io_get(&sc->sc_iopool, 0); >> +rv = mfii_mgmt(sc, ccb, cmd, NULL, NULL, 0, SCSI_NOSLEEP); >> +scsi_io_put(&sc->sc_iopool, ccb); Passing the mbox to mfii_mgmt() was missing. >> + done: >> +free(list, M_TEMP, sizeof(*list)); >> + >> +return (ENOTTY); >> +} > > Shouldn't this be return (rv) to return the EINVAL values? > With rv set to 0 before the 'done' to return 0 when there is no error? Yes, that's also right. Thanks. Let me update the diff. Index: sys/dev/pci/mfii.c === RCS file: /cvs/src/sys/dev/pci/mfii.c,v retrieving revision 1.28 diff -u -p -r1.28 mfii.c --- sys/dev/pci/mfii.c 24 Oct 2016 05:27:52 - 1.28 +++ sys/dev/pci/mfii.c 26 Oct 2016 03:46:15 - @@ -22,9 +22,11 @@ #include #include #include +#include #include #include +#include #include #include @@ -212,6 +214,13 @@ struct mfii_iop { u_int8_t sge_flag_eol; }; +struct mfii_cfg { + struct mfi_conf *cfg; + struct mfi_array*cfg_array; + struct mfi_ld_cfg *cfg_ld; + struct mfi_hotspare *cfg_hs; +}; + struct mfii_softc { struct device sc_dev; const struct mfii_iop *sc_iop; @@ -250,11 +259,15 @@ struct mfii_softc { struct scsi_iopool sc_iopool; struct mfi_ctrl_infosc_info; + + struct ksensor *sc_sensors; + struct ksensordev sc_sensordev; }; intmfii_match(struct device *, void *, void *); void mfii_attach(struct device *, struct device *, void *); intmfii_detach(struct device *, int); +intmfii_scsi_ioctl(struct scsi_link *, u_long, caddr_t, int); struct cfattach mfii_ca = { sizeof(struct mfii_softc), @@ -277,7 +290,7 @@ struct scsi_adapter mfii_switch = { scsi_minphys, NULL, /* probe */ NULL, /* unprobe */ - NULL /* ioctl */ + mfii_scsi_ioctl }; void mfii_pd_scsi_cmd(struct scsi_xfer *); @@ -334,7 +347,26 @@ intmfii_scsi_cmd_cdb(struct mfii_soft struct scsi_xfer *); intmfii_pd_scsi_cmd_cdb(struct mfii_softc *, struct scsi_xfer *); - +intmfii_scsi_ioctl_cache(struct scsi_link *, u_int, + struct dk_cache *); +#if NBIO > 0 +intmfii_ioctl(struct device *, u_long, caddr_t); +intmfii_fill_cfg(struct mfii_softc *, struct mfii_cfg *); +intmfii_ioctl_inq(struct mfii_softc *, struct bioc_inq *); +intmfii_ioctl_vol(struct mfii_softc *, struct bioc_vol *); +intmfii_ioctl_disk(struct mfii_softc *, + struct bioc_disk *); +intmfii_ioctl_alarm(struct mfii_softc *, + struct bioc_alarm *); +intmfii_ioctl_blink(struct mfii_softc *, + struct bioc_blink *); +intmfii_ioctl_setstate(struct mfii_softc *, + struct bioc_setstate *); +intmfii_ioctl_patrol(struct mfii_softc *, + struct bioc_patrol *); +intmfii_create_sensors(struct mfii_softc *); +void mfii_refresh_sensors(void *); +#endif #define mfii_fw_state(_sc) mfii_read((_sc), MFI_OSP) @@ -506,7 +538,8 @@ mfii_attach(struct device *parent, struc memset(&saa, 0, sizeof(saa)); saa.saa_sc_link = &s
Re: request for test: mfii
On Tue, Oct 25, 2016 at 05:29:55PM +0900, YASUOKA Masahiko wrote: > Hi, > > I'm working on making mfii(4) bio(4) capable. > > If you have a machine which has mfii(4), I'd like you to test the diff > following. (It might be risky for production machines for this > moment.) > > After the diff applied, bioctl(8) against the disk (eg. sd0) starts > working and also "sysctl hw.sensors.mfii0" will appear. > > Especially if you can configure a hotspare, testing it is very > helpful for me since I can't use a hotspare on my test machine. > + > +int > +mfii_ioctl_alarm(struct mfii_softc *sc, struct bioc_alarm *ba) > +{ > + struct mfii_ccb *ccb; > + u_char spkr; > + int rv, cmd, flags = 0; > + > + if (!ISSET(letoh32(sc->sc_info.mci_hw_present), MFI_INFO_HW_ALARM)) > + return (ENXIO); > + > + switch (ba->ba_status) { > + case BIOC_SADISABLE: > + cmd = MR_DCMD_SPEAKER_DISABLE; > + break; > + case BIOC_SAENABLE: > + cmd = MR_DCMD_SPEAKER_ENABLE; > + break; > + case BIOC_SASILENCE: > + cmd = MR_DCMD_SPEAKER_SILENCE; > + break; > + case BIOC_GASTATUS: > + cmd = MR_DCMD_SPEAKER_GET; > + flags = SCSI_DATA_IN; > + break; > + case BIOC_SATEST: > + cmd = MR_DCMD_SPEAKER_TEST; > + break; > + default: > + return (EINVAL); > + } > + > + ccb = scsi_io_get(&sc->sc_iopool, 0); > + rv = mfii_mgmt(sc, ccb, MR_DCMD_PD_SET_STATE, NULL, > + &spkr, sizeof(spkr), flags | SCSI_NOSLEEP); Should this be cmd rather than MR_DCMD_PD_SET_STATE? The cmd values from the switch statement are not used. > + scsi_io_put(&sc->sc_iopool, ccb); > + if (rv != 0) > + return (rv); > + > + ba->ba_status = (ba->ba_status == BIOC_GASTATUS)? spkr : 0; > + > + return (rv); > +} > + > +int > +mfii_ioctl_blink(struct mfii_softc *sc, struct bioc_blink *bb) > +{ > + struct mfi_pd_list *list = NULL; > + struct mfii_ccb *ccb; > + uint8_t mbox[MFI_MBOX_SIZE]; > + int rv, i, cmd; > + > + list = malloc(sizeof(*list), M_TEMP, M_WAITOK | M_ZERO); > + > + ccb = scsi_io_get(&sc->sc_iopool, 0); > + rv = mfii_mgmt(sc, ccb, MR_DCMD_PD_GET_LIST, NULL, > + list, sizeof(*list), SCSI_DATA_IN | SCSI_NOSLEEP); > + scsi_io_put(&sc->sc_iopool, ccb); > + if (rv != 0) > + goto done; > + > + for (i = 0; i < letoh16(list->mpl_no_pd); i++) > + if (list->mpl_address[i].mpa_enc_index == bb->bb_channel && > + list->mpl_address[i].mpa_enc_slot == bb->bb_target) > + break; > + if (i >= letoh16(list->mpl_no_pd)) { > + rv = EINVAL; > + goto done; > + } > + > + memset(mbox, 0, sizeof(mbox)); > + *((uint16_t *)&mbox[0]) = list->mpl_address[i].mpa_pd_id; > + > + switch (bb->bb_status) { > + case BIOC_SBUNBLINK: > + cmd = MR_DCMD_PD_UNBLINK; > + break; > + case BIOC_SBBLINK: > + case BIOC_SBALARM: > + cmd = MR_DCMD_PD_BLINK; > + break; > + default: > + rv = EINVAL; > + goto done; > + } > + > + ccb = scsi_io_get(&sc->sc_iopool, 0); > + rv = mfii_mgmt(sc, ccb, cmd, NULL, NULL, 0, SCSI_NOSLEEP); > + scsi_io_put(&sc->sc_iopool, ccb); > + > + done: > + free(list, M_TEMP, sizeof(*list)); > + > + return (ENOTTY); > +} Shouldn't this be return (rv) to return the EINVAL values? With rv set to 0 before the 'done' to return 0 when there is no error?
Re: aml_rdpciaddr is busted
> Date: Wed, 19 Oct 2016 21:51:47 +0200 (CEST) > From: Mark Kettenis > > The bus number it reports will be totally bogus for devices behind PCI > bridges. As a consequence AML will peek and poke at registers of the > wrong device. This is what caused the suspend issues with Joris' > Macbook. > > The diff below attempts to fix this by using the mapping between AML > nodes and PCI devices that we establish. Because _INI methods may end > up executing AML that ends up calling aml_rdpciaddr(), the mapping is > now established before we execute _INI. I'm not 100% sure this is > correct as there is a possibility that _INI will poke some PCI bridges > in a way that changes the mapping. Only one way to find out... > > The code also deals with devices that aren't there in a slightly > different way. They are now included in the node -> PCI mapping, but > they're still not included in the list of PCI device nodes that we > create. Writing to config space for devices that aren't there is > implemented as a no-op. Reading will return an all-ones pattern. > > So far I've only tested this on my x1. More testing is needed. This has been in snaps for a couple of days now. Anybody bold enough to ok this? > Index: dev/acpi/acpi.c > === > RCS file: /cvs/src/sys/dev/acpi/acpi.c,v > retrieving revision 1.316 > diff -u -p -r1.316 acpi.c > --- dev/acpi/acpi.c 18 Sep 2016 23:56:45 - 1.316 > +++ dev/acpi/acpi.c 19 Oct 2016 19:42:51 - > @@ -614,6 +614,7 @@ acpi_getpci(struct aml_node *node, void > pci->dev = ACPI_ADR_PCIDEV(val); > pci->fun = ACPI_ADR_PCIFUN(val); > pci->node = node; > + node->pci = pci; > pci->sub = -1; > > dnprintf(10, "%.2x:%.2x.%x -> %s\n", > @@ -639,17 +640,12 @@ acpi_getpci(struct aml_node *node, void > pci->_s4w = -1; > > /* Check if PCI device exists */ > - if (pci->dev > 0x1F || pci->fun > 7) { > - free(pci, M_DEVBUF, sizeof(*pci)); > - return (1); > - } > + if (pci->dev > 31 || pci->fun > 7) > + return 1; > tag = pci_make_tag(pc, pci->bus, pci->dev, pci->fun); > reg = pci_conf_read(pc, tag, PCI_ID_REG); > - if (PCI_VENDOR(reg) == PCI_VENDOR_INVALID) { > - free(pci, M_DEVBUF, sizeof(*pci)); > - return (1); > - } > - node->pci = pci; > + if (PCI_VENDOR(reg) == PCI_VENDOR_INVALID) > + return 1; > > TAILQ_INSERT_TAIL(&acpi_pcidevs, pci, next); > > @@ -1066,11 +1062,11 @@ acpi_attach(struct device *parent, struc > config_found_sm(self, &aaa, acpi_print, acpi_submatch); > } > > + /* get PCI mapping */ > + aml_walknodes(&aml_root, AML_WALK_PRE, acpi_getpci, sc); > + > /* initialize runtime environment */ > aml_find_node(&aml_root, "_INI", acpi_inidev, sc); > - > - /* Get PCI mapping */ > - aml_walknodes(&aml_root, AML_WALK_PRE, acpi_getpci, sc); > > /* attach pci interrupt routing tables */ > aml_find_node(&aml_root, "_PRT", acpi_foundprt, sc); > Index: dev/acpi/dsdt.c > === > RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v > retrieving revision 1.225 > diff -u -p -r1.225 dsdt.c > --- dev/acpi/dsdt.c 27 Sep 2016 10:04:19 - 1.225 > +++ dev/acpi/dsdt.c 19 Oct 2016 19:42:51 - > @@ -2216,21 +2216,16 @@ aml_rdpciaddr(struct aml_node *pcidev, u > { > int64_t res; > > - if (aml_evalinteger(acpi_softc, pcidev, "_ADR", 0, NULL, &res) == 0) { > - addr->fun = res & 0x; > - addr->dev = res >> 16; > - } > - while (pcidev != NULL) { > - /* HID device (PCI or PCIE root): eval _BBN */ > - if (__aml_search(pcidev, "_HID", 0)) { > - if (aml_evalinteger(acpi_softc, pcidev, "_BBN", 0, > NULL, &res) == 0) { > - addr->bus = res; > - break; > - } > - } > - pcidev = pcidev->parent; > - } > - return (0); > + if (pcidev->pci == NULL) > + return -1; > + > + if (aml_evalinteger(acpi_softc, pcidev, "_ADR", 0, NULL, &res)) > + return -1; > + > + addr->fun = res & 0x; > + addr->dev = res >> 16; > + addr->bus = pcidev->pci->bus; > + return 0; > } > > /* Read/Write from opregion object */ > @@ -2272,7 +2267,12 @@ aml_rwgas(struct aml_value *rgn, int bpo > > if (rgn->v_opregion.iospace == GAS_PCI_CFG_SPACE) { > /* Get PCI Root Address for this opregion */ > - aml_rdpciaddr(rgn->node->parent, &pi); > + if (aml_rdpciaddr(rgn->node->parent, &pi)) { > + if (mode == ACPI_IOREAD) > + pi.fun = 0x; > + else > + return; > + } > }
simplify vxlan_lookup return value handling
After my previous commit to the vxlan(4) driver it can no longer return -1 making this code path obsolete. OK to remove it? diff --git sys/netinet/udp_usrreq.c sys/netinet/udp_usrreq.c index 60a7bdf..fc5e866 100644 --- sys/netinet/udp_usrreq.c +++ sys/netinet/udp_usrreq.c @@ -388,17 +388,12 @@ udp_input(struct mbuf *m, ...) #if NVXLAN > 0 if (vxlan_enable > 0 && #if NPF > 0 !(m->m_pkthdr.pf.flags & PF_TAG_DIVERTED) && #endif - (error = vxlan_lookup(m, uh, iphlen, &srcsa.sa, &dstsa.sa)) != 0) { - if (error == -1) { - udpstat.udps_hdrops++; - m_freem(m); - } + (error = vxlan_lookup(m, uh, iphlen, &srcsa.sa, &dstsa.sa)) != 0) return; - } #endif if (m->m_flags & (M_BCAST|M_MCAST)) { struct inpcb *last; /*
pfctl skip invalid broadcast
Hi, On my test machine I have added a vether0 with a /32 IPv4 address. Since then the regress/sbin/pfctl pfi2 test fails. vether0: flags=8843 mtu 1500 ... inet 10.188.80.21 netmask 0x The test basically does this: echo "pass in from self:broadcast" | pfctl -o none -nvf- The result contains this rule: pass in inet from 0.0.0.0 to any flags S/SA The kernel view of (self:broadcast) does not contain the line with 0.0.0.0 so the test fails. ifconfig checks wether a broadcast address is 0 before printing it. I think pfctl should do the same check to find valid broadcast addresses. ok? bluhm Index: sbin/pfctl/pfctl_parser.c === RCS file: /data/mirror/openbsd/cvs/src/sbin/pfctl/pfctl_parser.c,v retrieving revision 1.308 diff -u -p -r1.308 pfctl_parser.c --- sbin/pfctl/pfctl_parser.c 3 Sep 2016 17:11:40 - 1.308 +++ sbin/pfctl/pfctl_parser.c 25 Oct 2016 17:01:36 - @@ -1518,6 +1518,8 @@ ifa_lookup(const char *ifa_name, int fla if ((flags & PFI_AFLAG_BROADCAST) && !(p->ifa_flags & IFF_BROADCAST)) continue; + if ((flags & PFI_AFLAG_BROADCAST) && p->bcast.v4.s_addr == 0) + continue; if ((flags & PFI_AFLAG_PEER) && !(p->ifa_flags & IFF_POINTOPOINT)) continue;
Re: kernel without inet6
On 25 October 2016 at 16:43, Alexander Bluhm wrote: > Hi, > > Make kernel without INET6 compile again. > > ok? > > bluhm > Sure, OK mikeb
kernel without inet6
Hi, Make kernel without INET6 compile again. ok? bluhm Index: net/if_vxlan.c === RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_vxlan.c,v retrieving revision 1.50 diff -u -p -r1.50 if_vxlan.c --- net/if_vxlan.c 14 Oct 2016 10:25:02 - 1.50 +++ net/if_vxlan.c 25 Oct 2016 14:32:54 - @@ -236,21 +236,29 @@ vxlan_multicast_join(struct ifnet *ifp, struct vxlan_softc *sc = ifp->if_softc; struct ip_moptions *imo = &sc->sc_imo; struct sockaddr_in *src4, *dst4; +#ifdef INET6 struct sockaddr_in6 *dst6; +#endif /* INET6 */ struct ifaddr *ifa; struct ifnet*mifp; - if (dst->sa_family == AF_INET) { + switch (dst->sa_family) { + case AF_INET: dst4 = satosin(dst); if (!IN_MULTICAST(dst4->sin_addr.s_addr)) return (0); - } else if (dst->sa_family == AF_INET6) { + break; +#ifdef INET6 + case AF_INET6: dst6 = satosin6(dst); if (!IN6_IS_ADDR_MULTICAST(&dst6->sin6_addr)) return (0); /* Multicast mode is currently not supported for IPv6 */ return (EAFNOSUPPORT); +#endif /* INET6 */ + default: + return (EAFNOSUPPORT); } src4 = satosin(src); @@ -333,12 +341,18 @@ vxlan_config(struct ifnet *ifp, struct s reset = 1; } - if (af == AF_INET) + switch (af) { + case AF_INET: slen = sizeof(struct sockaddr_in); - else if (af == AF_INET6) + break; +#ifdef INET6 + case AF_INET6: slen = sizeof(struct sockaddr_in6); - else + break; +#endif /* INET6 */ + default: return (EAFNOSUPPORT); + } if (src->sa_len != slen || dst->sa_len != slen) return (EINVAL); @@ -525,7 +539,9 @@ int vxlan_sockaddr_cmp(struct sockaddr *srcsa, struct sockaddr *dstsa) { struct sockaddr_in *src4, *dst4; +#ifdef INET6 struct sockaddr_in6 *src6, *dst6; +#endif /* INET6 */ if (srcsa->sa_family != dstsa->sa_family) return (1); @@ -536,11 +552,13 @@ vxlan_sockaddr_cmp(struct sockaddr *srcs dst4 = satosin(dstsa); if (src4->sin_addr.s_addr == dst4->sin_addr.s_addr) return (0); +#ifdef INET6 case AF_INET6: src6 = satosin6(srcsa); dst6 = satosin6(dstsa); if (IN6_ARE_ADDR_EQUAL(&src6->sin6_addr, &dst6->sin6_addr)) return (0); +#endif /* INET6 */ } return (1); @@ -550,15 +568,19 @@ uint16_t vxlan_sockaddr_port(struct sockaddr *sa) { struct sockaddr_in *sin4; +#ifdef INET6 struct sockaddr_in6 *sin6; +#endif /* INET6 */ switch (sa->sa_family) { case AF_INET: sin4 = satosin(sa); return (sin4->sin_port); +#ifdef INET6 case AF_INET6: sin6 = satosin6(sa); return (sin6->sin6_port); +#endif /* INET6 */ default: break; } @@ -717,6 +739,7 @@ vxlan_encap4(struct ifnet *ifp, struct m return (m); } +#ifdef INET6 struct mbuf * vxlan_encap6(struct ifnet *ifp, struct mbuf *m, struct sockaddr *src, struct sockaddr *dst) @@ -764,6 +787,7 @@ vxlan_encap6(struct ifnet *ifp, struct m return (m); } +#endif /* INET6 */ int vxlan_output(struct ifnet *ifp, struct mbuf *m) @@ -838,11 +862,16 @@ vxlan_output(struct ifnet *ifp, struct m vu->vu_v.vxlan_id = htonl(0); } - if (af == AF_INET) + switch (af) { + case AF_INET: m = vxlan_encap4(ifp, m, src, dst); - else if (af == AF_INET6) + break; +#ifdef INET6 + case AF_INET6: m = vxlan_encap6(ifp, m, src, dst); - else { + break; +#endif /* INET6 */ + default: m_freem(m); m = NULL; } @@ -866,11 +895,20 @@ vxlan_output(struct ifnet *ifp, struct m pf_pkt_addr_changed(m); #endif - if (af == AF_INET) + switch (af) { + case AF_INET: error = ip_output(m, NULL, NULL, IP_RAWOUTPUT, &sc->sc_imo, NULL, 0); - else + break; +#ifdef INET6 + case AF_INET6: error = ip6_output(m, 0, NULL, IPV6_MINMTU, 0, NULL); + break; +#endif /* INET6 */ + default: + m_freem(m); + error = EAFNOSUPPORT; + } if (error) ifp->if_oerrors++; Index: dev/usb/if_umb.c === RCS file: /data/mirror/openbsd/cvs/src/sys/dev/usb/if_umb.c,v re
video(1): maintain image aspect ratio
Hi! Another thing that bothered me about video(1) from Xenocara is that it does not maintain frame aspect ratio. The diff below adds panning to maintain aspect ratio after resize. Comments? OKs? -- Dmitrij D. Czarkoff Index: video.c === RCS file: /var/cvs/xenocara/app/video/video.c,v retrieving revision 1.21 diff -u -p -r1.21 video.c --- video.c 21 Oct 2016 09:48:48 - 1.21 +++ video.c 25 Oct 2016 12:34:01 - @@ -72,6 +72,11 @@ struct xdsp { int saved_y; int saved_w; int saved_h; + int resized; + int box_x; + int box_y; + int box_w; + int box_h; int max_width; int max_height; int screen_id; @@ -163,6 +168,7 @@ struct video { int net_wm; int width; int height; + double aspect; int bpf; int fps; int nofps; @@ -590,6 +596,20 @@ resize_window(struct video *vid, int ful x->saved_y = new_y; } + x->resized = 1; + + if ((double)x->width > (double)x->height * vid->aspect) { + x->box_h = x->height; + x->box_y = 0; + x->box_w = (int)(x->height * vid->aspect); + x->box_x = (x->width - x->box_w) / 2; + } else { + x->box_w = x->width; + x->box_x = 0; + x->box_h = (int)(x->width / vid->aspect); + x->box_y = (x->height - x->box_h) / 2; + } + XSync(x->dpy, False); XSync(x->dpy, True); } @@ -1252,6 +1272,7 @@ choose_size(struct video *vid) vid->fps = d->rates[i][cur]; } } + vid->aspect = (double)vid->width / (double)vid->height; return 1; } @@ -1715,9 +1736,13 @@ stream(struct video *vid) } if (vid->mode & M_OUT_XV) { x->xv_image->data = src; + if (x->resized) { + x->resized = 0; + XClearWindow(x->dpy, x->window); + } ret = XvPutImage(x->dpy, x->port, x->window, x->gc, x->xv_image, 0, 0, vid->width, vid->height, - 0, 0, x->width, x->height); + x->box_x, x->box_y, x->box_w, x->box_h); if (ret != Success) { warn("XvPutImage"); return 0;
Re: add in6 multicast support to vxlan(4) ; question on mbufs
On Tue, Oct 11, 2016 at 20:41 +1000, David Gwynne wrote: > On Tue, Oct 11, 2016 at 12:06:46AM +0200, Mike Belopuhov wrote: > > On Fri, Oct 07, 2016 at 20:48 +1000, David Gwynne wrote: > > > On Thu, Oct 06, 2016 at 12:13:20PM +0200, Mike Belopuhov wrote: > > > > m_pullup will always get a new mbuf and on > > > > strict alignment architectures you will always do a m_dup_pkt > > > > (verified by my -DTEST1). > > > > > > i didnt think m_pullup was that stupid, but yes, yes it is. > > > > > > im not sure we can do better than m_dup_pkt on strict alignment > > > archs, except to use memmove to realign simple mbufs. the alternative > > > is vxlan parses the packet to figure out the most conservative > > > realignment it can do, but itll have to allocate a new mbuf to > > > prefix it with, which would be about the same cost as blindly copying > > > it all. > > > > > > anyway, m_pullup could be simpler. while im there, it should maintain > > > the alignment of the payload. > > > > > > the diff below makes it return early if the current mbuf already > > > has the requested region, regardless of whether it has a cluster > > > or not. > > > > > > if that fails, but there is enough space in the first mbuf for the > > > requested region, itll memmove the data around to make the request > > > contig. > > > > > > if that fails, itll attempt to allocate an mbuf and maybe a cluster > > > to prefix the chain with. > > > > > > after shuffling the first mbuf data or prefixing an empty mbuf, > > > itll copy from the chain into the first mbuf. > > > > > > i reckon this would be comparable to m_pulldown now. > > > > > > ok? > > > > > > Index: uipc_mbuf.c > > > === > > > RCS file: /cvs/src/sys/kern/uipc_mbuf.c,v > > > retrieving revision 1.231 > > > diff -u -p -r1.231 uipc_mbuf.c > > > --- uipc_mbuf.c 15 Sep 2016 02:00:16 - 1.231 > > > +++ uipc_mbuf.c 7 Oct 2016 10:47:54 - > > > @@ -838,64 +842,73 @@ struct mbuf * > > > m_pullup(struct mbuf *n, int len) > > > { > > > struct mbuf *m; > > > - int count; > > > + unsigned int align; > > > + unsigned int space; > > > + > > > + /* if n is already contig then don't do any work */ > > > + if (len <= n->m_len) > > > + return (n); > > > + > > > + align = (unsigned long)n->m_data & ALIGNBYTES; > > > + space = M_LEADINGSPACE(n) - align; > > > + > > > > M_LEADINGSPACE for mbufs that have (m->m_len == 0) is actually zero > > so here you can have space underflow and become huge. > > yeesh. why do we let cthulu craft mbufs? > > > > + if (len <= space + n->m_len + M_TRAILINGSPACE(n)) { > > > + /* if there's enough space in the first mbuf memmove into it */ > > > + memmove(mtod(n, caddr_t) - space, mtod(n, caddr_t), n->m_len); > > > + n->m_data -= space; > > > + len -= n->m_len; > > > > > > > You're not performing a m_getptr operation so you never optimize > > for a case where you can memcpy from the other mbuf into the first > > one which is what old code does (when m->m_next != NULL)... I think > > these should be preserved. > > thats what this chunk does. in the diff below i made the the memmove > conditional on if there's not enough space in the tail. > Right, I've looked at the wrong one. As far as I can tell and test this new diff is fine. I've double checked the alignment math and it looks good to me. OK mikeb > Index: uipc_mbuf.c > === > RCS file: /cvs/src/sys/kern/uipc_mbuf.c,v > retrieving revision 1.233 > diff -u -p -r1.233 uipc_mbuf.c > --- uipc_mbuf.c 10 Oct 2016 00:41:17 - 1.233 > +++ uipc_mbuf.c 11 Oct 2016 09:07:09 - > @@ -842,64 +842,79 @@ struct mbuf * > m_pullup(struct mbuf *n, int len) > { > struct mbuf *m; > - int count; > + unsigned int adj; > + caddr_t head, tail; > + unsigned int space; > > - /* > - * If first mbuf has no cluster, and has room for len bytes > - * without shifting current data, pullup into it, > - * otherwise allocate a new mbuf to prepend to the chain. > - */ > - if ((n->m_flags & M_EXT) == 0 && n->m_next && > - n->m_data + len < &n->m_dat[MLEN]) { > - if (n->m_len >= len) > - return (n); > - m = n; > - n = n->m_next; > - len -= m->m_len; > - } else if ((n->m_flags & M_EXT) != 0 && len > MHLEN && n->m_next && > - n->m_data + len < &n->m_ext.ext_buf[n->m_ext.ext_size]) { > - if (n->m_len >= len) > - return (n); > + /* if n is already contig then don't do any work */ > + if (len <= n->m_len) > + return (n); > + > + adj = (unsigned long)n->m_data & ALIGNBYTES; > + head = (caddr_t)ALIGN(mtod(n, caddr_t) - M_LEADINGSPACE(n)) + adj; > + tail = mtod(n, caddr_t) + n->m_len + M_TRAILINGSPACE(n); > + > + if (head < tail && len <=
request for test: mfii
Hi, I'm working on making mfii(4) bio(4) capable. If you have a machine which has mfii(4), I'd like you to test the diff following. (It might be risky for production machines for this moment.) After the diff applied, bioctl(8) against the disk (eg. sd0) starts working and also "sysctl hw.sensors.mfii0" will appear. Especially if you can configure a hotspare, testing it is very helpful for me since I can't use a hotspare on my test machine. Index: sys/dev/pci//mfii.c === RCS file: /cvs/src/sys/dev/pci/mfii.c,v retrieving revision 1.28 diff -u -p -r1.28 mfii.c --- sys/dev/pci//mfii.c 24 Oct 2016 05:27:52 - 1.28 +++ sys/dev/pci//mfii.c 25 Oct 2016 07:39:12 - @@ -22,9 +22,12 @@ #include #include #include +#include #include #include +#include +#include #include #include @@ -212,6 +215,13 @@ struct mfii_iop { u_int8_t sge_flag_eol; }; +struct mfii_cfg { + struct mfi_conf *cfg; + struct mfi_array*cfg_array; + struct mfi_ld_cfg *cfg_ld; + struct mfi_hotspare *cfg_hs; +}; + struct mfii_softc { struct device sc_dev; const struct mfii_iop *sc_iop; @@ -250,11 +260,15 @@ struct mfii_softc { struct scsi_iopool sc_iopool; struct mfi_ctrl_infosc_info; + + struct ksensor *sc_sensors; + struct ksensordev sc_sensordev; }; intmfii_match(struct device *, void *, void *); void mfii_attach(struct device *, struct device *, void *); intmfii_detach(struct device *, int); +intmfii_scsi_ioctl(struct scsi_link *, u_long, caddr_t, int); struct cfattach mfii_ca = { sizeof(struct mfii_softc), @@ -277,7 +291,7 @@ struct scsi_adapter mfii_switch = { scsi_minphys, NULL, /* probe */ NULL, /* unprobe */ - NULL /* ioctl */ + mfii_scsi_ioctl }; void mfii_pd_scsi_cmd(struct scsi_xfer *); @@ -334,7 +348,26 @@ intmfii_scsi_cmd_cdb(struct mfii_soft struct scsi_xfer *); intmfii_pd_scsi_cmd_cdb(struct mfii_softc *, struct scsi_xfer *); - +intmfii_scsi_ioctl_cache(struct scsi_link *, u_int, + struct dk_cache *); +#if NBIO > 0 +intmfii_ioctl(struct device *, u_long, caddr_t); +intmfii_fill_cfg(struct mfii_softc *, struct mfii_cfg *); +intmfii_ioctl_inq(struct mfii_softc *, struct bioc_inq *); +intmfii_ioctl_vol(struct mfii_softc *, struct bioc_vol *); +intmfii_ioctl_disk(struct mfii_softc *, + struct bioc_disk *); +intmfii_ioctl_alarm(struct mfii_softc *, + struct bioc_alarm *); +intmfii_ioctl_blink(struct mfii_softc *, + struct bioc_blink *); +intmfii_ioctl_setstate(struct mfii_softc *, + struct bioc_setstate *); +intmfii_ioctl_patrol(struct mfii_softc *, + struct bioc_patrol *); +intmfii_create_sensors(struct mfii_softc *); +void mfii_refresh_sensors(void *); +#endif #define mfii_fw_state(_sc) mfii_read((_sc), MFI_OSP) @@ -506,7 +539,8 @@ mfii_attach(struct device *parent, struc memset(&saa, 0, sizeof(saa)); saa.saa_sc_link = &sc->sc_link; - config_found(&sc->sc_dev, &saa, scsiprint); + sc->sc_scsibus = (struct scsibus_softc *) + config_found(&sc->sc_dev, &saa, scsiprint); mfii_syspd(sc); @@ -514,6 +548,16 @@ mfii_attach(struct device *parent, struc mfii_write(sc, MFI_OSTS, 0x); mfii_write(sc, MFI_OMSK, ~MFII_OSTS_INTR_VALID); +#if NBIO > 0 + if (bio_register(&sc->sc_dev, mfii_ioctl) != 0) + panic("%s: controller registration failed", DEVNAME(sc)); + +#ifndef SMALL_KERNEL + if (mfii_create_sensors(sc) != 0) + printf("%s: unable to create sensors\n", DEVNAME(sc)); +#endif +#endif /* NBIO > 0 */ + return; free_sgl: mfii_dmamem_free(sc, sc->sc_sgl); @@ -621,6 +665,10 @@ mfii_detach(struct device *self, int fla if (sc->sc_ih == NULL) return (0); + if (sc->sc_sensors) { + sensordev_deinstall(&sc->sc_sensordev); + free(sc->sc_sensors, M_DEVBUF, sc->sc_info.mci_lds_present); + } pci_intr_disestablish(sc->sc_pc, sc->sc_ih); mfii_dmamem_free(sc, sc->sc_sgl); mfii_dmamem_free(sc, sc->sc_requests); @@ -1065,6 +1113,10 @@ mfii_mgmt(struct mfii_softc *sc, struct hdr->mfh_flags = htole16(MFI_FRAME_DIR_WRITE); memcpy(dma_buf, buf, len); break; +