From owner-svn-src-head@freebsd.org Sun Dec 25 09:40:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34361C8F8FE; Sun, 25 Dec 2016 09:40:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 012FF1FF5; Sun, 25 Dec 2016 09:40:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBP9ejkt031074; Sun, 25 Dec 2016 09:40:45 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBP9ej60031054; Sun, 25 Dec 2016 09:40:45 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612250940.uBP9ej60031054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 25 Dec 2016 09:40:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310534 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Dec 2016 09:40:46 -0000 Author: mav Date: Sun Dec 25 09:40:44 2016 New Revision: 310534 URL: https://svnweb.freebsd.org/changeset/base/310534 Log: Improve third-party copy error reporting. For EXTENDED COPY: - improve parameters checking to report some errors before copy start; - forward sense data from copy target as descriptor in case of error; - report which CSCD reported error in sense key specific information. For WRITE USING TOKEN: - pass through real sense data from copy target instead of reporting our copy error, since for initiator its a "simple" write, not a copy. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl_tpc.c Modified: head/sys/cam/ctl/ctl_tpc.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc.c Sun Dec 25 08:02:37 2016 (r310533) +++ head/sys/cam/ctl/ctl_tpc.c Sun Dec 25 09:40:44 2016 (r310534) @@ -82,6 +82,8 @@ struct tpc_list; TAILQ_HEAD(runl, tpc_io); struct tpc_io { union ctl_io *io; + uint8_t target; + uint32_t cscd; uint64_t lun; struct tpc_list *list; struct runl run; @@ -134,6 +136,11 @@ struct tpc_list { int completed; time_t last_active; TAILQ_HEAD(, tpc_io) allio; + struct scsi_sense_data fwd_sense_data; + uint8_t fwd_sense_len; + uint8_t fwd_scsi_status; + uint8_t fwd_target; + uint16_t fwd_cscd; struct scsi_sense_data sense_data; uint8_t sense_len; uint8_t scsi_status; @@ -809,6 +816,44 @@ tpc_resolve(struct tpc_list *list, uint1 list->init_port, &list->cscd[idx], ss, pb, pbo)); } +static void +tpc_set_io_error_sense(struct tpc_list *list) +{ + int flen; + uint8_t csi[4]; + uint8_t sks[3]; + uint8_t fbuf[4 + 64]; + + scsi_ulto4b(list->curseg, csi); + if (list->fwd_cscd <= 0x07ff) { + sks[0] = SSD_SKS_SEGMENT_VALID; + scsi_ulto2b((uint8_t *)&list->cscd[list->fwd_cscd] - + list->params, &sks[1]); + } else + sks[0] = 0; + if (list->fwd_scsi_status) { + fbuf[0] = 0x0c; + fbuf[2] = list->fwd_target; + flen = list->fwd_sense_len; + if (flen > 64) { + flen = 64; + fbuf[2] |= SSD_FORWARDED_FSDT; + } + fbuf[1] = 2 + flen; + fbuf[3] = list->fwd_scsi_status; + bcopy(&list->fwd_sense_data, &fbuf[4], flen); + flen += 4; + } else + flen = 0; + ctl_set_sense(list->ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_COPY_ABORTED, + /*asc*/ 0x0d, /*ascq*/ 0x01, + SSD_ELEM_COMMAND, sizeof(csi), csi, + sks[0] ? SSD_ELEM_SKS : SSD_ELEM_SKIP, sizeof(sks), sks, + flen ? SSD_ELEM_DESC : SSD_ELEM_SKIP, flen, fbuf, + SSD_ELEM_NONE); +} + static int tpc_process_b2b(struct tpc_list *list) { @@ -820,6 +865,7 @@ tpc_process_b2b(struct tpc_list *list) off_t srclba, dstlba, numbytes, donebytes, roundbytes; int numlba; uint32_t srcblock, dstblock, pb, pbo, adj; + uint16_t scscd, dcscd; uint8_t csi[4]; scsi_ulto4b(list->curseg, csi); @@ -834,11 +880,7 @@ tpc_process_b2b(struct tpc_list *list) ctl_set_task_aborted(list->ctsio); return (CTL_RETVAL_ERROR); } else if (list->error) { - ctl_set_sense(list->ctsio, /*current_error*/ 1, - /*sense_key*/ SSD_KEY_COPY_ABORTED, - /*asc*/ 0x0d, /*ascq*/ 0x01, - SSD_ELEM_COMMAND, sizeof(csi), csi, - SSD_ELEM_NONE); + tpc_set_io_error_sense(list); return (CTL_RETVAL_ERROR); } list->cursectors += list->segsectors; @@ -848,8 +890,10 @@ tpc_process_b2b(struct tpc_list *list) TAILQ_INIT(&list->allio); seg = (struct scsi_ec_segment_b2b *)list->seg[list->curseg]; - sl = tpc_resolve(list, scsi_2btoul(seg->src_cscd), &srcblock, NULL, NULL); - dl = tpc_resolve(list, scsi_2btoul(seg->dst_cscd), &dstblock, &pb, &pbo); + scscd = scsi_2btoul(seg->src_cscd); + dcscd = scsi_2btoul(seg->dst_cscd); + sl = tpc_resolve(list, scscd, &srcblock, NULL, NULL); + dl = tpc_resolve(list, dcscd, &dstblock, &pb, &pbo); if (sl >= CTL_MAX_LUNS || dl >= CTL_MAX_LUNS) { ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, @@ -860,10 +904,10 @@ tpc_process_b2b(struct tpc_list *list) } if (pbo > 0) pbo = pb - pbo; - sdstp = &list->cscd[scsi_2btoul(seg->src_cscd)].dtsp; + sdstp = &list->cscd[scscd].dtsp; if (scsi_3btoul(sdstp->block_length) != 0) srcblock = scsi_3btoul(sdstp->block_length); - ddstp = &list->cscd[scsi_2btoul(seg->dst_cscd)].dtsp; + ddstp = &list->cscd[dcscd].dtsp; if (scsi_3btoul(ddstp->block_length) != 0) dstblock = scsi_3btoul(ddstp->block_length); numlba = scsi_2btoul(seg->number_of_blocks); @@ -924,6 +968,8 @@ tpc_process_b2b(struct tpc_list *list) /*tag_type*/ CTL_TAG_SIMPLE, /*control*/ 0); tior->io->io_hdr.retries = 3; + tior->target = SSD_FORWARDED_SDS_EXSRC; + tior->cscd = scscd; tior->lun = sl; tior->io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = tior; @@ -943,6 +989,8 @@ tpc_process_b2b(struct tpc_list *list) /*tag_type*/ CTL_TAG_SIMPLE, /*control*/ 0); tiow->io->io_hdr.retries = 3; + tiow->target = SSD_FORWARDED_SDS_EXDST; + tiow->cscd = dcscd; tiow->lun = dl; tiow->io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = tiow; @@ -970,6 +1018,7 @@ tpc_process_verify(struct tpc_list *list struct scsi_ec_segment_verify *seg; struct tpc_io *tio; uint64_t sl; + uint16_t cscd; uint8_t csi[4]; scsi_ulto4b(list->curseg, csi); @@ -983,11 +1032,7 @@ tpc_process_verify(struct tpc_list *list ctl_set_task_aborted(list->ctsio); return (CTL_RETVAL_ERROR); } else if (list->error) { - ctl_set_sense(list->ctsio, /*current_error*/ 1, - /*sense_key*/ SSD_KEY_COPY_ABORTED, - /*asc*/ 0x0d, /*ascq*/ 0x01, - SSD_ELEM_COMMAND, sizeof(csi), csi, - SSD_ELEM_NONE); + tpc_set_io_error_sense(list); return (CTL_RETVAL_ERROR); } else return (CTL_RETVAL_COMPLETE); @@ -995,7 +1040,8 @@ tpc_process_verify(struct tpc_list *list TAILQ_INIT(&list->allio); seg = (struct scsi_ec_segment_verify *)list->seg[list->curseg]; - sl = tpc_resolve(list, scsi_2btoul(seg->src_cscd), NULL, NULL, NULL); + cscd = scsi_2btoul(seg->src_cscd); + sl = tpc_resolve(list, cscd, NULL, NULL, NULL); if (sl >= CTL_MAX_LUNS) { ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, @@ -1018,6 +1064,8 @@ tpc_process_verify(struct tpc_list *list tio->io = tpcl_alloc_io(); ctl_scsi_tur(tio->io, /*tag_type*/ CTL_TAG_SIMPLE, /*control*/ 0); tio->io->io_hdr.retries = 3; + tio->target = SSD_FORWARDED_SDS_EXSRC; + tio->cscd = cscd; tio->lun = sl; tio->io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = tio; list->stage++; @@ -1033,6 +1081,7 @@ tpc_process_register_key(struct tpc_list struct tpc_io *tio; uint64_t dl; int datalen; + uint16_t cscd; uint8_t csi[4]; scsi_ulto4b(list->curseg, csi); @@ -1047,11 +1096,7 @@ tpc_process_register_key(struct tpc_list ctl_set_task_aborted(list->ctsio); return (CTL_RETVAL_ERROR); } else if (list->error) { - ctl_set_sense(list->ctsio, /*current_error*/ 1, - /*sense_key*/ SSD_KEY_COPY_ABORTED, - /*asc*/ 0x0d, /*ascq*/ 0x01, - SSD_ELEM_COMMAND, sizeof(csi), csi, - SSD_ELEM_NONE); + tpc_set_io_error_sense(list); return (CTL_RETVAL_ERROR); } else return (CTL_RETVAL_COMPLETE); @@ -1059,7 +1104,8 @@ tpc_process_register_key(struct tpc_list TAILQ_INIT(&list->allio); seg = (struct scsi_ec_segment_register_key *)list->seg[list->curseg]; - dl = tpc_resolve(list, scsi_2btoul(seg->dst_cscd), NULL, NULL, NULL); + cscd = scsi_2btoul(seg->dst_cscd); + dl = tpc_resolve(list, cscd, NULL, NULL, NULL); if (dl >= CTL_MAX_LUNS) { ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, @@ -1084,6 +1130,8 @@ tpc_process_register_key(struct tpc_list scsi_8btou64(seg->res_key), scsi_8btou64(seg->sa_res_key), /*tag_type*/ CTL_TAG_SIMPLE, /*control*/ 0); tio->io->io_hdr.retries = 3; + tio->target = SSD_FORWARDED_SDS_EXDST; + tio->cscd = cscd; tio->lun = dl; tio->io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = tio; list->stage++; @@ -1185,9 +1233,17 @@ tpc_process_wut(struct tpc_list *list) ctl_set_task_aborted(list->ctsio); return (CTL_RETVAL_ERROR); } else if (list->error) { - ctl_set_sense(list->ctsio, /*current_error*/ 1, - /*sense_key*/ SSD_KEY_COPY_ABORTED, - /*asc*/ 0x0d, /*ascq*/ 0x01, SSD_ELEM_NONE); + if (list->fwd_scsi_status) { + list->ctsio->io_hdr.status = + CTL_SCSI_ERROR | CTL_AUTOSENSE; + list->ctsio->scsi_status = list->fwd_scsi_status; + list->ctsio->sense_data = list->fwd_sense_data; + list->ctsio->sense_len = list->fwd_sense_len; + } else { + ctl_set_invalid_field(list->ctsio, + /*sks_valid*/ 0, /*command*/ 0, + /*field*/ 0, /*bit_valid*/ 0, /*bit*/ 0); + } return (CTL_RETVAL_ERROR); } list->cursectors += list->segsectors; @@ -1210,9 +1266,8 @@ tpc_process_wut(struct tpc_list *list) if (tpc_skip_ranges(list->token->range, list->token->nrange, list->offset_into_rod + list->cursectors * dstblock / srcblock, &srange, &soffset) != 0) { - ctl_set_sense(list->ctsio, /*current_error*/ 1, - /*sense_key*/ SSD_KEY_COPY_ABORTED, - /*asc*/ 0x0d, /*ascq*/ 0x04, SSD_ELEM_NONE); + ctl_set_invalid_field(list->ctsio, /*sks_valid*/ 0, + /*command*/ 0, /*field*/ 0, /*bit_valid*/ 0, /*bit*/ 0); return (CTL_RETVAL_ERROR); } @@ -1233,9 +1288,8 @@ tpc_process_wut(struct tpc_list *list) } if (numbytes % srcblock != 0 || numbytes % dstblock != 0) { - ctl_set_sense(list->ctsio, /*current_error*/ 1, - /*sense_key*/ SSD_KEY_COPY_ABORTED, - /*asc*/ 0x26, /*ascq*/ 0x0A, SSD_ELEM_NONE); + ctl_set_invalid_field(list->ctsio, /*sks_valid*/ 0, + /*command*/ 0, /*field*/ 0, /*bit_valid*/ 0, /*bit*/ 0); return (CTL_RETVAL_ERROR); } @@ -1337,9 +1391,17 @@ complete: ctl_set_task_aborted(list->ctsio); return (CTL_RETVAL_ERROR); } else if (list->error) { - ctl_set_sense(list->ctsio, /*current_error*/ 1, - /*sense_key*/ SSD_KEY_COPY_ABORTED, - /*asc*/ 0x0d, /*ascq*/ 0x01, SSD_ELEM_NONE); + if (list->fwd_scsi_status) { + list->ctsio->io_hdr.status = + CTL_SCSI_ERROR | CTL_AUTOSENSE; + list->ctsio->scsi_status = list->fwd_scsi_status; + list->ctsio->sense_data = list->fwd_sense_data; + list->ctsio->sense_len = list->fwd_sense_len; + } else { + ctl_set_invalid_field(list->ctsio, + /*sks_valid*/ 0, /*command*/ 0, + /*field*/ 0, /*bit_valid*/ 0, /*bit*/ 0); + } return (CTL_RETVAL_ERROR); } list->cursectors += list->segsectors; @@ -1616,9 +1678,17 @@ tpc_done(union ctl_io *io) } } - if ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS) + if ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS) { tio->list->error = 1; - else + if (io->io_hdr.io_type == CTL_IO_SCSI && + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SCSI_ERROR) { + tio->list->fwd_scsi_status = io->scsiio.scsi_status; + tio->list->fwd_sense_data = io->scsiio.sense_data; + tio->list->fwd_sense_len = io->scsiio.sense_len; + tio->list->fwd_target = tio->target; + tio->list->fwd_cscd = tio->cscd; + } + } else atomic_add_int(&tio->list->curops, 1); if (!tio->list->error && !tio->list->abort) { while ((tior = TAILQ_FIRST(&tio->run)) != NULL) { @@ -1637,6 +1707,8 @@ ctl_extended_copy_lid1(struct ctl_scsiio { struct scsi_extended_copy *cdb; struct scsi_extended_copy_lid1_data *data; + struct scsi_ec_cscd *cscd; + struct scsi_ec_segment *seg; struct ctl_lun *lun; struct tpc_list *list, *tlist; uint8_t *ptr; @@ -1715,6 +1787,17 @@ ctl_extended_copy_lid1(struct ctl_scsiio list->flags = data->flags; list->params = ctsio->kern_data_ptr; list->cscd = (struct scsi_ec_cscd *)&data->data[0]; + ptr = &data->data[0]; + for (off = 0; off < lencscd; off += sizeof(struct scsi_ec_cscd)) { + cscd = (struct scsi_ec_cscd *)(ptr + off); + if (cscd->type_code != EC_CSCD_ID) { + free(list, M_CTL); + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, + /*asc*/ 0x26, /*ascq*/ 0x07, SSD_ELEM_NONE); + goto done; + } + } ptr = &data->data[lencscd]; for (nseg = 0, off = 0; off < lenseg; nseg++) { if (nseg >= TPC_MAX_SEGS) { @@ -1724,9 +1807,19 @@ ctl_extended_copy_lid1(struct ctl_scsiio /*asc*/ 0x26, /*ascq*/ 0x08, SSD_ELEM_NONE); goto done; } - list->seg[nseg] = (struct scsi_ec_segment *)(ptr + off); + seg = (struct scsi_ec_segment *)(ptr + off); + if (seg->type_code != EC_SEG_B2B && + seg->type_code != EC_SEG_VERIFY && + seg->type_code != EC_SEG_REGISTER_KEY) { + free(list, M_CTL); + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, + /*asc*/ 0x26, /*ascq*/ 0x09, SSD_ELEM_NONE); + goto done; + } + list->seg[nseg] = seg; off += sizeof(struct scsi_ec_segment) + - scsi_2btoul(list->seg[nseg]->descr_length); + scsi_2btoul(seg->descr_length); } list->inl = &data->data[lencscd + lenseg]; list->ncscd = lencscd / sizeof(struct scsi_ec_cscd); @@ -1770,6 +1863,8 @@ ctl_extended_copy_lid4(struct ctl_scsiio { struct scsi_extended_copy *cdb; struct scsi_extended_copy_lid4_data *data; + struct scsi_ec_cscd *cscd; + struct scsi_ec_segment *seg; struct ctl_lun *lun; struct tpc_list *list, *tlist; uint8_t *ptr; @@ -1848,6 +1943,17 @@ ctl_extended_copy_lid4(struct ctl_scsiio list->flags = data->flags; list->params = ctsio->kern_data_ptr; list->cscd = (struct scsi_ec_cscd *)&data->data[0]; + ptr = &data->data[0]; + for (off = 0; off < lencscd; off += sizeof(struct scsi_ec_cscd)) { + cscd = (struct scsi_ec_cscd *)(ptr + off); + if (cscd->type_code != EC_CSCD_ID) { + free(list, M_CTL); + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, + /*asc*/ 0x26, /*ascq*/ 0x07, SSD_ELEM_NONE); + goto done; + } + } ptr = &data->data[lencscd]; for (nseg = 0, off = 0; off < lenseg; nseg++) { if (nseg >= TPC_MAX_SEGS) { @@ -1857,9 +1963,19 @@ ctl_extended_copy_lid4(struct ctl_scsiio /*asc*/ 0x26, /*ascq*/ 0x08, SSD_ELEM_NONE); goto done; } - list->seg[nseg] = (struct scsi_ec_segment *)(ptr + off); + seg = (struct scsi_ec_segment *)(ptr + off); + if (seg->type_code != EC_SEG_B2B && + seg->type_code != EC_SEG_VERIFY && + seg->type_code != EC_SEG_REGISTER_KEY) { + free(list, M_CTL); + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, + /*asc*/ 0x26, /*ascq*/ 0x09, SSD_ELEM_NONE); + goto done; + } + list->seg[nseg] = seg; off += sizeof(struct scsi_ec_segment) + - scsi_2btoul(list->seg[nseg]->descr_length); + scsi_2btoul(seg->descr_length); } list->inl = &data->data[lencscd + lenseg]; list->ncscd = lencscd / sizeof(struct scsi_ec_cscd); From owner-svn-src-head@freebsd.org Sun Dec 25 13:34:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E9BFC8DC52; Sun, 25 Dec 2016 13:34:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3A6017D9; Sun, 25 Dec 2016 13:34:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBPDY3N4028482; Sun, 25 Dec 2016 13:34:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBPDY2Nn028478; Sun, 25 Dec 2016 13:34:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612251334.uBPDY2Nn028478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 25 Dec 2016 13:34:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310539 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Dec 2016 13:34:04 -0000 Author: mav Date: Sun Dec 25 13:34:02 2016 New Revision: 310539 URL: https://svnweb.freebsd.org/changeset/base/310539 Log: Remove CTL_MAX_LUNS from places where it is not required. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_frontend.c head/sys/cam/ctl/ctl_tpc.c head/sys/cam/ctl/ctl_tpc_local.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sun Dec 25 12:00:56 2016 (r310538) +++ head/sys/cam/ctl/ctl.c Sun Dec 25 13:34:02 2016 (r310539) @@ -1218,7 +1218,7 @@ ctl_isc_port_sync(struct ctl_softc *soft } mtx_lock(&softc->ctl_lock); STAILQ_FOREACH(lun, &softc->lun_list, links) { - if (ctl_lun_map_to_port(port, lun->lun) >= CTL_MAX_LUNS) + if (ctl_lun_map_to_port(port, lun->lun) == UINT32_MAX) continue; mtx_lock(&lun->lun_lock); ctl_est_ua_all(lun, -1, CTL_UA_INQ_CHANGE); @@ -2906,18 +2906,18 @@ ctl_ioctl(struct cdev *dev, u_long cmd, break; } case CTL_DUMP_STRUCTS: { - int i, j, k; + int j, k; struct ctl_port *port; struct ctl_frontend *fe; mtx_lock(&softc->ctl_lock); printf("CTL Persistent Reservation information start:\n"); - for (i = 0; i < CTL_MAX_LUNS; i++) { - lun = softc->ctl_luns[i]; - - if ((lun == NULL) - || ((lun->flags & CTL_LUN_DISABLED) != 0)) + STAILQ_FOREACH(lun, &softc->lun_list, links) { + mtx_lock(&lun->lun_lock); + if ((lun->flags & CTL_LUN_DISABLED) != 0) { + mtx_unlock(&lun->lun_lock); continue; + } for (j = 0; j < CTL_MAX_PORTS; j++) { if (lun->pr_keys[j] == NULL) @@ -2925,11 +2925,12 @@ ctl_ioctl(struct cdev *dev, u_long cmd, for (k = 0; k < CTL_MAX_INIT_PER_PORT; k++){ if (lun->pr_keys[j][k] == 0) continue; - printf(" LUN %d port %d iid %d key " - "%#jx\n", i, j, k, + printf(" LUN %ju port %d iid %d key " + "%#jx\n", lun->lun, j, k, (uintmax_t)lun->pr_keys[j][k]); } } + mtx_unlock(&lun->lun_lock); } printf("CTL Persistent Reservation information end\n"); printf("CTL Ports:\n"); @@ -3312,7 +3313,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, sbuf_printf(sb, "\ton\n"); for (j = 0; j < CTL_MAX_LUNS; j++) { plun = ctl_lun_map_from_port(port, j); - if (plun >= CTL_MAX_LUNS) + if (plun == UINT32_MAX) continue; sbuf_printf(sb, "\t%u\n", @@ -3380,8 +3381,8 @@ ctl_ioctl(struct cdev *dev, u_long cmd, } if (port->status & CTL_PORT_STATUS_ONLINE) { STAILQ_FOREACH(lun, &softc->lun_list, links) { - if (ctl_lun_map_to_port(port, lun->lun) >= - CTL_MAX_LUNS) + if (ctl_lun_map_to_port(port, lun->lun) == + UINT32_MAX) continue; mtx_lock(&lun->lun_lock); ctl_est_ua_port(lun, lm->port, -1, @@ -3509,7 +3510,7 @@ ctl_lun_map_set(struct ctl_port *port, u } old = port->lun_map[plun]; port->lun_map[plun] = glun; - if ((port->status & CTL_PORT_STATUS_ONLINE) && old >= CTL_MAX_LUNS) { + if ((port->status & CTL_PORT_STATUS_ONLINE) && old == UINT32_MAX) { if (port->lun_enable != NULL) port->lun_enable(port->targ_lun_arg, plun); ctl_isc_announce_port(port); @@ -3526,7 +3527,7 @@ ctl_lun_map_unset(struct ctl_port *port, return (0); old = port->lun_map[plun]; port->lun_map[plun] = UINT32_MAX; - if ((port->status & CTL_PORT_STATUS_ONLINE) && old < CTL_MAX_LUNS) { + if ((port->status & CTL_PORT_STATUS_ONLINE) && old != UINT32_MAX) { if (port->lun_disable != NULL) port->lun_disable(port->targ_lun_arg, plun); ctl_isc_announce_port(port); @@ -3540,7 +3541,7 @@ ctl_lun_map_from_port(struct ctl_port *p if (port == NULL) return (UINT32_MAX); - if (port->lun_map == NULL || lun_id >= CTL_MAX_LUNS) + if (port->lun_map == NULL || lun_id == UINT32_MAX) return (lun_id); return (port->lun_map[lun_id]); } @@ -7142,7 +7143,7 @@ ctl_report_tagret_port_groups(struct ctl STAILQ_FOREACH(port, &softc->port_list, links) { if ((port->status & CTL_PORT_STATUS_ONLINE) == 0) continue; - if (ctl_lun_map_to_port(port, lun->lun) >= CTL_MAX_LUNS) + if (ctl_lun_map_to_port(port, lun->lun) == UINT32_MAX) continue; num_target_ports++; if (port->status & CTL_PORT_STATUS_HA_SHARED) @@ -7234,7 +7235,7 @@ ctl_report_tagret_port_groups(struct ctl if (!softc->is_single && (port->status & CTL_PORT_STATUS_HA_SHARED) == 0) continue; - if (ctl_lun_map_to_port(port, lun->lun) >= CTL_MAX_LUNS) + if (ctl_lun_map_to_port(port, lun->lun) == UINT32_MAX) continue; scsi_ulto2b(port->targ_port, tpg_desc->descriptors[pc]. relative_target_port_identifier); @@ -7259,7 +7260,7 @@ ctl_report_tagret_port_groups(struct ctl continue; if (port->status & CTL_PORT_STATUS_HA_SHARED) continue; - if (ctl_lun_map_to_port(port, lun->lun) >= CTL_MAX_LUNS) + if (ctl_lun_map_to_port(port, lun->lun) == UINT32_MAX) continue; scsi_ulto2b(port->targ_port, tpg_desc->descriptors[pc]. relative_target_port_identifier); @@ -9078,7 +9079,7 @@ ctl_report_luns(struct ctl_scsiio *ctsio mtx_lock(&softc->ctl_lock); num_luns = 0; for (targ_lun_id = 0; targ_lun_id < CTL_MAX_LUNS; targ_lun_id++) { - if (ctl_lun_map_from_port(port, targ_lun_id) < CTL_MAX_LUNS) + if (ctl_lun_map_from_port(port, targ_lun_id) != UINT32_MAX) num_luns++; } mtx_unlock(&softc->ctl_lock); @@ -9138,7 +9139,7 @@ ctl_report_luns(struct ctl_scsiio *ctsio mtx_lock(&softc->ctl_lock); for (targ_lun_id = 0, num_filled = 0; targ_lun_id < CTL_MAX_LUNS && num_filled < num_luns; targ_lun_id++) { lun_id = ctl_lun_map_from_port(port, targ_lun_id); - if (lun_id >= CTL_MAX_LUNS) + if (lun_id == UINT32_MAX) continue; lun = softc->ctl_luns[lun_id]; if (lun == NULL) @@ -9774,7 +9775,7 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s if ((port->status & CTL_PORT_STATUS_ONLINE) == 0) continue; if (lun != NULL && - ctl_lun_map_to_port(port, lun->lun) >= CTL_MAX_LUNS) + ctl_lun_map_to_port(port, lun->lun) == UINT32_MAX) continue; num_target_ports++; if (port->init_devid) @@ -9825,7 +9826,7 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s if ((port->status & CTL_PORT_STATUS_ONLINE) == 0) continue; if (lun != NULL && - ctl_lun_map_to_port(port, lun->lun) >= CTL_MAX_LUNS) + ctl_lun_map_to_port(port, lun->lun) == UINT32_MAX) continue; scsi_ulto2b(port->targ_port, pd->relative_port_id); if (port->init_devid) { @@ -11882,7 +11883,7 @@ ctl_target_reset(struct ctl_softc *softc port = ctl_io_port(&io->io_hdr); STAILQ_FOREACH(lun, &softc->lun_list, links) { if (port != NULL && - ctl_lun_map_to_port(port, lun->lun) >= CTL_MAX_LUNS) + ctl_lun_map_to_port(port, lun->lun) == UINT32_MAX) continue; retval += ctl_do_lun_reset(lun, io, ua_type); } Modified: head/sys/cam/ctl/ctl_frontend.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend.c Sun Dec 25 12:00:56 2016 (r310538) +++ head/sys/cam/ctl/ctl_frontend.c Sun Dec 25 13:34:02 2016 (r310539) @@ -316,8 +316,8 @@ ctl_port_online(struct ctl_port *port) if (port->lun_enable != NULL) { if (port->lun_map) { for (l = 0; l < CTL_MAX_LUNS; l++) { - if (ctl_lun_map_from_port(port, l) >= - CTL_MAX_LUNS) + if (ctl_lun_map_from_port(port, l) == + UINT32_MAX) continue; port->lun_enable(port->targ_lun_arg, l); } @@ -338,7 +338,7 @@ ctl_port_online(struct ctl_port *port) } port->status |= CTL_PORT_STATUS_ONLINE; STAILQ_FOREACH(lun, &softc->lun_list, links) { - if (ctl_lun_map_to_port(port, lun->lun) >= CTL_MAX_LUNS) + if (ctl_lun_map_to_port(port, lun->lun) == UINT32_MAX) continue; mtx_lock(&lun->lun_lock); ctl_est_ua_all(lun, -1, CTL_UA_INQ_CHANGE); @@ -360,8 +360,8 @@ ctl_port_offline(struct ctl_port *port) if (port->lun_disable != NULL) { if (port->lun_map) { for (l = 0; l < CTL_MAX_LUNS; l++) { - if (ctl_lun_map_from_port(port, l) >= - CTL_MAX_LUNS) + if (ctl_lun_map_from_port(port, l) == + UINT32_MAX) continue; port->lun_disable(port->targ_lun_arg, l); } @@ -373,7 +373,7 @@ ctl_port_offline(struct ctl_port *port) mtx_lock(&softc->ctl_lock); port->status &= ~CTL_PORT_STATUS_ONLINE; STAILQ_FOREACH(lun, &softc->lun_list, links) { - if (ctl_lun_map_to_port(port, lun->lun) >= CTL_MAX_LUNS) + if (ctl_lun_map_to_port(port, lun->lun) == UINT32_MAX) continue; mtx_lock(&lun->lun_lock); ctl_est_ua_all(lun, -1, CTL_UA_INQ_CHANGE); Modified: head/sys/cam/ctl/ctl_tpc.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc.c Sun Dec 25 12:00:56 2016 (r310538) +++ head/sys/cam/ctl/ctl_tpc.c Sun Dec 25 13:34:02 2016 (r310539) @@ -894,7 +894,7 @@ tpc_process_b2b(struct tpc_list *list) dcscd = scsi_2btoul(seg->dst_cscd); sl = tpc_resolve(list, scscd, &srcblock, NULL, NULL); dl = tpc_resolve(list, dcscd, &dstblock, &pb, &pbo); - if (sl >= CTL_MAX_LUNS || dl >= CTL_MAX_LUNS) { + if (sl == UINT64_MAX || dl == UINT64_MAX) { ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x08, /*ascq*/ 0x04, @@ -1042,7 +1042,7 @@ tpc_process_verify(struct tpc_list *list seg = (struct scsi_ec_segment_verify *)list->seg[list->curseg]; cscd = scsi_2btoul(seg->src_cscd); sl = tpc_resolve(list, cscd, NULL, NULL, NULL); - if (sl >= CTL_MAX_LUNS) { + if (sl == UINT64_MAX) { ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x08, /*ascq*/ 0x04, @@ -1106,7 +1106,7 @@ tpc_process_register_key(struct tpc_list seg = (struct scsi_ec_segment_register_key *)list->seg[list->curseg]; cscd = scsi_2btoul(seg->dst_cscd); dl = tpc_resolve(list, cscd, NULL, NULL, NULL); - if (dl >= CTL_MAX_LUNS) { + if (dl == UINT64_MAX) { ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x08, /*ascq*/ 0x04, Modified: head/sys/cam/ctl/ctl_tpc_local.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc_local.c Sun Dec 25 12:00:56 2016 (r310538) +++ head/sys/cam/ctl/ctl_tpc_local.c Sun Dec 25 13:34:02 2016 (r310539) @@ -290,7 +290,7 @@ tpcl_resolve(struct ctl_softc *softc, in port = NULL; STAILQ_FOREACH(lun, &softc->lun_list, links) { if (port != NULL && - ctl_lun_map_to_port(port, lun->lun) >= CTL_MAX_LUNS) + ctl_lun_map_to_port(port, lun->lun) == UINT32_MAX) continue; if (lun->lun_devid == NULL) continue; From owner-svn-src-head@freebsd.org Sun Dec 25 15:39:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3F47C8E321; Sun, 25 Dec 2016 15:39:53 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 73B0CFCD; Sun, 25 Dec 2016 15:39:53 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBPFdq00079001; Sun, 25 Dec 2016 15:39:52 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBPFdqFR079000; Sun, 25 Dec 2016 15:39:52 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201612251539.uBPFdqFR079000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 25 Dec 2016 15:39:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310543 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Dec 2016 15:39:53 -0000 Author: bapt Date: Sun Dec 25 15:39:52 2016 New Revision: 310543 URL: https://svnweb.freebsd.org/changeset/base/310543 Log: Fix build of lib32 libraries for amd64 and powerpc64 with cross toolchain Modified: head/Makefile.libcompat Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Sun Dec 25 15:05:59 2016 (r310542) +++ head/Makefile.libcompat Sun Dec 25 15:39:52 2016 (r310543) @@ -85,7 +85,7 @@ LIBCOMPATCFLAGS+= -isystem ${LIBCOMPATTM .if ${X_COMPILER_VERSION} >= 40800 && \ (${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no") LIBCOMPATCXXFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include/c++/v1 -std=c++11 \ - -nostdinc++ -L${LIBCOMPAT_OBJTREE}${.CURDIR}/lib/libc++ + -nostdinc++ .endif .endif From owner-svn-src-head@freebsd.org Sun Dec 25 17:37:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4668C90A9B; Sun, 25 Dec 2016 17:37:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3BFB1142; Sun, 25 Dec 2016 17:37:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBPHbIZq027942; Sun, 25 Dec 2016 17:37:18 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBPHbIhd027939; Sun, 25 Dec 2016 17:37:18 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612251737.uBPHbIhd027939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 25 Dec 2016 17:37:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310547 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Dec 2016 17:37:19 -0000 Author: tuexen Date: Sun Dec 25 17:37:18 2016 New Revision: 310547 URL: https://svnweb.freebsd.org/changeset/base/310547 Log: Remove a KASSERT which is not always true. In case of the empty queue tp->snd_holes and tcp_sackhole_insert() failing due to memory shortage, tp->snd_holes will be empty. This problem was hit when stress tests where performed by pho. PR: 215513 Reported by: pho Tested by: pho Sponsored by: Netflix, Inc. Modified: head/sys/netinet/tcp_sack.c Modified: head/sys/netinet/tcp_sack.c ============================================================================== --- head/sys/netinet/tcp_sack.c Sun Dec 25 17:01:58 2016 (r310546) +++ head/sys/netinet/tcp_sack.c Sun Dec 25 17:37:18 2016 (r310547) @@ -470,9 +470,6 @@ tcp_sack_doack(struct tcpcb *tp, struct tp->snd_fack = sblkp->end; sack_changed = 1; } - /* We must have at least one SACK hole in scoreboard. */ - KASSERT(!TAILQ_EMPTY(&tp->snd_holes), - ("SACK scoreboard must not be empty")); cur = TAILQ_LAST(&tp->snd_holes, sackhole_head); /* Last SACK hole. */ /* * Since the incoming sack blocks are sorted, we can process them From owner-svn-src-head@freebsd.org Sun Dec 25 19:38:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7443CC90198; Sun, 25 Dec 2016 19:38:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38EF114E8; Sun, 25 Dec 2016 19:38:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBPJc714077452; Sun, 25 Dec 2016 19:38:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBPJc7rb077451; Sun, 25 Dec 2016 19:38:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612251938.uBPJc7rb077451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 25 Dec 2016 19:38:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310552 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Dec 2016 19:38:08 -0000 Author: kib Date: Sun Dec 25 19:38:07 2016 New Revision: 310552 URL: https://svnweb.freebsd.org/changeset/base/310552 Log: Some style. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week X-Differential revision: https://reviews.freebsd.org/D8901 Modified: head/sys/kern/kern_event.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Sun Dec 25 17:54:23 2016 (r310551) +++ head/sys/kern/kern_event.c Sun Dec 25 19:38:07 2016 (r310552) @@ -591,7 +591,7 @@ timer2sbintime(intptr_t data, int flags) case NOTE_SECONDS: #ifdef __LP64__ if (data > (SBT_MAX / SBT_1S)) - return SBT_MAX; + return (SBT_MAX); #endif return ((sbintime_t)data << 32); case NOTE_MSECONDS: /* FALLTHROUGH */ @@ -600,7 +600,7 @@ timer2sbintime(intptr_t data, int flags) int64_t secs = data / 1000; #ifdef __LP64__ if (secs > (SBT_MAX / SBT_1S)) - return SBT_MAX; + return (SBT_MAX); #endif return (secs << 32 | MS_TO_SBT(data % 1000)); } @@ -610,7 +610,7 @@ timer2sbintime(intptr_t data, int flags) int64_t secs = data / 1000000; #ifdef __LP64__ if (secs > (SBT_MAX / SBT_1S)) - return SBT_MAX; + return (SBT_MAX); #endif return (secs << 32 | US_TO_SBT(data % 1000000)); } @@ -620,11 +620,11 @@ timer2sbintime(intptr_t data, int flags) int64_t secs = data / 1000000000; #ifdef __LP64__ if (secs > (SBT_MAX / SBT_1S)) - return SBT_MAX; + return (SBT_MAX); #endif return (secs << 32 | US_TO_SBT(data % 1000000000)); } - return NS_TO_SBT(data); + return (NS_TO_SBT(data)); default: break; } From owner-svn-src-head@freebsd.org Sun Dec 25 19:49:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59539C904B8; Sun, 25 Dec 2016 19:49:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 286A119D5; Sun, 25 Dec 2016 19:49:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBPJn9oK081354; Sun, 25 Dec 2016 19:49:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBPJn9TS081353; Sun, 25 Dec 2016 19:49:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612251949.uBPJn9TS081353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 25 Dec 2016 19:49:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310553 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Dec 2016 19:49:10 -0000 Author: hselasky Date: Sun Dec 25 19:49:09 2016 New Revision: 310553 URL: https://svnweb.freebsd.org/changeset/base/310553 Log: Improve LinuxKPI device support. Only delete own BSD devices and not the ones obtained through devclass_get_device(). Some minor code cleanups while at it. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/device.h Modified: head/sys/compat/linuxkpi/common/include/linux/device.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/device.h Sun Dec 25 19:38:07 2016 (r310552) +++ head/sys/compat/linuxkpi/common/include/linux/device.h Sun Dec 25 19:49:09 2016 (r310553) @@ -63,6 +63,14 @@ struct device { struct device *parent; struct list_head irqents; device_t bsddev; + /* + * The following flag is used to determine if the LinuxKPI is + * responsible for detaching the BSD device or not. If the + * LinuxKPI got the BSD device using devclass_get_device(), it + * must not try to detach or delete it, because it's already + * done somewhere else. + */ + bool bsddev_attached_here; dev_t devt; struct class *class; void (*release)(struct device *dev); @@ -208,23 +216,36 @@ static inline struct device *kobj_to_dev static inline void device_initialize(struct device *dev) { - device_t bsddev; + device_t bsddev = NULL; + int unit = -1; - bsddev = NULL; if (dev->devt) { - int unit = MINOR(dev->devt); + unit = MINOR(dev->devt); bsddev = devclass_get_device(dev->class->bsdclass, unit); + dev->bsddev_attached_here = false; + } else if (dev->parent == NULL) { + bsddev = devclass_get_device(dev->class->bsdclass, 0); + dev->bsddev_attached_here = false; + } else { + dev->bsddev_attached_here = true; + } + + if (bsddev == NULL && dev->parent != NULL) { + bsddev = device_add_child(dev->parent->bsddev, + dev->class->kobj.name, unit); } + if (bsddev != NULL) device_set_softc(bsddev, dev); dev->bsddev = bsddev; + MPASS(dev->bsddev != NULL); kobject_init(&dev->kobj, &linux_dev_ktype); } static inline int device_add(struct device *dev) -{ +{ if (dev->bsddev != NULL) { if (dev->devt == 0) dev->devt = makedev(0, device_get_unit(dev->bsddev)); @@ -256,13 +277,13 @@ device_create_groups_vargs(struct class goto error; } - device_initialize(dev); dev->devt = devt; dev->class = class; dev->parent = parent; dev->groups = groups; dev->release = device_create_release; - dev->bsddev = devclass_get_device(dev->class->bsdclass, MINOR(devt)); + /* device_initialize() needs the class and parent to be set */ + device_initialize(dev); dev_set_drvdata(dev, drvdata); retval = kobject_set_name_vargs(&dev->kobj, fmt, args); @@ -298,17 +319,21 @@ device_create_with_groups(struct class * static inline int device_register(struct device *dev) { - device_t bsddev; - int unit; + device_t bsddev = NULL; + int unit = -1; - bsddev = NULL; - unit = -1; + if (dev->bsddev != NULL) + goto done; if (dev->devt) { unit = MINOR(dev->devt); bsddev = devclass_get_device(dev->class->bsdclass, unit); + dev->bsddev_attached_here = false; } else if (dev->parent == NULL) { bsddev = devclass_get_device(dev->class->bsdclass, 0); + dev->bsddev_attached_here = false; + } else { + dev->bsddev_attached_here = true; } if (bsddev == NULL && dev->parent != NULL) { bsddev = device_add_child(dev->parent->bsddev, @@ -320,6 +345,7 @@ device_register(struct device *dev) device_set_softc(bsddev, dev); } dev->bsddev = bsddev; +done: kobject_init(&dev->kobj, &linux_dev_ktype); kobject_add(&dev->kobj, &dev->class->kobj, dev_name(dev)); @@ -334,7 +360,7 @@ device_unregister(struct device *dev) bsddev = dev->bsddev; dev->bsddev = NULL; - if (bsddev != NULL) { + if (bsddev != NULL && dev->bsddev_attached_here) { mtx_lock(&Giant); device_delete_child(device_get_parent(bsddev), bsddev); mtx_unlock(&Giant); @@ -350,7 +376,7 @@ device_del(struct device *dev) bsddev = dev->bsddev; dev->bsddev = NULL; - if (bsddev != NULL) { + if (bsddev != NULL && dev->bsddev_attached_here) { mtx_lock(&Giant); device_delete_child(device_get_parent(bsddev), bsddev); mtx_unlock(&Giant); From owner-svn-src-head@freebsd.org Sun Dec 25 19:49:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72059C9053B; Sun, 25 Dec 2016 19:49:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C8AA1B7A; Sun, 25 Dec 2016 19:49:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBPJnZeO081413; Sun, 25 Dec 2016 19:49:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBPJnZnv081411; Sun, 25 Dec 2016 19:49:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612251949.uBPJnZnv081411@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 25 Dec 2016 19:49:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310554 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Dec 2016 19:49:36 -0000 Author: kib Date: Sun Dec 25 19:49:35 2016 New Revision: 310554 URL: https://svnweb.freebsd.org/changeset/base/310554 Log: Some optimizations for kqueue timers. There is no need to do two allocations per kqueue timer. Gather all data needed by the timer callout into the structure and allocate it at once. Use the structure to preserve the result of timer2sbintime(), to not perform repeated 64bit calculations in callout. Remove tautological casts. Remove now unused p_nexttime [1]. Noted by: markj [1] Reviewed by: markj (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week X-MFC note: do not remove p_nexttime Differential revision: https://reviews.freebsd.org/D8901 Modified: head/sys/kern/kern_event.c head/sys/sys/event.h Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Sun Dec 25 19:49:09 2016 (r310553) +++ head/sys/kern/kern_event.c Sun Dec 25 19:49:35 2016 (r310554) @@ -631,23 +631,29 @@ timer2sbintime(intptr_t data, int flags) return (-1); } +struct kq_timer_cb_data { + struct callout c; + sbintime_t next; /* next timer event fires at */ + sbintime_t to; /* precalculated timer period */ +}; + static void filt_timerexpire(void *knx) { - struct callout *calloutp; struct knote *kn; + struct kq_timer_cb_data *kc; kn = knx; kn->kn_data++; KNOTE_ACTIVATE(kn, 0); /* XXX - handle locking */ - if ((kn->kn_flags & EV_ONESHOT) != EV_ONESHOT) { - calloutp = (struct callout *)kn->kn_hook; - *kn->kn_ptr.p_nexttime += timer2sbintime(kn->kn_sdata, - kn->kn_sfflags); - callout_reset_sbt_on(calloutp, *kn->kn_ptr.p_nexttime, 0, - filt_timerexpire, kn, PCPU_GET(cpuid), C_ABSOLUTE); - } + if ((kn->kn_flags & EV_ONESHOT) != 0) + return; + + kc = kn->kn_ptr.p_v; + kc->next += kc->to; + callout_reset_sbt_on(&kc->c, kc->next, 0, filt_timerexpire, kn, + PCPU_GET(cpuid), C_ABSOLUTE); } /* @@ -656,16 +662,16 @@ filt_timerexpire(void *knx) static int filt_timerattach(struct knote *kn) { - struct callout *calloutp; + struct kq_timer_cb_data *kc; sbintime_t to; unsigned int ncallouts; - if ((intptr_t)kn->kn_sdata < 0) + if (kn->kn_sdata < 0) return (EINVAL); - if ((intptr_t)kn->kn_sdata == 0 && (kn->kn_flags & EV_ONESHOT) == 0) + if (kn->kn_sdata == 0 && (kn->kn_flags & EV_ONESHOT) == 0) kn->kn_sdata = 1; /* Only precision unit are supported in flags so far */ - if (kn->kn_sfflags & ~NOTE_TIMER_PRECMASK) + if ((kn->kn_sfflags & ~NOTE_TIMER_PRECMASK) != 0) return (EINVAL); to = timer2sbintime(kn->kn_sdata, kn->kn_sfflags); @@ -680,13 +686,12 @@ filt_timerattach(struct knote *kn) kn->kn_flags |= EV_CLEAR; /* automatically set */ kn->kn_status &= ~KN_DETACHED; /* knlist_add clears it */ - kn->kn_ptr.p_nexttime = malloc(sizeof(sbintime_t), M_KQUEUE, M_WAITOK); - calloutp = malloc(sizeof(*calloutp), M_KQUEUE, M_WAITOK); - callout_init(calloutp, 1); - kn->kn_hook = calloutp; - *kn->kn_ptr.p_nexttime = to + sbinuptime(); - callout_reset_sbt_on(calloutp, *kn->kn_ptr.p_nexttime, 0, - filt_timerexpire, kn, PCPU_GET(cpuid), C_ABSOLUTE); + kn->kn_ptr.p_v = kc = malloc(sizeof(*kc), M_KQUEUE, M_WAITOK); + callout_init(&kc->c, 1); + kc->next = to + sbinuptime(); + kc->to = to; + callout_reset_sbt_on(&kc->c, kc->next, 0, filt_timerexpire, kn, + PCPU_GET(cpuid), C_ABSOLUTE); return (0); } @@ -694,13 +699,12 @@ filt_timerattach(struct knote *kn) static void filt_timerdetach(struct knote *kn) { - struct callout *calloutp; + struct kq_timer_cb_data *kc; unsigned int old; - calloutp = (struct callout *)kn->kn_hook; - callout_drain(calloutp); - free(calloutp, M_KQUEUE); - free(kn->kn_ptr.p_nexttime, M_KQUEUE); + kc = kn->kn_ptr.p_v; + callout_drain(&kc->c); + free(kc, M_KQUEUE); old = atomic_fetchadd_int(&kq_ncallouts, -1); KASSERT(old > 0, ("Number of callouts cannot become negative")); kn->kn_status |= KN_DETACHED; /* knlist_remove sets it */ Modified: head/sys/sys/event.h ============================================================================== --- head/sys/sys/event.h Sun Dec 25 19:49:09 2016 (r310553) +++ head/sys/sys/event.h Sun Dec 25 19:49:35 2016 (r310554) @@ -231,7 +231,6 @@ struct knote { struct proc *p_proc; /* proc pointer */ struct kaiocb *p_aio; /* AIO job pointer */ struct aioliojob *p_lio; /* LIO job pointer */ - sbintime_t *p_nexttime; /* next timer event fires at */ void *p_v; /* generic other pointer */ } kn_ptr; struct filterops *kn_fop; From owner-svn-src-head@freebsd.org Sun Dec 25 20:17:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E9BEC90CAE; Sun, 25 Dec 2016 20:17:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6DE3BB33; Sun, 25 Dec 2016 20:17:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBPKHFHq093567; Sun, 25 Dec 2016 20:17:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBPKHFeC093566; Sun, 25 Dec 2016 20:17:15 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612252017.uBPKHFeC093566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 25 Dec 2016 20:17:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310555 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Dec 2016 20:17:16 -0000 Author: mav Date: Sun Dec 25 20:17:15 2016 New Revision: 310555 URL: https://svnweb.freebsd.org/changeset/base/310555 Log: Some random code cleaning. - Reduce indentation. - Remove extra braces. - Add few missing savety checks. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sun Dec 25 19:49:35 2016 (r310554) +++ head/sys/cam/ctl/ctl.c Sun Dec 25 20:17:15 2016 (r310555) @@ -424,7 +424,7 @@ static int ctl_init(void); void ctl_shutdown(void); static int ctl_open(struct cdev *dev, int flags, int fmt, struct thread *td); static int ctl_close(struct cdev *dev, int flags, int fmt, struct thread *td); -static int ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio); +static void ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio); static void ctl_ioctl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num, struct ctl_ooa *ooa_hdr, struct ctl_ooa_entry *kern_entries); @@ -1024,27 +1024,27 @@ ctl_isc_ua(struct ctl_softc *softc, unio uint32_t iid = ctl_get_initindex(&msg->hdr.nexus); mtx_lock(&softc->ctl_lock); - if (msg->hdr.nexus.targ_lun < CTL_MAX_LUNS && - (lun = softc->ctl_luns[msg->hdr.nexus.targ_mapped_lun]) != NULL) { - mtx_lock(&lun->lun_lock); - mtx_unlock(&softc->ctl_lock); - if (msg->ua.ua_type == CTL_UA_THIN_PROV_THRES && - msg->ua.ua_set) - memcpy(lun->ua_tpt_info, msg->ua.ua_info, 8); - if (msg->ua.ua_all) { - if (msg->ua.ua_set) - ctl_est_ua_all(lun, iid, msg->ua.ua_type); - else - ctl_clr_ua_all(lun, iid, msg->ua.ua_type); - } else { - if (msg->ua.ua_set) - ctl_est_ua(lun, iid, msg->ua.ua_type); - else - ctl_clr_ua(lun, iid, msg->ua.ua_type); - } - mtx_unlock(&lun->lun_lock); - } else + if (msg->hdr.nexus.targ_lun >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[msg->hdr.nexus.targ_mapped_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); + return; + } + mtx_lock(&lun->lun_lock); + mtx_unlock(&softc->ctl_lock); + if (msg->ua.ua_type == CTL_UA_THIN_PROV_THRES && msg->ua.ua_set) + memcpy(lun->ua_tpt_info, msg->ua.ua_info, 8); + if (msg->ua.ua_all) { + if (msg->ua.ua_set) + ctl_est_ua_all(lun, iid, msg->ua.ua_type); + else + ctl_clr_ua_all(lun, iid, msg->ua.ua_type); + } else { + if (msg->ua.ua_set) + ctl_est_ua(lun, iid, msg->ua.ua_type); + else + ctl_clr_ua(lun, iid, msg->ua.ua_type); + } + mtx_unlock(&lun->lun_lock); } static void @@ -1058,8 +1058,8 @@ ctl_isc_lun_sync(struct ctl_softc *softc targ_lun = msg->hdr.nexus.targ_mapped_lun; mtx_lock(&softc->ctl_lock); - if ((targ_lun >= CTL_MAX_LUNS) || - ((lun = softc->ctl_luns[targ_lun]) == NULL)) { + if (targ_lun >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); return; } @@ -1289,8 +1289,8 @@ ctl_isc_mode_sync(struct ctl_softc *soft targ_lun = msg->hdr.nexus.targ_mapped_lun; mtx_lock(&softc->ctl_lock); - if ((targ_lun >= CTL_MAX_LUNS) || - ((lun = softc->ctl_luns[targ_lun]) == NULL)) { + if (targ_lun >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); return; } @@ -2193,7 +2193,7 @@ ctl_create_iid(struct ctl_port *port, in * command on this side (XFER mode) or tell the other side to execute it * (SER_ONLY mode). */ -static int +static void ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) { struct ctl_softc *softc = control_softc; @@ -2201,7 +2201,6 @@ ctl_serialize_other_sc_cmd(struct ctl_sc struct ctl_port *port; struct ctl_lun *lun; const struct ctl_cmd_entry *entry; - int retval = 0; uint32_t targ_lun; targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; @@ -2216,24 +2215,10 @@ ctl_serialize_other_sc_cmd(struct ctl_sc } /* Make sure that we know about this LUN. */ - if ((targ_lun < CTL_MAX_LUNS) && - ((lun = softc->ctl_luns[targ_lun]) != NULL)) { - mtx_lock(&lun->lun_lock); - mtx_unlock(&softc->ctl_lock); - /* - * If the LUN is invalid, pretend that it doesn't exist. - * It will go away as soon as all pending I/O has been - * completed. - */ - if (lun->flags & CTL_LUN_DISABLED) { - mtx_unlock(&lun->lun_lock); - lun = NULL; - } - } else { + if (targ_lun >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); - lun = NULL; - } - if (lun == NULL) { + /* * The other node would not send this request to us unless * received announce that we are primary node for this LUN. @@ -2243,6 +2228,18 @@ ctl_serialize_other_sc_cmd(struct ctl_sc ctl_set_busy(ctsio); goto badjuju; } + mtx_lock(&lun->lun_lock); + mtx_unlock(&softc->ctl_lock); + + /* + * If the LUN is invalid, pretend that it doesn't exist. + * It will go away as soon as all pending I/Os completed. + */ + if (lun->flags & CTL_LUN_DISABLED) { + mtx_unlock(&lun->lun_lock); + ctl_set_busy(ctsio); + goto badjuju; + } entry = ctl_get_cmd_entry(ctsio, NULL); if (ctl_scsiio_lun_check(lun, entry, ctsio) != 0) { @@ -2314,10 +2311,9 @@ badjuju: msg_info.hdr.msg_type = CTL_MSG_BAD_JUJU; ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg_info, sizeof(msg_info.scsi), M_WAITOK); - retval = 1; + ctl_free_io((union ctl_io *)ctsio); break; } - return (retval); } /* @@ -2685,9 +2681,9 @@ ctl_ioctl(struct cdev *dev, u_long cmd, } mtx_lock(&softc->ctl_lock); - if (((ooa_hdr->flags & CTL_OOA_FLAG_ALL_LUNS) == 0) - && ((ooa_hdr->lun_num >= CTL_MAX_LUNS) - || (softc->ctl_luns[ooa_hdr->lun_num] == NULL))) { + if ((ooa_hdr->flags & CTL_OOA_FLAG_ALL_LUNS) == 0 && + (ooa_hdr->lun_num >= CTL_MAX_LUNS || + softc->ctl_luns[ooa_hdr->lun_num] == NULL)) { mtx_unlock(&softc->ctl_lock); free(entries, M_CTL); printf("%s: CTL_GET_OOA: invalid LUN %ju\n", @@ -2739,49 +2735,37 @@ ctl_ioctl(struct cdev *dev, u_long cmd, #ifdef CTL_IO_DELAY mtx_lock(&softc->ctl_lock); - - if ((delay_info->lun_id >= CTL_MAX_LUNS) - || (softc->ctl_luns[delay_info->lun_id] == NULL)) { + if (delay_info->lun_id >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[delay_info->lun_id]) == NULL) { + mtx_unlock(&softc->ctl_lock); delay_info->status = CTL_DELAY_STATUS_INVALID_LUN; - } else { - lun = softc->ctl_luns[delay_info->lun_id]; - mtx_lock(&lun->lun_lock); - - delay_info->status = CTL_DELAY_STATUS_OK; - - switch (delay_info->delay_type) { - case CTL_DELAY_TYPE_CONT: - break; - case CTL_DELAY_TYPE_ONESHOT: - break; - default: - delay_info->status = - CTL_DELAY_STATUS_INVALID_TYPE; - break; - } - - switch (delay_info->delay_loc) { - case CTL_DELAY_LOC_DATAMOVE: - lun->delay_info.datamove_type = - delay_info->delay_type; - lun->delay_info.datamove_delay = - delay_info->delay_secs; - break; - case CTL_DELAY_LOC_DONE: - lun->delay_info.done_type = - delay_info->delay_type; - lun->delay_info.done_delay = - delay_info->delay_secs; - break; - default: - delay_info->status = - CTL_DELAY_STATUS_INVALID_LOC; - break; - } - mtx_unlock(&lun->lun_lock); + break; } - + mtx_lock(&lun->lun_lock); mtx_unlock(&softc->ctl_lock); + delay_info->status = CTL_DELAY_STATUS_OK; + switch (delay_info->delay_type) { + case CTL_DELAY_TYPE_CONT: + case CTL_DELAY_TYPE_ONESHOT: + break; + default: + delay_info->status = CTL_DELAY_STATUS_INVALID_TYPE; + break; + } + switch (delay_info->delay_loc) { + case CTL_DELAY_LOC_DATAMOVE: + lun->delay_info.datamove_type = delay_info->delay_type; + lun->delay_info.datamove_delay = delay_info->delay_secs; + break; + case CTL_DELAY_LOC_DONE: + lun->delay_info.done_type = delay_info->delay_type; + lun->delay_info.done_delay = delay_info->delay_secs; + break; + default: + delay_info->status = CTL_DELAY_STATUS_INVALID_LOC; + break; + } + mtx_unlock(&lun->lun_lock); #else delay_info->status = CTL_DELAY_STATUS_NOT_IMPLEMENTED; #endif /* CTL_IO_DELAY */ @@ -2832,8 +2816,8 @@ ctl_ioctl(struct cdev *dev, u_long cmd, bcopy(err_desc, new_err_desc, sizeof(*new_err_desc)); mtx_lock(&softc->ctl_lock); - lun = softc->ctl_luns[err_desc->lun_id]; - if (lun == NULL) { + if (err_desc->lun_id >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[err_desc->lun_id]) == NULL) { mtx_unlock(&softc->ctl_lock); free(new_err_desc, M_CTL); printf("%s: CTL_ERROR_INJECT: invalid LUN %ju\n", @@ -2876,8 +2860,8 @@ ctl_ioctl(struct cdev *dev, u_long cmd, delete_done = 0; mtx_lock(&softc->ctl_lock); - lun = softc->ctl_luns[delete_desc->lun_id]; - if (lun == NULL) { + if (delete_desc->lun_id >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[delete_desc->lun_id]) == NULL) { mtx_unlock(&softc->ctl_lock); printf("%s: CTL_ERROR_INJECT_DELETE: invalid LUN %ju\n", __func__, (uintmax_t)delete_desc->lun_id); @@ -8540,8 +8524,8 @@ ctl_hndl_per_res_out_on_other_sc(union c targ_lun = msg->hdr.nexus.targ_mapped_lun; mtx_lock(&softc->ctl_lock); - if ((targ_lun >= CTL_MAX_LUNS) || - ((lun = softc->ctl_luns[targ_lun]) == NULL)) { + if (targ_lun >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); return; } @@ -11436,18 +11420,17 @@ ctl_failover_lun(union ctl_io *rio) /* Find and lock the LUN. */ mtx_lock(&softc->ctl_lock); - if ((targ_lun < CTL_MAX_LUNS) && - ((lun = softc->ctl_luns[targ_lun]) != NULL)) { - mtx_lock(&lun->lun_lock); - mtx_unlock(&softc->ctl_lock); - if (lun->flags & CTL_LUN_DISABLED) { - mtx_unlock(&lun->lun_lock); - return; - } - } else { + if (targ_lun > CTL_MAX_LUNS || + (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); return; } + mtx_lock(&lun->lun_lock); + mtx_unlock(&softc->ctl_lock); + if (lun->flags & CTL_LUN_DISABLED) { + mtx_unlock(&lun->lun_lock); + return; + } if (softc->ha_mode == CTL_HA_MODE_XFER) { TAILQ_FOREACH_SAFE(io, &lun->ooa_queue, ooa_links, next_io) { @@ -11515,15 +11498,13 @@ ctl_scsiio_precheck(struct ctl_softc *so struct ctl_lun *lun; const struct ctl_cmd_entry *entry; uint32_t initidx, targ_lun; - int retval; - - retval = 0; + int retval = 0; lun = NULL; - targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; - if ((targ_lun < CTL_MAX_LUNS) - && ((lun = softc->ctl_luns[targ_lun]) != NULL)) { + if (targ_lun < CTL_MAX_LUNS) + lun = softc->ctl_luns[targ_lun]; + if (lun) { /* * If the LUN is invalid, pretend that it doesn't exist. * It will go away as soon as all pending I/O has been @@ -11533,29 +11514,22 @@ ctl_scsiio_precheck(struct ctl_softc *so if (lun->flags & CTL_LUN_DISABLED) { mtx_unlock(&lun->lun_lock); lun = NULL; - ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr = NULL; - ctsio->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptr = NULL; - } else { - ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr = lun; - ctsio->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptr = - lun->be_lun; + } + } + ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr = lun; + if (lun) { + ctsio->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptr = + lun->be_lun; - /* - * Every I/O goes into the OOA queue for a - * particular LUN, and stays there until completion. - */ + /* + * Every I/O goes into the OOA queue for a particular LUN, + * and stays there until completion. + */ #ifdef CTL_TIME_IO - if (TAILQ_EMPTY(&lun->ooa_queue)) { - lun->idle_time += getsbinuptime() - - lun->last_busy; - } + if (TAILQ_EMPTY(&lun->ooa_queue)) + lun->idle_time += getsbinuptime() - lun->last_busy; #endif - TAILQ_INSERT_TAIL(&lun->ooa_queue, &ctsio->io_hdr, - ooa_links); - } - } else { - ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr = NULL; - ctsio->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptr = NULL; + TAILQ_INSERT_TAIL(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); } /* Get command entry and return error if it is unsuppotyed. */ @@ -11972,7 +11946,7 @@ ctl_lun_reset(struct ctl_softc *softc, u targ_lun = io->io_hdr.nexus.targ_mapped_lun; mtx_lock(&softc->ctl_lock); - if ((targ_lun >= CTL_MAX_LUNS) || + if (targ_lun >= CTL_MAX_LUNS || (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); io->taskio.task_status = CTL_TASK_LUN_DOES_NOT_EXIST; @@ -12051,7 +12025,7 @@ ctl_abort_task_set(union ctl_io *io) */ targ_lun = io->io_hdr.nexus.targ_mapped_lun; mtx_lock(&softc->ctl_lock); - if ((targ_lun >= CTL_MAX_LUNS) || + if (targ_lun >= CTL_MAX_LUNS || (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); io->taskio.task_status = CTL_TASK_LUN_DOES_NOT_EXIST; @@ -12136,7 +12110,7 @@ ctl_abort_task(union ctl_io *io) */ targ_lun = io->io_hdr.nexus.targ_mapped_lun; mtx_lock(&softc->ctl_lock); - if ((targ_lun >= CTL_MAX_LUNS) || + if (targ_lun >= CTL_MAX_LUNS || (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); io->taskio.task_status = CTL_TASK_LUN_DOES_NOT_EXIST; @@ -12261,7 +12235,7 @@ ctl_query_task(union ctl_io *io, int tas softc = control_softc; targ_lun = io->io_hdr.nexus.targ_mapped_lun; mtx_lock(&softc->ctl_lock); - if ((targ_lun >= CTL_MAX_LUNS) || + if (targ_lun >= CTL_MAX_LUNS || (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); io->taskio.task_status = CTL_TASK_LUN_DOES_NOT_EXIST; @@ -12301,7 +12275,7 @@ ctl_query_async_event(union ctl_io *io) softc = control_softc; targ_lun = io->io_hdr.nexus.targ_mapped_lun; mtx_lock(&softc->ctl_lock); - if ((targ_lun >= CTL_MAX_LUNS) || + if (targ_lun >= CTL_MAX_LUNS || (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); io->taskio.task_status = CTL_TASK_LUN_DOES_NOT_EXIST; @@ -12384,29 +12358,25 @@ ctl_run_task(union ctl_io *io) static void ctl_handle_isc(union ctl_io *io) { - int free_io; - struct ctl_lun *lun; struct ctl_softc *softc = control_softc; + struct ctl_lun *lun; + const struct ctl_cmd_entry *entry; uint32_t targ_lun; targ_lun = io->io_hdr.nexus.targ_mapped_lun; - lun = softc->ctl_luns[targ_lun]; - switch (io->io_hdr.msg_type) { case CTL_MSG_SERIALIZE: - free_io = ctl_serialize_other_sc_cmd(&io->scsiio); + ctl_serialize_other_sc_cmd(&io->scsiio); break; - case CTL_MSG_R2R: { - const struct ctl_cmd_entry *entry; - - /* - * This is only used in SER_ONLY mode. - */ - free_io = 0; + case CTL_MSG_R2R: /* Only used in SER_ONLY mode. */ entry = ctl_get_cmd_entry(&io->scsiio, NULL); + if (targ_lun >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[targ_lun]) == NULL) { + ctl_done(io); + break; + } mtx_lock(&lun->lun_lock); - if (ctl_scsiio_lun_check(lun, - entry, (struct ctl_scsiio *)io) != 0) { + if (ctl_scsiio_lun_check(lun, entry, &io->scsiio) != 0) { mtx_unlock(&lun->lun_lock); ctl_done(io); break; @@ -12415,51 +12385,46 @@ ctl_handle_isc(union ctl_io *io) mtx_unlock(&lun->lun_lock); ctl_enqueue_rtr(io); break; - } case CTL_MSG_FINISH_IO: if (softc->ha_mode == CTL_HA_MODE_XFER) { - free_io = 0; ctl_done(io); - } else { - free_io = 1; - mtx_lock(&lun->lun_lock); - TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, - ooa_links); - ctl_check_blocked(lun); - mtx_unlock(&lun->lun_lock); + break; } + if (targ_lun >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[targ_lun]) == NULL) { + ctl_free_io(io); + break; + } + mtx_lock(&lun->lun_lock); + TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links); + ctl_check_blocked(lun); + mtx_unlock(&lun->lun_lock); + ctl_free_io(io); break; case CTL_MSG_PERS_ACTION: ctl_hndl_per_res_out_on_other_sc( (union ctl_ha_msg *)&io->presio.pr_msg); - free_io = 1; + ctl_free_io(io); break; case CTL_MSG_BAD_JUJU: - free_io = 0; ctl_done(io); break; - case CTL_MSG_DATAMOVE: - /* Only used in XFER mode */ - free_io = 0; + case CTL_MSG_DATAMOVE: /* Only used in XFER mode */ ctl_datamove_remote(io); break; - case CTL_MSG_DATAMOVE_DONE: - /* Only used in XFER mode */ - free_io = 0; + case CTL_MSG_DATAMOVE_DONE: /* Only used in XFER mode */ io->scsiio.be_move_done(io); break; case CTL_MSG_FAILOVER: ctl_failover_lun(io); - free_io = 1; + ctl_free_io(io); break; default: - free_io = 1; printf("%s: Invalid message type %d\n", __func__, io->io_hdr.msg_type); + ctl_free_io(io); break; } - if (free_io) - ctl_free_io(io); } @@ -13360,37 +13325,33 @@ ctl_queue_sense(union ctl_io *io) struct ctl_softc *softc; uint32_t initidx, targ_lun; - softc = control_softc; - CTL_DEBUG_PRINT(("ctl_queue_sense\n")); + softc = control_softc; + port = ctl_io_port(&ctsio->io_hdr); + targ_lun = ctl_lun_map_from_port(port, io->io_hdr.nexus.targ_lun); + /* * LUN lookup will likely move to the ctl_work_thread() once we * have our new queueing infrastructure (that doesn't put things on * a per-LUN queue initially). That is so that we can handle * things like an INQUIRY to a LUN that we don't have enabled. We * can't deal with that right now. + * If we don't have a LUN for this, just toss the sense information. */ mtx_lock(&softc->ctl_lock); - - /* - * If we don't have a LUN for this, just toss the sense - * information. - */ - port = ctl_io_port(&ctsio->io_hdr); - targ_lun = ctl_lun_map_from_port(port, io->io_hdr.nexus.targ_lun); - if ((targ_lun < CTL_MAX_LUNS) - && (softc->ctl_luns[targ_lun] != NULL)) - lun = softc->ctl_luns[targ_lun]; - else + if (targ_lun >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[targ_lun]) == NULL) { + mtx_unlock(&softc->ctl_lock); goto bailout; - - initidx = ctl_get_initindex(&io->io_hdr.nexus); - + } mtx_lock(&lun->lun_lock); + mtx_unlock(&softc->ctl_lock); + /* * Already have CA set for this LUN...toss the sense information. */ + initidx = ctl_get_initindex(&io->io_hdr.nexus); if (ctl_is_set(lun->have_ca, initidx)) { mtx_unlock(&lun->lun_lock); goto bailout; @@ -13403,10 +13364,7 @@ ctl_queue_sense(union ctl_io *io) mtx_unlock(&lun->lun_lock); bailout: - mtx_unlock(&softc->ctl_lock); - ctl_free_io(io); - return (CTL_RETVAL_COMPLETE); } #endif From owner-svn-src-head@freebsd.org Sun Dec 25 20:19:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB449C90DD0; Sun, 25 Dec 2016 20:19:33 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAA0ED23; Sun, 25 Dec 2016 20:19:33 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBPKJWJJ093699; Sun, 25 Dec 2016 20:19:32 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBPKJWQ1093698; Sun, 25 Dec 2016 20:19:32 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612252019.uBPKJWQ1093698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 25 Dec 2016 20:19:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310556 - head/sys/powerpc/powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Dec 2016 20:19:34 -0000 Author: jhibbits Date: Sun Dec 25 20:19:32 2016 New Revision: 310556 URL: https://svnweb.freebsd.org/changeset/base/310556 Log: Use the correct format specifier for physmem chunk sizes. Arguments are unsigned, so should be printed as unsigned. Modified: head/sys/powerpc/powerpc/machdep.c Modified: head/sys/powerpc/powerpc/machdep.c ============================================================================== --- head/sys/powerpc/powerpc/machdep.c Sun Dec 25 20:17:15 2016 (r310555) +++ head/sys/powerpc/powerpc/machdep.c Sun Dec 25 20:19:32 2016 (r310556) @@ -199,7 +199,7 @@ cpu_startup(void *dummy) phys_avail[indx + 1] - phys_avail[indx]; #ifdef __powerpc64__ - printf("0x%016jx - 0x%016jx, %jd bytes (%jd pages)\n", + printf("0x%016jx - 0x%016jx, %ju bytes (%ju pages)\n", #else printf("0x%09jx - 0x%09jx, %ju bytes (%ju pages)\n", #endif From owner-svn-src-head@freebsd.org Sun Dec 25 21:41:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43ABBC90E13; Sun, 25 Dec 2016 21:41:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11D171BB2; Sun, 25 Dec 2016 21:41:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBPLfe28028870; Sun, 25 Dec 2016 21:41:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBPLfesO028869; Sun, 25 Dec 2016 21:41:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612252141.uBPLfesO028869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 25 Dec 2016 21:41:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310557 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Dec 2016 21:41:41 -0000 Author: hselasky Date: Sun Dec 25 21:41:40 2016 New Revision: 310557 URL: https://svnweb.freebsd.org/changeset/base/310557 Log: Use correct integer type when computing the maximum physical address for kmem_alloc_contig(). Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/gfp.h Modified: head/sys/compat/linuxkpi/common/include/linux/gfp.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/gfp.h Sun Dec 25 20:19:32 2016 (r310556) +++ head/sys/compat/linuxkpi/common/include/linux/gfp.h Sun Dec 25 21:41:40 2016 (r310557) @@ -136,8 +136,8 @@ alloc_pages(gfp_t gfp_mask, unsigned int size_t size; size = PAGE_SIZE << order; - page = kmem_alloc_contig(kmem_arena, size, gfp_mask, 0, -1, - size, 0, VM_MEMATTR_DEFAULT); + page = kmem_alloc_contig(kmem_arena, size, gfp_mask, + 0, ~(vm_paddr_t)0, size, 0, VM_MEMATTR_DEFAULT); if (page == 0) return (NULL); return (virt_to_page(page)); From owner-svn-src-head@freebsd.org Mon Dec 26 01:18:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5641EC90AB6; Mon, 26 Dec 2016 01:18:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16E7819A0; Mon, 26 Dec 2016 01:18:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQ1I8Zv015292; Mon, 26 Dec 2016 01:18:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQ1I8Dm015288; Mon, 26 Dec 2016 01:18:08 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612260118.uBQ1I8Dm015288@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 26 Dec 2016 01:18:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310559 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 01:18:09 -0000 Author: hselasky Date: Mon Dec 26 01:18:07 2016 New Revision: 310559 URL: https://svnweb.freebsd.org/changeset/base/310559 Log: Implement register and unregister chrdev in the LinuxKPI. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h head/sys/compat/linuxkpi/common/include/linux/fs.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/cdev.h Sun Dec 25 22:32:16 2016 (r310558) +++ head/sys/compat/linuxkpi/common/include/linux/cdev.h Mon Dec 26 01:18:07 2016 (r310559) @@ -95,7 +95,7 @@ cdev_add(struct linux_cdev *cdev, dev_t args.mda_gid = 0; args.mda_mode = 0700; args.mda_si_drv1 = cdev; - args.mda_unit = MINOR(dev); + args.mda_unit = dev; error = make_dev_s(&args, &cdev->cdev, "%s", kobject_name(&cdev->kobj)); @@ -121,7 +121,7 @@ cdev_add_ext(struct linux_cdev *cdev, de args.mda_gid = gid; args.mda_mode = mode; args.mda_si_drv1 = cdev; - args.mda_unit = MINOR(dev); + args.mda_unit = dev; error = make_dev_s(&args, &cdev->cdev, "%s/%d", kobject_name(&cdev->kobj), MINOR(dev)); @@ -142,6 +142,8 @@ cdev_del(struct linux_cdev *cdev) kobject_put(&cdev->kobj); } +struct linux_cdev *linux_find_cdev(const char *name, unsigned major, unsigned minor); + #define cdev linux_cdev #endif /* _LINUX_CDEV_H_ */ Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/fs.h Sun Dec 25 22:32:16 2016 (r310558) +++ head/sys/compat/linuxkpi/common/include/linux/fs.h Mon Dec 26 01:18:07 2016 (r310559) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -151,6 +151,39 @@ struct file_operations { #define FMODE_WRITE FWRITE #define FMODE_EXEC FEXEC +int __register_chrdev(unsigned int major, unsigned int baseminor, + unsigned int count, const char *name, + const struct file_operations *fops); +int __register_chrdev_p(unsigned int major, unsigned int baseminor, + unsigned int count, const char *name, + const struct file_operations *fops, uid_t uid, + gid_t gid, int mode); +void __unregister_chrdev(unsigned int major, unsigned int baseminor, + unsigned int count, const char *name); + +static inline void +unregister_chrdev(unsigned int major, const char *name) +{ + + __unregister_chrdev(major, 0, 256, name); +} + +static inline int +register_chrdev(unsigned int major, const char *name, + const struct file_operations *fops) +{ + + return (__register_chrdev(major, 0, 256, name, fops)); +} + +static inline int +register_chrdev_p(unsigned int major, const char *name, + const struct file_operations *fops, uid_t uid, gid_t gid, int mode) +{ + + return (__register_chrdev_p(major, 0, 256, name, fops, uid, gid, mode)); +} + static inline int register_chrdev_region(dev_t dev, unsigned range, const char *name) { @@ -184,7 +217,7 @@ static inline dev_t iminor(struct inode *inode) { - return dev2unit(inode->v_rdev); + return (MINOR(dev2unit(inode->v_rdev))); } static inline struct inode * Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Sun Dec 25 22:32:16 2016 (r310558) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Mon Dec 26 01:18:07 2016 (r310559) @@ -1418,6 +1418,82 @@ linux_irq_handler(void *ent) irqe->handler(irqe->irq, irqe->arg); } +struct linux_cdev * +linux_find_cdev(const char *name, unsigned major, unsigned minor) +{ + int unit = MKDEV(major, minor); + struct cdev *cdev; + + dev_lock(); + LIST_FOREACH(cdev, &linuxcdevsw.d_devs, si_list) { + struct linux_cdev *ldev = cdev->si_drv1; + if (dev2unit(cdev) == unit && + strcmp(kobject_name(&ldev->kobj), name) == 0) { + break; + } + } + dev_unlock(); + + return (cdev != NULL ? cdev->si_drv1 : NULL); +} + +int +__register_chrdev(unsigned int major, unsigned int baseminor, + unsigned int count, const char *name, + const struct file_operations *fops) +{ + struct linux_cdev *cdev; + int ret = 0; + int i; + + for (i = baseminor; i < baseminor + count; i++) { + cdev = cdev_alloc(); + cdev_init(cdev, fops); + kobject_set_name(&cdev->kobj, name); + + ret = cdev_add(cdev, makedev(major, i), 1); + if (ret != 0) + break; + } + return (ret); +} + +int +__register_chrdev_p(unsigned int major, unsigned int baseminor, + unsigned int count, const char *name, + const struct file_operations *fops, uid_t uid, + gid_t gid, int mode) +{ + struct linux_cdev *cdev; + int ret = 0; + int i; + + for (i = baseminor; i < baseminor + count; i++) { + cdev = cdev_alloc(); + cdev_init(cdev, fops); + kobject_set_name(&cdev->kobj, name); + + ret = cdev_add_ext(cdev, makedev(major, i), uid, gid, mode); + if (ret != 0) + break; + } + return (ret); +} + +void +__unregister_chrdev(unsigned int major, unsigned int baseminor, + unsigned int count, const char *name) +{ + struct linux_cdev *cdevp; + int i; + + for (i = baseminor; i < baseminor + count; i++) { + cdevp = linux_find_cdev(name, major, i); + if (cdevp != NULL) + cdev_del(cdevp); + } +} + #if defined(__i386__) || defined(__amd64__) bool linux_cpu_has_clflush; #endif From owner-svn-src-head@freebsd.org Mon Dec 26 02:51:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D645C901BA; Mon, 26 Dec 2016 02:51:04 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CC7814B8; Mon, 26 Dec 2016 02:51:04 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQ2p3iV052299; Mon, 26 Dec 2016 02:51:03 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQ2p3iX052298; Mon, 26 Dec 2016 02:51:03 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201612260251.uBQ2p3iX052298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 26 Dec 2016 02:51:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310560 - head/sys/contrib/vchiq/interface/vchiq_arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 02:51:04 -0000 Author: gonzo Date: Mon Dec 26 02:51:03 2016 New Revision: 310560 URL: https://svnweb.freebsd.org/changeset/base/310560 Log: [vchi] replace non-reproducible __DATE__/__TIME__ with hardcoded string Although vchiq_build_date and vchiq_build_time are not used in current vchi driver at the moment, make sure these value will not leak into build later on if at some point they will be refered in some new imported code PR: 215494 Reported by: emaste MFC after: 1 week Modified: head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_version.c Modified: head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_version.c ============================================================================== --- head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_version.c Mon Dec 26 01:18:07 2016 (r310559) +++ head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_version.c Mon Dec 26 02:51:03 2016 (r310560) @@ -35,8 +35,8 @@ VC_DEBUG_DECLARE_STRING_VAR( vchiq_build_hostname, "dc4-arm-01" ); VC_DEBUG_DECLARE_STRING_VAR( vchiq_build_version, "9245b4c35b99b3870e1f7dc598c5692b3c66a6f0 (tainted)" ); -VC_DEBUG_DECLARE_STRING_VAR( vchiq_build_time, __TIME__ ); -VC_DEBUG_DECLARE_STRING_VAR( vchiq_build_date, __DATE__ ); +VC_DEBUG_DECLARE_STRING_VAR( vchiq_build_time, "not available" ); +VC_DEBUG_DECLARE_STRING_VAR( vchiq_build_date, "not available" ); const char *vchiq_get_build_hostname( void ) { From owner-svn-src-head@freebsd.org Mon Dec 26 07:31:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AD38C91DFD; Mon, 26 Dec 2016 07:31:17 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A9EC8E0; Mon, 26 Dec 2016 07:31:17 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQ7VGYG070313; Mon, 26 Dec 2016 07:31:16 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQ7VGTZ070312; Mon, 26 Dec 2016 07:31:16 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612260731.uBQ7VGTZ070312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 26 Dec 2016 07:31:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310574 - head/contrib/bsnmp/snmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 07:31:17 -0000 Author: ngie Date: Mon Dec 26 07:31:16 2016 New Revision: 310574 URL: https://svnweb.freebsd.org/changeset/base/310574 Log: Fix style(9) - Sort #includes - Delete trailing whitespace No functional change MFC after: 3 days Modified: head/contrib/bsnmp/snmpd/trans_lsock.c Modified: head/contrib/bsnmp/snmpd/trans_lsock.c ============================================================================== --- head/contrib/bsnmp/snmpd/trans_lsock.c Mon Dec 26 06:59:22 2016 (r310573) +++ head/contrib/bsnmp/snmpd/trans_lsock.c Mon Dec 26 07:31:16 2016 (r310574) @@ -32,15 +32,15 @@ */ #include #include -#include #include +#include +#include +#include #include #include -#include -#include #include -#include +#include #include #include "snmpmod.h" @@ -417,7 +417,7 @@ lsock_send(struct tport *tp, const u_cha return (-1); } } - + return (sendto(peer->input.fd, buf, len, 0, addr, addrlen)); } From owner-svn-src-head@freebsd.org Mon Dec 26 08:47:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A79E6C9148B; Mon, 26 Dec 2016 08:47:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 708E5DF7; Mon, 26 Dec 2016 08:47:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQ8lZ5A098832; Mon, 26 Dec 2016 08:47:35 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQ8lZoD098831; Mon, 26 Dec 2016 08:47:35 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612260847.uBQ8lZoD098831@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 26 Dec 2016 08:47:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310575 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 08:47:36 -0000 Author: mav Date: Mon Dec 26 08:47:35 2016 New Revision: 310575 URL: https://svnweb.freebsd.org/changeset/base/310575 Log: Fix improperly used nexus.targ_lun. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Mon Dec 26 07:31:16 2016 (r310574) +++ head/sys/cam/ctl/ctl.c Mon Dec 26 08:47:35 2016 (r310575) @@ -1024,7 +1024,7 @@ ctl_isc_ua(struct ctl_softc *softc, unio uint32_t iid = ctl_get_initindex(&msg->hdr.nexus); mtx_lock(&softc->ctl_lock); - if (msg->hdr.nexus.targ_lun >= CTL_MAX_LUNS || + if (msg->hdr.nexus.targ_mapped_lun >= CTL_MAX_LUNS || (lun = softc->ctl_luns[msg->hdr.nexus.targ_mapped_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); return; @@ -1074,7 +1074,7 @@ ctl_isc_lun_sync(struct ctl_softc *softc memcmp(&msg->lun.data[0], lun->lun_devid->data, i) != 0)) { mtx_unlock(&lun->lun_lock); printf("%s: Received conflicting HA LUN %d\n", - __func__, msg->hdr.nexus.targ_lun); + __func__, targ_lun); return; } else { /* Record whether peer is primary. */ @@ -1108,7 +1108,7 @@ ctl_isc_lun_sync(struct ctl_softc *softc mtx_unlock(&lun->lun_lock); CTL_DEBUG_PRINT(("%s: Known LUN %d, peer is %s\n", - __func__, msg->hdr.nexus.targ_lun, + __func__, targ_lun, (msg->lun.flags & CTL_LUN_PRIMARY_SC) ? "primary" : "secondary")); From owner-svn-src-head@freebsd.org Mon Dec 26 09:38:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0B3EC8F57C; Mon, 26 Dec 2016 09:38:19 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-wj0-x244.google.com (mail-wj0-x244.google.com [IPv6:2a00:1450:400c:c01::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 73D3696A; Mon, 26 Dec 2016 09:38:19 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-wj0-x244.google.com with SMTP id kp2so47922540wjc.0; Mon, 26 Dec 2016 01:38:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:references:to:reply-to:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=cLpnfGCTbT6hTiYY5njmZI0jRQPReR+3bvfUyfDIy4M=; b=d7RVxtFINEYv1MEZO44LOeNWvbzFklrVddnI3XkkwClFV1vkG4aIrqV+6xw9otMDXQ f9fPBsY9ahqwl8yrxtZvSVgEmhN5LzXGVBI1UyAHGtzhosvekq8wI0SDtl0we/PSQw9M f5cCky5rkuG8Sv54smymrtLf7oV7GqEuD4tID4gn0EQ9e7aNqrqvncblVZqCeFJSL1YQ 4Mah/l09PuR5SUz/T00V5Tl65eiC+6SexP13FzkQmL0gZINLJ5amdEJX7gr6svmvxN5D MWUA1O/DEbkx2/s93dwqwxo+kOB3JlsUNNG0P6WmjuE+m1TiiT7zsUK7YrBQUbGshesF iNGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:references:to:reply-to:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=cLpnfGCTbT6hTiYY5njmZI0jRQPReR+3bvfUyfDIy4M=; b=CG7UZbbWWqiji2nr5KA7HkpO7sofuGgbVBwKGgW//b0jEq9rx0lZCBAcAn/YHa6AJK zVJ2nypTqsEtzoaYO4USp7Ul065HZKTkVgTjbYUCm+xgWJGOOZGsHBVDrFAnSbPDwT9p 71Ke/hmIGApk9sLggi63W67b3d+AvG85phJ3R3VuBgyvpSFUbCA0LJB+brJousEMxw9D lmRUFSY96D4VdogrN0vCGs5WO+Q04z1LFIubAPqZlL7Zc+PPNHxNEjsy8ymjGr6yRBoi PIeUiMf3aVdyYdRr5fxiSol+VROF/w598PApvvusbmjvDG5tq9SW/3A20RHDs2M/d2b6 A8QA== X-Gm-Message-State: AIkVDXL6RlHCvwx9JhoHOi1ninXdJ0fq1TezK8Z/nOVA4SUvK1x3P1P+P+6RE2N0rzo5GA== X-Received: by 10.194.249.72 with SMTP id ys8mr26319681wjc.92.1482745097380; Mon, 26 Dec 2016 01:38:17 -0800 (PST) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id t194sm29580406wmd.1.2016.12.26.01.38.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Dec 2016 01:38:16 -0800 (PST) From: Michal Meloun X-Google-Original-From: Michal Meloun Subject: Re: svn commit: r310559 - in head/sys/compat/linuxkpi/common: include/linux src References: <201612260118.uBQ1I8Dm015288@repo.freebsd.org> To: Hans Petter Selasky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: mmel@freebsd.org Message-ID: Date: Mon, 26 Dec 2016 10:38:30 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <201612260118.uBQ1I8Dm015288@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 09:38:20 -0000 On 26.12.2016 2:18, Hans Petter Selasky wrote: > Author: hselasky > Date: Mon Dec 26 01:18:07 2016 > New Revision: 310559 > URL: https://svnweb.freebsd.org/changeset/base/310559 > > Log: > Implement register and unregister chrdev in the LinuxKPI. > > Obtained from: kmacy @ > MFC after: 1 week > Sponsored by: Mellanox Technologies > > Modified: > head/sys/compat/linuxkpi/common/include/linux/cdev.h > head/sys/compat/linuxkpi/common/include/linux/fs.h > head/sys/compat/linuxkpi/common/src/linux_compat.c > > Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h > ============================================================================== > --- head/sys/compat/linuxkpi/common/include/linux/cdev.h Sun Dec 25 22:32:16 2016 (r310558) > +++ head/sys/compat/linuxkpi/common/include/linux/cdev.h Mon Dec 26 01:18:07 2016 (r310559) > @@ -95,7 +95,7 @@ cdev_add(struct linux_cdev *cdev, dev_t > args.mda_gid = 0; > args.mda_mode = 0700; > args.mda_si_drv1 = cdev; > - args.mda_unit = MINOR(dev); > + args.mda_unit = dev; > > error = make_dev_s(&args, &cdev->cdev, "%s", > kobject_name(&cdev->kobj)); > @@ -121,7 +121,7 @@ cdev_add_ext(struct linux_cdev *cdev, de > args.mda_gid = gid; > args.mda_mode = mode; > args.mda_si_drv1 = cdev; > - args.mda_unit = MINOR(dev); > + args.mda_unit = dev; > > error = make_dev_s(&args, &cdev->cdev, "%s/%d", > kobject_name(&cdev->kobj), MINOR(dev)); > @@ -142,6 +142,8 @@ cdev_del(struct linux_cdev *cdev) > kobject_put(&cdev->kobj); > } > > +struct linux_cdev *linux_find_cdev(const char *name, unsigned major, unsigned minor); > + > #define cdev linux_cdev > > #endif /* _LINUX_CDEV_H_ */ > > Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h > ============================================================================== > --- head/sys/compat/linuxkpi/common/include/linux/fs.h Sun Dec 25 22:32:16 2016 (r310558) > +++ head/sys/compat/linuxkpi/common/include/linux/fs.h Mon Dec 26 01:18:07 2016 (r310559) > @@ -2,7 +2,7 @@ > * Copyright (c) 2010 Isilon Systems, Inc. > * Copyright (c) 2010 iX Systems, Inc. > * Copyright (c) 2010 Panasas, Inc. > - * Copyright (c) 2013 Mellanox Technologies, Ltd. > + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. > * All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > @@ -151,6 +151,39 @@ struct file_operations { > #define FMODE_WRITE FWRITE > #define FMODE_EXEC FEXEC > > +int __register_chrdev(unsigned int major, unsigned int baseminor, > + unsigned int count, const char *name, > + const struct file_operations *fops); > +int __register_chrdev_p(unsigned int major, unsigned int baseminor, > + unsigned int count, const char *name, > + const struct file_operations *fops, uid_t uid, > + gid_t gid, int mode); > +void __unregister_chrdev(unsigned int major, unsigned int baseminor, > + unsigned int count, const char *name); > + > +static inline void > +unregister_chrdev(unsigned int major, const char *name) > +{ > + > + __unregister_chrdev(major, 0, 256, name); > +} > + > +static inline int > +register_chrdev(unsigned int major, const char *name, > + const struct file_operations *fops) > +{ > + > + return (__register_chrdev(major, 0, 256, name, fops)); > +} > + > +static inline int > +register_chrdev_p(unsigned int major, const char *name, > + const struct file_operations *fops, uid_t uid, gid_t gid, int mode) > +{ > + > + return (__register_chrdev_p(major, 0, 256, name, fops, uid, gid, mode)); > +} > + > static inline int > register_chrdev_region(dev_t dev, unsigned range, const char *name) > { > @@ -184,7 +217,7 @@ static inline dev_t > iminor(struct inode *inode) > { > > - return dev2unit(inode->v_rdev); > + return (MINOR(dev2unit(inode->v_rdev))); This breaks many kernels: --- all_subdir_ibcore --- In file included from /usr2/Meloun/svn/src/sys/modules/ibcore/../../ofed/drivers/infiniband/core/ucma.c:34: In file included from /usr2/Meloun/svn/src/sys/modules/ibcore/../../compat/linuxkpi/common/include/linux/file.h:41: /usr2/Meloun/svn/src/sys/modules/ibcore/../../compat/linuxkpi/common/include/linux/fs.h:220:10: error: implicit declaration of function 'MINOR' is invalid in C99 [-Werror,-Wimplicit-function-declaration] return (MINOR(dev2unit(inode->v_rdev))); ^ > } > > static inline struct inode * > > Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c > ============================================================================== > --- head/sys/compat/linuxkpi/common/src/linux_compat.c Sun Dec 25 22:32:16 2016 (r310558) > +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Mon Dec 26 01:18:07 2016 (r310559) > @@ -1418,6 +1418,82 @@ linux_irq_handler(void *ent) > irqe->handler(irqe->irq, irqe->arg); > } > > +struct linux_cdev * > +linux_find_cdev(const char *name, unsigned major, unsigned minor) > +{ > + int unit = MKDEV(major, minor); > + struct cdev *cdev; > + > + dev_lock(); > + LIST_FOREACH(cdev, &linuxcdevsw.d_devs, si_list) { > + struct linux_cdev *ldev = cdev->si_drv1; > + if (dev2unit(cdev) == unit && > + strcmp(kobject_name(&ldev->kobj), name) == 0) { > + break; > + } > + } > + dev_unlock(); > + > + return (cdev != NULL ? cdev->si_drv1 : NULL); > +} > + > +int > +__register_chrdev(unsigned int major, unsigned int baseminor, > + unsigned int count, const char *name, > + const struct file_operations *fops) > +{ > + struct linux_cdev *cdev; > + int ret = 0; > + int i; > + > + for (i = baseminor; i < baseminor + count; i++) { > + cdev = cdev_alloc(); > + cdev_init(cdev, fops); > + kobject_set_name(&cdev->kobj, name); > + > + ret = cdev_add(cdev, makedev(major, i), 1); > + if (ret != 0) > + break; > + } > + return (ret); > +} > + > +int > +__register_chrdev_p(unsigned int major, unsigned int baseminor, > + unsigned int count, const char *name, > + const struct file_operations *fops, uid_t uid, > + gid_t gid, int mode) > +{ > + struct linux_cdev *cdev; > + int ret = 0; > + int i; > + > + for (i = baseminor; i < baseminor + count; i++) { > + cdev = cdev_alloc(); > + cdev_init(cdev, fops); > + kobject_set_name(&cdev->kobj, name); > + > + ret = cdev_add_ext(cdev, makedev(major, i), uid, gid, mode); > + if (ret != 0) > + break; > + } > + return (ret); > +} > + > +void > +__unregister_chrdev(unsigned int major, unsigned int baseminor, > + unsigned int count, const char *name) > +{ > + struct linux_cdev *cdevp; > + int i; > + > + for (i = baseminor; i < baseminor + count; i++) { > + cdevp = linux_find_cdev(name, major, i); > + if (cdevp != NULL) > + cdev_del(cdevp); > + } > +} > + > #if defined(__i386__) || defined(__amd64__) > bool linux_cpu_has_clflush; > #endif > From owner-svn-src-head@freebsd.org Mon Dec 26 09:48:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2876C8F87A; Mon, 26 Dec 2016 09:48:37 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85795103F; Mon, 26 Dec 2016 09:48:37 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 5F2641FE157; Mon, 26 Dec 2016 10:48:27 +0100 (CET) Subject: Re: svn commit: r310559 - in head/sys/compat/linuxkpi/common: include/linux src To: mmel@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201612260118.uBQ1I8Dm015288@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <4cd92dee-4cb2-954d-7157-6fcd122131c2@selasky.org> Date: Mon, 26 Dec 2016 10:48:03 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 09:48:37 -0000 On 12/26/16 10:38, Michal Meloun wrote: > > > On 26.12.2016 2:18, Hans Petter Selasky wrote: >> Author: hselasky >> Date: Mon Dec 26 01:18:07 2016 >> New Revision: 310559 >> URL: https://svnweb.freebsd.org/changeset/base/310559 >> >> Log: >> Implement register and unregister chrdev in the LinuxKPI. >> >> Obtained from: kmacy @ >> MFC after: 1 week >> Sponsored by: Mellanox Technologies >> >> Modified: >> head/sys/compat/linuxkpi/common/include/linux/cdev.h >> head/sys/compat/linuxkpi/common/include/linux/fs.h >> head/sys/compat/linuxkpi/common/src/linux_compat.c >> >> Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h >> ============================================================================== >> --- head/sys/compat/linuxkpi/common/include/linux/cdev.h Sun Dec 25 22:32:16 2016 (r310558) >> +++ head/sys/compat/linuxkpi/common/include/linux/cdev.h Mon Dec 26 01:18:07 2016 (r310559) >> @@ -95,7 +95,7 @@ cdev_add(struct linux_cdev *cdev, dev_t >> args.mda_gid = 0; >> args.mda_mode = 0700; >> args.mda_si_drv1 = cdev; >> - args.mda_unit = MINOR(dev); >> + args.mda_unit = dev; >> >> error = make_dev_s(&args, &cdev->cdev, "%s", >> kobject_name(&cdev->kobj)); >> @@ -121,7 +121,7 @@ cdev_add_ext(struct linux_cdev *cdev, de >> args.mda_gid = gid; >> args.mda_mode = mode; >> args.mda_si_drv1 = cdev; >> - args.mda_unit = MINOR(dev); >> + args.mda_unit = dev; >> >> error = make_dev_s(&args, &cdev->cdev, "%s/%d", >> kobject_name(&cdev->kobj), MINOR(dev)); >> @@ -142,6 +142,8 @@ cdev_del(struct linux_cdev *cdev) >> kobject_put(&cdev->kobj); >> } >> >> +struct linux_cdev *linux_find_cdev(const char *name, unsigned major, unsigned minor); >> + >> #define cdev linux_cdev >> >> #endif /* _LINUX_CDEV_H_ */ >> >> Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h >> ============================================================================== >> --- head/sys/compat/linuxkpi/common/include/linux/fs.h Sun Dec 25 22:32:16 2016 (r310558) >> +++ head/sys/compat/linuxkpi/common/include/linux/fs.h Mon Dec 26 01:18:07 2016 (r310559) >> @@ -2,7 +2,7 @@ >> * Copyright (c) 2010 Isilon Systems, Inc. >> * Copyright (c) 2010 iX Systems, Inc. >> * Copyright (c) 2010 Panasas, Inc. >> - * Copyright (c) 2013 Mellanox Technologies, Ltd. >> + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. >> * All rights reserved. >> * >> * Redistribution and use in source and binary forms, with or without >> @@ -151,6 +151,39 @@ struct file_operations { >> #define FMODE_WRITE FWRITE >> #define FMODE_EXEC FEXEC >> >> +int __register_chrdev(unsigned int major, unsigned int baseminor, >> + unsigned int count, const char *name, >> + const struct file_operations *fops); >> +int __register_chrdev_p(unsigned int major, unsigned int baseminor, >> + unsigned int count, const char *name, >> + const struct file_operations *fops, uid_t uid, >> + gid_t gid, int mode); >> +void __unregister_chrdev(unsigned int major, unsigned int baseminor, >> + unsigned int count, const char *name); >> + >> +static inline void >> +unregister_chrdev(unsigned int major, const char *name) >> +{ >> + >> + __unregister_chrdev(major, 0, 256, name); >> +} >> + >> +static inline int >> +register_chrdev(unsigned int major, const char *name, >> + const struct file_operations *fops) >> +{ >> + >> + return (__register_chrdev(major, 0, 256, name, fops)); >> +} >> + >> +static inline int >> +register_chrdev_p(unsigned int major, const char *name, >> + const struct file_operations *fops, uid_t uid, gid_t gid, int mode) >> +{ >> + >> + return (__register_chrdev_p(major, 0, 256, name, fops, uid, gid, mode)); >> +} >> + >> static inline int >> register_chrdev_region(dev_t dev, unsigned range, const char *name) >> { >> @@ -184,7 +217,7 @@ static inline dev_t >> iminor(struct inode *inode) >> { >> >> - return dev2unit(inode->v_rdev); >> + return (MINOR(dev2unit(inode->v_rdev))); > > This breaks many kernels: > > --- all_subdir_ibcore --- > In file included from > /usr2/Meloun/svn/src/sys/modules/ibcore/../../ofed/drivers/infiniband/core/ucma.c:34: > In file included from > /usr2/Meloun/svn/src/sys/modules/ibcore/../../compat/linuxkpi/common/include/linux/file.h:41: > /usr2/Meloun/svn/src/sys/modules/ibcore/../../compat/linuxkpi/common/include/linux/fs.h:220:10: error: implicit declaration of function 'MINOR' is invalid in C99 > [-Werror,-Wimplicit-function-declaration] > return (MINOR(dev2unit(inode->v_rdev))); > ^ > I'll fix shortly. --HPS From owner-svn-src-head@freebsd.org Mon Dec 26 10:03:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BE8FC90176; Mon, 26 Dec 2016 10:03:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1AB0E1AE; Mon, 26 Dec 2016 10:03:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQA3Xb4031402; Mon, 26 Dec 2016 10:03:33 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQA3XnI031401; Mon, 26 Dec 2016 10:03:33 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612261003.uBQA3XnI031401@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 26 Dec 2016 10:03:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310583 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 10:03:34 -0000 Author: hselasky Date: Mon Dec 26 10:03:33 2016 New Revision: 310583 URL: https://svnweb.freebsd.org/changeset/base/310583 Log: Fix LINT build. Found by: mmel @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/fs.h Mon Dec 26 10:02:02 2016 (r310582) +++ head/sys/compat/linuxkpi/common/include/linux/fs.h Mon Dec 26 10:03:33 2016 (r310583) @@ -217,7 +217,7 @@ static inline dev_t iminor(struct inode *inode) { - return (MINOR(dev2unit(inode->v_rdev))); + return (minor(dev2unit(inode->v_rdev))); } static inline struct inode * From owner-svn-src-head@freebsd.org Mon Dec 26 10:05:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9B55C9034A; Mon, 26 Dec 2016 10:05:03 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9119D7AD; Mon, 26 Dec 2016 10:05:03 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 4F03C1FE157; Mon, 26 Dec 2016 11:04:53 +0100 (CET) Subject: Re: svn commit: r310559 - in head/sys/compat/linuxkpi/common: include/linux src To: mmel@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201612260118.uBQ1I8Dm015288@repo.freebsd.org> <4cd92dee-4cb2-954d-7157-6fcd122131c2@selasky.org> From: Hans Petter Selasky Message-ID: <97224f13-5334-f6f0-4917-0b32a3e3ecca@selasky.org> Date: Mon, 26 Dec 2016 11:04:30 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <4cd92dee-4cb2-954d-7157-6fcd122131c2@selasky.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 10:05:03 -0000 Hi, Looks like this build error slipped under my -DNO_CLEAN flag. Sorry . Fixed in r310583 . --HPS From owner-svn-src-head@freebsd.org Mon Dec 26 10:17:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3212C9085D; Mon, 26 Dec 2016 10:17:23 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD38A83; Mon, 26 Dec 2016 10:17:23 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQAHMQp035681; Mon, 26 Dec 2016 10:17:22 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQAHMnE035676; Mon, 26 Dec 2016 10:17:22 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612261017.uBQAHMnE035676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 26 Dec 2016 10:17:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310586 - head/contrib/bsnmp/snmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 10:17:23 -0000 Author: ngie Date: Mon Dec 26 10:17:22 2016 New Revision: 310586 URL: https://svnweb.freebsd.org/changeset/base/310586 Log: Refactor transport sources a bit to facilitate changes coming down pipeline Add recv callback to transport layer to better facilitate code reuse and readability and for symmetry with send callback. Move recv_dgram and recv_stream to udp_recv and lsock_recv, respectively, and make the beforementioned functions recv callbacks for the udp and lsock transports, respectively. Consolidate the check_priv* functions in their relevant trans*.c source to limit scope/use. Note: this code is roughly based content from the submitter, although this was modified to be more of a direct move from snmpd/main.c to the trans_*.c sources, and to reduce unnecessary static function declarations. MFC after: 2 weeks Submitted by: Thor Steingrimsson Sponsored by: Dell EMC Isilon Modified: head/contrib/bsnmp/snmpd/main.c head/contrib/bsnmp/snmpd/snmpd.h head/contrib/bsnmp/snmpd/trans_lsock.c head/contrib/bsnmp/snmpd/trans_udp.c Modified: head/contrib/bsnmp/snmpd/main.c ============================================================================== --- head/contrib/bsnmp/snmpd/main.c Mon Dec 26 10:16:05 2016 (r310585) +++ head/contrib/bsnmp/snmpd/main.c Mon Dec 26 10:17:22 2016 (r310586) @@ -1024,154 +1024,6 @@ snmp_input_consume(struct port_input *pi pi->length -= pi->consumed; } -static void -check_priv_dgram(struct port_input *pi, struct sockcred *cred) -{ - - /* process explicitly sends credentials */ - if (cred) - pi->priv = (cred->sc_euid == 0); - else - pi->priv = 0; -} - -static void -check_priv_stream(struct port_input *pi) -{ - struct xucred ucred; - socklen_t ucredlen; - - /* obtain the accept time credentials */ - ucredlen = sizeof(ucred); - - if (getsockopt(pi->fd, 0, LOCAL_PEERCRED, &ucred, &ucredlen) == 0 && - ucredlen >= sizeof(ucred) && ucred.cr_version == XUCRED_VERSION) - pi->priv = (ucred.cr_uid == 0); - else - pi->priv = 0; -} - -/* - * Input from a stream socket. - */ -static int -recv_stream(struct port_input *pi) -{ - struct msghdr msg; - struct iovec iov[1]; - ssize_t len; - - if (pi->buf == NULL) { - /* no buffer yet - allocate one */ - if ((pi->buf = buf_alloc(0)) == NULL) { - /* ups - could not get buffer. Return an error - * the caller must close the transport. */ - return (-1); - } - pi->buflen = buf_size(0); - pi->consumed = 0; - pi->length = 0; - } - - /* try to get a message */ - msg.msg_name = pi->peer; - msg.msg_namelen = pi->peerlen; - msg.msg_iov = iov; - msg.msg_iovlen = 1; - msg.msg_control = NULL; - msg.msg_controllen = 0; - msg.msg_flags = 0; - - iov[0].iov_base = pi->buf + pi->length; - iov[0].iov_len = pi->buflen - pi->length; - - len = recvmsg(pi->fd, &msg, 0); - - if (len == -1 || len == 0) - /* receive error */ - return (-1); - - pi->length += len; - - if (pi->cred) - check_priv_stream(pi); - - return (0); -} - -/* - * Input from a datagram socket. - * Each receive should return one datagram. - */ -static int -recv_dgram(struct port_input *pi, struct in_addr *laddr) -{ - u_char embuf[1000]; - char cbuf[CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + - CMSG_SPACE(sizeof(struct in_addr))]; - struct msghdr msg; - struct iovec iov[1]; - ssize_t len; - struct cmsghdr *cmsg; - struct sockcred *cred = NULL; - - if (pi->buf == NULL) { - /* no buffer yet - allocate one */ - if ((pi->buf = buf_alloc(0)) == NULL) { - /* ups - could not get buffer. Read away input - * and drop it */ - (void)recvfrom(pi->fd, embuf, sizeof(embuf), - 0, NULL, NULL); - /* return error */ - return (-1); - } - pi->buflen = buf_size(0); - } - - /* try to get a message */ - msg.msg_name = pi->peer; - msg.msg_namelen = pi->peerlen; - msg.msg_iov = iov; - msg.msg_iovlen = 1; - memset(cbuf, 0, sizeof(cbuf)); - msg.msg_control = cbuf; - msg.msg_controllen = sizeof(cbuf); - msg.msg_flags = 0; - - iov[0].iov_base = pi->buf; - iov[0].iov_len = pi->buflen; - - len = recvmsg(pi->fd, &msg, 0); - - if (len == -1 || len == 0) - /* receive error */ - return (-1); - - if (msg.msg_flags & MSG_TRUNC) { - /* truncated - drop */ - snmpd_stats.silentDrops++; - snmpd_stats.inTooLong++; - return (-1); - } - - pi->length = (size_t)len; - - for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; - cmsg = CMSG_NXTHDR(&msg, cmsg)) { - if (cmsg->cmsg_level == IPPROTO_IP && - cmsg->cmsg_type == IP_RECVDSTADDR) - memcpy(laddr, CMSG_DATA(cmsg), sizeof(struct in_addr)); - if (cmsg->cmsg_level == SOL_SOCKET && - cmsg->cmsg_type == SCM_CREDS) - cred = (struct sockcred *)CMSG_DATA(cmsg); - } - - if (pi->cred) - check_priv_dgram(pi, cred); - - return (0); -} - /* * Input from a socket */ @@ -1191,35 +1043,8 @@ snmpd_input(struct port_input *pi, struc #endif struct msghdr msg; struct iovec iov[1]; - char cbuf[CMSG_SPACE(sizeof(struct in_addr))]; - struct cmsghdr *cmsgp; - - /* get input depending on the transport */ - if (pi->stream) { - msg.msg_control = NULL; - msg.msg_controllen = 0; - - ret = recv_stream(pi); - } else { - struct in_addr *laddr; - - memset(cbuf, 0, CMSG_SPACE(sizeof(struct in_addr))); - msg.msg_control = cbuf; - msg.msg_controllen = CMSG_SPACE(sizeof(struct in_addr)); - cmsgp = CMSG_FIRSTHDR(&msg); - cmsgp->cmsg_len = CMSG_LEN(sizeof(struct in_addr)); - cmsgp->cmsg_level = IPPROTO_IP; - cmsgp->cmsg_type = IP_SENDSRCADDR; - laddr = (struct in_addr *)CMSG_DATA(cmsgp); - - ret = recv_dgram(pi, laddr); - - if (laddr->s_addr == 0) { - msg.msg_control = NULL; - msg.msg_controllen = 0; - } - } + ret = tport->transport->vtab->recv(pi); if (ret == -1) return (-1); Modified: head/contrib/bsnmp/snmpd/snmpd.h ============================================================================== --- head/contrib/bsnmp/snmpd/snmpd.h Mon Dec 26 10:16:05 2016 (r310585) +++ head/contrib/bsnmp/snmpd/snmpd.h Mon Dec 26 10:17:22 2016 (r310586) @@ -193,6 +193,7 @@ struct transport_def { ssize_t (*send)(struct tport *, const u_char *, size_t, const struct sockaddr *, size_t); + ssize_t (*recv)(struct port_input *); }; struct transport { struct asn_oid index; /* transport table index */ Modified: head/contrib/bsnmp/snmpd/trans_lsock.c ============================================================================== --- head/contrib/bsnmp/snmpd/trans_lsock.c Mon Dec 26 10:16:05 2016 (r310585) +++ head/contrib/bsnmp/snmpd/trans_lsock.c Mon Dec 26 10:17:22 2016 (r310586) @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -58,6 +59,7 @@ static void lsock_close_port(struct tpor static int lsock_init_port(struct tport *); static ssize_t lsock_send(struct tport *, const u_char *, size_t, const struct sockaddr *, size_t); +static ssize_t lsock_recv(struct port_input *); /* exported */ const struct transport_def lsock_trans = { @@ -67,7 +69,8 @@ const struct transport_def lsock_trans = lsock_stop, lsock_close_port, lsock_init_port, - lsock_send + lsock_send, + lsock_recv }; static struct transport *my_trans; @@ -421,6 +424,73 @@ lsock_send(struct tport *tp, const u_cha return (sendto(peer->input.fd, buf, len, 0, addr, addrlen)); } +static void +check_priv_stream(struct port_input *pi) +{ + struct xucred ucred; + socklen_t ucredlen; + + /* obtain the accept time credentials */ + ucredlen = sizeof(ucred); + + if (getsockopt(pi->fd, 0, LOCAL_PEERCRED, &ucred, &ucredlen) == 0 && + ucredlen >= sizeof(ucred) && ucred.cr_version == XUCRED_VERSION) + pi->priv = (ucred.cr_uid == 0); + else + pi->priv = 0; +} + +/* + * Receive something + */ +static ssize_t +lsock_recv(struct port_input *pi) +{ + struct msghdr msg; + struct iovec iov[1]; + ssize_t len; + + msg.msg_control = NULL; + msg.msg_controllen = 0; + + if (pi->buf == NULL) { + /* no buffer yet - allocate one */ + if ((pi->buf = buf_alloc(0)) == NULL) { + /* ups - could not get buffer. Return an error + * the caller must close the transport. */ + return (-1); + } + pi->buflen = buf_size(0); + pi->consumed = 0; + pi->length = 0; + } + + /* try to get a message */ + msg.msg_name = pi->peer; + msg.msg_namelen = pi->peerlen; + msg.msg_iov = iov; + msg.msg_iovlen = 1; + msg.msg_control = NULL; + msg.msg_controllen = 0; + msg.msg_flags = 0; + + iov[0].iov_base = pi->buf + pi->length; + iov[0].iov_len = pi->buflen - pi->length; + + len = recvmsg(pi->fd, &msg, 0); + + if (len == -1 || len == 0) + /* receive error */ + return (-1); + + pi->length += len; + + if (pi->cred) + check_priv_stream(pi); + + return (0); +} + /* * Dependency to create a lsock port */ Modified: head/contrib/bsnmp/snmpd/trans_udp.c ============================================================================== --- head/contrib/bsnmp/snmpd/trans_udp.c Mon Dec 26 10:16:05 2016 (r310585) +++ head/contrib/bsnmp/snmpd/trans_udp.c Mon Dec 26 10:17:22 2016 (r310586) @@ -32,6 +32,7 @@ */ #include #include +#include #include #include @@ -54,6 +55,7 @@ static void udp_close_port(struct tport static int udp_init_port(struct tport *); static ssize_t udp_send(struct tport *, const u_char *, size_t, const struct sockaddr *, size_t); +static ssize_t udp_recv(struct port_input *); /* exported */ const struct transport_def udp_trans = { @@ -63,7 +65,8 @@ const struct transport_def udp_trans = { udp_stop, udp_close_port, udp_init_port, - udp_send + udp_send, + udp_recv }; static struct transport *my_trans; @@ -218,6 +221,123 @@ udp_send(struct tport *tp, const u_char return (sendto(p->input.fd, buf, len, 0, addr, addrlen)); } +static void +check_priv_dgram(struct port_input *pi, struct sockcred *cred) +{ + + /* process explicitly sends credentials */ + if (cred) + pi->priv = (cred->sc_euid == 0); + else + pi->priv = 0; +} + +/* + * Input from a datagram socket. + * Each receive should return one datagram. + */ +static int +recv_dgram(struct port_input *pi, struct in_addr *laddr) +{ + u_char embuf[1000]; + char cbuf[CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + + CMSG_SPACE(sizeof(struct in_addr))]; + struct msghdr msg; + struct iovec iov[1]; + ssize_t len; + struct cmsghdr *cmsg; + struct sockcred *cred = NULL; + + if (pi->buf == NULL) { + /* no buffer yet - allocate one */ + if ((pi->buf = buf_alloc(0)) == NULL) { + /* ups - could not get buffer. Read away input + * and drop it */ + (void)recvfrom(pi->fd, embuf, sizeof(embuf), + 0, NULL, NULL); + /* return error */ + return (-1); + } + pi->buflen = buf_size(0); + } + + /* try to get a message */ + msg.msg_name = pi->peer; + msg.msg_namelen = pi->peerlen; + msg.msg_iov = iov; + msg.msg_iovlen = 1; + memset(cbuf, 0, sizeof(cbuf)); + msg.msg_control = cbuf; + msg.msg_controllen = sizeof(cbuf); + msg.msg_flags = 0; + + iov[0].iov_base = pi->buf; + iov[0].iov_len = pi->buflen; + + len = recvmsg(pi->fd, &msg, 0); + + if (len == -1 || len == 0) + /* receive error */ + return (-1); + + if (msg.msg_flags & MSG_TRUNC) { + /* truncated - drop */ + snmpd_stats.silentDrops++; + snmpd_stats.inTooLong++; + return (-1); + } + + pi->length = (size_t)len; + + for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; + cmsg = CMSG_NXTHDR(&msg, cmsg)) { + if (cmsg->cmsg_level == IPPROTO_IP && + cmsg->cmsg_type == IP_RECVDSTADDR) + memcpy(laddr, CMSG_DATA(cmsg), sizeof(struct in_addr)); + if (cmsg->cmsg_level == SOL_SOCKET && + cmsg->cmsg_type == SCM_CREDS) + cred = (struct sockcred *)CMSG_DATA(cmsg); + } + + if (pi->cred) + check_priv_dgram(pi, cred); + + return (0); +} + +/* + * Receive something + */ +static ssize_t +udp_recv(struct port_input *pi) +{ + struct in_addr *laddr; + struct msghdr msg; + char cbuf[CMSG_SPACE(sizeof(struct in_addr))]; + struct cmsghdr *cmsgp; + ssize_t ret; + + memset(cbuf, 0, sizeof(cbuf)); + + msg.msg_control = cbuf; + msg.msg_controllen = sizeof(cbuf); + + cmsgp = CMSG_FIRSTHDR(&msg); + cmsgp->cmsg_len = CMSG_LEN(sizeof(struct in_addr)); + cmsgp->cmsg_level = IPPROTO_IP; + cmsgp->cmsg_type = IP_SENDSRCADDR; + laddr = (struct in_addr *)CMSG_DATA(cmsgp); + + ret = recv_dgram(pi, laddr); + + if (laddr->s_addr == INADDR_ANY) { + msg.msg_control = NULL; + msg.msg_controllen = 0; + } + + return (ret); +} + /* * Port table */ From owner-svn-src-head@freebsd.org Mon Dec 26 10:21:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA428C909F7; Mon, 26 Dec 2016 10:21:29 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79C0E6A2; Mon, 26 Dec 2016 10:21:29 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQALSBL038147; Mon, 26 Dec 2016 10:21:28 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQALSFf038146; Mon, 26 Dec 2016 10:21:28 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612261021.uBQALSFf038146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 26 Dec 2016 10:21:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310587 - head/contrib/bsnmp/snmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 10:21:29 -0000 Author: ngie Date: Mon Dec 26 10:21:28 2016 New Revision: 310587 URL: https://svnweb.freebsd.org/changeset/base/310587 Log: Fix definition for recv_dgram(..); it should be "ssize_t", not "int" I'm not sure why this wasn't flagged as an issue by the compiler, yet MFC after: 3 weeks X-MFC with: r310586 Modified: head/contrib/bsnmp/snmpd/trans_udp.c Modified: head/contrib/bsnmp/snmpd/trans_udp.c ============================================================================== --- head/contrib/bsnmp/snmpd/trans_udp.c Mon Dec 26 10:17:22 2016 (r310586) +++ head/contrib/bsnmp/snmpd/trans_udp.c Mon Dec 26 10:21:28 2016 (r310587) @@ -236,7 +236,7 @@ check_priv_dgram(struct port_input *pi, * Input from a datagram socket. * Each receive should return one datagram. */ -static int +static ssize_t recv_dgram(struct port_input *pi, struct in_addr *laddr) { u_char embuf[1000]; From owner-svn-src-head@freebsd.org Mon Dec 26 10:24:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D625C90C92; Mon, 26 Dec 2016 10:24:49 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A30EA1A; Mon, 26 Dec 2016 10:24:49 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQAOm0K040030; Mon, 26 Dec 2016 10:24:48 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQAOmhD040029; Mon, 26 Dec 2016 10:24:48 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612261024.uBQAOmhD040029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 26 Dec 2016 10:24:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310588 - head/contrib/bsnmp/snmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 10:24:49 -0000 Author: ngie Date: Mon Dec 26 10:24:48 2016 New Revision: 310588 URL: https://svnweb.freebsd.org/changeset/base/310588 Log: Fix return type for `ret` (recv callback) and sort variables by alignment Again, for reasons I don't yet understand, this is not being flagged by the compiler. Unlike the issue addressed in r310587, this problem existed prior to r310586 MFC after: 2 weeks X-MFC with: r310586, r310587 Modified: head/contrib/bsnmp/snmpd/main.c Modified: head/contrib/bsnmp/snmpd/main.c ============================================================================== --- head/contrib/bsnmp/snmpd/main.c Mon Dec 26 10:21:28 2016 (r310587) +++ head/contrib/bsnmp/snmpd/main.c Mon Dec 26 10:24:48 2016 (r310588) @@ -1035,9 +1035,8 @@ snmpd_input(struct port_input *pi, struc struct snmp_pdu pdu; enum snmpd_input_err ierr, ferr; enum snmpd_proxy_err perr; + ssize_t ret, slen; int32_t vi; - int ret; - ssize_t slen; #ifdef USE_TCPWRAPPERS char client[16]; #endif From owner-svn-src-head@freebsd.org Mon Dec 26 10:41:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52CA8C0B32E; Mon, 26 Dec 2016 10:41:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03EF3875; Mon, 26 Dec 2016 10:41:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQAfqAB047026; Mon, 26 Dec 2016 10:41:52 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQAfqCs047025; Mon, 26 Dec 2016 10:41:52 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612261041.uBQAfqCs047025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 26 Dec 2016 10:41:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310589 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 10:41:53 -0000 Author: hselasky Date: Mon Dec 26 10:41:51 2016 New Revision: 310589 URL: https://svnweb.freebsd.org/changeset/base/310589 Log: Implement more list header file functions. Add definition guard for the list_head structure. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/list.h Modified: head/sys/compat/linuxkpi/common/include/linux/list.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/list.h Mon Dec 26 10:24:48 2016 (r310588) +++ head/sys/compat/linuxkpi/common/include/linux/list.h Mon Dec 26 10:41:51 2016 (r310589) @@ -72,10 +72,18 @@ #define prefetch(x) +#define LINUX_LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LINUX_LIST_HEAD(name) \ + struct list_head name = LINUX_LIST_HEAD_INIT(name) + +#ifndef LIST_HEAD_DEF +#define LIST_HEAD_DEF struct list_head { struct list_head *next; struct list_head *prev; }; +#endif static inline void INIT_LIST_HEAD(struct list_head *list) @@ -91,12 +99,26 @@ list_empty(const struct list_head *head) return (head->next == head); } +static inline int +list_empty_careful(const struct list_head *head) +{ + struct list_head *next = head->next; + + return ((next == head) && (next == head->prev)); +} + +static inline void +__list_del(struct list_head *prev, struct list_head *next) +{ + next->prev = prev; + WRITE_ONCE(prev->next, next); +} + static inline void list_del(struct list_head *entry) { - entry->next->prev = entry->prev; - entry->prev->next = entry->next; + __list_del(entry->prev, entry->next); } static inline void @@ -183,6 +205,11 @@ list_del_init(struct list_head *entry) for (p = list_entry((h)->prev, typeof(*p), field); &(p)->field != (h); \ p = list_entry((p)->field.prev, typeof(*p), field)) +#define list_for_each_entry_safe_reverse(p, n, h, field) \ + for (p = list_entry((h)->prev, typeof(*p), field), \ + n = list_entry((p)->field.prev, typeof(*p), field); &(p)->field != (h); \ + p = n, n = list_entry(n->field.prev, typeof(*n), field)) + #define list_for_each_entry_continue_reverse(p, h, field) \ for (p = list_entry((p)->field.prev, typeof(*p), field); &(p)->field != (h); \ p = list_entry((p)->field.prev, typeof(*p), field)) From owner-svn-src-head@freebsd.org Mon Dec 26 11:06:43 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C779C0BB75; Mon, 26 Dec 2016 11:06:43 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38D1A1337; Mon, 26 Dec 2016 11:06:43 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQB6gUZ056166; Mon, 26 Dec 2016 11:06:42 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQB6fi0056159; Mon, 26 Dec 2016 11:06:41 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612261106.uBQB6fi0056159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 26 Dec 2016 11:06:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310590 - in head/sys: netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 11:06:43 -0000 Author: tuexen Date: Mon Dec 26 11:06:41 2016 New Revision: 310590 URL: https://svnweb.freebsd.org/changeset/base/310590 Log: Whitespace changes. The toolchain for processing the sources has been updated. No functional change. MFC after: 3 days Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_auth.c head/sys/netinet/sctp_auth.h head/sys/netinet/sctp_bsd_addr.c head/sys/netinet/sctp_bsd_addr.h head/sys/netinet/sctp_cc_functions.c head/sys/netinet/sctp_crc32.c head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_indata.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_input.h head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_pcb.h head/sys/netinet/sctp_ss_functions.c head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_timer.c head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_asconf.c ============================================================================== --- head/sys/netinet/sctp_asconf.c Mon Dec 26 10:41:51 2016 (r310589) +++ head/sys/netinet/sctp_asconf.c Mon Dec 26 11:06:41 2016 (r310590) @@ -97,7 +97,7 @@ sctp_asconf_success_response(uint32_t id } static struct mbuf * -sctp_asconf_error_response(uint32_t id, uint16_t cause, uint8_t * error_tlv, +sctp_asconf_error_response(uint32_t id, uint16_t cause, uint8_t *error_tlv, uint16_t tlv_length) { struct mbuf *m_reply = NULL; @@ -132,7 +132,7 @@ sctp_asconf_error_response(uint32_t id, return (NULL); } if (error_tlv != NULL) { - tlv = (uint8_t *) (error + 1); + tlv = (uint8_t *)(error + 1); memcpy(tlv, error_tlv, tlv_length); } SCTP_BUF_LEN(m_reply) = aph->ph.param_length; @@ -222,7 +222,7 @@ sctp_process_asconf_add_ip(struct sockad #endif default: m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_INVALID_PARAM, (uint8_t *) aph, + SCTP_CAUSE_INVALID_PARAM, (uint8_t *)aph, aparam_length); return (m_reply); } /* end switch */ @@ -237,7 +237,7 @@ sctp_process_asconf_add_ip(struct sockad /* add the address */ if (bad_address) { m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_INVALID_PARAM, (uint8_t *) aph, + SCTP_CAUSE_INVALID_PARAM, (uint8_t *)aph, aparam_length); } else if (sctp_add_remote_addr(stcb, sa, &net, stcb->asoc.port, SCTP_DONOT_SETSCOPE, @@ -245,7 +245,7 @@ sctp_process_asconf_add_ip(struct sockad SCTPDBG(SCTP_DEBUG_ASCONF1, "process_asconf_add_ip: error adding address\n"); m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_RESOURCE_SHORTAGE, (uint8_t *) aph, + SCTP_CAUSE_RESOURCE_SHORTAGE, (uint8_t *)aph, aparam_length); } else { /* notify upper layer */ @@ -367,7 +367,7 @@ sctp_process_asconf_delete_ip(struct soc #endif default: m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *) aph, + SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *)aph, aparam_length); return (m_reply); } @@ -377,7 +377,7 @@ sctp_process_asconf_delete_ip(struct soc /* trying to delete the source address! */ SCTPDBG(SCTP_DEBUG_ASCONF1, "process_asconf_delete_ip: tried to delete source addr\n"); m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_DELETING_SRC_ADDR, (uint8_t *) aph, + SCTP_CAUSE_DELETING_SRC_ADDR, (uint8_t *)aph, aparam_length); return (m_reply); } @@ -391,7 +391,7 @@ sctp_process_asconf_delete_ip(struct soc /* what error to reply with?? */ m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_REQUEST_REFUSED, (uint8_t *) aph, + SCTP_CAUSE_REQUEST_REFUSED, (uint8_t *)aph, aparam_length); } else if (response_required) { m_reply = @@ -410,7 +410,7 @@ sctp_process_asconf_delete_ip(struct soc /* only one address in the asoc */ SCTPDBG(SCTP_DEBUG_ASCONF1, "process_asconf_delete_ip: tried to delete last IP addr!\n"); m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_DELETING_LAST_ADDR, (uint8_t *) aph, + SCTP_CAUSE_DELETING_LAST_ADDR, (uint8_t *)aph, aparam_length); } else { if (response_required) { @@ -492,7 +492,7 @@ sctp_process_asconf_set_primary(struct s #endif default: m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *) aph, + SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *)aph, aparam_length); return (m_reply); } @@ -563,7 +563,7 @@ sctp_process_asconf_set_primary(struct s "process_asconf_set_primary: set primary failed!\n"); /* must have been an invalid address, so report */ m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *) aph, + SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *)aph, aparam_length); } @@ -658,7 +658,7 @@ sctp_handle_asconf(struct mbuf *m, unsig /* skip the lookup address parameter */ offset += sizeof(struct sctp_asconf_chunk); - p_addr = (struct sctp_ipv6addr_param *)sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr), (uint8_t *) & aparam_buf); + p_addr = (struct sctp_ipv6addr_param *)sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr), (uint8_t *)&aparam_buf); if (p_addr == NULL) { SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf: couldn't get lookup addr!\n"); @@ -668,7 +668,7 @@ sctp_handle_asconf(struct mbuf *m, unsig /* param_length is already validated in process_control... */ offset += ntohs(p_addr->ph.param_length); /* skip lookup addr */ /* get pointer to first asconf param in ASCONF */ - aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset, sizeof(struct sctp_asconf_paramhdr), (uint8_t *) & aparam_buf); + aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset, sizeof(struct sctp_asconf_paramhdr), (uint8_t *)&aparam_buf); if (aph == NULL) { SCTPDBG(SCTP_DEBUG_ASCONF1, "Empty ASCONF received?\n"); goto send_reply; @@ -765,7 +765,7 @@ sctp_handle_asconf(struct mbuf *m, unsig /* get pointer to next asconf param */ aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset, sizeof(struct sctp_asconf_paramhdr), - (uint8_t *) & aparam_buf); + (uint8_t *)&aparam_buf); if (aph == NULL) { /* can't get an asconf paramhdr */ SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf: can't get asconf param hdr!\n"); @@ -1094,7 +1094,7 @@ sctp_path_check_and_react(struct sctp_tc * NOT corresponding to the current nexthop, the path will * not be changed. */ - SCTP_RTALLOC((sctp_route_t *) & net->ro, + SCTP_RTALLOC((sctp_route_t *)&net->ro, stcb->sctp_ep->def_vrf_id, stcb->sctp_ep->fibnum); if (net->ro.ro_rt == NULL) @@ -1104,7 +1104,7 @@ sctp_path_check_and_react(struct sctp_tc switch (net->ro._l_addr.sa.sa_family) { #ifdef INET case AF_INET: - if (sctp_v4src_match_nexthop(newifa, (sctp_route_t *) & net->ro)) { + if (sctp_v4src_match_nexthop(newifa, (sctp_route_t *)&net->ro)) { changed = 1; } break; @@ -1112,7 +1112,7 @@ sctp_path_check_and_react(struct sctp_tc #ifdef INET6 case AF_INET6: if (sctp_v6src_match_nexthop( - &newifa->address.sin6, (sctp_route_t *) & net->ro)) { + &newifa->address.sin6, (sctp_route_t *)&net->ro)) { changed = 1; } break; @@ -2419,8 +2419,10 @@ sctp_is_addr_pending(struct sctp_tcb *st } } - /* we want to find the sequences which consist of ADD -> DEL -> ADD - * or DEL -> ADD */ + /* + * we want to find the sequences which consist of ADD -> DEL -> ADD + * or DEL -> ADD + */ if (add_cnt > del_cnt || (add_cnt == del_cnt && last_param_type == SCTP_ADD_IP_ADDRESS)) { return (1); @@ -2472,8 +2474,10 @@ sctp_find_valid_localaddr(struct sctp_tc if (sctp_is_addr_restricted(stcb, sctp_ifa) && (!sctp_is_addr_pending(stcb, sctp_ifa))) continue; - /* found a valid local v4 address to - * use */ + /* + * found a valid local v4 address to + * use + */ if (addr_locked == SCTP_ADDR_NOT_LOCKED) SCTP_IPI_ADDR_RUNLOCK(); return (&sctp_ifa->address.sa); @@ -2490,8 +2494,10 @@ sctp_find_valid_localaddr(struct sctp_tc } sin6 = &sctp_ifa->address.sin6; if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { - /* we skip unspecifed - * addresses */ + /* + * we skip unspecifed + * addresses + */ continue; } if (prison_check_ip6(stcb->sctp_ep->ip_inp.inp.inp_cred, @@ -2508,8 +2514,10 @@ sctp_find_valid_localaddr(struct sctp_tc if (sctp_is_addr_restricted(stcb, sctp_ifa) && (!sctp_is_addr_pending(stcb, sctp_ifa))) continue; - /* found a valid local v6 address to - * use */ + /* + * found a valid local v6 address to + * use + */ if (addr_locked == SCTP_ADDR_NOT_LOCKED) SCTP_IPI_ADDR_RUNLOCK(); return (&sctp_ifa->address.sa); @@ -2777,7 +2785,7 @@ sctp_process_initack_addresses(struct sc /* go through the addresses in the init-ack */ ph = (struct sctp_paramhdr *) sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr), - (uint8_t *) & tmp_param); + (uint8_t *)&tmp_param); while (ph != NULL) { ptype = ntohs(ph->param_type); plen = ntohs(ph->param_length); @@ -2791,7 +2799,7 @@ sctp_process_initack_addresses(struct sc a6p = (struct sctp_ipv6addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv6addr_param), - (uint8_t *) & addr6_store); + (uint8_t *)&addr6_store); if (plen != sizeof(struct sctp_ipv6addr_param) || a6p == NULL) { return; @@ -2812,7 +2820,7 @@ sctp_process_initack_addresses(struct sc /* get the entire IPv4 address param */ a4p = (struct sctp_ipv4addr_param *)sctp_m_getptr(m, offset, sizeof(struct sctp_ipv4addr_param), - (uint8_t *) & addr4_store); + (uint8_t *)&addr4_store); if (plen != sizeof(struct sctp_ipv4addr_param) || a4p == NULL) { return; @@ -2874,7 +2882,7 @@ next_addr: if ((offset + sizeof(struct sctp_paramhdr)) > length) return; ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, - sizeof(struct sctp_paramhdr), (uint8_t *) & tmp_param); + sizeof(struct sctp_paramhdr), (uint8_t *)&tmp_param); } /* while */ } @@ -2925,7 +2933,7 @@ sctp_addr_in_initack(struct mbuf *m, uin } /* go through the addresses in the init-ack */ ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, - sizeof(struct sctp_paramhdr), (uint8_t *) & tmp_param); + sizeof(struct sctp_paramhdr), (uint8_t *)&tmp_param); while (ph != NULL) { ptype = ntohs(ph->param_type); plen = ntohs(ph->param_length); @@ -2941,7 +2949,7 @@ sctp_addr_in_initack(struct mbuf *m, uin a6p = (struct sctp_ipv6addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv6addr_param), - (uint8_t *) & addr6_store); + (uint8_t *)&addr6_store); if (a6p == NULL) { return (0); } @@ -2971,7 +2979,7 @@ sctp_addr_in_initack(struct mbuf *m, uin a4p = (struct sctp_ipv4addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv4addr_param), - (uint8_t *) & addr4_store); + (uint8_t *)&addr4_store); if (a4p == NULL) { return (0); } @@ -2993,7 +3001,7 @@ sctp_addr_in_initack(struct mbuf *m, uin } ph = (struct sctp_paramhdr *) sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr), - (uint8_t *) & tmp_param); + (uint8_t *)&tmp_param); } /* while */ /* not found! */ return (0); Modified: head/sys/netinet/sctp_auth.c ============================================================================== --- head/sys/netinet/sctp_auth.c Mon Dec 26 10:41:51 2016 (r310589) +++ head/sys/netinet/sctp_auth.c Mon Dec 26 11:06:41 2016 (r310590) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); void -sctp_clear_chunklist(sctp_auth_chklist_t * chklist) +sctp_clear_chunklist(sctp_auth_chklist_t *chklist) { bzero(chklist, sizeof(*chklist)); /* chklist->num_chunks = 0; */ @@ -73,14 +73,14 @@ sctp_alloc_chunklist(void) } void -sctp_free_chunklist(sctp_auth_chklist_t * list) +sctp_free_chunklist(sctp_auth_chklist_t *list) { if (list != NULL) SCTP_FREE(list, SCTP_M_AUTH_CL); } sctp_auth_chklist_t * -sctp_copy_chunklist(sctp_auth_chklist_t * list) +sctp_copy_chunklist(sctp_auth_chklist_t *list) { sctp_auth_chklist_t *new_list; @@ -102,7 +102,7 @@ sctp_copy_chunklist(sctp_auth_chklist_t * add a chunk to the required chunks list */ int -sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t * list) +sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t *list) { if (list == NULL) return (-1); @@ -128,7 +128,7 @@ sctp_auth_add_chunk(uint8_t chunk, sctp_ * delete a chunk from the required chunks list */ int -sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t * list) +sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t *list) { if (list == NULL) return (-1); @@ -144,7 +144,7 @@ sctp_auth_delete_chunk(uint8_t chunk, sc } size_t -sctp_auth_get_chklist_size(const sctp_auth_chklist_t * list) +sctp_auth_get_chklist_size(const sctp_auth_chklist_t *list) { if (list == NULL) return (0); @@ -157,7 +157,7 @@ sctp_auth_get_chklist_size(const sctp_au * guarantee ptr has space for up to 256 bytes */ int -sctp_serialize_auth_chunks(const sctp_auth_chklist_t * list, uint8_t * ptr) +sctp_serialize_auth_chunks(const sctp_auth_chklist_t *list, uint8_t *ptr) { int i, count = 0; @@ -174,7 +174,7 @@ sctp_serialize_auth_chunks(const sctp_au } int -sctp_pack_auth_chunks(const sctp_auth_chklist_t * list, uint8_t * ptr) +sctp_pack_auth_chunks(const sctp_auth_chklist_t *list, uint8_t *ptr) { int i, size = 0; @@ -206,8 +206,8 @@ sctp_pack_auth_chunks(const sctp_auth_ch } int -sctp_unpack_auth_chunks(const uint8_t * ptr, uint8_t num_chunks, - sctp_auth_chklist_t * list) +sctp_unpack_auth_chunks(const uint8_t *ptr, uint8_t num_chunks, + sctp_auth_chklist_t *list) { int i; int size; @@ -257,14 +257,14 @@ sctp_alloc_key(uint32_t keylen) } void -sctp_free_key(sctp_key_t * key) +sctp_free_key(sctp_key_t *key) { if (key != NULL) SCTP_FREE(key, SCTP_M_AUTH_KY); } void -sctp_print_key(sctp_key_t * key, const char *str) +sctp_print_key(sctp_key_t *key, const char *str) { uint32_t i; @@ -283,7 +283,7 @@ sctp_print_key(sctp_key_t * key, const c } void -sctp_show_key(sctp_key_t * key, const char *str) +sctp_show_key(sctp_key_t *key, const char *str) { uint32_t i; @@ -302,7 +302,7 @@ sctp_show_key(sctp_key_t * key, const ch } static uint32_t -sctp_get_keylen(sctp_key_t * key) +sctp_get_keylen(sctp_key_t *key) { if (key != NULL) return (key->keylen); @@ -329,7 +329,7 @@ sctp_generate_random_key(uint32_t keylen } sctp_key_t * -sctp_set_key(uint8_t * key, uint32_t keylen) +sctp_set_key(uint8_t *key, uint32_t keylen) { sctp_key_t *new_key; @@ -349,7 +349,7 @@ sctp_set_key(uint8_t * key, uint32_t key * 0 if key1 = key2 */ static int -sctp_compare_key(sctp_key_t * key1, sctp_key_t * key2) +sctp_compare_key(sctp_key_t *key1, sctp_key_t *key2) { uint32_t maxlen; uint32_t i; @@ -400,7 +400,7 @@ sctp_compare_key(sctp_key_t * key1, sctp * order for concatenation */ sctp_key_t * -sctp_compute_hashkey(sctp_key_t * key1, sctp_key_t * key2, sctp_key_t * shared) +sctp_compute_hashkey(sctp_key_t *key1, sctp_key_t *key2, sctp_key_t *shared) { uint32_t keylen; sctp_key_t *new_key; @@ -474,7 +474,7 @@ sctp_alloc_sharedkey(void) } void -sctp_free_sharedkey(sctp_sharedkey_t * skey) +sctp_free_sharedkey(sctp_sharedkey_t *skey) { if (skey == NULL) return; @@ -500,7 +500,7 @@ sctp_find_sharedkey(struct sctp_keyhead int sctp_insert_sharedkey(struct sctp_keyhead *shared_keys, - sctp_sharedkey_t * new_skey) + sctp_sharedkey_t *new_skey) { sctp_sharedkey_t *skey; @@ -594,7 +594,7 @@ sctp_auth_key_release(struct sctp_tcb *s } static sctp_sharedkey_t * -sctp_copy_sharedkey(const sctp_sharedkey_t * skey) +sctp_copy_sharedkey(const sctp_sharedkey_t *skey) { sctp_sharedkey_t *new_skey; @@ -652,7 +652,7 @@ sctp_alloc_hmaclist(uint16_t num_hmacs) } void -sctp_free_hmaclist(sctp_hmaclist_t * list) +sctp_free_hmaclist(sctp_hmaclist_t *list) { if (list != NULL) { SCTP_FREE(list, SCTP_M_AUTH_HL); @@ -661,7 +661,7 @@ sctp_free_hmaclist(sctp_hmaclist_t * lis } int -sctp_auth_add_hmacid(sctp_hmaclist_t * list, uint16_t hmac_id) +sctp_auth_add_hmacid(sctp_hmaclist_t *list, uint16_t hmac_id) { int i; @@ -689,7 +689,7 @@ sctp_auth_add_hmacid(sctp_hmaclist_t * l } sctp_hmaclist_t * -sctp_copy_hmaclist(sctp_hmaclist_t * list) +sctp_copy_hmaclist(sctp_hmaclist_t *list) { sctp_hmaclist_t *new_list; int i; @@ -727,7 +727,7 @@ sctp_default_supported_hmaclist(void) * find the best HMAC id to use for the peer based on local support */ uint16_t -sctp_negotiate_hmacid(sctp_hmaclist_t * peer, sctp_hmaclist_t * local) +sctp_negotiate_hmacid(sctp_hmaclist_t *peer, sctp_hmaclist_t *local) { int i, j; @@ -754,7 +754,7 @@ sctp_negotiate_hmacid(sctp_hmaclist_t * * caller must guarantee ptr has appropriate space */ int -sctp_serialize_hmaclist(sctp_hmaclist_t * list, uint8_t * ptr) +sctp_serialize_hmaclist(sctp_hmaclist_t *list, uint8_t *ptr) { int i; uint16_t hmac_id; @@ -800,7 +800,7 @@ sctp_alloc_authinfo(void) } void -sctp_free_authinfo(sctp_authinfo_t * authinfo) +sctp_free_authinfo(sctp_authinfo_t *authinfo) { if (authinfo == NULL) return; @@ -858,7 +858,7 @@ sctp_get_hmac_block_len(uint16_t hmac_al } static void -sctp_hmac_init(uint16_t hmac_algo, sctp_hash_context_t * ctx) +sctp_hmac_init(uint16_t hmac_algo, sctp_hash_context_t *ctx) { switch (hmac_algo) { case SCTP_AUTH_HMAC_ID_SHA1: @@ -875,8 +875,8 @@ sctp_hmac_init(uint16_t hmac_algo, sctp_ } static void -sctp_hmac_update(uint16_t hmac_algo, sctp_hash_context_t * ctx, - uint8_t * text, uint32_t textlen) +sctp_hmac_update(uint16_t hmac_algo, sctp_hash_context_t *ctx, + uint8_t *text, uint32_t textlen) { switch (hmac_algo) { case SCTP_AUTH_HMAC_ID_SHA1: @@ -893,8 +893,8 @@ sctp_hmac_update(uint16_t hmac_algo, sct } static void -sctp_hmac_final(uint16_t hmac_algo, sctp_hash_context_t * ctx, - uint8_t * digest) +sctp_hmac_final(uint16_t hmac_algo, sctp_hash_context_t *ctx, + uint8_t *digest) { switch (hmac_algo) { case SCTP_AUTH_HMAC_ID_SHA1: @@ -921,8 +921,8 @@ sctp_hmac_final(uint16_t hmac_algo, sctp * resultant digest. */ uint32_t -sctp_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, - uint8_t * text, uint32_t textlen, uint8_t * digest) +sctp_hmac(uint16_t hmac_algo, uint8_t *key, uint32_t keylen, + uint8_t *text, uint32_t textlen, uint8_t *digest) { uint32_t digestlen; uint32_t blocklen; @@ -981,8 +981,8 @@ sctp_hmac(uint16_t hmac_algo, uint8_t * /* mbuf version */ uint32_t -sctp_hmac_m(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, - struct mbuf *m, uint32_t m_offset, uint8_t * digest, uint32_t trailer) +sctp_hmac_m(uint16_t hmac_algo, uint8_t *key, uint32_t keylen, + struct mbuf *m, uint32_t m_offset, uint8_t *digest, uint32_t trailer) { uint32_t digestlen; uint32_t blocklen; @@ -1029,17 +1029,17 @@ sctp_hmac_m(uint16_t hmac_algo, uint8_t sctp_hmac_update(hmac_algo, &ctx, ipad, blocklen); /* find the correct starting mbuf and offset (get start of text) */ m_tmp = m; - while ((m_tmp != NULL) && (m_offset >= (uint32_t) SCTP_BUF_LEN(m_tmp))) { + while ((m_tmp != NULL) && (m_offset >= (uint32_t)SCTP_BUF_LEN(m_tmp))) { m_offset -= SCTP_BUF_LEN(m_tmp); m_tmp = SCTP_BUF_NEXT(m_tmp); } /* now use the rest of the mbuf chain for the text */ while (m_tmp != NULL) { if ((SCTP_BUF_NEXT(m_tmp) == NULL) && trailer) { - sctp_hmac_update(hmac_algo, &ctx, mtod(m_tmp, uint8_t *) + m_offset, + sctp_hmac_update(hmac_algo, &ctx, mtod(m_tmp, uint8_t *)+m_offset, SCTP_BUF_LEN(m_tmp) - (trailer + m_offset)); } else { - sctp_hmac_update(hmac_algo, &ctx, mtod(m_tmp, uint8_t *) + m_offset, + sctp_hmac_update(hmac_algo, &ctx, mtod(m_tmp, uint8_t *)+m_offset, SCTP_BUF_LEN(m_tmp) - m_offset); } @@ -1064,9 +1064,9 @@ sctp_hmac_m(uint16_t hmac_algo, uint8_t * Returns -1 on error, 0 on success. */ int -sctp_verify_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, - uint8_t * text, uint32_t textlen, - uint8_t * digest, uint32_t digestlen) +sctp_verify_hmac(uint16_t hmac_algo, uint8_t *key, uint32_t keylen, + uint8_t *text, uint32_t textlen, + uint8_t *digest, uint32_t digestlen) { uint32_t len; uint8_t temp[SCTP_AUTH_DIGEST_LEN_MAX]; @@ -1097,8 +1097,8 @@ sctp_verify_hmac(uint16_t hmac_algo, uin * the keylen exceeds the HMAC block len). */ uint32_t -sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t * key, uint8_t * text, - uint32_t textlen, uint8_t * digest) +sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t *key, uint8_t *text, + uint32_t textlen, uint8_t *digest) { uint32_t digestlen; uint32_t blocklen; @@ -1132,8 +1132,8 @@ sctp_compute_hmac(uint16_t hmac_algo, sc /* mbuf version */ uint32_t -sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t * key, struct mbuf *m, - uint32_t m_offset, uint8_t * digest) +sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t *key, struct mbuf *m, + uint32_t m_offset, uint8_t *digest) { uint32_t digestlen; uint32_t blocklen; @@ -1164,7 +1164,7 @@ sctp_compute_hmac_m(uint16_t hmac_algo, } int -sctp_auth_is_supported_hmac(sctp_hmaclist_t * list, uint16_t id) +sctp_auth_is_supported_hmac(sctp_hmaclist_t *list, uint16_t id) { int i; @@ -1422,7 +1422,7 @@ sctp_auth_get_cookie_params(struct sctp_ length += offset; phdr = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, - sizeof(struct sctp_paramhdr), (uint8_t *) & tmp_param); + sizeof(struct sctp_paramhdr), (uint8_t *)&tmp_param); while (phdr != NULL) { ptype = ntohs(phdr->param_type); plen = ntohs(phdr->param_length); @@ -1489,7 +1489,7 @@ sctp_auth_get_cookie_params(struct sctp_ if (offset + sizeof(struct sctp_paramhdr) > length) break; phdr = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr), - (uint8_t *) & tmp_param); + (uint8_t *)&tmp_param); } /* concatenate the full random key */ keylen = sizeof(*p_random) + random_len + sizeof(*hmacs) + hmacs_len; @@ -1599,14 +1599,14 @@ sctp_bzero_m(struct mbuf *m, uint32_t m_ /* find the correct starting mbuf and offset (get start position) */ m_tmp = m; - while ((m_tmp != NULL) && (m_offset >= (uint32_t) SCTP_BUF_LEN(m_tmp))) { + while ((m_tmp != NULL) && (m_offset >= (uint32_t)SCTP_BUF_LEN(m_tmp))) { m_offset -= SCTP_BUF_LEN(m_tmp); m_tmp = SCTP_BUF_NEXT(m_tmp); } /* now use the rest of the mbuf chain */ while ((m_tmp != NULL) && (size > 0)) { - data = mtod(m_tmp, uint8_t *) + m_offset; - if (size > (uint32_t) SCTP_BUF_LEN(m_tmp)) { + data = mtod(m_tmp, uint8_t *)+m_offset; + if (size > (uint32_t)SCTP_BUF_LEN(m_tmp)) { bzero(data, SCTP_BUF_LEN(m_tmp)); size -= SCTP_BUF_LEN(m_tmp); } else { Modified: head/sys/netinet/sctp_auth.h ============================================================================== --- head/sys/netinet/sctp_auth.h Mon Dec 26 10:41:51 2016 (r310589) +++ head/sys/netinet/sctp_auth.h Mon Dec 26 11:06:41 2016 (r310590) @@ -51,12 +51,12 @@ __FBSDID("$FreeBSD$"); typedef union sctp_hash_context { SCTP_SHA1_CTX sha1; SCTP_SHA256_CTX sha256; -} sctp_hash_context_t; +} sctp_hash_context_t; typedef struct sctp_key { uint32_t keylen; uint8_t key[]; -} sctp_key_t; +} sctp_key_t; typedef struct sctp_shared_key { LIST_ENTRY(sctp_shared_key) next; @@ -64,7 +64,7 @@ typedef struct sctp_shared_key { uint32_t refcount; /* reference count */ uint16_t keyid; /* shared key ID */ uint8_t deactivated; /* key is deactivated */ -} sctp_sharedkey_t; +} sctp_sharedkey_t; LIST_HEAD(sctp_keyhead, sctp_shared_key); @@ -72,14 +72,14 @@ LIST_HEAD(sctp_keyhead, sctp_shared_key) typedef struct sctp_auth_chklist { uint8_t chunks[256]; uint8_t num_chunks; -} sctp_auth_chklist_t; +} sctp_auth_chklist_t; /* hmac algos supported list */ typedef struct sctp_hmaclist { uint16_t max_algo; /* max algorithms allocated */ uint16_t num_algo; /* num algorithms used */ uint16_t hmac[]; -} sctp_hmaclist_t; +} sctp_hmaclist_t; /* authentication info */ typedef struct sctp_authinformation { @@ -91,7 +91,7 @@ typedef struct sctp_authinformation { uint16_t active_keyid; /* active send keyid */ uint16_t assoc_keyid; /* current send keyid (cached) */ uint16_t recv_keyid; /* last recv keyid (cached) */ -} sctp_authinfo_t; +} sctp_authinfo_t; @@ -106,42 +106,42 @@ typedef struct sctp_authinformation { /* socket option api functions */ extern sctp_auth_chklist_t *sctp_alloc_chunklist(void); -extern void sctp_free_chunklist(sctp_auth_chklist_t * chklist); -extern void sctp_clear_chunklist(sctp_auth_chklist_t * chklist); -extern sctp_auth_chklist_t *sctp_copy_chunklist(sctp_auth_chklist_t * chklist); -extern int sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t * list); -extern int sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t * list); -extern size_t sctp_auth_get_chklist_size(const sctp_auth_chklist_t * list); +extern void sctp_free_chunklist(sctp_auth_chklist_t *chklist); +extern void sctp_clear_chunklist(sctp_auth_chklist_t *chklist); +extern sctp_auth_chklist_t *sctp_copy_chunklist(sctp_auth_chklist_t *chklist); +extern int sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t *list); +extern int sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t *list); +extern size_t sctp_auth_get_chklist_size(const sctp_auth_chklist_t *list); extern int -sctp_serialize_auth_chunks(const sctp_auth_chklist_t * list, - uint8_t * ptr); +sctp_serialize_auth_chunks(const sctp_auth_chklist_t *list, + uint8_t *ptr); extern int -sctp_pack_auth_chunks(const sctp_auth_chklist_t * list, - uint8_t * ptr); +sctp_pack_auth_chunks(const sctp_auth_chklist_t *list, + uint8_t *ptr); extern int -sctp_unpack_auth_chunks(const uint8_t * ptr, uint8_t num_chunks, - sctp_auth_chklist_t * list); +sctp_unpack_auth_chunks(const uint8_t *ptr, uint8_t num_chunks, + sctp_auth_chklist_t *list); /* key handling */ extern sctp_key_t *sctp_alloc_key(uint32_t keylen); -extern void sctp_free_key(sctp_key_t * key); -extern void sctp_print_key(sctp_key_t * key, const char *str); -extern void sctp_show_key(sctp_key_t * key, const char *str); +extern void sctp_free_key(sctp_key_t *key); +extern void sctp_print_key(sctp_key_t *key, const char *str); +extern void sctp_show_key(sctp_key_t *key, const char *str); extern sctp_key_t *sctp_generate_random_key(uint32_t keylen); -extern sctp_key_t *sctp_set_key(uint8_t * key, uint32_t keylen); +extern sctp_key_t *sctp_set_key(uint8_t *key, uint32_t keylen); extern sctp_key_t * -sctp_compute_hashkey(sctp_key_t * key1, sctp_key_t * key2, - sctp_key_t * shared); +sctp_compute_hashkey(sctp_key_t *key1, sctp_key_t *key2, + sctp_key_t *shared); /* shared key handling */ extern sctp_sharedkey_t *sctp_alloc_sharedkey(void); -extern void sctp_free_sharedkey(sctp_sharedkey_t * skey); +extern void sctp_free_sharedkey(sctp_sharedkey_t *skey); extern sctp_sharedkey_t * sctp_find_sharedkey(struct sctp_keyhead *shared_keys, uint16_t key_id); extern int sctp_insert_sharedkey(struct sctp_keyhead *shared_keys, - sctp_sharedkey_t * new_skey); + sctp_sharedkey_t *new_skey); extern int sctp_copy_skeylist(const struct sctp_keyhead *src, struct sctp_keyhead *dest); @@ -155,42 +155,42 @@ sctp_auth_key_release(struct sctp_tcb *s /* hmac list handling */ extern sctp_hmaclist_t *sctp_alloc_hmaclist(uint16_t num_hmacs); -extern void sctp_free_hmaclist(sctp_hmaclist_t * list); -extern int sctp_auth_add_hmacid(sctp_hmaclist_t * list, uint16_t hmac_id); -extern sctp_hmaclist_t *sctp_copy_hmaclist(sctp_hmaclist_t * list); +extern void sctp_free_hmaclist(sctp_hmaclist_t *list); +extern int sctp_auth_add_hmacid(sctp_hmaclist_t *list, uint16_t hmac_id); +extern sctp_hmaclist_t *sctp_copy_hmaclist(sctp_hmaclist_t *list); extern sctp_hmaclist_t *sctp_default_supported_hmaclist(void); extern uint16_t -sctp_negotiate_hmacid(sctp_hmaclist_t * peer, - sctp_hmaclist_t * local); -extern int sctp_serialize_hmaclist(sctp_hmaclist_t * list, uint8_t * ptr); +sctp_negotiate_hmacid(sctp_hmaclist_t *peer, + sctp_hmaclist_t *local); +extern int sctp_serialize_hmaclist(sctp_hmaclist_t *list, uint8_t *ptr); extern int sctp_verify_hmac_param(struct sctp_auth_hmac_algo *hmacs, uint32_t num_hmacs); extern sctp_authinfo_t *sctp_alloc_authinfo(void); -extern void sctp_free_authinfo(sctp_authinfo_t * authinfo); +extern void sctp_free_authinfo(sctp_authinfo_t *authinfo); /* keyed-HMAC functions */ extern uint32_t sctp_get_auth_chunk_len(uint16_t hmac_algo); extern uint32_t sctp_get_hmac_digest_len(uint16_t hmac_algo); extern uint32_t -sctp_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, - uint8_t * text, uint32_t textlen, uint8_t * digest); +sctp_hmac(uint16_t hmac_algo, uint8_t *key, uint32_t keylen, + uint8_t *text, uint32_t textlen, uint8_t *digest); extern int -sctp_verify_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, - uint8_t * text, uint32_t textlen, uint8_t * digest, uint32_t digestlen); +sctp_verify_hmac(uint16_t hmac_algo, uint8_t *key, uint32_t keylen, + uint8_t *text, uint32_t textlen, uint8_t *digest, uint32_t digestlen); extern uint32_t -sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t * key, - uint8_t * text, uint32_t textlen, uint8_t * digest); -extern int sctp_auth_is_supported_hmac(sctp_hmaclist_t * list, uint16_t id); +sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t *key, + uint8_t *text, uint32_t textlen, uint8_t *digest); +extern int sctp_auth_is_supported_hmac(sctp_hmaclist_t *list, uint16_t id); /* mbuf versions */ extern uint32_t -sctp_hmac_m(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, - struct mbuf *m, uint32_t m_offset, uint8_t * digest, uint32_t trailer); +sctp_hmac_m(uint16_t hmac_algo, uint8_t *key, uint32_t keylen, + struct mbuf *m, uint32_t m_offset, uint8_t *digest, uint32_t trailer); extern uint32_t -sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t * key, - struct mbuf *m, uint32_t m_offset, uint8_t * digest); +sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t *key, + struct mbuf *m, uint32_t m_offset, uint8_t *digest); /* * authentication routines @@ -212,7 +212,7 @@ sctp_fill_hmac_digest_m(struct mbuf *m, struct sctp_auth_chunk *auth, struct sctp_tcb *stcb, uint16_t key_id); extern struct mbuf * sctp_add_auth_chunk(struct mbuf *m, struct mbuf **m_end, - struct sctp_auth_chunk **auth_ret, uint32_t * offset, + struct sctp_auth_chunk **auth_ret, uint32_t *offset, struct sctp_tcb *stcb, uint8_t chunk); extern int sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_auth_chunk *ch, Modified: head/sys/netinet/sctp_bsd_addr.c ============================================================================== --- head/sys/netinet/sctp_bsd_addr.c Mon Dec 26 10:41:51 2016 (r310589) +++ head/sys/netinet/sctp_bsd_addr.c Mon Dec 26 11:06:41 2016 (r310590) @@ -477,7 +477,7 @@ again_locked: lenat++; *lenat = value; lenat++; - tick_tock = (uint32_t *) lenat; + tick_tock = (uint32_t *)lenat; lenat++; *tick_tock = sctp_get_tick_count(); copyto = (void *)lenat; @@ -498,7 +498,7 @@ no_log: int -sctp_copy_out_packet_log(uint8_t * target, int length) +sctp_copy_out_packet_log(uint8_t *target, int length) { /* * We wind through the packet log starting at start copying up to Modified: head/sys/netinet/sctp_bsd_addr.h ============================================================================== --- head/sys/netinet/sctp_bsd_addr.h Mon Dec 26 10:41:51 2016 (r310589) +++ head/sys/netinet/sctp_bsd_addr.h Mon Dec 26 11:06:41 2016 (r310590) @@ -53,7 +53,7 @@ void sctp_gather_internal_ifa_flags(stru #ifdef SCTP_PACKET_LOGGING void sctp_packet_log(struct mbuf *m); -int sctp_copy_out_packet_log(uint8_t * target, int length); +int sctp_copy_out_packet_log(uint8_t *target, int length); #endif Modified: head/sys/netinet/sctp_cc_functions.c ============================================================================== --- head/sys/netinet/sctp_cc_functions.c Mon Dec 26 10:41:51 2016 (r310589) +++ head/sys/netinet/sctp_cc_functions.c Mon Dec 26 11:06:41 2016 (r310590) @@ -122,7 +122,7 @@ sctp_cwnd_update_after_fr(struct sctp_tc t_ssthresh += net->ssthresh; t_cwnd += net->cwnd; if (net->lastsa > 0) { - t_ucwnd_sbw += (uint64_t) net->cwnd / (uint64_t) net->lastsa; + t_ucwnd_sbw += (uint64_t)net->cwnd / (uint64_t)net->lastsa; } } if (t_ucwnd_sbw == 0) { @@ -150,27 +150,31 @@ sctp_cwnd_update_after_fr(struct sctp_tc if ((asoc->sctp_cmt_on_off == SCTP_CMT_RPV1) || (asoc->sctp_cmt_on_off == SCTP_CMT_RPV2)) { if (asoc->sctp_cmt_on_off == SCTP_CMT_RPV1) { - net->ssthresh = (uint32_t) (((uint64_t) 4 * - (uint64_t) net->mtu * - (uint64_t) net->ssthresh) / - (uint64_t) t_ssthresh); + net->ssthresh = (uint32_t)(((uint64_t)4 * + (uint64_t)net->mtu * + (uint64_t)net->ssthresh) / + (uint64_t)t_ssthresh); } if (asoc->sctp_cmt_on_off == SCTP_CMT_RPV2) { uint32_t srtt; srtt = net->lastsa; - /* lastsa>>3; we don't need - * to devide ... */ + /* + * lastsa>>3; we don't need + * to devide ... + */ if (srtt == 0) { srtt = 1; } - /* Short Version => Equal to - * Contel Version MBe */ - net->ssthresh = (uint32_t) (((uint64_t) 4 * - (uint64_t) net->mtu * - (uint64_t) net->cwnd) / - ((uint64_t) srtt * + /* + * Short Version => Equal to + * Contel Version MBe + */ + net->ssthresh = (uint32_t)(((uint64_t)4 * + (uint64_t)net->mtu * + (uint64_t)net->cwnd) / + ((uint64_t)srtt * t_ucwnd_sbw)); /* INCREASE FACTOR */ ; } @@ -249,7 +253,7 @@ cc_bw_same(struct sctp_tcb *stcb, struct { uint64_t oth, probepoint; - probepoint = (((uint64_t) net->cwnd) << 32); + probepoint = (((uint64_t)net->cwnd) << 32); if (net->rtt > net->cc_mod.rtcc.lbw_rtt + rtt_offset) { /* * rtt increased we don't update bw.. so we don't update the @@ -385,7 +389,7 @@ cc_bw_decrease(struct sctp_tcb *stcb, st uint64_t oth, probepoint; /* Bandwidth decreased. */ - probepoint = (((uint64_t) net->cwnd) << 32); + probepoint = (((uint64_t)net->cwnd) << 32); if (net->rtt > net->cc_mod.rtcc.lbw_rtt + rtt_offset) { /* rtt increased */ /* Did we add more */ @@ -401,8 +405,10 @@ cc_bw_decrease(struct sctp_tcb *stcb, st net->flight_size, probepoint); if (net->cc_mod.rtcc.ret_from_eq) { - /* Switch over to CA if we are less - * aggressive */ + /* + * Switch over to CA if we are less + * aggressive + */ net->ssthresh = net->cwnd - 1; net->partial_bytes_acked = 0; } @@ -528,7 +534,7 @@ cc_bw_increase(struct sctp_tcb *stcb, st * attention to the inst_ind since our overall sum is increasing. */ /* PROBE POINT 0 */ - probepoint = (((uint64_t) net->cwnd) << 32); + probepoint = (((uint64_t)net->cwnd) << 32); SDT_PROBE5(sctp, cwnd, net, rttvar, vtag, ((net->cc_mod.rtcc.lbw << 32) | nbw), @@ -610,8 +616,8 @@ cc_bw_limit(struct sctp_tcb *stcb, struc */ bw_shift = SCTP_BASE_SYSCTL(sctp_rttvar_bw); rtt = stcb->asoc.my_vtag; - vtag = (rtt << 32) | (((uint32_t) (stcb->sctp_ep->sctp_lport)) << 16) | (stcb->rport); - probepoint = (((uint64_t) net->cwnd) << 32); + vtag = (rtt << 32) | (((uint32_t)(stcb->sctp_ep->sctp_lport)) << 16) | (stcb->rport); + probepoint = (((uint64_t)net->cwnd) << 32); rtt = net->rtt; if (net->cc_mod.rtcc.rtt_set_this_sack) { net->cc_mod.rtcc.rtt_set_this_sack = 0; @@ -631,7 +637,7 @@ cc_bw_limit(struct sctp_tcb *stcb, struc probepoint |= ((0xb << 16) | inst_ind); } else { inst_ind = net->cc_mod.rtcc.last_inst_ind; - inst_bw = bytes_for_this_rtt / (uint64_t) (net->rtt); + inst_bw = bytes_for_this_rtt / (uint64_t)(net->rtt); /* Can't determine do not change */ probepoint |= ((0xc << 16) | inst_ind); } @@ -703,11 +709,11 @@ sctp_cwnd_update_after_sack_common(struc if (srtt > 0) { uint64_t tmp; - t_ucwnd_sbw += (uint64_t) net->cwnd / (uint64_t) srtt; - t_path_mptcp += (((uint64_t) net->cwnd) << SHIFT_MPTCP_MULTI_Z) / - (((uint64_t) net->mtu) * (uint64_t) srtt); - tmp = (((uint64_t) net->cwnd) << SHIFT_MPTCP_MULTI_N) / - ((uint64_t) net->mtu * (uint64_t) (srtt * srtt)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Dec 26 11:11:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E932C0BF89; Mon, 26 Dec 2016 11:11:32 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F28BB17E5; Mon, 26 Dec 2016 11:11:31 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQBBVKO057812; Mon, 26 Dec 2016 11:11:31 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQBBV0E057811; Mon, 26 Dec 2016 11:11:31 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612261111.uBQBBV0E057811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 26 Dec 2016 11:11:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310591 - head/contrib/bsnmp/snmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 11:11:32 -0000 Author: ngie Date: Mon Dec 26 11:11:30 2016 New Revision: 310591 URL: https://svnweb.freebsd.org/changeset/base/310591 Log: Update engine time using update_snmpd_engine_time(..) MFC after: 6 days X-MFC with: r310498 Sponsored by: Dell EMC Isilon Modified: head/contrib/bsnmp/snmpd/trap.c Modified: head/contrib/bsnmp/snmpd/trap.c ============================================================================== --- head/contrib/bsnmp/snmpd/trap.c Mon Dec 26 11:06:41 2016 (r310590) +++ head/contrib/bsnmp/snmpd/trap.c Mon Dec 26 11:11:30 2016 (r310591) @@ -464,7 +464,6 @@ static void snmp_create_v3_trap(struct snmp_pdu *pdu, struct target_param *target, const struct asn_oid *trap_oid) { - uint64_t etime; struct usm_user *usmuser; memset(pdu, 0, sizeof(*pdu)); @@ -487,14 +486,7 @@ snmp_create_v3_trap(struct snmp_pdu *pdu pdu->nbindings = 2; - etime = (get_ticks() - start_tick) / 100ULL; - if (etime < INT32_MAX) - snmpd_engine.engine_time = etime; - else { - start_tick = get_ticks(); - set_snmpd_engine(); - snmpd_engine.engine_time = start_tick; - } + update_snmpd_engine_time(); memcpy(pdu->engine.engine_id, snmpd_engine.engine_id, snmpd_engine.engine_len); From owner-svn-src-head@freebsd.org Mon Dec 26 11:16:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98000C910C6; Mon, 26 Dec 2016 11:16:56 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66F0B1BBC; Mon, 26 Dec 2016 11:16:56 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQBGtaN060231; Mon, 26 Dec 2016 11:16:55 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQBGtHk060230; Mon, 26 Dec 2016 11:16:55 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612261116.uBQBGtHk060230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 26 Dec 2016 11:16:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310592 - head/contrib/bsnmp/snmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 11:16:56 -0000 Author: ngie Date: Mon Dec 26 11:16:55 2016 New Revision: 310592 URL: https://svnweb.freebsd.org/changeset/base/310592 Log: style(9): fix trailing whitespace MFC after: 3 days Modified: head/contrib/bsnmp/snmpd/trap.c Modified: head/contrib/bsnmp/snmpd/trap.c ============================================================================== --- head/contrib/bsnmp/snmpd/trap.c Mon Dec 26 11:11:30 2016 (r310591) +++ head/contrib/bsnmp/snmpd/trap.c Mon Dec 26 11:16:55 2016 (r310592) @@ -214,7 +214,7 @@ trapsink_unmodify(struct trapsink *t, st t->version = tdep->rb_version; if (tdep->set & TDEP_COMM) strcpy(t->comm, tdep->rb_comm); - + return (SNMP_ERR_NOERROR); } @@ -538,7 +538,7 @@ snmp_send_trap(const struct asn_oid *tra TAILQ_FOREACH(t, &trapsink_list, link) { if (t->status != TRAPSINK_ACTIVE) continue; - + if (t->version == TRAPSINK_V1) snmp_create_v1_trap(&pdu, t->comm, trap_oid); else From owner-svn-src-head@freebsd.org Mon Dec 26 11:20:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F67AC911A5; Mon, 26 Dec 2016 11:20:42 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3BB31DB0; Mon, 26 Dec 2016 11:20:41 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQBKeMl060417; Mon, 26 Dec 2016 11:20:40 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQBKefw060416; Mon, 26 Dec 2016 11:20:40 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201612261120.uBQBKefw060416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Mon, 26 Dec 2016 11:20:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310593 - head/sys/dev/drm2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 11:20:42 -0000 Author: mmel Date: Mon Dec 26 11:20:40 2016 New Revision: 310593 URL: https://svnweb.freebsd.org/changeset/base/310593 Log: Fix late monitor hotplug event. If system starts without attached monitor, DRM create framebuffer for VT console. Later, when monitor is attached, the hotplug event must issue full modeset procedure to setup CRTC. In original code, this was done in drm_fb_helper_set_par(), but we don't have this function implemented yet. Use unrolled version of drm_fb_helper_set_par() to ensure same functionality. MFC after: 1 month Modified: head/sys/dev/drm2/drm_fb_helper.c Modified: head/sys/dev/drm2/drm_fb_helper.c ============================================================================== --- head/sys/dev/drm2/drm_fb_helper.c Mon Dec 26 11:16:55 2016 (r310592) +++ head/sys/dev/drm2/drm_fb_helper.c Mon Dec 26 11:20:40 2016 (r310593) @@ -339,6 +339,7 @@ bool drm_fb_helper_restore_fbdev_mode(st { bool error = false; int i, ret; + for (i = 0; i < fb_helper->crtc_count; i++) { struct drm_mode_set *mode_set = &fb_helper->crtc_info[i].mode_set; ret = mode_set->crtc->funcs->set_config(mode_set); @@ -841,6 +842,9 @@ int drm_fb_helper_single_fb_probe(struct struct drm_fb_helper_surface_size sizes; int gamma_size = 0; #if defined(__FreeBSD__) + struct drm_crtc *crtc; + struct drm_device *dev; + int ret; device_t kdev; #endif @@ -942,6 +946,24 @@ int drm_fb_helper_single_fb_probe(struct if (ret != 0) DRM_ERROR("Failed to attach fbd device: %d\n", ret); #endif + } else { + /* Modified version of drm_fb_helper_set_par() */ + dev = fb_helper->dev; + sx_xlock(&dev->mode_config.mutex); + for (i = 0; i < fb_helper->crtc_count; i++) { + crtc = fb_helper->crtc_info[i].mode_set.crtc; + ret = crtc->funcs->set_config(&fb_helper->crtc_info[i].mode_set); + if (ret) { + sx_xunlock(&dev->mode_config.mutex); + return ret; + } + } + sx_xunlock(&dev->mode_config.mutex); + + if (fb_helper->delayed_hotplug) { + fb_helper->delayed_hotplug = false; + drm_fb_helper_hotplug_event(fb_helper); + } } #else if (new_fb) { From owner-svn-src-head@freebsd.org Mon Dec 26 13:20:25 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72A44C91592; Mon, 26 Dec 2016 13:20:25 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: from mail-qt0-x242.google.com (mail-qt0-x242.google.com [IPv6:2607:f8b0:400d:c0d::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2A5F310B8; Mon, 26 Dec 2016 13:20:25 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: by mail-qt0-x242.google.com with SMTP id d22so10628121qtd.3; Mon, 26 Dec 2016 05:20:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=q3ctZqxznjooWMbLWf6hPPMeGXPKCnkl/rdCbEldtKE=; b=fa4Tsxhemi8Qb2dATWnyc+XN9jqStAwmWUD2kuXbkvrcjgRZDV+tvtexB6zf986p4B Dl13mwB0i3b7Wm+2vlcc9go+0zIjec7sguhP4vLuKRRn8G54EbRpZR9pw/4WAWvyi6RI Lze8llYDegNkKtqxCEcwvT85ex8nz9fnqn656XNFtSSbReHFATPQm/zsO7R3cCdkqePp 1wJROYQeWSMJznxWEe9R5kwboi2MJqhzQ+iCZzuU126cq1ewzqem2oyuig13zXjrzJhK QNoUd9oRaJFIod4B3p7+kQYe4b5KJHfJqfgTw4y40MujM7u9+auTG73uk71Ei5KZJIej 04dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=q3ctZqxznjooWMbLWf6hPPMeGXPKCnkl/rdCbEldtKE=; b=YlWbUaswok5g7kewRvV2A/tOIOl5ZvrcQSxWoPGUJCQEqv/E0s4mULKCGVvMZ7/fq8 5ibPCKZlmhGf/kqWdprc66Ax+JaczEEx+8kty2aTglgOozJe6WpWtD/sbJuFQLco9FDT k62AIJfglCCaxYv/ZEUUOQ42dxjx+XiuWCqU4augpz3YB3+qOS6okYQEEafCP+5SaHZA 9htFnf+tcedd0qINNGtjTqhZpxUaLqY2299fkFQfsc0eKT+g5WHnAuUHh4nO4Fy09Rs+ HAJk5e1TWQQvGyaigk/5+5LKHPTqMX3zZC+lugV10GjGIm+cgnqgqwPpkXEfX/0PJKkz 6Mng== X-Gm-Message-State: AIkVDXK3vGjf6NCkt6ZwVEa3AKuqFgSwq3L3IXW3/718GdRvfpNiF5ua669C0RljIwow1w== X-Received: by 10.200.38.50 with SMTP id u47mr28434542qtu.288.1482758424114; Mon, 26 Dec 2016 05:20:24 -0800 (PST) Received: from mbp.home ([187.94.175.146]) by smtp.gmail.com with ESMTPSA id 16sm26289834qtn.33.2016.12.26.05.20.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Dec 2016 05:20:23 -0800 (PST) Sender: Renato Botelho From: Renato Botelho Message-Id: <31D36CA7-4D63-43F6-8845-57F6B68E1925@FreeBSD.org> Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Subject: Re: svn commit: r293829 - head/sys/net Date: Mon, 26 Dec 2016 11:20:19 -0200 In-Reply-To: <201601131432.u0DEWn2H088657@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, "Andrey V. Elsukov" To: "Alexander V. Chernikov" References: <201601131432.u0DEWn2H088657@repo.freebsd.org> X-Mailer: Apple Mail (2.3259) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 13:20:25 -0000 Alexander, Looks like this change introduced a bug. It was reported at pfSense and = a ticket was opened at bugzilla: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D215122 > On 13 Jan 2016, at 12:32, Alexander V. Chernikov = wrote: >=20 > Author: melifaro > Date: Wed Jan 13 14:32:48 2016 > New Revision: 293829 > URL: https://svnweb.freebsd.org/changeset/base/293829 >=20 > Log: > Remove RTF_RNH_LOCKED support from rtalloc1_fib(). >=20 > Last caller using it was eliminated in r293471. >=20 > Sponsored by: Yandex LLC >=20 > Modified: > head/sys/net/route.c > head/sys/net/route.h >=20 > Modified: head/sys/net/route.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/net/route.c Wed Jan 13 14:28:12 2016 = (r293828) > +++ head/sys/net/route.c Wed Jan 13 14:32:48 2016 = (r293829) > @@ -409,7 +409,6 @@ rtalloc1_fib(struct sockaddr *dst, int r > struct rtentry *newrt; > struct rt_addrinfo info; > int err =3D 0, msgtype =3D RTM_MISS; > - int needlock; >=20 > KASSERT((fibnum < rt_numfibs), ("rtalloc1_fib: bad fibnum")); > rnh =3D rt_tables_get_rnh(fibnum, dst->sa_family); > @@ -420,23 +419,16 @@ rtalloc1_fib(struct sockaddr *dst, int r > /* > * Look up the address in the table for that Address Family > */ > - needlock =3D !(ignflags & RTF_RNH_LOCKED); > - if (needlock) > - RADIX_NODE_HEAD_RLOCK(rnh); > -#ifdef INVARIANTS=09 > - else > - RADIX_NODE_HEAD_LOCK_ASSERT(rnh); > -#endif > + RADIX_NODE_HEAD_RLOCK(rnh); > rn =3D rnh->rnh_matchaddr(dst, rnh); > if (rn && ((rn->rn_flags & RNF_ROOT) =3D=3D 0)) { > newrt =3D RNTORT(rn); > RT_LOCK(newrt); > RT_ADDREF(newrt); > - if (needlock) > - RADIX_NODE_HEAD_RUNLOCK(rnh); > - goto done; > + RADIX_NODE_HEAD_RUNLOCK(rnh); > + return (newrt); >=20 > - } else if (needlock) > + } else > RADIX_NODE_HEAD_RUNLOCK(rnh); > =09 > /* > @@ -456,10 +448,7 @@ miss: > bzero(&info, sizeof(info)); > info.rti_info[RTAX_DST] =3D dst; > rt_missmsg_fib(msgtype, &info, 0, err, fibnum); > - }=09 > -done: > - if (newrt) > - RT_LOCK_ASSERT(newrt); > + } > return (newrt); > } >=20 >=20 > Modified: head/sys/net/route.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/net/route.h Wed Jan 13 14:28:12 2016 = (r293828) > +++ head/sys/net/route.h Wed Jan 13 14:32:48 2016 = (r293829) > @@ -175,7 +175,7 @@ struct rtentry { > /* 0x8000000 and up unassigned = */ > #define RTF_STICKY 0x10000000 /* always route dst->src = */ >=20 > -#define RTF_RNH_LOCKED 0x40000000 /* radix node head is = locked */ > +#define RTF_RNH_LOCKED 0x40000000 /* unused */ >=20 > #define RTF_GWFLAG_COMPAT 0x80000000 /* a compatibility bit = for interacting > with existing routing apps */ > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to = "svn-src-head-unsubscribe@freebsd.org" -- Renato Botelho From owner-svn-src-head@freebsd.org Mon Dec 26 14:28:25 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60A12C91B86; Mon, 26 Dec 2016 14:28:25 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B1721A12; Mon, 26 Dec 2016 14:28:25 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQESO1I041003; Mon, 26 Dec 2016 14:28:24 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQESOCT041000; Mon, 26 Dec 2016 14:28:24 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201612261428.uBQESOCT041000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Mon, 26 Dec 2016 14:28:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310599 - in head/sys: conf dev/drm2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 14:28:25 -0000 Author: mmel Date: Mon Dec 26 14:28:23 2016 New Revision: 310599 URL: https://svnweb.freebsd.org/changeset/base/310599 Log: Import drm_patform.c, an implementation of non-PCI based attachment for graphics drivers. It will be used in upcoming driver for Nvidia Tegra boards. MFC after: 1 month Added: head/sys/dev/drm2/drm_platform.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/drm2/drmP.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Dec 26 12:41:38 2016 (r310598) +++ head/sys/conf/files Mon Dec 26 14:28:23 2016 (r310599) @@ -1544,6 +1544,7 @@ dev/drm2/drm_memory.c optional drm2 dev/drm2/drm_mm.c optional drm2 dev/drm2/drm_modes.c optional drm2 dev/drm2/drm_pci.c optional drm2 +dev/drm2/drm_platform.c optional drm2 dev/drm2/drm_scatter.c optional drm2 dev/drm2/drm_stub.c optional drm2 dev/drm2/drm_sysctl.c optional drm2 Modified: head/sys/dev/drm2/drmP.h ============================================================================== --- head/sys/dev/drm2/drmP.h Mon Dec 26 12:41:38 2016 (r310598) +++ head/sys/dev/drm2/drmP.h Mon Dec 26 14:28:23 2016 (r310599) @@ -1576,6 +1576,10 @@ extern int drm_pcie_get_speed_cap_mask(s #define drm_can_sleep() (DRM_HZ & 1) +/* Platform section */ +int drm_get_platform_dev(device_t kdev, struct drm_device *dev, + struct drm_driver *driver); + /* FreeBSD specific -- should be moved to drm_os_freebsd.h */ #define DRM_GEM_MAPPING_MASK (3ULL << 62) Added: head/sys/dev/drm2/drm_platform.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/drm2/drm_platform.c Mon Dec 26 14:28:23 2016 (r310599) @@ -0,0 +1,183 @@ +/* + * Derived from drm_pci.c + * + * Copyright 2003 José Fonseca. + * Copyright 2003 Leif Delgass. + * Copyright (c) 2009, Code Aurora Forum. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include +__FBSDID("$FreeBSD$"); + +#include + +static void drm_platform_free_irq(struct drm_device *dev) +{ + if (dev->irqr == NULL) + return; + + bus_release_resource(dev->dev, SYS_RES_IRQ, + dev->irqrid, dev->irqr); + + dev->irqr = NULL; + dev->irq = 0; +} + +static const char *drm_platform_get_name(struct drm_device *dev) +{ + return dev->driver->name; +} + +static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *master) +{ + int len, ret, id; + + master->unique_len = 13 + strlen(dev->driver->name); + master->unique_size = master->unique_len; + master->unique = malloc(master->unique_len + 1, DRM_MEM_DRIVER, M_NOWAIT); + + if (master->unique == NULL) + return -ENOMEM; + + id = 0; // XXX dev->driver->id; + + /* if only a single instance of the platform device, id will be + * set to -1.. use 0 instead to avoid a funny looking bus-id: + */ + if (id == -1) + id = 0; + + len = snprintf(master->unique, master->unique_len, + "platform:%s:%02d", dev->driver->name, id); + + if (len > master->unique_len) { + DRM_ERROR("Unique buffer overflowed\n"); + ret = -EINVAL; + goto err; + } + + return 0; +err: + return ret; +} + +static int drm_platform_get_irq(struct drm_device *dev) +{ + if (dev->irqr) + return (dev->irq); + + dev->irqr = bus_alloc_resource_any(dev->dev, SYS_RES_IRQ, + &dev->irqrid, RF_SHAREABLE); + if (!dev->irqr) { + dev_err(dev->dev, "Failed to allocate IRQ\n"); + return (0); + } + + dev->irq = (int) rman_get_start(dev->irqr); + + return (dev->irq); +} + +static struct drm_bus drm_platform_bus = { + .bus_type = DRIVER_BUS_PLATFORM, + .get_irq = drm_platform_get_irq, + .free_irq = drm_platform_free_irq, + .get_name = drm_platform_get_name, + .set_busid = drm_platform_set_busid, +}; + +/** + * Register. + * + * \param platdev - Platform device struture + * \return zero on success or a negative number on failure. + * + * Attempt to gets inter module "drm" information. If we are first + * then register the character device and inter module information. + * Try and register, if we fail to register, backout previous work. + */ + +int drm_get_platform_dev(device_t kdev, struct drm_device *dev, + struct drm_driver *driver) +{ + int ret; + + DRM_DEBUG("\n"); + + driver->bus = &drm_platform_bus; + + dev->dev = kdev; + + sx_xlock(&drm_global_mutex); + + ret = drm_fill_in_dev(dev, driver); + + if (ret) { + printf("DRM: Fill_in_dev failed.\n"); + goto err_g1; + } + + if (drm_core_check_feature(dev, DRIVER_MODESET)) { + ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL); + if (ret) + goto err_g1; + } + + ret = drm_get_minor(dev, &dev->primary, DRM_MINOR_LEGACY); + if (ret) + goto err_g2; + + if (dev->driver->load) { + ret = dev->driver->load(dev, 0); + if (ret) + goto err_g3; + } + + /* setup the grouping for the legacy output */ + if (drm_core_check_feature(dev, DRIVER_MODESET)) { + ret = drm_mode_group_init_legacy_group(dev, + &dev->primary->mode_group); + if (ret) + goto err_g3; + } + +#ifdef FREEBSD_NOTYET + list_add_tail(&dev->driver_item, &driver->device_list); +#endif /* FREEBSD_NOTYET */ + + sx_xunlock(&drm_global_mutex); + + DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", + driver->name, driver->major, driver->minor, driver->patchlevel, + driver->date, dev->primary->index); + + return 0; + +err_g3: + drm_put_minor(&dev->primary); +err_g2: + if (drm_core_check_feature(dev, DRIVER_MODESET)) + drm_put_minor(&dev->control); +err_g1: + sx_xunlock(&drm_global_mutex); + return ret; +} +EXPORT_SYMBOL(drm_get_platform_dev); From owner-svn-src-head@freebsd.org Mon Dec 26 14:36:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A876C91F8E; Mon, 26 Dec 2016 14:36:06 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53139134A; Mon, 26 Dec 2016 14:36:06 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQEa5Kl045714; Mon, 26 Dec 2016 14:36:05 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQEa5vB045711; Mon, 26 Dec 2016 14:36:05 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201612261436.uBQEa5vB045711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Mon, 26 Dec 2016 14:36:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310600 - in head/sys/arm: conf nvidia/drm2 nvidia/tegra124 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 14:36:06 -0000 Author: mmel Date: Mon Dec 26 14:36:05 2016 New Revision: 310600 URL: https://svnweb.freebsd.org/changeset/base/310600 Log: Implement drivers for NVIDIA tegra124 display controller, HDMI source and host1x module. Unfortunately, tegra124 SoC doesn't have 2D acceleration engine and 3D requires not yet started nouveau driver. These drivers forms a first non-x86 DRM2 enabled graphic stack. Note, there are 2 outstanding issues: - The code uses gross hack in order to be comply with OBJT_MGTDEVICE pager. (See tegra_bo_init_pager() in tegra_bo.c) - Due to improper(probably) refcounting in drm_gem_mmap_single() (in drm_gem.c), the gem objects are never released. I hope that I will be able to address both issues in finite time, but I don't want to touch x86 world now. MFC after: 1 month Added: head/sys/arm/nvidia/drm2/ head/sys/arm/nvidia/drm2/hdmi.c (contents, props changed) head/sys/arm/nvidia/drm2/hdmi.h (contents, props changed) head/sys/arm/nvidia/drm2/tegra_bo.c (contents, props changed) head/sys/arm/nvidia/drm2/tegra_dc.c (contents, props changed) head/sys/arm/nvidia/drm2/tegra_dc_if.m (contents, props changed) head/sys/arm/nvidia/drm2/tegra_dc_reg.h (contents, props changed) head/sys/arm/nvidia/drm2/tegra_drm.h (contents, props changed) head/sys/arm/nvidia/drm2/tegra_drm_if.m (contents, props changed) head/sys/arm/nvidia/drm2/tegra_drm_subr.c (contents, props changed) head/sys/arm/nvidia/drm2/tegra_fb.c (contents, props changed) head/sys/arm/nvidia/drm2/tegra_hdmi.c (contents, props changed) head/sys/arm/nvidia/drm2/tegra_hdmi_reg.h (contents, props changed) head/sys/arm/nvidia/drm2/tegra_host1x.c (contents, props changed) Modified: head/sys/arm/conf/TEGRA124 head/sys/arm/nvidia/tegra124/files.tegra124 Modified: head/sys/arm/conf/TEGRA124 ============================================================================== --- head/sys/arm/conf/TEGRA124 Mon Dec 26 14:28:23 2016 (r310599) +++ head/sys/arm/conf/TEGRA124 Mon Dec 26 14:36:05 2016 (r310600) @@ -123,11 +123,10 @@ device pci device re # RealTek 8139C+/8169/8169S/8110S # DRM2 -#device fbd -#device vt -#device splash -#device kbdmux -#device drm2 +device fbd +device vt +device kbdmux +device drm2 # Sound #device sound Added: head/sys/arm/nvidia/drm2/hdmi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/nvidia/drm2/hdmi.c Mon Dec 26 14:36:05 2016 (r310600) @@ -0,0 +1,1229 @@ +/* + * Copyright (C) 2012 Avionic Design GmbH + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include + +#define EXPORT_SYMBOL(x) +#ifndef BIT +#define BIT(x) (1U << (x)) +#endif +#define hdmi_log(fmt, ...) printf(fmt, ##__VA_ARGS__) + +static uint8_t hdmi_infoframe_checksum(uint8_t *ptr, size_t size) +{ + uint8_t csum = 0; + size_t i; + + /* compute checksum */ + for (i = 0; i < size; i++) + csum += ptr[i]; + + return 256 - csum; +} + +static void hdmi_infoframe_set_checksum(void *buffer, size_t size) +{ + uint8_t *ptr = buffer; + + ptr[3] = hdmi_infoframe_checksum(buffer, size); +} + +/** + * hdmi_avi_infoframe_init() - initialize an HDMI AVI infoframe + * @frame: HDMI AVI infoframe + * + * Returns 0 on success or a negative error code on failure. + */ +int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame) +{ + memset(frame, 0, sizeof(*frame)); + + frame->type = HDMI_INFOFRAME_TYPE_AVI; + frame->version = 2; + frame->length = HDMI_AVI_INFOFRAME_SIZE; + + return 0; +} +EXPORT_SYMBOL(hdmi_avi_infoframe_init); + +/** + * hdmi_avi_infoframe_pack() - write HDMI AVI infoframe to binary buffer + * @frame: HDMI AVI infoframe + * @buffer: destination buffer + * @size: size of buffer + * + * Packs the information contained in the @frame structure into a binary + * representation that can be written into the corresponding controller + * registers. Also computes the checksum as required by section 5.3.5 of + * the HDMI 1.4 specification. + * + * Returns the number of bytes packed into the binary buffer or a negative + * error code on failure. + */ +ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer, + size_t size) +{ + uint8_t *ptr = buffer; + size_t length; + + length = HDMI_INFOFRAME_HEADER_SIZE + frame->length; + + if (size < length) + return -ENOSPC; + + memset(buffer, 0, size); + + ptr[0] = frame->type; + ptr[1] = frame->version; + ptr[2] = frame->length; + ptr[3] = 0; /* checksum */ + + /* start infoframe payload */ + ptr += HDMI_INFOFRAME_HEADER_SIZE; + + ptr[0] = ((frame->colorspace & 0x3) << 5) | (frame->scan_mode & 0x3); + + /* + * Data byte 1, bit 4 has to be set if we provide the active format + * aspect ratio + */ + if (frame->active_aspect & 0xf) + ptr[0] |= BIT(4); + + /* Bit 3 and 2 indicate if we transmit horizontal/vertical bar data */ + if (frame->top_bar || frame->bottom_bar) + ptr[0] |= BIT(3); + + if (frame->left_bar || frame->right_bar) + ptr[0] |= BIT(2); + + ptr[1] = ((frame->colorimetry & 0x3) << 6) | + ((frame->picture_aspect & 0x3) << 4) | + (frame->active_aspect & 0xf); + + ptr[2] = ((frame->extended_colorimetry & 0x7) << 4) | + ((frame->quantization_range & 0x3) << 2) | + (frame->nups & 0x3); + + if (frame->itc) + ptr[2] |= BIT(7); + + ptr[3] = frame->video_code & 0x7f; + + ptr[4] = ((frame->ycc_quantization_range & 0x3) << 6) | + ((frame->content_type & 0x3) << 4) | + (frame->pixel_repeat & 0xf); + + ptr[5] = frame->top_bar & 0xff; + ptr[6] = (frame->top_bar >> 8) & 0xff; + ptr[7] = frame->bottom_bar & 0xff; + ptr[8] = (frame->bottom_bar >> 8) & 0xff; + ptr[9] = frame->left_bar & 0xff; + ptr[10] = (frame->left_bar >> 8) & 0xff; + ptr[11] = frame->right_bar & 0xff; + ptr[12] = (frame->right_bar >> 8) & 0xff; + + hdmi_infoframe_set_checksum(buffer, length); + + return length; +} +EXPORT_SYMBOL(hdmi_avi_infoframe_pack); + +/** + * hdmi_spd_infoframe_init() - initialize an HDMI SPD infoframe + * @frame: HDMI SPD infoframe + * @vendor: vendor string + * @product: product string + * + * Returns 0 on success or a negative error code on failure. + */ +int hdmi_spd_infoframe_init(struct hdmi_spd_infoframe *frame, + const char *vendor, const char *product) +{ + memset(frame, 0, sizeof(*frame)); + + frame->type = HDMI_INFOFRAME_TYPE_SPD; + frame->version = 1; + frame->length = HDMI_SPD_INFOFRAME_SIZE; + + strncpy(frame->vendor, vendor, sizeof(frame->vendor)); + strncpy(frame->product, product, sizeof(frame->product)); + + return 0; +} +EXPORT_SYMBOL(hdmi_spd_infoframe_init); + +/** + * hdmi_spd_infoframe_pack() - write HDMI SPD infoframe to binary buffer + * @frame: HDMI SPD infoframe + * @buffer: destination buffer + * @size: size of buffer + * + * Packs the information contained in the @frame structure into a binary + * representation that can be written into the corresponding controller + * registers. Also computes the checksum as required by section 5.3.5 of + * the HDMI 1.4 specification. + * + * Returns the number of bytes packed into the binary buffer or a negative + * error code on failure. + */ +ssize_t hdmi_spd_infoframe_pack(struct hdmi_spd_infoframe *frame, void *buffer, + size_t size) +{ + uint8_t *ptr = buffer; + size_t length; + + length = HDMI_INFOFRAME_HEADER_SIZE + frame->length; + + if (size < length) + return -ENOSPC; + + memset(buffer, 0, size); + + ptr[0] = frame->type; + ptr[1] = frame->version; + ptr[2] = frame->length; + ptr[3] = 0; /* checksum */ + + /* start infoframe payload */ + ptr += HDMI_INFOFRAME_HEADER_SIZE; + + memcpy(ptr, frame->vendor, sizeof(frame->vendor)); + memcpy(ptr + 8, frame->product, sizeof(frame->product)); + + ptr[24] = frame->sdi; + + hdmi_infoframe_set_checksum(buffer, length); + + return length; +} +EXPORT_SYMBOL(hdmi_spd_infoframe_pack); + +/** + * hdmi_audio_infoframe_init() - initialize an HDMI audio infoframe + * @frame: HDMI audio infoframe + * + * Returns 0 on success or a negative error code on failure. + */ +int hdmi_audio_infoframe_init(struct hdmi_audio_infoframe *frame) +{ + memset(frame, 0, sizeof(*frame)); + + frame->type = HDMI_INFOFRAME_TYPE_AUDIO; + frame->version = 1; + frame->length = HDMI_AUDIO_INFOFRAME_SIZE; + + return 0; +} +EXPORT_SYMBOL(hdmi_audio_infoframe_init); + +/** + * hdmi_audio_infoframe_pack() - write HDMI audio infoframe to binary buffer + * @frame: HDMI audio infoframe + * @buffer: destination buffer + * @size: size of buffer + * + * Packs the information contained in the @frame structure into a binary + * representation that can be written into the corresponding controller + * registers. Also computes the checksum as required by section 5.3.5 of + * the HDMI 1.4 specification. + * + * Returns the number of bytes packed into the binary buffer or a negative + * error code on failure. + */ +ssize_t hdmi_audio_infoframe_pack(struct hdmi_audio_infoframe *frame, + void *buffer, size_t size) +{ + unsigned char channels; + uint8_t *ptr = buffer; + size_t length; + + length = HDMI_INFOFRAME_HEADER_SIZE + frame->length; + + if (size < length) + return -ENOSPC; + + memset(buffer, 0, size); + + if (frame->channels >= 2) + channels = frame->channels - 1; + else + channels = 0; + + ptr[0] = frame->type; + ptr[1] = frame->version; + ptr[2] = frame->length; + ptr[3] = 0; /* checksum */ + + /* start infoframe payload */ + ptr += HDMI_INFOFRAME_HEADER_SIZE; + + ptr[0] = ((frame->coding_type & 0xf) << 4) | (channels & 0x7); + ptr[1] = ((frame->sample_frequency & 0x7) << 2) | + (frame->sample_size & 0x3); + ptr[2] = frame->coding_type_ext & 0x1f; + ptr[3] = frame->channel_allocation; + ptr[4] = (frame->level_shift_value & 0xf) << 3; + + if (frame->downmix_inhibit) + ptr[4] |= BIT(7); + + hdmi_infoframe_set_checksum(buffer, length); + + return length; +} +EXPORT_SYMBOL(hdmi_audio_infoframe_pack); + +/** + * hdmi_vendor_infoframe_init() - initialize an HDMI vendor infoframe + * @frame: HDMI vendor infoframe + * + * Returns 0 on success or a negative error code on failure. + */ +int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame) +{ + memset(frame, 0, sizeof(*frame)); + + frame->type = HDMI_INFOFRAME_TYPE_VENDOR; + frame->version = 1; + + frame->oui = HDMI_IEEE_OUI; + + /* + * 0 is a valid value for s3d_struct, so we use a special "not set" + * value + */ + frame->s3d_struct = HDMI_3D_STRUCTURE_INVALID; + + return 0; +} +EXPORT_SYMBOL(hdmi_vendor_infoframe_init); + +/** + * hdmi_vendor_infoframe_pack() - write a HDMI vendor infoframe to binary buffer + * @frame: HDMI infoframe + * @buffer: destination buffer + * @size: size of buffer + * + * Packs the information contained in the @frame structure into a binary + * representation that can be written into the corresponding controller + * registers. Also computes the checksum as required by section 5.3.5 of + * the HDMI 1.4 specification. + * + * Returns the number of bytes packed into the binary buffer or a negative + * error code on failure. + */ +ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame, + void *buffer, size_t size) +{ + uint8_t *ptr = buffer; + size_t length; + + /* empty info frame */ + if (frame->vic == 0 && frame->s3d_struct == HDMI_3D_STRUCTURE_INVALID) + return -EINVAL; + + /* only one of those can be supplied */ + if (frame->vic != 0 && frame->s3d_struct != HDMI_3D_STRUCTURE_INVALID) + return -EINVAL; + + /* for side by side (half) we also need to provide 3D_Ext_Data */ + if (frame->s3d_struct >= HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF) + frame->length = 6; + else + frame->length = 5; + + length = HDMI_INFOFRAME_HEADER_SIZE + frame->length; + + if (size < length) + return -ENOSPC; + + memset(buffer, 0, size); + + ptr[0] = frame->type; + ptr[1] = frame->version; + ptr[2] = frame->length; + ptr[3] = 0; /* checksum */ + + /* HDMI OUI */ + ptr[4] = 0x03; + ptr[5] = 0x0c; + ptr[6] = 0x00; + + if (frame->vic) { + ptr[7] = 0x1 << 5; /* video format */ + ptr[8] = frame->vic; + } else { + ptr[7] = 0x2 << 5; /* video format */ + ptr[8] = (frame->s3d_struct & 0xf) << 4; + if (frame->s3d_struct >= HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF) + ptr[9] = (frame->s3d_ext_data & 0xf) << 4; + } + + hdmi_infoframe_set_checksum(buffer, length); + + return length; +} +EXPORT_SYMBOL(hdmi_vendor_infoframe_pack); + +/* + * hdmi_vendor_any_infoframe_pack() - write a vendor infoframe to binary buffer + */ +static ssize_t +hdmi_vendor_any_infoframe_pack(union hdmi_vendor_any_infoframe *frame, + void *buffer, size_t size) +{ + /* we only know about HDMI vendor infoframes */ + if (frame->any.oui != HDMI_IEEE_OUI) + return -EINVAL; + + return hdmi_vendor_infoframe_pack(&frame->hdmi, buffer, size); +} + +/** + * hdmi_infoframe_pack() - write a HDMI infoframe to binary buffer + * @frame: HDMI infoframe + * @buffer: destination buffer + * @size: size of buffer + * + * Packs the information contained in the @frame structure into a binary + * representation that can be written into the corresponding controller + * registers. Also computes the checksum as required by section 5.3.5 of + * the HDMI 1.4 specification. + * + * Returns the number of bytes packed into the binary buffer or a negative + * error code on failure. + */ +ssize_t +hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer, size_t size) +{ + ssize_t length; + + switch (frame->any.type) { + case HDMI_INFOFRAME_TYPE_AVI: + length = hdmi_avi_infoframe_pack(&frame->avi, buffer, size); + break; + case HDMI_INFOFRAME_TYPE_SPD: + length = hdmi_spd_infoframe_pack(&frame->spd, buffer, size); + break; + case HDMI_INFOFRAME_TYPE_AUDIO: + length = hdmi_audio_infoframe_pack(&frame->audio, buffer, size); + break; + case HDMI_INFOFRAME_TYPE_VENDOR: + length = hdmi_vendor_any_infoframe_pack(&frame->vendor, + buffer, size); + break; + default: + printf("Bad infoframe type %d\n", frame->any.type); + length = -EINVAL; + } + + return length; +} +EXPORT_SYMBOL(hdmi_infoframe_pack); + +static const char *hdmi_infoframe_type_get_name(enum hdmi_infoframe_type type) +{ + if (type < 0x80 || type > 0x9f) + return "Invalid"; + switch (type) { + case HDMI_INFOFRAME_TYPE_VENDOR: + return "Vendor"; + case HDMI_INFOFRAME_TYPE_AVI: + return "Auxiliary Video Information (AVI)"; + case HDMI_INFOFRAME_TYPE_SPD: + return "Source Product Description (SPD)"; + case HDMI_INFOFRAME_TYPE_AUDIO: + return "Audio"; + } + return "Reserved"; +} + +static void hdmi_infoframe_log_header(struct hdmi_any_infoframe *frame) +{ + hdmi_log("HDMI infoframe: %s, version %u, length %u\n", + hdmi_infoframe_type_get_name(frame->type), + frame->version, frame->length); +} + +static const char *hdmi_colorspace_get_name(enum hdmi_colorspace colorspace) +{ + switch (colorspace) { + case HDMI_COLORSPACE_RGB: + return "RGB"; + case HDMI_COLORSPACE_YUV422: + return "YCbCr 4:2:2"; + case HDMI_COLORSPACE_YUV444: + return "YCbCr 4:4:4"; + case HDMI_COLORSPACE_YUV420: + return "YCbCr 4:2:0"; + case HDMI_COLORSPACE_RESERVED4: + return "Reserved (4)"; + case HDMI_COLORSPACE_RESERVED5: + return "Reserved (5)"; + case HDMI_COLORSPACE_RESERVED6: + return "Reserved (6)"; + case HDMI_COLORSPACE_IDO_DEFINED: + return "IDO Defined"; + } + return "Invalid"; +} + +static const char *hdmi_scan_mode_get_name(enum hdmi_scan_mode scan_mode) +{ + switch (scan_mode) { + case HDMI_SCAN_MODE_NONE: + return "No Data"; + case HDMI_SCAN_MODE_OVERSCAN: + return "Overscan"; + case HDMI_SCAN_MODE_UNDERSCAN: + return "Underscan"; + case HDMI_SCAN_MODE_RESERVED: + return "Reserved"; + } + return "Invalid"; +} + +static const char *hdmi_colorimetry_get_name(enum hdmi_colorimetry colorimetry) +{ + switch (colorimetry) { + case HDMI_COLORIMETRY_NONE: + return "No Data"; + case HDMI_COLORIMETRY_ITU_601: + return "ITU601"; + case HDMI_COLORIMETRY_ITU_709: + return "ITU709"; + case HDMI_COLORIMETRY_EXTENDED: + return "Extended"; + } + return "Invalid"; +} + +static const char * +hdmi_picture_aspect_get_name(enum hdmi_picture_aspect picture_aspect) +{ + switch (picture_aspect) { + case HDMI_PICTURE_ASPECT_NONE: + return "No Data"; + case HDMI_PICTURE_ASPECT_4_3: + return "4:3"; + case HDMI_PICTURE_ASPECT_16_9: + return "16:9"; + case HDMI_PICTURE_ASPECT_RESERVED: + return "Reserved"; + } + return "Invalid"; +} + +static const char * +hdmi_active_aspect_get_name(enum hdmi_active_aspect active_aspect) +{ + if (active_aspect > 0xf) + return "Invalid"; + + switch (active_aspect) { + case HDMI_ACTIVE_ASPECT_16_9_TOP: + return "16:9 Top"; + case HDMI_ACTIVE_ASPECT_14_9_TOP: + return "14:9 Top"; + case HDMI_ACTIVE_ASPECT_16_9_CENTER: + return "16:9 Center"; + case HDMI_ACTIVE_ASPECT_PICTURE: + return "Same as Picture"; + case HDMI_ACTIVE_ASPECT_4_3: + return "4:3"; + case HDMI_ACTIVE_ASPECT_16_9: + return "16:9"; + case HDMI_ACTIVE_ASPECT_14_9: + return "14:9"; + case HDMI_ACTIVE_ASPECT_4_3_SP_14_9: + return "4:3 SP 14:9"; + case HDMI_ACTIVE_ASPECT_16_9_SP_14_9: + return "16:9 SP 14:9"; + case HDMI_ACTIVE_ASPECT_16_9_SP_4_3: + return "16:9 SP 4:3"; + } + return "Reserved"; +} + +static const char * +hdmi_extended_colorimetry_get_name(enum hdmi_extended_colorimetry ext_col) +{ + switch (ext_col) { + case HDMI_EXTENDED_COLORIMETRY_XV_YCC_601: + return "xvYCC 601"; + case HDMI_EXTENDED_COLORIMETRY_XV_YCC_709: + return "xvYCC 709"; + case HDMI_EXTENDED_COLORIMETRY_S_YCC_601: + return "sYCC 601"; + case HDMI_EXTENDED_COLORIMETRY_ADOBE_YCC_601: + return "Adobe YCC 601"; + case HDMI_EXTENDED_COLORIMETRY_ADOBE_RGB: + return "Adobe RGB"; + case HDMI_EXTENDED_COLORIMETRY_BT2020_CONST_LUM: + return "BT.2020 Constant Luminance"; + case HDMI_EXTENDED_COLORIMETRY_BT2020: + return "BT.2020"; + case HDMI_EXTENDED_COLORIMETRY_RESERVED: + return "Reserved"; + } + return "Invalid"; +} + +static const char * +hdmi_quantization_range_get_name(enum hdmi_quantization_range qrange) +{ + switch (qrange) { + case HDMI_QUANTIZATION_RANGE_DEFAULT: + return "Default"; + case HDMI_QUANTIZATION_RANGE_LIMITED: + return "Limited"; + case HDMI_QUANTIZATION_RANGE_FULL: + return "Full"; + case HDMI_QUANTIZATION_RANGE_RESERVED: + return "Reserved"; + } + return "Invalid"; +} + +static const char *hdmi_nups_get_name(enum hdmi_nups nups) +{ + switch (nups) { + case HDMI_NUPS_UNKNOWN: + return "Unknown Non-uniform Scaling"; + case HDMI_NUPS_HORIZONTAL: + return "Horizontally Scaled"; + case HDMI_NUPS_VERTICAL: + return "Vertically Scaled"; + case HDMI_NUPS_BOTH: + return "Horizontally and Vertically Scaled"; + } + return "Invalid"; +} + +static const char * +hdmi_ycc_quantization_range_get_name(enum hdmi_ycc_quantization_range qrange) +{ + switch (qrange) { + case HDMI_YCC_QUANTIZATION_RANGE_LIMITED: + return "Limited"; + case HDMI_YCC_QUANTIZATION_RANGE_FULL: + return "Full"; + } + return "Invalid"; +} + +static const char * +hdmi_content_type_get_name(enum hdmi_content_type content_type) +{ + switch (content_type) { + case HDMI_CONTENT_TYPE_GRAPHICS: + return "Graphics"; + case HDMI_CONTENT_TYPE_PHOTO: + return "Photo"; + case HDMI_CONTENT_TYPE_CINEMA: + return "Cinema"; + case HDMI_CONTENT_TYPE_GAME: + return "Game"; + } + return "Invalid"; +} + +/** + * hdmi_avi_infoframe_log() - log info of HDMI AVI infoframe + * @level: logging level + * @dev: device + * @frame: HDMI AVI infoframe + */ +static void hdmi_avi_infoframe_log(struct hdmi_avi_infoframe *frame) +{ + hdmi_infoframe_log_header((struct hdmi_any_infoframe *)frame); + + hdmi_log(" colorspace: %s\n", + hdmi_colorspace_get_name(frame->colorspace)); + hdmi_log(" scan mode: %s\n", + hdmi_scan_mode_get_name(frame->scan_mode)); + hdmi_log(" colorimetry: %s\n", + hdmi_colorimetry_get_name(frame->colorimetry)); + hdmi_log(" picture aspect: %s\n", + hdmi_picture_aspect_get_name(frame->picture_aspect)); + hdmi_log(" active aspect: %s\n", + hdmi_active_aspect_get_name(frame->active_aspect)); + hdmi_log(" itc: %s\n", frame->itc ? "IT Content" : "No Data"); + hdmi_log(" extended colorimetry: %s\n", + hdmi_extended_colorimetry_get_name(frame->extended_colorimetry)); + hdmi_log(" quantization range: %s\n", + hdmi_quantization_range_get_name(frame->quantization_range)); + hdmi_log(" nups: %s\n", hdmi_nups_get_name(frame->nups)); + hdmi_log(" video code: %u\n", frame->video_code); + hdmi_log(" ycc quantization range: %s\n", + hdmi_ycc_quantization_range_get_name(frame->ycc_quantization_range)); + hdmi_log(" hdmi content type: %s\n", + hdmi_content_type_get_name(frame->content_type)); + hdmi_log(" pixel repeat: %u\n", frame->pixel_repeat); + hdmi_log(" bar top %u, bottom %u, left %u, right %u\n", + frame->top_bar, frame->bottom_bar, + frame->left_bar, frame->right_bar); +} + +static const char *hdmi_spd_sdi_get_name(enum hdmi_spd_sdi sdi) +{ +; + switch (sdi) { + case HDMI_SPD_SDI_UNKNOWN: + return "Unknown"; + case HDMI_SPD_SDI_DSTB: + return "Digital STB"; + case HDMI_SPD_SDI_DVDP: + return "DVD Player"; + case HDMI_SPD_SDI_DVHS: + return "D-VHS"; + case HDMI_SPD_SDI_HDDVR: + return "HDD Videorecorder"; + case HDMI_SPD_SDI_DVC: + return "DVC"; + case HDMI_SPD_SDI_DSC: + return "DSC"; + case HDMI_SPD_SDI_VCD: + return "Video CD"; + case HDMI_SPD_SDI_GAME: + return "Game"; + case HDMI_SPD_SDI_PC: + return "PC General"; + case HDMI_SPD_SDI_BD: + return "Blu-Ray Disc (BD)"; + case HDMI_SPD_SDI_SACD: + return "Super Audio CD"; + case HDMI_SPD_SDI_HDDVD: + return "HD DVD"; + case HDMI_SPD_SDI_PMP: + return "PMP"; + } + return "Reserved"; +} + +/** + * hdmi_spd_infoframe_log() - log info of HDMI SPD infoframe + * @level: logging level + * @dev: device + * @frame: HDMI SPD infoframe + */ +static void hdmi_spd_infoframe_log(struct hdmi_spd_infoframe *frame) +{ + uint8_t buf[17]; + + hdmi_infoframe_log_header((struct hdmi_any_infoframe *)frame); + + memset(buf, 0, sizeof(buf)); + + strncpy(buf, frame->vendor, 8); + hdmi_log(" vendor: %s\n", buf); + strncpy(buf, frame->product, 16); + hdmi_log(" product: %s\n", buf); + hdmi_log(" source device information: %s (0x%x)\n", + hdmi_spd_sdi_get_name(frame->sdi), frame->sdi); +} + +static const char * +hdmi_audio_coding_type_get_name(enum hdmi_audio_coding_type coding_type) +{ + switch (coding_type) { + case HDMI_AUDIO_CODING_TYPE_STREAM: + return "Refer to Stream Header"; + case HDMI_AUDIO_CODING_TYPE_PCM: + return "PCM"; + case HDMI_AUDIO_CODING_TYPE_AC3: + return "AC-3"; + case HDMI_AUDIO_CODING_TYPE_MPEG1: + return "MPEG1"; + case HDMI_AUDIO_CODING_TYPE_MP3: + return "MP3"; + case HDMI_AUDIO_CODING_TYPE_MPEG2: + return "MPEG2"; + case HDMI_AUDIO_CODING_TYPE_AAC_LC: + return "AAC"; + case HDMI_AUDIO_CODING_TYPE_DTS: + return "DTS"; + case HDMI_AUDIO_CODING_TYPE_ATRAC: + return "ATRAC"; + case HDMI_AUDIO_CODING_TYPE_DSD: + return "One Bit Audio"; + case HDMI_AUDIO_CODING_TYPE_EAC3: + return "Dolby Digital +"; + case HDMI_AUDIO_CODING_TYPE_DTS_HD: + return "DTS-HD"; + case HDMI_AUDIO_CODING_TYPE_MLP: + return "MAT (MLP)"; + case HDMI_AUDIO_CODING_TYPE_DST: + return "DST"; + case HDMI_AUDIO_CODING_TYPE_WMA_PRO: + return "WMA PRO"; + case HDMI_AUDIO_CODING_TYPE_CXT: + return "Refer to CXT"; + } + return "Invalid"; +} + +static const char * +hdmi_audio_sample_size_get_name(enum hdmi_audio_sample_size sample_size) +{ + switch (sample_size) { + case HDMI_AUDIO_SAMPLE_SIZE_STREAM: + return "Refer to Stream Header"; + case HDMI_AUDIO_SAMPLE_SIZE_16: + return "16 bit"; + case HDMI_AUDIO_SAMPLE_SIZE_20: + return "20 bit"; + case HDMI_AUDIO_SAMPLE_SIZE_24: + return "24 bit"; + } + return "Invalid"; +} + +static const char * +hdmi_audio_sample_frequency_get_name(enum hdmi_audio_sample_frequency freq) +{ + switch (freq) { + case HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM: + return "Refer to Stream Header"; + case HDMI_AUDIO_SAMPLE_FREQUENCY_32000: + return "32 kHz"; + case HDMI_AUDIO_SAMPLE_FREQUENCY_44100: + return "44.1 kHz (CD)"; + case HDMI_AUDIO_SAMPLE_FREQUENCY_48000: + return "48 kHz"; + case HDMI_AUDIO_SAMPLE_FREQUENCY_88200: + return "88.2 kHz"; + case HDMI_AUDIO_SAMPLE_FREQUENCY_96000: + return "96 kHz"; + case HDMI_AUDIO_SAMPLE_FREQUENCY_176400: + return "176.4 kHz"; + case HDMI_AUDIO_SAMPLE_FREQUENCY_192000: + return "192 kHz"; + } + return "Invalid"; +} + +static const char * +hdmi_audio_coding_type_ext_get_name(enum hdmi_audio_coding_type_ext ctx) +{ + + switch (ctx) { + case HDMI_AUDIO_CODING_TYPE_EXT_CT: + return "Refer to CT"; + case HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC: + return "HE AAC"; + case HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC_V2: + return "HE AAC v2"; + case HDMI_AUDIO_CODING_TYPE_EXT_MPEG_SURROUND: + return "MPEG SURROUND"; + case HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_HE_AAC: + return "MPEG-4 HE AAC"; + case HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_HE_AAC_V2: + return "MPEG-4 HE AAC v2"; + case HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_AAC_LC: + return "MPEG-4 AAC LC"; + case HDMI_AUDIO_CODING_TYPE_EXT_DRA: + return "DRA"; + case HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_HE_AAC_SURROUND: + return "MPEG-4 HE AAC + MPEG Surround"; + case HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_AAC_LC_SURROUND: + return "MPEG-4 AAC LC + MPEG Surround"; + } + return "Reserved"; +} + +/** + * hdmi_audio_infoframe_log() - log info of HDMI AUDIO infoframe + * @level: logging level + * @dev: device + * @frame: HDMI AUDIO infoframe + */ +static void hdmi_audio_infoframe_log(struct hdmi_audio_infoframe *frame) +{ + hdmi_infoframe_log_header((struct hdmi_any_infoframe *)frame); + + if (frame->channels) + hdmi_log(" channels: %u\n", frame->channels - 1); + else + hdmi_log(" channels: Refer to stream header\n"); + hdmi_log(" coding type: %s\n", + hdmi_audio_coding_type_get_name(frame->coding_type)); + hdmi_log(" sample size: %s\n", + hdmi_audio_sample_size_get_name(frame->sample_size)); + hdmi_log(" sample frequency: %s\n", + hdmi_audio_sample_frequency_get_name(frame->sample_frequency)); + hdmi_log(" coding type ext: %s\n", + hdmi_audio_coding_type_ext_get_name(frame->coding_type_ext)); + hdmi_log(" channel allocation: 0x%x\n", + frame->channel_allocation); + hdmi_log(" level shift value: %u dB\n", + frame->level_shift_value); + hdmi_log(" downmix inhibit: %s\n", + frame->downmix_inhibit ? "Yes" : "No"); +} + +static const char * +hdmi_3d_structure_get_name(enum hdmi_3d_structure s3d_struct) +{ + if (s3d_struct < 0 || s3d_struct > 0xf) + return "Invalid"; + + switch (s3d_struct) { + case HDMI_3D_STRUCTURE_FRAME_PACKING: + return "Frame Packing"; + case HDMI_3D_STRUCTURE_FIELD_ALTERNATIVE: + return "Field Alternative"; + case HDMI_3D_STRUCTURE_LINE_ALTERNATIVE: + return "Line Alternative"; + case HDMI_3D_STRUCTURE_SIDE_BY_SIDE_FULL: + return "Side-by-side (Full)"; + case HDMI_3D_STRUCTURE_L_DEPTH: + return "L + Depth"; + case HDMI_3D_STRUCTURE_L_DEPTH_GFX_GFX_DEPTH: + return "L + Depth + Graphics + Graphics-depth"; + case HDMI_3D_STRUCTURE_TOP_AND_BOTTOM: + return "Top-and-Bottom"; + case HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF: + return "Side-by-side (Half)"; + default: + break; + } + return "Reserved"; +} + +/** + * hdmi_vendor_infoframe_log() - log info of HDMI VENDOR infoframe + * @level: logging level + * @dev: device + * @frame: HDMI VENDOR infoframe + */ +static void +hdmi_vendor_any_infoframe_log(union hdmi_vendor_any_infoframe *frame) +{ + struct hdmi_vendor_infoframe *hvf = &frame->hdmi; + + hdmi_infoframe_log_header((struct hdmi_any_infoframe *)frame); + + if (frame->any.oui != HDMI_IEEE_OUI) { + hdmi_log(" not a HDMI vendor infoframe\n"); + return; + } + if (hvf->vic == 0 && hvf->s3d_struct == HDMI_3D_STRUCTURE_INVALID) { + hdmi_log(" empty frame\n"); + return; + } + + if (hvf->vic) + hdmi_log(" HDMI VIC: %u\n", hvf->vic); + if (hvf->s3d_struct != HDMI_3D_STRUCTURE_INVALID) { + hdmi_log(" 3D structure: %s\n", + hdmi_3d_structure_get_name(hvf->s3d_struct)); + if (hvf->s3d_struct >= HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF) + hdmi_log(" 3D extension data: %d\n", + hvf->s3d_ext_data); + } +} + +/** + * hdmi_infoframe_log() - log info of HDMI infoframe + * @level: logging level + * @dev: device + * @frame: HDMI infoframe + */ +void hdmi_infoframe_log(union hdmi_infoframe *frame) +{ + switch (frame->any.type) { + case HDMI_INFOFRAME_TYPE_AVI: + hdmi_avi_infoframe_log(&frame->avi); + break; + case HDMI_INFOFRAME_TYPE_SPD: + hdmi_spd_infoframe_log(&frame->spd); + break; + case HDMI_INFOFRAME_TYPE_AUDIO: + hdmi_audio_infoframe_log(&frame->audio); + break; + case HDMI_INFOFRAME_TYPE_VENDOR: + hdmi_vendor_any_infoframe_log(&frame->vendor); + break; + } +} +EXPORT_SYMBOL(hdmi_infoframe_log); + +/** *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Dec 26 17:10:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6073C92756; Mon, 26 Dec 2016 17:10:42 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95A6419DA; Mon, 26 Dec 2016 17:10:42 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQHAfm1009808; Mon, 26 Dec 2016 17:10:41 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQHAfse009807; Mon, 26 Dec 2016 17:10:41 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201612261710.uBQHAfse009807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 26 Dec 2016 17:10:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310608 - head/libexec/talkd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 17:10:42 -0000 Author: delphij Date: Mon Dec 26 17:10:41 2016 New Revision: 310608 URL: https://svnweb.freebsd.org/changeset/base/310608 Log: Avoid use after free. Reported by: Clang static code analyzer MFC after: 2 weeks Modified: head/libexec/talkd/table.c Modified: head/libexec/talkd/table.c ============================================================================== --- head/libexec/talkd/table.c Mon Dec 26 16:45:00 2016 (r310607) +++ head/libexec/talkd/table.c Mon Dec 26 17:10:41 2016 (r310608) @@ -82,14 +82,15 @@ static TABLE_ENTRY *table = NIL; CTL_MSG * find_match(CTL_MSG *request) { - TABLE_ENTRY *ptr; + TABLE_ENTRY *ptr, *next; time_t current_time; gettimeofday(&tp, NULL); current_time = tp.tv_sec; if (debug) print_request("find_match", request); - for (ptr = table; ptr != NIL; ptr = ptr->next) { + for (ptr = table; ptr != NIL; ptr = next) { + next = ptr->next; if ((ptr->time - current_time) > MAX_LIFE) { /* the entry is too old */ if (debug) @@ -115,7 +116,7 @@ find_match(CTL_MSG *request) CTL_MSG * find_request(CTL_MSG *request) { - TABLE_ENTRY *ptr; + TABLE_ENTRY *ptr, *next; time_t current_time; gettimeofday(&tp, NULL); @@ -126,7 +127,8 @@ find_request(CTL_MSG *request) */ if (debug) print_request("find_request", request); - for (ptr = table; ptr != NIL; ptr = ptr->next) { + for (ptr = table; ptr != NIL; ptr = next) { + next = ptr->next; if ((ptr->time - current_time) > MAX_LIFE) { /* the entry is too old */ if (debug) From owner-svn-src-head@freebsd.org Mon Dec 26 17:23:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3FD3C92BD6; Mon, 26 Dec 2016 17:23:10 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C387413F0; Mon, 26 Dec 2016 17:23:10 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQHN9Sa017441; Mon, 26 Dec 2016 17:23:09 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQHN9WI017440; Mon, 26 Dec 2016 17:23:09 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201612261723.uBQHN9WI017440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 26 Dec 2016 17:23:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310609 - head/libexec/talkd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 17:23:11 -0000 Author: delphij Date: Mon Dec 26 17:23:09 2016 New Revision: 310609 URL: https://svnweb.freebsd.org/changeset/base/310609 Log: Don't use high precision clock for expiration as only second portion is used. MFC after: 2 weeks Modified: head/libexec/talkd/table.c Modified: head/libexec/talkd/table.c ============================================================================== --- head/libexec/talkd/table.c Mon Dec 26 17:10:41 2016 (r310608) +++ head/libexec/talkd/table.c Mon Dec 26 17:23:09 2016 (r310609) @@ -60,7 +60,7 @@ static const char rcsid[] = #define NIL ((TABLE_ENTRY *)0) -static struct timeval tp; +static struct timespec ts; typedef struct table_entry TABLE_ENTRY; @@ -85,8 +85,8 @@ find_match(CTL_MSG *request) TABLE_ENTRY *ptr, *next; time_t current_time; - gettimeofday(&tp, NULL); - current_time = tp.tv_sec; + clock_gettime(CLOCK_MONOTONIC_FAST, &ts); + current_time = ts.tv_sec; if (debug) print_request("find_match", request); for (ptr = table; ptr != NIL; ptr = next) { @@ -119,8 +119,8 @@ find_request(CTL_MSG *request) TABLE_ENTRY *ptr, *next; time_t current_time; - gettimeofday(&tp, NULL); - current_time = tp.tv_sec; + clock_gettime(CLOCK_MONOTONIC_FAST, &ts); + current_time = ts.tv_sec; /* * See if this is a repeated message, and check for * out of date entries in the table while we are it. @@ -157,8 +157,8 @@ insert_table(CTL_MSG *request, CTL_RESPO TABLE_ENTRY *ptr; time_t current_time; - gettimeofday(&tp, NULL); - current_time = tp.tv_sec; + clock_gettime(CLOCK_MONOTONIC_FAST, &ts); + current_time = ts.tv_sec; request->id_num = new_id(); response->id_num = htonl(request->id_num); /* insert a new entry into the top of the list */ From owner-svn-src-head@freebsd.org Mon Dec 26 17:34:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 217B2C92F22; Mon, 26 Dec 2016 17:34:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D908F1E8A; Mon, 26 Dec 2016 17:34:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQHYSGA022121; Mon, 26 Dec 2016 17:34:28 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQHYS2x022120; Mon, 26 Dec 2016 17:34:28 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201612261734.uBQHYS2x022120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 26 Dec 2016 17:34:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310611 - head/usr.sbin/pstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 17:34:29 -0000 Author: delphij Date: Mon Dec 26 17:34:27 2016 New Revision: 310611 URL: https://svnweb.freebsd.org/changeset/base/310611 Log: - pstat(8) does not accept any arguments other than getopt() args, so don't bother to adjust argc/argv after getopt() loop. - Make a string pointer constant. MFC after: 2 weeks Modified: head/usr.sbin/pstat/pstat.c Modified: head/usr.sbin/pstat/pstat.c ============================================================================== --- head/usr.sbin/pstat/pstat.c Mon Dec 26 17:26:25 2016 (r310610) +++ head/usr.sbin/pstat/pstat.c Mon Dec 26 17:34:27 2016 (r310611) @@ -174,8 +174,6 @@ main(int argc, char *argv[]) default: usage(); } - argc -= optind; - argv += optind; /* * Initialize symbol names list. @@ -339,7 +337,7 @@ static void ttyprt(struct xtty *xt) { int i, j; - char *name; + const char *name; if (xt->xt_size != sizeof *xt) errx(1, "struct xtty size mismatch"); From owner-svn-src-head@freebsd.org Mon Dec 26 17:48:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E6FDC91218; Mon, 26 Dec 2016 17:48:15 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0CBA215BF; Mon, 26 Dec 2016 17:48:14 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQHmEWP026407; Mon, 26 Dec 2016 17:48:14 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQHmEAx026406; Mon, 26 Dec 2016 17:48:14 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201612261748.uBQHmEAx026406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 26 Dec 2016 17:48:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310612 - head/sys/dev/evdev X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 17:48:15 -0000 Author: gonzo Date: Mon Dec 26 17:48:13 2016 New Revision: 310612 URL: https://svnweb.freebsd.org/changeset/base/310612 Log: [evdev] Fix build for older versions of clang There was report of stable/11 build failure on older versions of FreeBSD. The problem was a reference to static variable in inline function. Although fairly recent versions of clang can cope with this situation just fine there is no strict requirement to make functions in question inline, they're not in any time-critical codepath. So to keep HEAD and 11-STABLE buildable on older FreeBSDs some of the util functions were converted from inline to normal. Reported by: hselasky MFC after: 3 days Modified: head/sys/dev/evdev/evdev_utils.c Modified: head/sys/dev/evdev/evdev_utils.c ============================================================================== --- head/sys/dev/evdev/evdev_utils.c Mon Dec 26 17:34:27 2016 (r310611) +++ head/sys/dev/evdev/evdev_utils.c Mon Dec 26 17:48:13 2016 (r310612) @@ -206,13 +206,13 @@ static uint16_t evdev_led_codes[] = { LED_SCROLLL, /* SLKED */ }; -inline uint16_t +uint16_t evdev_hid2key(int scancode) { return evdev_usb_scancodes[scancode]; } -inline void +void evdev_support_all_known_keys(struct evdev_dev *evdev) { size_t i; @@ -222,7 +222,7 @@ evdev_support_all_known_keys(struct evde evdev_support_key(evdev, evdev_at_set1_scancodes[i]); } -inline uint16_t +uint16_t evdev_scancode2key(int *state, int scancode) { uint16_t keycode; From owner-svn-src-head@freebsd.org Mon Dec 26 19:26:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6883C92C45; Mon, 26 Dec 2016 19:26:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A63FF1542; Mon, 26 Dec 2016 19:26:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQJQedH067288; Mon, 26 Dec 2016 19:26:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQJQeSG067287; Mon, 26 Dec 2016 19:26:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612261926.uBQJQeSG067287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 26 Dec 2016 19:26:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310613 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 19:26:41 -0000 Author: kib Date: Mon Dec 26 19:26:40 2016 New Revision: 310613 URL: https://svnweb.freebsd.org/changeset/base/310613 Log: Style. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week X-Differential revision: https://reviews.freebsd.org/D8898 Modified: head/sys/kern/kern_event.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Mon Dec 26 17:48:13 2016 (r310612) +++ head/sys/kern/kern_event.c Mon Dec 26 19:26:40 2016 (r310613) @@ -2123,12 +2123,12 @@ knlist_empty(struct knlist *knl) { KNL_ASSERT_LOCKED(knl); - return SLIST_EMPTY(&knl->kl_list); + return (SLIST_EMPTY(&knl->kl_list)); } -static struct mtx knlist_lock; +static struct mtx knlist_lock; MTX_SYSINIT(knlist_lock, &knlist_lock, "knlist lock for lockless objects", - MTX_DEF); + MTX_DEF); static void knlist_mtx_lock(void *arg); static void knlist_mtx_unlock(void *arg); @@ -2391,17 +2391,15 @@ knote_attach(struct knote *kn, struct kq if (kn->kn_fop->f_isfd) { if (kn->kn_id >= kq->kq_knlistsize) - return ENOMEM; + return (ENOMEM); list = &kq->kq_knlist[kn->kn_id]; } else { if (kq->kq_knhash == NULL) - return ENOMEM; + return (ENOMEM); list = &kq->kq_knhash[KN_HASH(kn->kn_id, kq->kq_knhashmask)]; } - SLIST_INSERT_HEAD(list, kn, kn_link); - - return 0; + return (0); } /* @@ -2511,11 +2509,9 @@ kqfd_register(int fd, struct kevent *kev goto noacquire; error = kqueue_register(kq, kev, td, waitok); - kqueue_release(kq, 0); noacquire: fdrop(fp, td); - - return error; + return (error); } From owner-svn-src-head@freebsd.org Mon Dec 26 19:27:13 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64F6EC92C97; Mon, 26 Dec 2016 19:27:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34AD116C7; Mon, 26 Dec 2016 19:27:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQJRCTw067361; Mon, 26 Dec 2016 19:27:12 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQJRCr6067360; Mon, 26 Dec 2016 19:27:12 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201612261927.uBQJRCr6067360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 26 Dec 2016 19:27:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310614 - head/usr.sbin/jail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 19:27:13 -0000 Author: delphij Date: Mon Dec 26 19:27:12 2016 New Revision: 310614 URL: https://svnweb.freebsd.org/changeset/base/310614 Log: Don't assign rtjp twice. Reported by: clang static analyzer MFC after: 2 weeks Modified: head/usr.sbin/jail/jail.c Modified: head/usr.sbin/jail/jail.c ============================================================================== --- head/usr.sbin/jail/jail.c Mon Dec 26 19:26:40 2016 (r310613) +++ head/usr.sbin/jail/jail.c Mon Dec 26 19:27:12 2016 (r310614) @@ -806,8 +806,7 @@ rdtun_params(struct cfjail *j, int dofai if (jailparam_get(rtparams, nrt, bool_param(j->intparams[IP_ALLOW_DYING]) ? JAIL_DYING : 0) > 0) { rtjp = rtparams + 1; - for (jp = j->jp, rtjp = rtparams + 1; rtjp < rtparams + nrt; - jp++) { + for (jp = j->jp; rtjp < rtparams + nrt; jp++) { if (JP_RDTUN(jp) && strcmp(jp->jp_name, "jid")) { if (!((jp->jp_flags & (JP_BOOL | JP_NOBOOL)) && jp->jp_valuelen == 0 && From owner-svn-src-head@freebsd.org Mon Dec 26 19:28:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B02BC92CF6; Mon, 26 Dec 2016 19:28:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF0861869; Mon, 26 Dec 2016 19:28:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQJSBhR067450; Mon, 26 Dec 2016 19:28:11 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQJSBos067449; Mon, 26 Dec 2016 19:28:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612261928.uBQJSBos067449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 26 Dec 2016 19:28:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310615 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 19:28:12 -0000 Author: kib Date: Mon Dec 26 19:28:10 2016 New Revision: 310615 URL: https://svnweb.freebsd.org/changeset/base/310615 Log: Change knlist_destroy() to assert that knlist is empty instead of accepting the wrong state and printing warning. Do not obliterate kl_lock and kl_unlock pointers, they are often useful for post-mortem analysis. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks X-Differential revision: https://reviews.freebsd.org/D8898 Modified: head/sys/kern/kern_event.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Mon Dec 26 19:27:12 2016 (r310614) +++ head/sys/kern/kern_event.c Mon Dec 26 19:28:10 2016 (r310615) @@ -2249,17 +2249,8 @@ void knlist_destroy(struct knlist *knl) { -#ifdef INVARIANTS - /* - * if we run across this error, we need to find the offending - * driver and have it call knlist_clear or knlist_delete. - */ - if (!SLIST_EMPTY(&knl->kl_list)) - printf("WARNING: destroying knlist w/ knotes on it!\n"); -#endif - - knl->kl_lockarg = knl->kl_lock = knl->kl_unlock = NULL; - SLIST_INIT(&knl->kl_list); + KASSERT(KNLIST_EMPTY(knl), + ("destroying knlist %p with knotes on it", knl)); } void From owner-svn-src-head@freebsd.org Mon Dec 26 19:29:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCC3BC92D56; Mon, 26 Dec 2016 19:29:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC7FE19EF; Mon, 26 Dec 2016 19:29:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQJT4s3067527; Mon, 26 Dec 2016 19:29:04 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQJT4Y8067526; Mon, 26 Dec 2016 19:29:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612261929.uBQJT4Y8067526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 26 Dec 2016 19:29:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310616 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 19:29:06 -0000 Author: kib Date: Mon Dec 26 19:29:04 2016 New Revision: 310616 URL: https://svnweb.freebsd.org/changeset/base/310616 Log: Remove redundancy in vmtotal(). There are two instances of inlined unlocks + continue in vmtotal() switch statements, which are ordinary expressed with break from the switch case and code after the switch. Also, the combination of continue and break statement is redundand. Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/vm_meter.c Modified: head/sys/vm/vm_meter.c ============================================================================== --- head/sys/vm/vm_meter.c Mon Dec 26 19:28:10 2016 (r310615) +++ head/sys/vm/vm_meter.c Mon Dec 26 19:29:04 2016 (r310616) @@ -121,15 +121,10 @@ vmtotal(SYSCTL_HANDLER_ARGS) */ sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { - if (p->p_flag & P_SYSTEM) + if ((p->p_flag & P_SYSTEM) != 0) continue; PROC_LOCK(p); - switch (p->p_state) { - case PRS_NEW: - PROC_UNLOCK(p); - continue; - break; - default: + if (p->p_state != PRS_NEW) { FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); switch (td->td_state) { @@ -146,15 +141,13 @@ vmtotal(SYSCTL_HANDLER_ARGS) total.t_pw++; } break; - case TDS_CAN_RUN: total.t_sw++; break; case TDS_RUNQ: case TDS_RUNNING: total.t_rq++; - thread_unlock(td); - continue; + break; default: break; } From owner-svn-src-head@freebsd.org Mon Dec 26 19:33:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9B86C92F8C; Mon, 26 Dec 2016 19:33:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 823AF1F44; Mon, 26 Dec 2016 19:33:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQJXeYo071335; Mon, 26 Dec 2016 19:33:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQJXe7T071333; Mon, 26 Dec 2016 19:33:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612261933.uBQJXe7T071333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 26 Dec 2016 19:33:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310617 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 19:33:41 -0000 Author: kib Date: Mon Dec 26 19:33:40 2016 New Revision: 310617 URL: https://svnweb.freebsd.org/changeset/base/310617 Log: Make knote KN_INFLUX state counted. This is final fix for the issue closed by r310302 for knote(). If KN_INFLUX | KN_SCAN flags are set for the note passed to knote() or knote_fork(), i.e. the knote is scanned, we might erronously clear INFLUX when finishing notification. For normal knote() it was fixed in r310302 simply by remembering the fact that we do not own KN_INFLUX, since there we own knlist lock and scan thread cannot clear KN_INFLUX until we drop the lock. For knote_fork(), the situation is more complicated, e must drop knlist lock AKA the process lock, since we need to register new knotes. Change KN_INFLUX into counter and allow shared ownership of the in-flux state between scan and knote_fork() or knote(). Both in-flux setters need to ensure that knote is not dropped in parallel. Added assert about kn_influx == 1 in knote_drop() verifies that in-flux state is not shared when knote is destroyed. Since KBI of the struct knote is changed by addition of the int kn_influx field, reorder kn_hook and kn_hookid to fill pad on LP64 arches [1]. This keeps sizeof(struct knote) to same 128 bytes as it was before addition of kn_influx, on amd64. Reviewed by: markj Suggested by: markj [1] Tested by: pho (previous version) Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D8898 Modified: head/sys/kern/kern_event.c head/sys/sys/event.h Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Mon Dec 26 19:29:04 2016 (r310616) +++ head/sys/kern/kern_event.c Mon Dec 26 19:33:40 2016 (r310617) @@ -193,7 +193,7 @@ static unsigned int kq_calloutmax = 4 * SYSCTL_UINT(_kern, OID_AUTO, kq_calloutmax, CTLFLAG_RW, &kq_calloutmax, 0, "Maximum number of callouts allocated for kqueue"); -/* XXX - ensure not KN_INFLUX?? */ +/* XXX - ensure not influx ? */ #define KNOTE_ACTIVATE(kn, islock) do { \ if ((islock)) \ mtx_assert(&(kn)->kn_kq->kq_lock, MA_OWNED); \ @@ -254,6 +254,32 @@ kn_list_unlock(struct knlist *knl) } } +static bool +kn_in_flux(struct knote *kn) +{ + + return (kn->kn_influx > 0); +} + +static void +kn_enter_flux(struct knote *kn) +{ + + KQ_OWNED(kn->kn_kq); + MPASS(kn->kn_influx < INT_MAX); + kn->kn_influx++; +} + +static bool +kn_leave_flux(struct knote *kn) +{ + + KQ_OWNED(kn->kn_kq); + MPASS(kn->kn_influx > 0); + kn->kn_influx--; + return (kn->kn_influx == 0); +} + #define KNL_ASSERT_LOCK(knl, islocked) do { \ if (islocked) \ KNL_ASSERT_LOCKED(knl); \ @@ -498,7 +524,7 @@ knote_fork(struct knlist *list, int pid) SLIST_FOREACH(kn, &list->kl_list, kn_selnext) { kq = kn->kn_kq; KQ_LOCK(kq); - if ((kn->kn_status & (KN_INFLUX | KN_SCAN)) == KN_INFLUX) { + if (kn_in_flux(kn) && (kn->kn_status & KN_SCAN) == 0) { KQ_UNLOCK(kq); continue; } @@ -521,7 +547,7 @@ knote_fork(struct knlist *list, int pid) * track the child. Drop the locks in preparation for * the call to kqueue_register(). */ - kn->kn_status |= KN_INFLUX; + kn_enter_flux(kn); KQ_UNLOCK(kq); list->kl_unlock(list->kl_lockarg); @@ -561,7 +587,7 @@ knote_fork(struct knlist *list, int pid) if (kn->kn_fop->f_event(kn, NOTE_FORK)) KNOTE_ACTIVATE(kn, 0); KQ_LOCK(kq); - kn->kn_status &= ~KN_INFLUX; + kn_leave_flux(kn); KQ_UNLOCK_FLUX(kq); list->kl_lock(list->kl_lockarg); } @@ -1262,7 +1288,7 @@ findkn: } /* knote is in the process of changing, wait for it to stabilize. */ - if (kn != NULL && (kn->kn_status & KN_INFLUX) == KN_INFLUX) { + if (kn != NULL && kn_in_flux(kn)) { KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal); if (filedesc_unlock) { FILEDESC_XUNLOCK(td->td_proc->p_fd); @@ -1306,7 +1332,8 @@ findkn: kn->kn_kevent = *kev; kn->kn_kevent.flags &= ~(EV_ADD | EV_DELETE | EV_ENABLE | EV_DISABLE | EV_FORCEONESHOT); - kn->kn_status = KN_INFLUX|KN_DETACHED; + kn->kn_status = KN_DETACHED; + kn_enter_flux(kn); error = knote_attach(kn, kq); KQ_UNLOCK(kq); @@ -1330,7 +1357,7 @@ findkn: } if (kev->flags & EV_DELETE) { - kn->kn_status |= KN_INFLUX; + kn_enter_flux(kn); KQ_UNLOCK(kq); if (!(kn->kn_status & KN_DETACHED)) kn->kn_fop->f_detach(kn); @@ -1348,7 +1375,8 @@ findkn: * but doing so will not reset any filter which has already been * triggered. */ - kn->kn_status |= KN_INFLUX | KN_SCAN; + kn->kn_status |= KN_SCAN; + kn_enter_flux(kn); KQ_UNLOCK(kq); knl = kn_list_lock(kn); kn->kn_kevent.udata = kev->udata; @@ -1383,7 +1411,8 @@ done_ev_add: if ((kn->kn_status & (KN_ACTIVE | KN_DISABLED | KN_QUEUED)) == KN_ACTIVE) knote_enqueue(kn); - kn->kn_status &= ~(KN_INFLUX | KN_SCAN); + kn->kn_status &= ~KN_SCAN; + kn_leave_flux(kn); kn_list_unlock(knl); KQ_UNLOCK_FLUX(kq); @@ -1546,7 +1575,7 @@ kqueue_task(void *arg, int pending) /* * Scan, update kn_data (if not ONESHOT), and copyout triggered events. - * We treat KN_MARKER knotes as if they are INFLUX. + * We treat KN_MARKER knotes as if they are in flux. */ static int kqueue_scan(struct kqueue *kq, int maxevents, struct kevent_copyops *k_ops, @@ -1620,7 +1649,7 @@ retry: kn = TAILQ_FIRST(&kq->kq_head); if ((kn->kn_status == KN_MARKER && kn != marker) || - (kn->kn_status & KN_INFLUX) == KN_INFLUX) { + kn_in_flux(kn)) { if (influx) { influx = 0; KQ_FLUX_WAKEUP(kq); @@ -1643,17 +1672,17 @@ retry: goto retry; goto done; } - KASSERT((kn->kn_status & KN_INFLUX) == 0, - ("KN_INFLUX set when not suppose to be")); + KASSERT(!kn_in_flux(kn), + ("knote %p is unexpectedly in flux", kn)); if ((kn->kn_flags & EV_DROP) == EV_DROP) { kn->kn_status &= ~KN_QUEUED; - kn->kn_status |= KN_INFLUX; + kn_enter_flux(kn); kq->kq_count--; KQ_UNLOCK(kq); /* - * We don't need to lock the list since we've marked - * it _INFLUX. + * We don't need to lock the list since we've + * marked it as in flux. */ if (!(kn->kn_status & KN_DETACHED)) kn->kn_fop->f_detach(kn); @@ -1662,12 +1691,12 @@ retry: continue; } else if ((kn->kn_flags & EV_ONESHOT) == EV_ONESHOT) { kn->kn_status &= ~KN_QUEUED; - kn->kn_status |= KN_INFLUX; + kn_enter_flux(kn); kq->kq_count--; KQ_UNLOCK(kq); /* - * We don't need to lock the list since we've marked - * it _INFLUX. + * We don't need to lock the list since we've + * marked the knote as being in flux. */ *kevp = kn->kn_kevent; if (!(kn->kn_status & KN_DETACHED)) @@ -1676,7 +1705,8 @@ retry: KQ_LOCK(kq); kn = NULL; } else { - kn->kn_status |= KN_INFLUX | KN_SCAN; + kn->kn_status |= KN_SCAN; + kn_enter_flux(kn); KQ_UNLOCK(kq); if ((kn->kn_status & KN_KQUEUE) == KN_KQUEUE) KQ_GLOBAL_LOCK(&kq_global, haskqglobal); @@ -1684,9 +1714,9 @@ retry: if (kn->kn_fop->f_event(kn, 0) == 0) { KQ_LOCK(kq); KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal); - kn->kn_status &= - ~(KN_QUEUED | KN_ACTIVE | KN_INFLUX | + kn->kn_status &= ~(KN_QUEUED | KN_ACTIVE | KN_SCAN); + kn_leave_flux(kn); kq->kq_count--; kn_list_unlock(knl); influx = 1; @@ -1716,7 +1746,8 @@ retry: } else TAILQ_INSERT_TAIL(&kq->kq_head, kn, kn_tqe); - kn->kn_status &= ~(KN_INFLUX | KN_SCAN); + kn->kn_status &= ~KN_SCAN; + kn_leave_flux(kn); kn_list_unlock(knl); influx = 1; } @@ -1864,12 +1895,12 @@ kqueue_drain(struct kqueue *kq, struct t for (i = 0; i < kq->kq_knlistsize; i++) { while ((kn = SLIST_FIRST(&kq->kq_knlist[i])) != NULL) { - if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) { + if (kn_in_flux(kn)) { kq->kq_state |= KQ_FLUXWAIT; msleep(kq, &kq->kq_lock, PSOCK, "kqclo1", 0); continue; } - kn->kn_status |= KN_INFLUX; + kn_enter_flux(kn); KQ_UNLOCK(kq); if (!(kn->kn_status & KN_DETACHED)) kn->kn_fop->f_detach(kn); @@ -1880,13 +1911,13 @@ kqueue_drain(struct kqueue *kq, struct t if (kq->kq_knhashmask != 0) { for (i = 0; i <= kq->kq_knhashmask; i++) { while ((kn = SLIST_FIRST(&kq->kq_knhash[i])) != NULL) { - if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) { + if (kn_in_flux(kn)) { kq->kq_state |= KQ_FLUXWAIT; msleep(kq, &kq->kq_lock, PSOCK, "kqclo2", 0); continue; } - kn->kn_status |= KN_INFLUX; + kn_enter_flux(kn); KQ_UNLOCK(kq); if (!(kn->kn_status & KN_DETACHED)) kn->kn_fop->f_detach(kn); @@ -2010,7 +2041,6 @@ knote(struct knlist *list, long hint, in struct kqueue *kq; struct knote *kn, *tkn; int error; - bool own_influx; if (list == NULL) return; @@ -2021,7 +2051,7 @@ knote(struct knlist *list, long hint, in list->kl_lock(list->kl_lockarg); /* - * If we unlock the list lock (and set KN_INFLUX), we can + * If we unlock the list lock (and enter influx), we can * eliminate the kqueue scheduling, but this will introduce * four lock/unlock's for each knote to test. Also, marker * would be needed to keep iteration position, since filters @@ -2030,7 +2060,7 @@ knote(struct knlist *list, long hint, in SLIST_FOREACH_SAFE(kn, &list->kl_list, kn_selnext, tkn) { kq = kn->kn_kq; KQ_LOCK(kq); - if ((kn->kn_status & (KN_INFLUX | KN_SCAN)) == KN_INFLUX) { + if (kn_in_flux(kn) && (kn->kn_status & KN_SCAN) == 0) { /* * Do not process the influx notes, except for * the influx coming from the kq unlock in the @@ -2041,14 +2071,11 @@ knote(struct knlist *list, long hint, in */ KQ_UNLOCK(kq); } else if ((lockflags & KNF_NOKQLOCK) != 0) { - own_influx = (kn->kn_status & KN_INFLUX) == 0; - if (own_influx) - kn->kn_status |= KN_INFLUX; + kn_enter_flux(kn); KQ_UNLOCK(kq); error = kn->kn_fop->f_event(kn, hint); KQ_LOCK(kq); - if (own_influx) - kn->kn_status &= ~KN_INFLUX; + kn_leave_flux(kn); if (error) KNOTE_ACTIVATE(kn, 1); KQ_UNLOCK_FLUX(kq); @@ -2070,10 +2097,12 @@ knote(struct knlist *list, long hint, in void knlist_add(struct knlist *knl, struct knote *kn, int islocked) { + KNL_ASSERT_LOCK(knl, islocked); KQ_NOTOWNED(kn->kn_kq); - KASSERT((kn->kn_status & (KN_INFLUX|KN_DETACHED)) == - (KN_INFLUX|KN_DETACHED), ("knote not KN_INFLUX and KN_DETACHED")); + KASSERT(kn_in_flux(kn), ("knote %p not in flux", kn)); + KASSERT((kn->kn_status & KN_DETACHED) != 0, + ("knote %p was not detached", kn)); if (!islocked) knl->kl_lock(knl->kl_lockarg); SLIST_INSERT_HEAD(&knl->kl_list, kn, kn_selnext); @@ -2089,12 +2118,13 @@ static void knlist_remove_kq(struct knlist *knl, struct knote *kn, int knlislocked, int kqislocked) { - KASSERT(!(!!kqislocked && !knlislocked), ("kq locked w/o knl locked")); + + KASSERT(!kqislocked || knlislocked, ("kq locked w/o knl locked")); KNL_ASSERT_LOCK(knl, knlislocked); mtx_assert(&kn->kn_kq->kq_lock, kqislocked ? MA_OWNED : MA_NOTOWNED); - if (!kqislocked) - KASSERT((kn->kn_status & (KN_INFLUX|KN_DETACHED)) == KN_INFLUX, - ("knlist_remove called w/o knote being KN_INFLUX or already removed")); + KASSERT(kqislocked || kn_in_flux(kn), ("knote %p not in flux", kn)); + KASSERT((kn->kn_status & KN_DETACHED) == 0, + ("knote %p was already detached", kn)); if (!knlislocked) knl->kl_lock(knl->kl_lockarg); SLIST_REMOVE(&knl->kl_list, kn, knote, kn_selnext); @@ -2287,30 +2317,30 @@ again: /* need to reacquire lock since SLIST_FOREACH_SAFE(kn, &knl->kl_list, kn_selnext, kn2) { kq = kn->kn_kq; KQ_LOCK(kq); - if ((kn->kn_status & KN_INFLUX)) { + if (kn_in_flux(kn)) { KQ_UNLOCK(kq); continue; } knlist_remove_kq(knl, kn, 1, 1); if (killkn) { - kn->kn_status |= KN_INFLUX | KN_DETACHED; + kn->kn_status |= KN_DETACHED; + kn_enter_flux(kn); KQ_UNLOCK(kq); knote_drop(kn, td); } else { /* Make sure cleared knotes disappear soon */ - kn->kn_flags |= (EV_EOF | EV_ONESHOT); + kn->kn_flags |= EV_EOF | EV_ONESHOT; KQ_UNLOCK(kq); } kq = NULL; } if (!SLIST_EMPTY(&knl->kl_list)) { - /* there are still KN_INFLUX remaining */ + /* there are still in flux knotes remaining */ kn = SLIST_FIRST(&knl->kl_list); kq = kn->kn_kq; KQ_LOCK(kq); - KASSERT(kn->kn_status & KN_INFLUX, - ("knote removed w/o list lock")); + KASSERT(kn_in_flux(kn), ("knote removed w/o list lock")); knl->kl_unlock(knl->kl_lockarg); kq->kq_state |= KQ_FLUXWAIT; msleep(kq, &kq->kq_lock, PSOCK | PDROP, "kqkclr", 0); @@ -2352,7 +2382,7 @@ again: influx = 0; while (kq->kq_knlistsize > fd && (kn = SLIST_FIRST(&kq->kq_knlist[fd])) != NULL) { - if (kn->kn_status & KN_INFLUX) { + if (kn_in_flux(kn)) { /* someone else might be waiting on our knote */ if (influx) wakeup(kq); @@ -2360,7 +2390,7 @@ again: msleep(kq, &kq->kq_lock, PSOCK, "kqflxwt", 0); goto again; } - kn->kn_status |= KN_INFLUX; + kn_enter_flux(kn); KQ_UNLOCK(kq); if (!(kn->kn_status & KN_DETACHED)) kn->kn_fop->f_detach(kn); @@ -2377,7 +2407,7 @@ knote_attach(struct knote *kn, struct kq { struct klist *list; - KASSERT(kn->kn_status & KN_INFLUX, ("knote not marked INFLUX")); + KASSERT(kn_in_flux(kn), ("knote %p not marked influx", kn)); KQ_OWNED(kq); if (kn->kn_fop->f_isfd) { @@ -2395,7 +2425,7 @@ knote_attach(struct knote *kn, struct kq /* * knote must already have been detached using the f_detach method. - * no lock need to be held, it is assumed that the KN_INFLUX flag is set + * no lock need to be held, it is assumed that the influx state is set * to prevent other removal. */ static void @@ -2407,10 +2437,10 @@ knote_drop(struct knote *kn, struct thre kq = kn->kn_kq; KQ_NOTOWNED(kq); - KASSERT((kn->kn_status & KN_INFLUX) == KN_INFLUX, - ("knote_drop called without KN_INFLUX set in kn_status")); - KQ_LOCK(kq); + KASSERT(kn->kn_influx == 1, + ("knote_drop called on %p with influx %d", kn, kn->kn_influx)); + if (kn->kn_fop->f_isfd) list = &kq->kq_knlist[kn->kn_id]; else Modified: head/sys/sys/event.h ============================================================================== --- head/sys/sys/event.h Mon Dec 26 19:29:04 2016 (r310616) +++ head/sys/sys/event.h Mon Dec 26 19:33:40 2016 (r310617) @@ -202,8 +202,11 @@ struct filterops { }; /* - * Setting the KN_INFLUX flag enables you to unlock the kq that this knote - * is on, and modify kn_status as if you had the KQ lock. + * An in-flux knote cannot be dropped from its kq while the kq is + * unlocked. If the KN_SCAN flag is not set, a thread can only set + * kn_influx when it is exclusive owner of the knote state, and can + * modify kn_status as if it had the KQ lock. KN_SCAN must not be set + * on a knote which is already in flux. * * kn_sfflags, kn_sdata, and kn_kevent are protected by the knlist lock. */ @@ -214,16 +217,18 @@ struct knote { TAILQ_ENTRY(knote) kn_tqe; struct kqueue *kn_kq; /* which queue we are on */ struct kevent kn_kevent; + void *kn_hook; + int kn_hookid; int kn_status; /* protected by kq lock */ #define KN_ACTIVE 0x01 /* event has been triggered */ #define KN_QUEUED 0x02 /* event is on queue */ #define KN_DISABLED 0x04 /* event is disabled */ #define KN_DETACHED 0x08 /* knote is detached */ -#define KN_INFLUX 0x10 /* knote is in flux */ #define KN_MARKER 0x20 /* ignore this knote */ #define KN_KQUEUE 0x40 /* this knote belongs to a kq */ #define KN_HASKQLOCK 0x80 /* for _inevent */ #define KN_SCAN 0x100 /* flux set in kqueue_scan() */ + int kn_influx; int kn_sfflags; /* saved filter flags */ intptr_t kn_sdata; /* saved data field */ union { @@ -234,8 +239,6 @@ struct knote { void *p_v; /* generic other pointer */ } kn_ptr; struct filterops *kn_fop; - void *kn_hook; - int kn_hookid; #define kn_id kn_kevent.ident #define kn_filter kn_kevent.filter From owner-svn-src-head@freebsd.org Mon Dec 26 22:13:45 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3729FC9178F; Mon, 26 Dec 2016 22:13:45 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3F161A54; Mon, 26 Dec 2016 22:13:44 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBQMDiVE036337; Mon, 26 Dec 2016 22:13:44 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQMDh9c036331; Mon, 26 Dec 2016 22:13:43 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201612262213.uBQMDh9c036331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 26 Dec 2016 22:13:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310621 - in head/sys: conf dev/ichiic modules/i2c/controllers/ichiic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 22:13:45 -0000 Author: gonzo Date: Mon Dec 26 22:13:43 2016 New Revision: 310621 URL: https://svnweb.freebsd.org/changeset/base/310621 Log: [ig4] Add ACPI platform support for ig4 driver Add ACPI part for ig4 driver to make it work on Intel BayTrail SoC where ig4 device is available only through ACPI Reviewed by: avg MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8742 Added: head/sys/dev/ichiic/ig4_acpi.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_pci.c head/sys/dev/ichiic/ig4_var.h head/sys/modules/i2c/controllers/ichiic/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Dec 26 21:27:21 2016 (r310620) +++ head/sys/conf/files Mon Dec 26 22:13:43 2016 (r310621) @@ -1730,6 +1730,7 @@ dev/hptiop/hptiop.c optional hptiop scb dev/hwpmc/hwpmc_logging.c optional hwpmc dev/hwpmc/hwpmc_mod.c optional hwpmc dev/hwpmc/hwpmc_soft.c optional hwpmc +dev/ichiic/ig4_acpi.c optional ig4 acpi iicbus dev/ichiic/ig4_iic.c optional ig4 iicbus dev/ichiic/ig4_pci.c optional ig4 pci iicbus dev/ichsmb/ichsmb.c optional ichsmb Added: head/sys/dev/ichiic/ig4_acpi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/ichiic/ig4_acpi.c Mon Dec 26 22:13:43 2016 (r310621) @@ -0,0 +1,166 @@ +/*- + * Copyright (c) 2016 Oleksandr Tymoshenko + * All rights reserved. + * + * 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 AUTHOR 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 AUTHOR 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 +__FBSDID("$FreeBSD$"); + +#include "opt_acpi.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +static int ig4iic_acpi_probe(device_t dev); +static int ig4iic_acpi_attach(device_t dev); +static int ig4iic_acpi_detach(device_t dev); + +static char *ig4iic_ids[] = { + "INT33C2", + "INT33C3", + "INT3432", + "INT3433", + "80860F41", + "808622C1", + "AMDI0510", + "APMC0D0F", + NULL +}; + +static int +ig4iic_acpi_probe(device_t dev) +{ + + if (acpi_disabled("ig4iic") || + ACPI_ID_PROBE(device_get_parent(dev), dev, ig4iic_ids) == NULL) + return (ENXIO); + + device_set_desc(dev, "Designware I2C Controller"); + return (0); +} + +static int +ig4iic_acpi_attach(device_t dev) +{ + ig4iic_softc_t *sc; + int error; + + sc = device_get_softc(dev); + + sc->dev = dev; + sc->regs_rid = 0; + sc->regs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->regs_rid, RF_ACTIVE); + if (sc->regs_res == NULL) { + device_printf(dev, "unable to map registers\n"); + ig4iic_acpi_detach(dev); + return (ENXIO); + } + sc->intr_rid = 0; + sc->intr_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &sc->intr_rid, RF_SHAREABLE | RF_ACTIVE); + if (sc->intr_res == NULL) { + device_printf(dev, "unable to map interrupt\n"); + ig4iic_acpi_detach(dev); + return (ENXIO); + } + sc->platform_attached = 1; + + error = ig4iic_attach(sc); + if (error) + ig4iic_acpi_detach(dev); + + return (error); +} + +static int +ig4iic_acpi_detach(device_t dev) +{ + ig4iic_softc_t *sc = device_get_softc(dev); + int error; + + if (sc->platform_attached) { + error = ig4iic_detach(sc); + if (error) + return (error); + sc->platform_attached = 0; + } + + if (sc->intr_res) { + bus_release_resource(dev, SYS_RES_IRQ, + sc->intr_rid, sc->intr_res); + sc->intr_res = NULL; + } + if (sc->regs_res) { + bus_release_resource(dev, SYS_RES_MEMORY, + sc->regs_rid, sc->regs_res); + sc->regs_res = NULL; + } + + return (0); +} + +static device_method_t ig4iic_acpi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ig4iic_acpi_probe), + DEVMETHOD(device_attach, ig4iic_acpi_attach), + DEVMETHOD(device_detach, ig4iic_acpi_detach), + + /* iicbus interface */ + DEVMETHOD(iicbus_transfer, ig4iic_transfer), + DEVMETHOD(iicbus_reset, ig4iic_reset), + DEVMETHOD(iicbus_callback, iicbus_null_callback), + + DEVMETHOD_END +}; + +static driver_t ig4iic_acpi_driver = { + "ig4iic_acpi", + ig4iic_acpi_methods, + sizeof(struct ig4iic_softc), +}; + +static devclass_t ig4iic_acpi_devclass; +DRIVER_MODULE(ig4iic_acpi, acpi, ig4iic_acpi_driver, ig4iic_acpi_devclass, 0, 0); + +MODULE_DEPEND(ig4iic_acpi, acpi, 1, 1, 1); +MODULE_DEPEND(ig4iic_acpi, pci, 1, 1, 1); +MODULE_DEPEND(ig4iic_acpi, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); +MODULE_VERSION(ig4iic_acpi, 1); Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Mon Dec 26 21:27:21 2016 (r310620) +++ head/sys/dev/ichiic/ig4_iic.c Mon Dec 26 22:13:43 2016 (r310621) @@ -522,6 +522,9 @@ ig4iic_attach(ig4iic_softc_t *sc) int error; uint32_t v; + mtx_init(&sc->io_lock, "IG4 I/O lock", NULL, MTX_DEF); + sx_init(&sc->call_lock, "IG4 call lock"); + v = reg_read(sc, IG4_REG_COMP_TYPE); v = reg_read(sc, IG4_REG_COMP_PARAM1); v = reg_read(sc, IG4_REG_GENERAL); @@ -664,6 +667,10 @@ ig4iic_detach(ig4iic_softc_t *sc) mtx_unlock(&sc->io_lock); sx_xunlock(&sc->call_lock); + + mtx_destroy(&sc->io_lock); + sx_destroy(&sc->call_lock); + return (0); } @@ -731,4 +738,5 @@ ig4iic_dump(ig4iic_softc_t *sc) } #undef REGDUMP -DRIVER_MODULE(iicbus, ig4iic, iicbus_driver, iicbus_devclass, NULL, NULL); +DRIVER_MODULE(iicbus, ig4iic_acpi, iicbus_driver, iicbus_devclass, NULL, NULL); +DRIVER_MODULE(iicbus, ig4iic_pci, iicbus_driver, iicbus_devclass, NULL, NULL); Modified: head/sys/dev/ichiic/ig4_pci.c ============================================================================== --- head/sys/dev/ichiic/ig4_pci.c Mon Dec 26 21:27:21 2016 (r310620) +++ head/sys/dev/ichiic/ig4_pci.c Mon Dec 26 22:13:43 2016 (r310621) @@ -115,11 +115,6 @@ ig4iic_pci_attach(device_t dev) ig4iic_softc_t *sc = device_get_softc(dev); int error; - bzero(sc, sizeof(*sc)); - - mtx_init(&sc->io_lock, "IG4 I/O lock", NULL, MTX_DEF); - sx_init(&sc->call_lock, "IG4 call lock"); - sc->dev = dev; sc->regs_rid = PCIR_BAR(0); sc->regs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, @@ -140,7 +135,7 @@ ig4iic_pci_attach(device_t dev) ig4iic_pci_detach(dev); return (ENXIO); } - sc->pci_attached = 1; + sc->platform_attached = 1; error = ig4iic_attach(sc); if (error) @@ -155,11 +150,11 @@ ig4iic_pci_detach(device_t dev) ig4iic_softc_t *sc = device_get_softc(dev); int error; - if (sc->pci_attached) { + if (sc->platform_attached) { error = ig4iic_detach(sc); if (error) return (error); - sc->pci_attached = 0; + sc->platform_attached = 0; } if (sc->intr_res) { @@ -174,10 +169,6 @@ ig4iic_pci_detach(device_t dev) sc->regs_rid, sc->regs_res); sc->regs_res = NULL; } - if (mtx_initialized(&sc->io_lock)) { - mtx_destroy(&sc->io_lock); - sx_destroy(&sc->call_lock); - } return (0); } @@ -196,15 +187,15 @@ static device_method_t ig4iic_pci_method }; static driver_t ig4iic_pci_driver = { - "ig4iic", + "ig4iic_pci", ig4iic_pci_methods, sizeof(struct ig4iic_softc) }; static devclass_t ig4iic_pci_devclass; -DRIVER_MODULE_ORDERED(ig4iic, pci, ig4iic_pci_driver, ig4iic_pci_devclass, 0, 0, +DRIVER_MODULE_ORDERED(ig4iic_pci, pci, ig4iic_pci_driver, ig4iic_pci_devclass, 0, 0, SI_ORDER_ANY); -MODULE_DEPEND(ig4iic, pci, 1, 1, 1); -MODULE_DEPEND(ig4iic, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); -MODULE_VERSION(ig4iic, 1); +MODULE_DEPEND(ig4iic_pci, pci, 1, 1, 1); +MODULE_DEPEND(ig4iic_pci, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); +MODULE_VERSION(ig4iic_pci, 1); Modified: head/sys/dev/ichiic/ig4_var.h ============================================================================== --- head/sys/dev/ichiic/ig4_var.h Mon Dec 26 21:27:21 2016 (r310620) +++ head/sys/dev/ichiic/ig4_var.h Mon Dec 26 22:13:43 2016 (r310621) @@ -65,7 +65,7 @@ struct ig4iic_softc { char rbuf[IG4_RBUFSIZE]; int error; uint8_t last_slave; - int pci_attached : 1; + int platform_attached : 1; int use_10bit : 1; int slave_valid : 1; int read_started : 1; Modified: head/sys/modules/i2c/controllers/ichiic/Makefile ============================================================================== --- head/sys/modules/i2c/controllers/ichiic/Makefile Mon Dec 26 21:27:21 2016 (r310620) +++ head/sys/modules/i2c/controllers/ichiic/Makefile Mon Dec 26 22:13:43 2016 (r310621) @@ -2,7 +2,12 @@ .PATH: ${.CURDIR}/../../../../dev/ichiic KMOD = ig4 -SRCS = device_if.h bus_if.h iicbus_if.h pci_if.h smbus_if.h \ - ig4_iic.c ig4_pci.c ig4_reg.h ig4_var.h +SRCS = acpi_if.h device_if.h bus_if.h iicbus_if.h pci_if.h \ + smbus_if.h ${ig4_acpi} ig4_iic.c ig4_pci.c ig4_reg.h \ + ig4_var.h opt_acpi.h + +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" +ig4_acpi= ig4_acpi.c +.endif .include From owner-svn-src-head@freebsd.org Tue Dec 27 01:10:31 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3930C91267; Tue, 27 Dec 2016 01:10:31 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 921C31CC2; Tue, 27 Dec 2016 01:10:31 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBR1AUk9005241; Tue, 27 Dec 2016 01:10:30 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBR1AS3a005222; Tue, 27 Dec 2016 01:10:28 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201612270110.uBR1AS3a005222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Tue, 27 Dec 2016 01:10:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310623 - in head: contrib/libarchive/cpio/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar lib/libarchive/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 01:10:32 -0000 Author: mm Date: Tue Dec 27 01:10:28 2016 New Revision: 310623 URL: https://svnweb.freebsd.org/changeset/base/310623 Log: MFV r310622: Sync libarchive with vendor. Vendor bugfixes (relevant to FreeBSD): PR 846: Spelling fixes PR 850: Fix issues with reading certain jar files OSS-Fuzz 286: Bugfix in archive_strncat_l() Added: head/contrib/libarchive/libarchive/test/test_read_format_zip_jar.c - copied unchanged from r310622, vendor/libarchive/dist/libarchive/test/test_read_format_zip_jar.c head/contrib/libarchive/libarchive/test/test_read_format_zip_jar.jar.uu - copied unchanged from r310622, vendor/libarchive/dist/libarchive/test/test_read_format_zip_jar.jar.uu Modified: head/contrib/libarchive/cpio/test/test_owner_parse.c head/contrib/libarchive/libarchive/archive_read.c head/contrib/libarchive/libarchive/archive_read_disk_posix.c head/contrib/libarchive/libarchive/archive_read_support_filter_xz.c head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c head/contrib/libarchive/libarchive/archive_read_support_format_zip.c head/contrib/libarchive/libarchive/archive_string.c head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c head/contrib/libarchive/libarchive/test/test_read_disk_directory_traversals.c head/contrib/libarchive/libarchive/test/test_write_disk_appledouble.c head/contrib/libarchive/libarchive/test/test_write_format_xar_empty.c head/contrib/libarchive/libarchive/test/test_write_format_zip_empty.c head/contrib/libarchive/libarchive/test/test_write_format_zip_empty_zip64.c head/contrib/libarchive/tar/read.c head/contrib/libarchive/tar/write.c head/lib/libarchive/tests/Makefile Directory Properties: head/contrib/libarchive/ (props changed) Modified: head/contrib/libarchive/cpio/test/test_owner_parse.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_owner_parse.c Tue Dec 27 00:51:53 2016 (r310622) +++ head/contrib/libarchive/cpio/test/test_owner_parse.c Tue Dec 27 01:10:28 2016 (r310623) @@ -38,7 +38,7 @@ static const int root_gids[] = { 0, 1 }; * its primary group membership depends on how the user set up * their /etc/passwd. Likely values are 513 (None), 545 (Users), * or 544 (Administrators). Just check for one of those... - * TODO: Handle non-English localizations...e.g. French 'Administrateur' + * TODO: Handle non-English localizations... e.g. French 'Administrateur' * Use CreateWellKnownSID() and LookupAccountName()? */ #define ROOT "Administrator" Modified: head/contrib/libarchive/libarchive/archive_read.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read.c Tue Dec 27 00:51:53 2016 (r310622) +++ head/contrib/libarchive/libarchive/archive_read.c Tue Dec 27 01:10:28 2016 (r310623) @@ -764,7 +764,7 @@ archive_read_header_position(struct arch * we cannot say whether there are encrypted entries, then * ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW is returned. * In general, this function will return values below zero when the - * reader is uncertain or totally uncapable of encryption support. + * reader is uncertain or totally incapable of encryption support. * When this function returns 0 you can be sure that the reader * supports encryption detection but no encrypted entries have * been found yet. Modified: head/contrib/libarchive/libarchive/archive_read_disk_posix.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_posix.c Tue Dec 27 00:51:53 2016 (r310622) +++ head/contrib/libarchive/libarchive/archive_read_disk_posix.c Tue Dec 27 01:10:28 2016 (r310623) @@ -1026,7 +1026,7 @@ next_entry(struct archive_read_disk *a, /* Save the times to be restored. This must be in before * calling archive_read_disk_descend() or any chance of it, - * especially, invokng a callback. */ + * especially, invoking a callback. */ t->restore_time.mtime = archive_entry_mtime(entry); t->restore_time.mtime_nsec = archive_entry_mtime_nsec(entry); t->restore_time.atime = archive_entry_atime(entry); Modified: head/contrib/libarchive/libarchive/archive_read_support_filter_xz.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_filter_xz.c Tue Dec 27 00:51:53 2016 (r310622) +++ head/contrib/libarchive/libarchive/archive_read_support_filter_xz.c Tue Dec 27 01:10:28 2016 (r310623) @@ -293,7 +293,7 @@ lzma_bidder_bid(struct archive_read_filt /* Second through fifth bytes are dictionary size, stored in * little-endian order. The minimum dictionary size is * 1 << 12(4KiB) which the lzma of LZMA SDK uses with option - * -d12 and the maxinam dictionary size is 1 << 27(128MiB) + * -d12 and the maximum dictionary size is 1 << 27(128MiB) * which the one uses with option -d27. * NOTE: A comment of LZMA SDK source code says this dictionary * range is from 1 << 12 to 1 << 30. */ @@ -584,9 +584,7 @@ lzip_init(struct archive_read_filter *se return (ARCHIVE_FATAL); } ret = lzma_raw_decoder(&(state->stream), filters); -#if LZMA_VERSION < 50010000 free(filters[0].options); -#endif if (ret != LZMA_OK) { set_error(self, ret); return (ARCHIVE_FATAL); Modified: head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c Tue Dec 27 00:51:53 2016 (r310622) +++ head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c Tue Dec 27 01:10:28 2016 (r310623) @@ -263,22 +263,22 @@ struct _7zip { /* * Decompressor controllers. */ - /* Decording LZMA1 and LZMA2 data. */ + /* Decoding LZMA1 and LZMA2 data. */ #ifdef HAVE_LZMA_H lzma_stream lzstream; int lzstream_valid; #endif - /* Decording bzip2 data. */ + /* Decoding bzip2 data. */ #if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR) bz_stream bzstream; int bzstream_valid; #endif - /* Decording deflate data. */ + /* Decoding deflate data. */ #ifdef HAVE_ZLIB_H z_stream stream; int stream_valid; #endif - /* Decording PPMd data. */ + /* Decoding PPMd data. */ int ppmd7_stat; CPpmd7 ppmd7_context; CPpmd7z_RangeDec range_dec; @@ -1056,10 +1056,7 @@ init_decompression(struct archive_read * #endif { lzma_options_delta delta_opt; - lzma_filter filters[LZMA_FILTERS_MAX]; -#if LZMA_VERSION < 50010000 - lzma_filter *ff; -#endif + lzma_filter filters[LZMA_FILTERS_MAX], *ff; int fi = 0; if (zip->lzstream_valid) { @@ -1144,9 +1141,7 @@ init_decompression(struct archive_read * else filters[fi].id = LZMA_FILTER_LZMA1; filters[fi].options = NULL; -#if LZMA_VERSION < 50010000 ff = &filters[fi]; -#endif r = lzma_properties_decode(&filters[fi], NULL, coder1->properties, (size_t)coder1->propertiesSize); if (r != LZMA_OK) { @@ -1158,9 +1153,7 @@ init_decompression(struct archive_read * filters[fi].id = LZMA_VLI_UNKNOWN; filters[fi].options = NULL; r = lzma_raw_decoder(&(zip->lzstream), filters); -#if LZMA_VERSION < 50010000 free(ff->options); -#endif if (r != LZMA_OK) { set_error(a, r); return (ARCHIVE_FAILED); Modified: head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Tue Dec 27 00:51:53 2016 (r310622) +++ head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Tue Dec 27 01:10:28 2016 (r310623) @@ -326,7 +326,7 @@ archive_read_format_cpio_options(struct cpio = (struct cpio *)(a->format->data); if (strcmp(key, "compat-2x") == 0) { - /* Handle filnames as libarchive 2.x */ + /* Handle filenames as libarchive 2.x */ cpio->init_default_conversion = (val != NULL)?1:0; return (ARCHIVE_OK); } else if (strcmp(key, "hdrcharset") == 0) { Modified: head/contrib/libarchive/libarchive/archive_read_support_format_zip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_zip.c Tue Dec 27 00:51:53 2016 (r310622) +++ head/contrib/libarchive/libarchive/archive_read_support_format_zip.c Tue Dec 27 01:10:28 2016 (r310623) @@ -864,29 +864,33 @@ zip_read_local_file_header(struct archiv zip_entry->mode |= AE_IFREG; } - if ((zip_entry->mode & AE_IFMT) == 0) { - /* Especially in streaming mode, we can end up - here without having seen proper mode information. - Guess from the filename. */ + /* If the mode is totally empty, set some sane default. */ + if (zip_entry->mode == 0) { + zip_entry->mode |= 0664; + } + + /* Make sure that entries with a trailing '/' are marked as directories + * even if the External File Attributes contains bogus values. If this + * is not a directory and there is no type, assume regularfile. */ + if ((zip_entry->mode & AE_IFMT) != AE_IFDIR) { + int has_slash; + wp = archive_entry_pathname_w(entry); if (wp != NULL) { len = wcslen(wp); - if (len > 0 && wp[len - 1] == L'/') - zip_entry->mode |= AE_IFDIR; - else - zip_entry->mode |= AE_IFREG; + has_slash = len > 0 && wp[len - 1] == L'/'; } else { cp = archive_entry_pathname(entry); len = (cp != NULL)?strlen(cp):0; - if (len > 0 && cp[len - 1] == '/') - zip_entry->mode |= AE_IFDIR; - else - zip_entry->mode |= AE_IFREG; - } - if (zip_entry->mode == AE_IFDIR) { - zip_entry->mode |= 0775; - } else if (zip_entry->mode == AE_IFREG) { - zip_entry->mode |= 0664; + has_slash = len > 0 && cp[len - 1] == '/'; + } + /* Correct file type as needed. */ + if (has_slash) { + zip_entry->mode &= ~AE_IFMT; + zip_entry->mode |= AE_IFDIR; + zip_entry->mode |= 0111; + } else if ((zip_entry->mode & AE_IFMT) == 0) { + zip_entry->mode |= AE_IFREG; } } Modified: head/contrib/libarchive/libarchive/archive_string.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_string.c Tue Dec 27 00:51:53 2016 (r310622) +++ head/contrib/libarchive/libarchive/archive_string.c Tue Dec 27 01:10:28 2016 (r310623) @@ -1827,7 +1827,7 @@ archive_string_conversion_set_opt(struct * A filename in UTF-8 was made with libarchive 2.x in a wrong * assumption that wchar_t was Unicode. * This option enables simulating the assumption in order to read - * that filname correctly. + * that filename correctly. */ case SCONV_SET_OPT_UTF8_LIBARCHIVE2X: #if (defined(_WIN32) && !defined(__CYGWIN__)) \ @@ -1939,12 +1939,19 @@ archive_strncat_l(struct archive_string struct archive_string_conv *sc) { const void *s; - size_t length; + size_t length = 0; int i, r = 0, r2; + if (_p != NULL && n > 0) { + if (sc != NULL && (sc->flag & SCONV_FROM_UTF16)) + length = utf16nbytes(_p, n); + else + length = mbsnbytes(_p, n); + } + /* We must allocate memory even if there is no data for conversion * or copy. This simulates archive_string_append behavior. */ - if (_p == NULL || n == 0) { + if (length == 0) { int tn = 1; if (sc != NULL && (sc->flag & SCONV_TO_UTF16)) tn = 2; @@ -1960,16 +1967,11 @@ archive_strncat_l(struct archive_string * If sc is NULL, we just make a copy. */ if (sc == NULL) { - length = mbsnbytes(_p, n); if (archive_string_append(as, _p, length) == NULL) return (-1);/* No memory */ return (0); } - if (sc->flag & SCONV_FROM_UTF16) - length = utf16nbytes(_p, n); - else - length = mbsnbytes(_p, n); s = _p; i = 0; if (sc->nconverter > 1) { Modified: head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c Tue Dec 27 00:51:53 2016 (r310622) +++ head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c Tue Dec 27 01:10:28 2016 (r310623) @@ -680,7 +680,7 @@ struct iso9660 { /* The creation time of ISO image. */ time_t birth_time; /* A file stream of a temporary file, which file contents - * save to until ISO iamge can be created. */ + * save to until ISO image can be created. */ int temp_fd; struct isofile *cur_file; @@ -1995,7 +1995,7 @@ iso9660_close(struct archive_write *a) * Write an ISO 9660 image. */ - /* Switc to start using wbuff as file buffer. */ + /* Switch to start using wbuff as file buffer. */ iso9660->wbuff_remaining = wb_buffmax(); iso9660->wbuff_type = WB_TO_STREAM; iso9660->wbuff_offset = 0; @@ -4558,7 +4558,7 @@ write_file_descriptors(struct archive_wr file->cur_content = &(file->content); do { blocks += file->cur_content->blocks; - /* Next fragument */ + /* Next fragment */ file->cur_content = file->cur_content->next; } while (file->cur_content != NULL); } @@ -4748,7 +4748,7 @@ isofile_gen_utility_names(struct archive } /* - * Converte a filename to UTF-16BE. + * Convert a filename to UTF-16BE. */ if (0 > archive_entry_pathname_l(file->entry, &u16, &u16len, iso9660->sconv_to_utf16be)) { @@ -5512,7 +5512,7 @@ isoent_setup_file_location(struct iso966 file->cur_content->location = location; location += file->cur_content->blocks; total_block += file->cur_content->blocks; - /* Next fragument */ + /* Next fragment */ file->cur_content = file->cur_content->next; } while (file->cur_content != NULL); } @@ -6164,7 +6164,7 @@ isoent_gen_iso9660_identifier(struct arc np->id_len = l = ext_off + np->ext_len; /* Make an offset of the number which is used to be set - * hexadecimal number to avoid duplicate identififier. */ + * hexadecimal number to avoid duplicate identifier. */ if (iso9660->opt.iso_level == 1) { if (ext_off >= 5) noff = 5; @@ -6742,7 +6742,7 @@ isoent_rr_move(struct archive_write *a) int r; pt = &(iso9660->primary.pathtbl[MAX_DEPTH-1]); - /* Theare aren't level 8 directories reaching a deepr level. */ + /* There aren't level 8 directories reaching a deeper level. */ if (pt->cnt == 0) return (ARCHIVE_OK); @@ -6813,7 +6813,7 @@ _compare_path_table(const void *v1, cons if (cmp != 0) return (cmp); - /* Compare indetifier */ + /* Compare identifier */ s1 = p1->identifier; s2 = p2->identifier; l = p1->ext_off; @@ -6855,7 +6855,7 @@ _compare_path_table_joliet(const void *v if (cmp != 0) return (cmp); - /* Compare indetifier */ + /* Compare identifier */ s1 = (const unsigned char *)p1->identifier; s2 = (const unsigned char *)p2->identifier; l = p1->ext_off; Modified: head/contrib/libarchive/libarchive/test/test_read_disk_directory_traversals.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_read_disk_directory_traversals.c Tue Dec 27 00:51:53 2016 (r310622) +++ head/contrib/libarchive/libarchive/test/test_read_disk_directory_traversals.c Tue Dec 27 01:10:28 2016 (r310623) @@ -500,8 +500,8 @@ test_basic(void) /* * We should be on the initial directory where we performed - * archive_read_disk_new() after we perfome archive_read_free() - * even if we broke off the directory traversals. + * archive_read_disk_new() after we perform archive_read_free() + * even if we broke off the directory traversals. */ /* Save current working directory. */ @@ -1565,11 +1565,11 @@ DEFINE_TEST(test_read_disk_directory_tra { /* Basic test. */ test_basic(); - /* Test hybird mode; follow symlink initially, then not. */ + /* Test hybrid mode; follow symlink initially, then not. */ test_symlink_hybrid(); - /* Test logcal mode; follow all symlinks. */ + /* Test logical mode; follow all symlinks. */ test_symlink_logical(); - /* Test logcal mode; prevent loop in symlinks. */ + /* Test logical mode; prevent loop in symlinks. */ test_symlink_logical_loop(); /* Test to restore atime. */ test_restore_atime(); Copied: head/contrib/libarchive/libarchive/test/test_read_format_zip_jar.c (from r310622, vendor/libarchive/dist/libarchive/test/test_read_format_zip_jar.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/libarchive/test/test_read_format_zip_jar.c Tue Dec 27 01:10:28 2016 (r310623, copy of r310622, vendor/libarchive/dist/libarchive/test/test_read_format_zip_jar.c) @@ -0,0 +1,59 @@ +/*- + * Copyright (c) 2016 Peter Wu + * All rights reserved. + * + * 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 AUTHOR(S) ``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 AUTHOR(S) 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 "test.h" +__FBSDID("$FreeBSD$"); + +/* + * Issue 822: jar files have an empty External File Attributes field which + * is misinterpreted as regular file type due to OS MS-DOS. + */ + +DEFINE_TEST(test_read_format_zip_jar) +{ + const char *refname = "test_read_format_zip_jar.jar"; + char *p; + size_t s; + struct archive *a; + struct archive_entry *ae; + char data[16]; + + extract_reference_file(refname); + p = slurpfile(&s, refname); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip_seekable(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, p, s, 1)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("somedir/", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR | 0775, archive_entry_mode(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualIntA(a, 0, archive_read_data(a, data, 16)); + + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a)); + free(p); +} Copied: head/contrib/libarchive/libarchive/test/test_read_format_zip_jar.jar.uu (from r310622, vendor/libarchive/dist/libarchive/test/test_read_format_zip_jar.jar.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/libarchive/test/test_read_format_zip_jar.jar.uu Tue Dec 27 01:10:28 2016 (r310623, copy of r310622, vendor/libarchive/dist/libarchive/test/test_read_format_zip_jar.jar.uu) @@ -0,0 +1,6 @@ +begin 640 test_read_format_zip_jar.jar +M4$L#! H @ $AQETD ( 0 Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27D1CC92161; Tue, 27 Dec 2016 06:10:30 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC5871245; Tue, 27 Dec 2016 06:10:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBR6ATpI025715; Tue, 27 Dec 2016 06:10:29 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBR6ASrp025710; Tue, 27 Dec 2016 06:10:28 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201612270610.uBR6ASrp025710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 27 Dec 2016 06:10:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310624 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 06:10:30 -0000 Author: adrian Date: Tue Dec 27 06:10:28 2016 New Revision: 310624 URL: https://svnweb.freebsd.org/changeset/base/310624 Log: [net80211] turn the default TX key configuration (for WEP) into a vap callback. The ath10k firmware supports hardware WEP offload, and in native wifi mode (or 802.3 ethernet mode, for that matter) the WEP key isn't actually included in the TX payload from net80211. Instead, a separate firmware command is issued that sets the default TX key to be the specified key. However, net80211 doesn't at all inform the driver layer that this is occuring - it just "expects" to be inserting WEP header information when doing WEP TX, even with hardware encryption. So, to better support the newer world order, turn the default TX key assignment into a VAP method that can be overridden by the driver and ensure its wrapped in a crypto begin/end set. That way it should be correctly atomic from the point of view of keychanges (as long as the driver does the right thing.) It'd be nice if we passed through to the key_set call a flag that says "also make this the default key" - that's captured here by calling the deftxkey method after the key_set method. Maybe I can do that later. Note: this is a net80211 ABI change, and will require a kernel+modules recompile. Happy Holidays, etc. Tested: * ath10k driver port * rtwn_usb, WEP station Modified: head/sys/net80211/ieee80211.c head/sys/net80211/ieee80211_crypto.c head/sys/net80211/ieee80211_crypto.h head/sys/net80211/ieee80211_ioctl.c head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Tue Dec 27 01:10:28 2016 (r310623) +++ head/sys/net80211/ieee80211.c Tue Dec 27 06:10:28 2016 (r310624) @@ -433,6 +433,22 @@ default_reset(struct ieee80211vap *vap, } /* + * Default for updating the VAP default TX key index. + * + * Drivers that support TX offload as well as hardware encryption offload + * may need to be informed of key index changes separate from the key + * update. + */ +static void +default_update_deftxkey(struct ieee80211vap *vap, ieee80211_keyix kid) +{ + + /* XXX assert validity */ + /* XXX assert we're in a key update block */ + vap->iv_def_txkey = kid; +} + +/* * Add underlying device errors to vap errors. */ static uint64_t @@ -561,6 +577,12 @@ ieee80211_vap_setup(struct ieee80211com */ vap->iv_reset = default_reset; + /* + * Install a default crypto key update method, the driver + * can override this. + */ + vap->iv_update_deftxkey = default_update_deftxkey; + ieee80211_sysctl_vattach(vap); ieee80211_crypto_vattach(vap); ieee80211_node_vattach(vap); Modified: head/sys/net80211/ieee80211_crypto.c ============================================================================== --- head/sys/net80211/ieee80211_crypto.c Tue Dec 27 01:10:28 2016 (r310623) +++ head/sys/net80211/ieee80211_crypto.c Tue Dec 27 06:10:28 2016 (r310624) @@ -787,3 +787,18 @@ ieee80211_crypto_reload_keys(struct ieee */ ieee80211_iterate_nodes(&ic->ic_sta, load_ucastkey, NULL); } + +/* + * Set the default key index for WEP, or KEYIX_NONE for no default TX key. + * + * This should be done as part of a key update block (iv_key_update_begin / + * iv_key_update_end.) + */ +void +ieee80211_crypto_set_deftxkey(struct ieee80211vap *vap, ieee80211_keyix kid) +{ + + /* XXX TODO: assert we're in a key update block */ + + vap->iv_update_deftxkey(vap, kid); +} Modified: head/sys/net80211/ieee80211_crypto.h ============================================================================== --- head/sys/net80211/ieee80211_crypto.h Tue Dec 27 01:10:28 2016 (r310623) +++ head/sys/net80211/ieee80211_crypto.h Tue Dec 27 06:10:28 2016 (r310624) @@ -171,6 +171,8 @@ int ieee80211_crypto_delkey(struct ieee8 int ieee80211_crypto_setkey(struct ieee80211vap *, struct ieee80211_key *); void ieee80211_crypto_delglobalkeys(struct ieee80211vap *); void ieee80211_crypto_reload_keys(struct ieee80211com *); +void ieee80211_crypto_set_deftxkey(struct ieee80211vap *, + ieee80211_keyix kid); /* * Template for a supported cipher. Ciphers register with the Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Tue Dec 27 01:10:28 2016 (r310623) +++ head/sys/net80211/ieee80211_ioctl.c Tue Dec 27 06:10:28 2016 (r310624) @@ -855,6 +855,8 @@ ieee80211_ioctl_get80211(struct ieee8021 * Tx power limit is the min of max regulatory * power, any user-set limit, and the max the * radio can do. + * + * TODO: methodize this */ ireq->i_val = 2*ic->ic_curchan->ic_maxregpower; if (ireq->i_val > ic->ic_txpowlimit) @@ -1013,6 +1015,7 @@ ieee80211_ioctl_get80211(struct ieee8021 ireq->i_val |= 2; break; case IEEE80211_IOC_AMPDU_LIMIT: + /* XXX TODO: make this a per-node thing; and leave this as global */ if (vap->iv_opmode == IEEE80211_M_HOSTAP) ireq->i_val = vap->iv_ampdu_rxmax; else if (vap->iv_state == IEEE80211_S_RUN || vap->iv_state == IEEE80211_S_SLEEP) @@ -1026,6 +1029,7 @@ ieee80211_ioctl_get80211(struct ieee8021 ireq->i_val = vap->iv_ampdu_limit; break; case IEEE80211_IOC_AMPDU_DENSITY: + /* XXX TODO: make this a per-node thing; and leave this as global */ if (vap->iv_opmode == IEEE80211_M_STA && (vap->iv_state == IEEE80211_S_RUN || vap->iv_state == IEEE80211_S_SLEEP)) /* @@ -1204,7 +1208,15 @@ ieee80211_ioctl_setkey(struct ieee80211v if (!ieee80211_crypto_setkey(vap, wk)) error = EIO; else if ((ik.ik_flags & IEEE80211_KEY_DEFAULT)) - vap->iv_def_txkey = kid; + /* + * Inform the driver that this is the default + * transmit key. Now, ideally we'd just set + * a flag in the key update that would + * say "yes, we're the default key", but + * that currently isn't the way the ioctl -> + * key interface works. + */ + ieee80211_crypto_set_deftxkey(vap, kid); } else error = ENXIO; ieee80211_key_update_end(vap); @@ -2687,7 +2699,17 @@ ieee80211_ioctl_set80211(struct ieee8021 if (kid >= IEEE80211_WEP_NKID && (uint16_t) kid != IEEE80211_KEYIX_NONE) return EINVAL; - vap->iv_def_txkey = kid; + /* + * Firmware devices may need to be told about an explicit + * key index here, versus just inferring it from the + * key set / change. Since we may also need to pause + * things like transmit before the key is updated, + * give the driver a chance to flush things by tying + * into key update begin/end. + */ + ieee80211_key_update_begin(vap); + ieee80211_crypto_set_deftxkey(vap, kid); + ieee80211_key_update_end(vap); break; case IEEE80211_IOC_AUTHMODE: switch (ireq->i_val) { @@ -3094,6 +3116,7 @@ ieee80211_ioctl_set80211(struct ieee8021 error = ERESTART; break; case IEEE80211_IOC_AMPDU_LIMIT: + /* XXX TODO: figure out ampdu_limit versus ampdu_rxmax */ if (!(IEEE80211_HTCAP_MAXRXAMPDU_8K <= ireq->i_val && ireq->i_val <= IEEE80211_HTCAP_MAXRXAMPDU_64K)) return EINVAL; Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Tue Dec 27 01:10:28 2016 (r310623) +++ head/sys/net80211/ieee80211_var.h Tue Dec 27 06:10:28 2016 (r310624) @@ -470,6 +470,8 @@ struct ieee80211vap { struct ieee80211_appie *iv_appie_wpa; uint8_t *iv_wpa_ie; uint8_t *iv_rsn_ie; + + /* Key management */ uint16_t iv_max_keyix; /* max h/w key index */ ieee80211_keyix iv_def_txkey; /* default/group tx key index */ struct ieee80211_key iv_nw_keys[IEEE80211_WEP_NKID]; @@ -482,6 +484,8 @@ struct ieee80211vap { const struct ieee80211_key *); void (*iv_key_update_begin)(struct ieee80211vap *); void (*iv_key_update_end)(struct ieee80211vap *); + void (*iv_update_deftxkey)(struct ieee80211vap *, + ieee80211_keyix deftxkey); const struct ieee80211_authenticator *iv_auth; /* authenticator glue */ void *iv_ec; /* private auth state */ @@ -536,6 +540,7 @@ struct ieee80211vap { /* 802.3 output method for raw frame xmit */ int (*iv_output)(struct ifnet *, struct mbuf *, const struct sockaddr *, struct route *); + uint64_t iv_spare[6]; }; MALLOC_DECLARE(M_80211_VAP); From owner-svn-src-head@freebsd.org Tue Dec 27 08:19:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95E58C93A86; Tue, 27 Dec 2016 08:19:46 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from mail.strugglingcoder.info (strugglingcoder.info [104.236.146.68]) by mx1.freebsd.org (Postfix) with ESMTP id 880B91610; Tue, 27 Dec 2016 08:19:46 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from localhost (unknown [10.1.1.3]) (Authenticated sender: hiren@strugglingcoder.info) by mail.strugglingcoder.info (Postfix) with ESMTPA id 5DEAF17985; Tue, 27 Dec 2016 00:19:40 -0800 (PST) Date: Tue, 27 Dec 2016 00:19:40 -0800 From: hiren panchasara To: Michael Tuexen Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310547 - head/sys/netinet Message-ID: <20161227081940.GL82166@strugglingcoder.info> References: <201612251737.uBPHbIhd027939@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="DMotDPdpQlD4ewOK" Content-Disposition: inline In-Reply-To: <201612251737.uBPHbIhd027939@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 08:19:46 -0000 --DMotDPdpQlD4ewOK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 12/25/16 at 05:37P, Michael Tuexen wrote: > Author: tuexen > Date: Sun Dec 25 17:37:18 2016 > New Revision: 310547 > URL: https://svnweb.freebsd.org/changeset/base/310547 >=20 > Log: > Remove a KASSERT which is not always true. > =20 > In case of the empty queue tp->snd_holes and tcp_sackhole_insert() > failing due to memory shortage, tp->snd_holes will be empty. > This problem was hit when stress tests where performed by pho. > =20 > PR: 215513 > Reported by: pho > Tested by: pho > Sponsored by: Netflix, Inc. >=20 > Modified: > head/sys/netinet/tcp_sack.c Thanks for the fix, Michael. Can you please MFC this? Cheers, Hiren --DMotDPdpQlD4ewOK Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAABCgBmBQJYYiQXXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4 QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/l23YH/0cjn7o0/yLDsEMdLKyN7MRr sxE4g74dafR9ZnfvQAKClJp145fjN0its4oQUEJGbnOvlV9BMTSy48d4M+gsF/zr pVa9//tQYBvpc+zkyt00wP+r+SXq2w9xd9sq/eTLagFAz8bW54XGacm6xCqkKIcs 0SuijW7eCeRiTSJ2HJxy6BeVQi+r/UgMaNe1onObSqgEn8aOB+1j1AaMisYDbAUP bVQX6ipUaInNgpoh0ktmnzehRdI8MPA6l7Kz8fk/PXl5mWeZxOunP4K0rEDPpNt/ jMMjf3EQx4TdNo29PEkKCXlEIfzpi/2j9k6zg3SzC3KtW7D/dy3mdwNGi5cIUm8= =twQt -----END PGP SIGNATURE----- --DMotDPdpQlD4ewOK-- From owner-svn-src-head@freebsd.org Tue Dec 27 08:51:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77997C9189C; Tue, 27 Dec 2016 08:51:28 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39F3219B0; Tue, 27 Dec 2016 08:51:28 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBR8pRer089577; Tue, 27 Dec 2016 08:51:27 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBR8pRIc089574; Tue, 27 Dec 2016 08:51:27 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612270851.uBR8pRIc089574@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Tue, 27 Dec 2016 08:51:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310627 - head/sys/dev/sfxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 08:51:28 -0000 Author: arybchik Date: Tue Dec 27 08:51:26 2016 New Revision: 310627 URL: https://svnweb.freebsd.org/changeset/base/310627 Log: sfxge(4): do not limit driver RSS table to RSS channels max Specification of entire RSS table in the driver allows to spread traffic more equally across CPUs/RSS channels if number of RSS channels is not power of 2. Reviewed by: philip Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8910 Modified: head/sys/dev/sfxge/sfxge.h head/sys/dev/sfxge/sfxge_rx.c head/sys/dev/sfxge/sfxge_tx.c Modified: head/sys/dev/sfxge/sfxge.h ============================================================================== --- head/sys/dev/sfxge/sfxge.h Tue Dec 27 08:32:54 2016 (r310626) +++ head/sys/dev/sfxge/sfxge.h Tue Dec 27 08:51:26 2016 (r310627) @@ -301,7 +301,7 @@ struct sfxge_softc { unsigned int max_rss_channels; uma_zone_t rxq_cache; struct sfxge_rxq *rxq[SFXGE_RX_SCALE_MAX]; - unsigned int rx_indir_table[SFXGE_RX_SCALE_MAX]; + unsigned int rx_indir_table[EFX_RSS_TBL_SIZE]; struct sfxge_txq *txq[SFXGE_TXQ_NTYPES + SFXGE_RX_SCALE_MAX]; Modified: head/sys/dev/sfxge/sfxge_rx.c ============================================================================== --- head/sys/dev/sfxge/sfxge_rx.c Tue Dec 27 08:32:54 2016 (r310626) +++ head/sys/dev/sfxge/sfxge_rx.c Tue Dec 27 08:51:26 2016 (r310627) @@ -1128,7 +1128,7 @@ sfxge_rx_start(struct sfxge_softc *sc) /* * Set up the scale table. Enable all hash types and hash insertion. */ - for (index = 0; index < SFXGE_RX_SCALE_MAX; index++) + for (index = 0; index < nitems(sc->rx_indir_table); index++) #ifdef RSS sc->rx_indir_table[index] = rss_get_indirection_to_bucket(index) % sc->rxq_count; @@ -1136,7 +1136,7 @@ sfxge_rx_start(struct sfxge_softc *sc) sc->rx_indir_table[index] = index % sc->rxq_count; #endif if ((rc = efx_rx_scale_tbl_set(sc->enp, sc->rx_indir_table, - SFXGE_RX_SCALE_MAX)) != 0) + nitems(sc->rx_indir_table))) != 0) goto fail; (void)efx_rx_scale_mode_set(sc->enp, EFX_RX_HASHALG_TOEPLITZ, (1 << EFX_RX_HASH_IPV4) | (1 << EFX_RX_HASH_TCPIPV4) | Modified: head/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- head/sys/dev/sfxge/sfxge_tx.c Tue Dec 27 08:32:54 2016 (r310626) +++ head/sys/dev/sfxge/sfxge_tx.c Tue Dec 27 08:51:26 2016 (r310627) @@ -838,8 +838,9 @@ sfxge_if_transmit(struct ifnet *ifp, str /* check if flowid is set */ if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) { uint32_t hash = m->m_pkthdr.flowid; + uint32_t idx = hash % nitems(sc->rx_indir_table); - index = sc->rx_indir_table[hash % SFXGE_RX_SCALE_MAX]; + index = sc->rx_indir_table[idx]; } #endif #if SFXGE_TX_PARSE_EARLY From owner-svn-src-head@freebsd.org Tue Dec 27 10:17:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A071C8FEBE; Tue, 27 Dec 2016 10:17:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34A8D1AC1; Tue, 27 Dec 2016 10:17:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBRAHvsv026774; Tue, 27 Dec 2016 10:17:57 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBRAHv1N026771; Tue, 27 Dec 2016 10:17:57 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612271017.uBRAHv1N026771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 27 Dec 2016 10:17:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310630 - in head: include lib/libkvm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 10:17:58 -0000 Author: avg Date: Tue Dec 27 10:17:56 2016 New Revision: 310630 URL: https://svnweb.freebsd.org/changeset/base/310630 Log: libkvm: support access to vmm guest memory, allow writes to fwmem and vmm This change consists of two parts: - allow libkvm to recognize /dev/vmm/* character devices as devices that provide access to the physical memory of a system (similarly to /dev/fwmem*) - allow libkvm to recognize that /dev/vmm/* and /dev/fwmem* devices provide access to the physical memory of live remote systems and, thus, the memory is writable As a result, it should be possible to run commands like $ kgdb -w /path/to/kernel /dev/fwmem0.0 $ kgdb /path/to/kernel /dev/vmm/guest Reviewed by: kib, jhb MFC after: 2 weeks Relnotes: yes Sponsored by: Panzura Differential Revision: https://reviews.freebsd.org/D8679 Modified: head/include/paths.h head/lib/libkvm/kvm.c head/lib/libkvm/kvm_private.h Modified: head/include/paths.h ============================================================================== --- head/include/paths.h Tue Dec 27 09:40:07 2016 (r310629) +++ head/include/paths.h Tue Dec 27 10:17:56 2016 (r310630) @@ -99,6 +99,7 @@ #define _PATH_VARDB "/var/db/" #define _PATH_VARRUN "/var/run/" #define _PATH_VARTMP "/var/tmp/" +#define _PATH_DEVVMM "/dev/vmm/" #define _PATH_YP "/var/yp/" #define _PATH_UUCPLOCK "/var/spool/lock/" Modified: head/lib/libkvm/kvm.c ============================================================================== --- head/lib/libkvm/kvm.c Tue Dec 27 09:40:07 2016 (r310629) +++ head/lib/libkvm/kvm.c Tue Dec 27 10:17:56 2016 (r310630) @@ -167,8 +167,10 @@ _kvm_open(kvm_t *kd, const char *uf, con return (kd); } } + /* - * This is a crash dump. + * This is either a crash dump or a remote live system with its physical + * memory fully accessible via a special device. * Open the namelist fd and determine the architecture. */ if ((kd->nlfd = open(uf, O_RDONLY | O_CLOEXEC, 0)) < 0) { @@ -177,8 +179,11 @@ _kvm_open(kvm_t *kd, const char *uf, con } if (_kvm_read_kernel_ehdr(kd) < 0) goto failed; - if (strncmp(mf, _PATH_FWMEM, strlen(_PATH_FWMEM)) == 0) + if (strncmp(mf, _PATH_FWMEM, strlen(_PATH_FWMEM)) == 0 || + strncmp(mf, _PATH_DEVVMM, strlen(_PATH_DEVVMM)) == 0) { kd->rawdump = 1; + kd->writable = 1; + } SET_FOREACH(parch, kvm_arch) { if ((*parch)->ka_probe(kd)) { kd->arch = *parch; @@ -405,6 +410,15 @@ ssize_t kvm_write(kvm_t *kd, u_long kva, const void *buf, size_t len) { int cc; + ssize_t cw; + off_t pa; + const char *cp; + + if (!ISALIVE(kd) && !kd->writable) { + _kvm_err(kd, kd->program, + "kvm_write not implemented for dead kernels"); + return (-1); + } if (ISALIVE(kd)) { /* @@ -422,12 +436,38 @@ kvm_write(kvm_t *kd, u_long kva, const v } else if ((size_t)cc < len) _kvm_err(kd, kd->program, "short write"); return (cc); - } else { - _kvm_err(kd, kd->program, - "kvm_write not implemented for dead kernels"); - return (-1); } - /* NOTREACHED */ + + cp = buf; + while (len > 0) { + cc = kd->arch->ka_kvatop(kd, kva, &pa); + if (cc == 0) + return (-1); + if (cc > (ssize_t)len) + cc = len; + errno = 0; + if (lseek(kd->pmfd, pa, 0) == -1 && errno != 0) { + _kvm_syserr(kd, 0, _PATH_MEM); + break; + } + cw = write(kd->pmfd, cp, cc); + if (cw < 0) { + _kvm_syserr(kd, kd->program, "kvm_write"); + break; + } + /* + * If ka_kvatop returns a bogus value or our core file is + * truncated, we might wind up seeking beyond the end of the + * core file in which case the read will return 0 (EOF). + */ + if (cw == 0) + break; + cp += cw; + kva += cw; + len -= cw; + } + + return (cp - (char *)buf); } int Modified: head/lib/libkvm/kvm_private.h ============================================================================== --- head/lib/libkvm/kvm_private.h Tue Dec 27 09:40:07 2016 (r310629) +++ head/lib/libkvm/kvm_private.h Tue Dec 27 10:17:56 2016 (r310630) @@ -78,6 +78,7 @@ struct __kvm { */ struct vmstate *vmst; int rawdump; /* raw dump format */ + int writable; /* physical memory is writable */ int vnet_initialized; /* vnet fields set up */ kvaddr_t vnet_start; /* start of kernel's vnet region */ From owner-svn-src-head@freebsd.org Tue Dec 27 10:56:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF4D4C93DD2; Tue, 27 Dec 2016 10:56:18 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (mail-n.franken.de [193.175.24.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 89501159F; Tue, 27 Dec 2016 10:56:17 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from [192.168.1.121] (p4FE316D7.dip0.t-ipconnect.de [79.227.22.215]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 82F9A721E282E; Tue, 27 Dec 2016 11:56:13 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Subject: Re: svn commit: r310547 - head/sys/netinet From: Michael Tuexen In-Reply-To: <20161227081940.GL82166@strugglingcoder.info> Date: Tue, 27 Dec 2016 11:56:13 +0100 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <693D4C85-526B-426C-9685-1D463E3C3903@freebsd.org> References: <201612251737.uBPHbIhd027939@repo.freebsd.org> <20161227081940.GL82166@strugglingcoder.info> To: hiren panchasara X-Mailer: Apple Mail (2.3259) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 10:56:18 -0000 > On 27 Dec 2016, at 09:19, hiren panchasara = wrote: >=20 > On 12/25/16 at 05:37P, Michael Tuexen wrote: >> Author: tuexen >> Date: Sun Dec 25 17:37:18 2016 >> New Revision: 310547 >> URL: https://svnweb.freebsd.org/changeset/base/310547 >>=20 >> Log: >> Remove a KASSERT which is not always true. >>=20 >> In case of the empty queue tp->snd_holes and tcp_sackhole_insert() >> failing due to memory shortage, tp->snd_holes will be empty. >> This problem was hit when stress tests where performed by pho. >>=20 >> PR: 215513 >> Reported by: pho >> Tested by: pho >> Sponsored by: Netflix, Inc. >>=20 >> Modified: >> head/sys/netinet/tcp_sack.c >=20 > Thanks for the fix, Michael. Can you please MFC this? Sure. Will do it after 3 days or so. Missed that. Best regards Michael >=20 > Cheers, > Hiren From owner-svn-src-head@freebsd.org Tue Dec 27 14:08:50 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FB5BC8A5DA for ; Tue, 27 Dec 2016 14:08:50 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk0-x233.google.com (mail-qk0-x233.google.com [IPv6:2607:f8b0:400d:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CED301A15 for ; Tue, 27 Dec 2016 14:08:49 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk0-x233.google.com with SMTP id h201so80621449qke.1 for ; Tue, 27 Dec 2016 06:08:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=R6UiMYzSMRT9KL6vQAeLB04Inq58HJ+E8cqoRKtE+hQ=; b=e4uHXHpqYLJdnmqGg2SY7WHOay1KzNsaZddYpBJYvBZ6m/lUDKV2p9eY38ZsJNwio+ GI4FoMbXIgYdCVZJNLqvJ1droLWjzkdd7Puyb1KuCUE36YrLWXpUVT2zv0QUnV2xHGs/ 3fSz+i7Ow+x5edcG9wM0WBi0HsWs0mnjt9p9Tso0zyaZ7/CbOPgfuu3Dk/4aXwPIOtGD qYZY/nTRdst1n+mR00+NOtmwEYVctezleTnNlPW60awToIl6JAYdPFbik/sL2lt41nfS m5JfdgDN7OR6wIgxVV46OZlYaeYxeuELmwx0oW1QC44ysn6zw4XlAj+VZ4gOcIJ/UJCw qFSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=R6UiMYzSMRT9KL6vQAeLB04Inq58HJ+E8cqoRKtE+hQ=; b=brGEx1WmITPoH2ZTDEleFpAmfZHj00U7+bOUmy4FWogIfFVYBSui2MBHrjaW2Tq9JW Sg9WdYa+NCU7+H14VKVwItDOEu2ERB+4wIEEOd+v6jrCkpvsz2WAnoPXzAsPbWQULRcv HR4FzgoPsg/06cCo2Y0b0EO8mvH2tG6mXrMg2q3gCTjQcIdPwCdgGXVwtjxC4uiLPXr3 BgWZoL5yCuPVVJtfmqpJBqivN18XnJ0cHoA688/LhOeJE9ApG4JunWY0bt08DiQdWPyk tv9PeZB3KZr+0a7qisrTfzMZ9r3m1xnRqTVlLvkE0hAnc/y7Kbb04wAMl25zp8TDjPy+ LU1Q== X-Gm-Message-State: AIkVDXKZYYTrjHA94im8e1vzKTXBTIdDesXYNN4TSQKdnHyJK4Iw4opgSdkmhOjWfdQx0dQL X-Received: by 10.55.198.129 with SMTP id s1mr33800972qkl.268.1482847729009; Tue, 27 Dec 2016 06:08:49 -0800 (PST) Received: from mutt-hardenedbsd ([63.88.83.66]) by smtp.gmail.com with ESMTPSA id s65sm28640599qtd.2.2016.12.27.06.08.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Dec 2016 06:08:47 -0800 (PST) Date: Tue, 27 Dec 2016 09:08:46 -0500 From: Shawn Webb To: Adrian Chadd Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310624 - head/sys/net80211 Message-ID: <20161227140846.xu4f6lmsgqytuhne@mutt-hardenedbsd> References: <201612270610.uBR6ASrp025710@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dxse5plh6235ywib" Content-Disposition: inline In-Reply-To: <201612270610.uBR6ASrp025710@repo.freebsd.org> X-Operating-System: FreeBSD mutt-hardenedbsd 12.0-CURRENT-HBSD FreeBSD 12.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: NeoMutt/20161126 (1.7.1) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 14:08:50 -0000 --dxse5plh6235ywib Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 27, 2016 at 06:10:28AM +0000, Adrian Chadd wrote: > Author: adrian > Date: Tue Dec 27 06:10:28 2016 > New Revision: 310624 > URL: https://svnweb.freebsd.org/changeset/base/310624 >=20 > Log: > [net80211] turn the default TX key configuration (for WEP) into a vap c= allback. > =20 > The ath10k firmware supports hardware WEP offload, and in native wifi m= ode > (or 802.3 ethernet mode, for that matter) the WEP key isn't actually in= cluded > in the TX payload from net80211. Instead, a separate firmware command = is issued > that sets the default TX key to be the specified key. > =20 > However, net80211 doesn't at all inform the driver layer that this is > occuring - it just "expects" to be inserting WEP header information > when doing WEP TX, even with hardware encryption. > =20 > So, to better support the newer world order, turn the default TX key as= signment > into a VAP method that can be overridden by the driver and ensure its w= rapped > in a crypto begin/end set. That way it should be correctly atomic from= the > point of view of keychanges (as long as the driver does the right thing= =2E) > =20 > It'd be nice if we passed through to the key_set call a flag that says > "also make this the default key" - that's captured here by calling the > deftxkey method after the key_set method. Maybe I can do that later. > =20 > Note: this is a net80211 ABI change, and will require a kernel+modules > recompile. Happy Holidays, etc. Hey Adrian, Thank you very much for your hard work on the wireless stack. Since this introduces an ABI change, should __FreeBSD_version be bumped? Thanks, --=20 Shawn Webb Cofounder and Security Engineer HardenedBSD GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --dxse5plh6235ywib Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEKrq2ve9q9Ia+iT2eaoRlj1JFbu4FAlhidewACgkQaoRlj1JF bu5t5g//cfiAvi9JeNZ37WoRx80fonwDtUHSN+vKLrzeQBFl1yBlpD5S0CWi0nAD RbFUIWmJ/Rn9aMt9BrPWAK/TTipZVed6XT+xCBodNf8kQatQTD45CdAy+5OAUK8L txpmE8Fyh2FkOvw4p5WtkHyuYzfocZVGqP4NnJXlhQg0N38EigZTVRZkRub5j3FU xRJvz49Qn1U7YUJqoWWFLf9CHFMI2jHi65CUMNAcNA05tTw0Rng6l/vkulWThOyw 7B2cMdixfrGH64EdShgjh0uvbYrr8hAh4mHt1rXpHNejQVctU/gJRdpOEDcD8olN jYae0H2SWWECuYPu2u7fGj/K6lUPfktuIG9okqJLBDjv+m4QgK8HVZjtie7Ehj9v E1gQ+eeHWNfLbV2d8x+ezATZWd2Wl9CmLqgP/4VsvnBfV0iuURlv1c1mE0YEJOhO LodNbRx39r4N5m0kbEBk12Yk2O0dvsHnduMssJYHbU4+0kndHcOPTVhVySwC6U8H p+/vDTaGRwhbgZ6VAfQoMOkvyk60ud5ciEt89JXKMGtZlPxh6xVrG8JgRKvvZwnR 050wAggl2zo9yYceYnvOaEl+94/IdXiMo1Do2ViLj8BtBViRnjZ5tBjrUp8BPtQ+ 2mUQkNAVu/3vljkf5aBzo8PkNJjnoRSgGg5bsiGtxO/O1WOSaMg= =gumU -----END PGP SIGNATURE----- --dxse5plh6235ywib-- From owner-svn-src-head@freebsd.org Tue Dec 27 17:13:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48686C926F9; Tue, 27 Dec 2016 17:13:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F37281DF8; Tue, 27 Dec 2016 17:13:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBRHDWPk098800; Tue, 27 Dec 2016 17:13:32 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBRHDWac098798; Tue, 27 Dec 2016 17:13:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612271713.uBRHDWac098798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Dec 2016 17:13:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310633 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 17:13:33 -0000 Author: mav Date: Tue Dec 27 17:13:31 2016 New Revision: 310633 URL: https://svnweb.freebsd.org/changeset/base/310633 Log: Add MAX_LUNS overflow safety checks. While this MAX_LUNS limitation is too synthetic and should be removed, it is better to enforce it while it is here. MFC after: 2 weeks Modified: head/usr.sbin/ctld/parse.y head/usr.sbin/ctld/uclparse.c Modified: head/usr.sbin/ctld/parse.y ============================================================================== --- head/usr.sbin/ctld/parse.y Tue Dec 27 11:31:17 2016 (r310632) +++ head/usr.sbin/ctld/parse.y Tue Dec 27 17:13:31 2016 (r310633) @@ -821,6 +821,11 @@ lun_number: STR free($1); return (1); } + if (tmp >= MAX_LUNS) { + yyerror("LU number is too big"); + free($1); + return (1); + } ret = asprintf(&name, "%s,lun,%ju", target->t_name, tmp); if (ret <= 0) @@ -845,6 +850,11 @@ target_lun_ref: LUN STR STR return (1); } free($2); + if (tmp >= MAX_LUNS) { + yyerror("LU number is too big"); + free($3); + return (1); + } lun = lun_find(conf, $3); free($3); Modified: head/usr.sbin/ctld/uclparse.c ============================================================================== --- head/usr.sbin/ctld/uclparse.c Tue Dec 27 11:31:17 2016 (r310632) +++ head/usr.sbin/ctld/uclparse.c Tue Dec 27 17:13:31 2016 (r310633) @@ -183,18 +183,25 @@ static int uclparse_target_lun(struct target *target, const ucl_object_t *obj) { struct lun *lun; + uint64_t tmp; if (obj->type == UCL_INT) { char *name; - asprintf(&name, "%s,lun,%ju", target->t_name, - ucl_object_toint(obj)); + tmp = ucl_object_toint(obj); + if (tmp >= MAX_LUNS) { + log_warnx("LU number %ju in target \"%s\" is too big", + tmp, target->t_name); + return (1); + } + + asprintf(&name, "%s,lun,%ju", target->t_name, tmp); lun = lun_new(conf, name); if (lun == NULL) return (1); lun_set_scsiname(lun, name); - target->t_luns[ucl_object_toint(obj)] = lun; + target->t_luns[tmp] = lun; return (0); } @@ -207,6 +214,12 @@ uclparse_target_lun(struct target *targe "\"number\" integer property", target->t_name); return (1); } + tmp = ucl_object_toint(num); + if (tmp >= MAX_LUNS) { + log_warnx("LU number %ju in target \"%s\" is too big", + tmp, target->t_name); + return (1); + } if (name == NULL || name->type != UCL_STRING) { log_warnx("lun section in target \"%s\" is missing " @@ -218,7 +231,7 @@ uclparse_target_lun(struct target *targe if (lun == NULL) return (1); - target->t_luns[ucl_object_toint(num)] = lun; + target->t_luns[tmp] = lun; } return (0); From owner-svn-src-head@freebsd.org Tue Dec 27 17:31:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0DB8C92B90; Tue, 27 Dec 2016 17:31:08 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 671C0179E; Tue, 27 Dec 2016 17:31:08 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBRHV7BO004205; Tue, 27 Dec 2016 17:31:07 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBRHV7Ul004204; Tue, 27 Dec 2016 17:31:07 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612271731.uBRHV7Ul004204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 27 Dec 2016 17:31:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310634 - head/contrib/elftoolchain/elfcopy X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 17:31:08 -0000 Author: emaste Date: Tue Dec 27 17:31:07 2016 New Revision: 310634 URL: https://svnweb.freebsd.org/changeset/base/310634 Log: elfcopy: fix PE object section name corruption and crash Fixed a bug that the PE object section names are generated incorrectly using the section name table found in the original input ELF object instead of the intermediate ELF object. Ticket: #541 Do not try to copy section content from a NULL d_buf when creating uninitialized data COFF section for PE object. Ticket: #540 Obtained from: ELF Tool Chain r3507, r3508 MFC after: 1 week Modified: head/contrib/elftoolchain/elfcopy/pe.c Modified: head/contrib/elftoolchain/elfcopy/pe.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/pe.c Tue Dec 27 17:13:31 2016 (r310633) +++ head/contrib/elftoolchain/elfcopy/pe.c Tue Dec 27 17:31:07 2016 (r310634) @@ -70,7 +70,7 @@ create_pe(struct elfcopy *ecp, int ifd, errx(EXIT_FAILURE, "gelf_getehdr() failed: %s", elf_errmsg(-1)); - if (elf_getshstrndx(ecp->ein, &indx) == 0) + if (elf_getshstrndx(e, &indx) == 0) errx(EXIT_FAILURE, "elf_getshstrndx() failed: %s", elf_errmsg(-1)); @@ -124,7 +124,7 @@ create_pe(struct elfcopy *ecp, int ifd, (void) elf_errno(); continue; } - if ((name = elf_strptr(ecp->ein, indx, sh.sh_name)) == + if ((name = elf_strptr(e, indx, sh.sh_name)) == NULL) { warnx("elf_strptr() failed: %s", elf_errmsg(-1)); (void) elf_errno(); @@ -210,12 +210,14 @@ create_pe(struct elfcopy *ecp, int ifd, } pb->pb_align = 1; pb->pb_off = 0; - pb->pb_size = roundup(sh.sh_size, poh.oh_filealign); - if ((pb->pb_buf = calloc(1, pb->pb_size)) == NULL) { - warn("calloc failed"); - continue; + if (sh.sh_type != SHT_NOBITS) { + pb->pb_size = roundup(sh.sh_size, poh.oh_filealign); + if ((pb->pb_buf = calloc(1, pb->pb_size)) == NULL) { + warn("calloc failed"); + continue; + } + memcpy(pb->pb_buf, d->d_buf, sh.sh_size); } - memcpy(pb->pb_buf, d->d_buf, sh.sh_size); } elferr = elf_errno(); if (elferr != 0) From owner-svn-src-head@freebsd.org Tue Dec 27 18:23:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76612C9334C; Tue, 27 Dec 2016 18:23:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3714E1993; Tue, 27 Dec 2016 18:23:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBRINHfO028634; Tue, 27 Dec 2016 18:23:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBRINHwn028630; Tue, 27 Dec 2016 18:23:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612271823.uBRINHwn028630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Dec 2016 18:23:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310635 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 18:23:18 -0000 Author: mav Date: Tue Dec 27 18:23:16 2016 New Revision: 310635 URL: https://svnweb.freebsd.org/changeset/base/310635 Log: Decouple limits on number of LUNs per port and LUs per CTL. Those two values are not directly related, so make them independent. This does not change any limits immediately, but makes number of LUNs per port controllable via tunable/sysctl kern.cam.ctl.lun_map_size. After this change increasing CTL_MAX_LUNS should be pretty cheap, and even making it tunable should be easy. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_frontend.c head/sys/cam/ctl/ctl_frontend.h head/sys/cam/ctl/ctl_io.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Tue Dec 27 17:31:07 2016 (r310634) +++ head/sys/cam/ctl/ctl.c Tue Dec 27 18:23:16 2016 (r310635) @@ -407,6 +407,9 @@ SYSCTL_INT(_kern_cam_ctl, OID_AUTO, work static int ctl_debug = CTL_DEBUG_NONE; SYSCTL_INT(_kern_cam_ctl, OID_AUTO, debug, CTLFLAG_RWTUN, &ctl_debug, 0, "Enabled debug flags"); +static int ctl_lun_map_size = 1024; +SYSCTL_INT(_kern_cam_ctl, OID_AUTO, lun_map_size, CTLFLAG_RWTUN, + &ctl_lun_map_size, 0, "Size of per-port LUN map (max LUN + 1)"); /* * Supported pages (0x00), Serial number (0x80), Device ID (0x83), @@ -826,7 +829,7 @@ ctl_isc_announce_port(struct ctl_port *p return; i = sizeof(msg->port) + strlen(port->port_name) + 1; if (port->lun_map) - i += sizeof(uint32_t) * CTL_MAX_LUNS; + i += port->lun_map_size * sizeof(uint32_t); if (port->port_devid) i += port->port_devid->len; if (port->target_devid) @@ -846,7 +849,7 @@ ctl_isc_announce_port(struct ctl_port *p "%d:%s", softc->ha_id, port->port_name) + 1; i += msg->port.name_len; if (port->lun_map) { - msg->port.lun_map_len = sizeof(uint32_t) * CTL_MAX_LUNS; + msg->port.lun_map_len = port->lun_map_size * sizeof(uint32_t); memcpy(&msg->port.data[i], port->lun_map, msg->port.lun_map_len); i += msg->port.lun_map_len; @@ -1155,19 +1158,25 @@ ctl_isc_port_sync(struct ctl_softc *soft M_CTL); i += msg->port.name_len; if (msg->port.lun_map_len != 0) { - if (port->lun_map == NULL) - port->lun_map = malloc(sizeof(uint32_t) * CTL_MAX_LUNS, + if (port->lun_map == NULL || + port->lun_map_size * sizeof(uint32_t) < + msg->port.lun_map_len) { + port->lun_map_size = 0; + free(port->lun_map, M_CTL); + port->lun_map = malloc(msg->port.lun_map_len, M_CTL, M_WAITOK); - memcpy(port->lun_map, &msg->port.data[i], - sizeof(uint32_t) * CTL_MAX_LUNS); + } + memcpy(port->lun_map, &msg->port.data[i], msg->port.lun_map_len); + port->lun_map_size = msg->port.lun_map_len / sizeof(uint32_t); i += msg->port.lun_map_len; } else { + port->lun_map_size = 0; free(port->lun_map, M_CTL); port->lun_map = NULL; } if (msg->port.port_devid_len != 0) { if (port->port_devid == NULL || - port->port_devid->len != msg->port.port_devid_len) { + port->port_devid->len < msg->port.port_devid_len) { free(port->port_devid, M_CTL); port->port_devid = malloc(sizeof(struct ctl_devid) + msg->port.port_devid_len, M_CTL, M_WAITOK); @@ -1182,7 +1191,7 @@ ctl_isc_port_sync(struct ctl_softc *soft } if (msg->port.target_devid_len != 0) { if (port->target_devid == NULL || - port->target_devid->len != msg->port.target_devid_len) { + port->target_devid->len < msg->port.target_devid_len) { free(port->target_devid, M_CTL); port->target_devid = malloc(sizeof(struct ctl_devid) + msg->port.target_devid_len, M_CTL, M_WAITOK); @@ -1197,7 +1206,7 @@ ctl_isc_port_sync(struct ctl_softc *soft } if (msg->port.init_devid_len != 0) { if (port->init_devid == NULL || - port->init_devid->len != msg->port.init_devid_len) { + port->init_devid->len < msg->port.init_devid_len) { free(port->init_devid, M_CTL); port->init_devid = malloc(sizeof(struct ctl_devid) + msg->port.init_devid_len, M_CTL, M_WAITOK); @@ -3295,7 +3304,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, if (port->lun_map != NULL) { sbuf_printf(sb, "\ton\n"); - for (j = 0; j < CTL_MAX_LUNS; j++) { + for (j = 0; j < port->lun_map_size; j++) { plun = ctl_lun_map_from_port(port, j); if (plun == UINT32_MAX) continue; @@ -3375,7 +3384,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, } } mtx_unlock(&softc->ctl_lock); // XXX: port_enable sleeps - if (lm->plun < CTL_MAX_LUNS) { + if (lm->plun != UINT32_MAX) { if (lm->lun == UINT32_MAX) retval = ctl_lun_map_unset(port, lm->plun); else if (lm->lun < CTL_MAX_LUNS && @@ -3383,13 +3392,12 @@ ctl_ioctl(struct cdev *dev, u_long cmd, retval = ctl_lun_map_set(port, lm->plun, lm->lun); else return (ENXIO); - } else if (lm->plun == UINT32_MAX) { + } else { if (lm->lun == UINT32_MAX) retval = ctl_lun_map_deinit(port); else retval = ctl_lun_map_init(port); - } else - return (ENXIO); + } if (port->status & CTL_PORT_STATUS_ONLINE) ctl_isc_announce_port(port); break; @@ -3442,15 +3450,20 @@ ctl_lun_map_init(struct ctl_port *port) { struct ctl_softc *softc = port->ctl_softc; struct ctl_lun *lun; + int size = ctl_lun_map_size; uint32_t i; - if (port->lun_map == NULL) - port->lun_map = malloc(sizeof(uint32_t) * CTL_MAX_LUNS, + if (port->lun_map == NULL || port->lun_map_size < size) { + port->lun_map_size = 0; + free(port->lun_map, M_CTL); + port->lun_map = malloc(size * sizeof(uint32_t), M_CTL, M_NOWAIT); + } if (port->lun_map == NULL) return (ENOMEM); - for (i = 0; i < CTL_MAX_LUNS; i++) + for (i = 0; i < size; i++) port->lun_map[i] = UINT32_MAX; + port->lun_map_size = size; if (port->status & CTL_PORT_STATUS_ONLINE) { if (port->lun_disable != NULL) { STAILQ_FOREACH(lun, &softc->lun_list, links) @@ -3469,6 +3482,7 @@ ctl_lun_map_deinit(struct ctl_port *port if (port->lun_map == NULL) return (0); + port->lun_map_size = 0; free(port->lun_map, M_CTL); port->lun_map = NULL; if (port->status & CTL_PORT_STATUS_ONLINE) { @@ -3492,6 +3506,8 @@ ctl_lun_map_set(struct ctl_port *port, u if (status != 0) return (status); } + if (plun >= port->lun_map_size) + return (EINVAL); old = port->lun_map[plun]; port->lun_map[plun] = glun; if ((port->status & CTL_PORT_STATUS_ONLINE) && old == UINT32_MAX) { @@ -3507,7 +3523,7 @@ ctl_lun_map_unset(struct ctl_port *port, { uint32_t old; - if (port->lun_map == NULL) + if (port->lun_map == NULL || plun >= port->lun_map_size) return (0); old = port->lun_map[plun]; port->lun_map[plun] = UINT32_MAX; @@ -3525,8 +3541,10 @@ ctl_lun_map_from_port(struct ctl_port *p if (port == NULL) return (UINT32_MAX); - if (port->lun_map == NULL || lun_id == UINT32_MAX) + if (port->lun_map == NULL) return (lun_id); + if (lun_id > port->lun_map_size) + return (UINT32_MAX); return (port->lun_map[lun_id]); } @@ -3539,7 +3557,7 @@ ctl_lun_map_to_port(struct ctl_port *por return (UINT32_MAX); if (port->lun_map == NULL) return (lun_id); - for (i = 0; i < CTL_MAX_LUNS; i++) { + for (i = 0; i < port->lun_map_size; i++) { if (port->lun_map[i] == lun_id) return (i); } @@ -9048,9 +9066,8 @@ ctl_report_luns(struct ctl_scsiio *ctsio struct scsi_report_luns_data *lun_data; struct ctl_lun *lun, *request_lun; struct ctl_port *port; - int num_luns, retval; + int num_filled, num_luns, num_port_luns, retval; uint32_t alloc_len, lun_datalen; - int num_filled; uint32_t initidx, targ_lun_id, lun_id; retval = CTL_RETVAL_COMPLETE; @@ -9060,9 +9077,10 @@ ctl_report_luns(struct ctl_scsiio *ctsio CTL_DEBUG_PRINT(("ctl_report_luns\n")); - mtx_lock(&softc->ctl_lock); num_luns = 0; - for (targ_lun_id = 0; targ_lun_id < CTL_MAX_LUNS; targ_lun_id++) { + num_port_luns = port->lun_map ? port->lun_map_size : CTL_MAX_LUNS; + mtx_lock(&softc->ctl_lock); + for (targ_lun_id = 0; targ_lun_id < num_port_luns; targ_lun_id++) { if (ctl_lun_map_from_port(port, targ_lun_id) != UINT32_MAX) num_luns++; } @@ -9121,7 +9139,9 @@ ctl_report_luns(struct ctl_scsiio *ctsio initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); mtx_lock(&softc->ctl_lock); - for (targ_lun_id = 0, num_filled = 0; targ_lun_id < CTL_MAX_LUNS && num_filled < num_luns; targ_lun_id++) { + for (targ_lun_id = 0, num_filled = 0; + targ_lun_id < num_port_luns && num_filled < num_luns; + targ_lun_id++) { lun_id = ctl_lun_map_from_port(port, targ_lun_id); if (lun_id == UINT32_MAX) continue; Modified: head/sys/cam/ctl/ctl_frontend.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend.c Tue Dec 27 17:31:07 2016 (r310634) +++ head/sys/cam/ctl/ctl_frontend.c Tue Dec 27 18:23:16 2016 (r310635) @@ -315,7 +315,7 @@ ctl_port_online(struct ctl_port *port) if (port->lun_enable != NULL) { if (port->lun_map) { - for (l = 0; l < CTL_MAX_LUNS; l++) { + for (l = 0; l < port->lun_map_size; l++) { if (ctl_lun_map_from_port(port, l) == UINT32_MAX) continue; @@ -359,7 +359,7 @@ ctl_port_offline(struct ctl_port *port) port->port_offline(port->onoff_arg); if (port->lun_disable != NULL) { if (port->lun_map) { - for (l = 0; l < CTL_MAX_LUNS; l++) { + for (l = 0; l < port->lun_map_size; l++) { if (ctl_lun_map_from_port(port, l) == UINT32_MAX) continue; Modified: head/sys/cam/ctl/ctl_frontend.h ============================================================================== --- head/sys/cam/ctl/ctl_frontend.h Tue Dec 27 17:31:07 2016 (r310634) +++ head/sys/cam/ctl/ctl_frontend.h Tue Dec 27 18:23:16 2016 (r310635) @@ -225,6 +225,7 @@ struct ctl_port { void *onoff_arg; /* passed to CTL */ lun_func_t lun_enable; /* passed to CTL */ lun_func_t lun_disable; /* passed to CTL */ + int lun_map_size; /* passed to CTL */ uint32_t *lun_map; /* passed to CTL */ void *targ_lun_arg; /* passed to CTL */ void (*fe_datamove)(union ctl_io *io); /* passed to CTL */ Modified: head/sys/cam/ctl/ctl_io.h ============================================================================== --- head/sys/cam/ctl/ctl_io.h Tue Dec 27 17:31:07 2016 (r310634) +++ head/sys/cam/ctl/ctl_io.h Tue Dec 27 18:23:16 2016 (r310635) @@ -365,7 +365,7 @@ struct ctl_taskio { /* * HA link messages. */ -#define CTL_HA_VERSION 1 +#define CTL_HA_VERSION 2 /* * Used for CTL_MSG_LOGIN. From owner-svn-src-head@freebsd.org Tue Dec 27 18:48:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57BDBC938B3; Tue, 27 Dec 2016 18:48:20 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D76DC1499; Tue, 27 Dec 2016 18:48:19 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wm0-x243.google.com with SMTP id u144so58389530wmu.0; Tue, 27 Dec 2016 10:48:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=QUyXkiY0/KZFjcDxEubcDuTUwDblAVofste+4KOtob0=; b=NKMaZLoc/G/qRCqugx1ZSR6aL5+Acyw1gHI94c9BR1G0uDXIkzrOxN+pvx8Mcccde2 svR1qjMU+0xCTRi+qqtrtfhlBK0QksVApLf/9M3Y2SoA3E380+PI8nH4LlHhN+yfBxQj UtcJkcgxl5+Fl2f3Y1o2rv52b67XVoL8dpJMH4rQRUIwAH5avqkhZPDCu+gBd6bbA0I8 p0MfxiJ/3rrjbgJxL2EheTIirgZ+1JHe7cGqpgvtQxxVSwUFLoLj9K3NK+ZvXvQfTT8m EciPs7bQQoVxnXTOJ/fUgydUi77yZyowiXAtIrctWoTSmzQP3NRXF2xjUDBHiL+G152/ m/uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=QUyXkiY0/KZFjcDxEubcDuTUwDblAVofste+4KOtob0=; b=s2yzd5f4NdqC4OC4RHUax4oFGzIllGCJrA4w6oTui2O/qsqS4pExmAdd3DZv/KR6i8 eNRUd+AMIq0Y6CzcqGyxiEk11o6/7CJnMMHv4WjTZuQnCLfi2lmy1QVBHqz6oBCPlhAx pDXYrS5EdTLkwqSS3FVOSHDzBFeq8yyefgjyTQWH3MHjea5iG0XwDUlFLB6Ms8afZI13 YWUlzPqjq5bIUNQsaFQejUmiyl2+DjLHrruQOaIjPwKvswB0HxM0gpB/rK40WDInebNN FeNICRjqmKnlKbrSREGAFBN+ilVuONC0SxAyhWSVx7EXrRVPfUuHu2tYSIs99JMq0KPb Lq4w== X-Gm-Message-State: AIkVDXKs9tr5yj/gWz0m05BqQAopi6eXVDBMWG2V51+kv+oXrCo3cP6wFp3S5RTg1LIhGlYZq6LewtzRbWATqQ== X-Received: by 10.28.165.82 with SMTP id o79mr17941688wme.129.1482864498188; Tue, 27 Dec 2016 10:48:18 -0800 (PST) MIME-Version: 1.0 Sender: adrian.chadd@gmail.com Received: by 10.194.44.1 with HTTP; Tue, 27 Dec 2016 10:48:17 -0800 (PST) In-Reply-To: <20161227140846.xu4f6lmsgqytuhne@mutt-hardenedbsd> References: <201612270610.uBR6ASrp025710@repo.freebsd.org> <20161227140846.xu4f6lmsgqytuhne@mutt-hardenedbsd> From: Adrian Chadd Date: Tue, 27 Dec 2016 10:48:17 -0800 X-Google-Sender-Auth: 6EkElqfV0HDqV_T4p5xhjrefq5A Message-ID: Subject: Re: svn commit: r310624 - head/sys/net80211 To: Shawn Webb Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 18:48:20 -0000 Hi, As it's a kernel change in a frequently changing subsystem in -HEAD, I'm opting not to bump it until I get the 11ac bits "done" enough. Otherwise there'd be a lot of churn. I did bump it for the userland facing ABI though as that did have a pretty big impact. Anyone using binary-only wifi kernel modules on FreeBSD should know better. :) I promise to bump it once 11ac is "done" enough to use, so there is a good reference point. Thanks, -adrian On 27 December 2016 at 06:08, Shawn Webb wrote: > On Tue, Dec 27, 2016 at 06:10:28AM +0000, Adrian Chadd wrote: >> Author: adrian >> Date: Tue Dec 27 06:10:28 2016 >> New Revision: 310624 >> URL: https://svnweb.freebsd.org/changeset/base/310624 >> >> Log: >> [net80211] turn the default TX key configuration (for WEP) into a vap callback. >> >> The ath10k firmware supports hardware WEP offload, and in native wifi mode >> (or 802.3 ethernet mode, for that matter) the WEP key isn't actually included >> in the TX payload from net80211. Instead, a separate firmware command is issued >> that sets the default TX key to be the specified key. >> >> However, net80211 doesn't at all inform the driver layer that this is >> occuring - it just "expects" to be inserting WEP header information >> when doing WEP TX, even with hardware encryption. >> >> So, to better support the newer world order, turn the default TX key assignment >> into a VAP method that can be overridden by the driver and ensure its wrapped >> in a crypto begin/end set. That way it should be correctly atomic from the >> point of view of keychanges (as long as the driver does the right thing.) >> >> It'd be nice if we passed through to the key_set call a flag that says >> "also make this the default key" - that's captured here by calling the >> deftxkey method after the key_set method. Maybe I can do that later. >> >> Note: this is a net80211 ABI change, and will require a kernel+modules >> recompile. Happy Holidays, etc. > > Hey Adrian, > > Thank you very much for your hard work on the wireless stack. Since this > introduces an ABI change, should __FreeBSD_version be bumped? > > Thanks, > > -- > Shawn Webb > Cofounder and Security Engineer > HardenedBSD > > GPG Key ID: 0x6A84658F52456EEE > GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE From owner-svn-src-head@freebsd.org Tue Dec 27 18:50:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5AD1C939EA for ; Tue, 27 Dec 2016 18:50:11 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk0-x230.google.com (mail-qk0-x230.google.com [IPv6:2607:f8b0:400d:c09::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A2B717A2 for ; Tue, 27 Dec 2016 18:50:11 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk0-x230.google.com with SMTP id u25so216330665qki.2 for ; Tue, 27 Dec 2016 10:50:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=UlPp1hdCfOpF7u0wdvwTVYa7saALUaFByXAVw8UKF2o=; b=KBojRPYcgYwbbOR7Z9Jp/3GRJlVipN1cE+O5ZOGuSK/EifvLVpIVB3p5XAoV1XMhLB fZTo6VhNzqmGn/TUZkelSeQx8CL9qVSl6guMmw1ngka4kINpfs3OzpXw3iueygy58nuv PWN/y5EzvBLds60mghfxet5gSYrLTwOMAHKkWp4Nnlu0Tsx4q6z7EbUN0mlDWZFPEeyK o19kN6zTi4mGk2Y2SHowfDdWoTgx4FSssKJd2wAQqyYnEskTr+jxsMP9W7CoyI6hFbGT y0moz3K7/lQgcRU2A92a1C5T8PxYVrfr1NXN/Kh7qrdeTlgNEfWxaX8mhbz6/DTA1Wrf rnGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=UlPp1hdCfOpF7u0wdvwTVYa7saALUaFByXAVw8UKF2o=; b=NjK6Fl2157KtgVIZN9cXGws4EbCWWqUqJcirqSq00pcz184qeoDAUwtkGN+Nk9gBMK 6bJxwUIu+M35n/vLoZZOLqKhRlSrx0tk8N1DSjcsT/4+sLeTMVgywjOF3SjYn/JMg7E0 rmXrpBo6cuTPVt14rovPjcYthLdJx5s2+6WEA8ShzLOZkXrKjtE2umOEuKTMR8iv+c9X FQd9kH/7MEtJWx7EAKW17qYBFIyFJOEyGB3zk6YDQBwjY0jtUE7y/BYXITsovdPccO9W t2TEFm2yXI7Agh+2trFhI94DK/IgOpJzOdsO1Nd+v7xQ7YQDI9SkEY1JfmlpcwaVLfyf M/Ig== X-Gm-Message-State: AIkVDXI8LMG3/APN8c+5kj6NS7j2uD2icgI2jjw+sbDX0iakrEx0EpY4fxBE52pfgJy3ZiDj X-Received: by 10.55.44.193 with SMTP id s184mr35029490qkh.278.1482864610591; Tue, 27 Dec 2016 10:50:10 -0800 (PST) Received: from mutt-hardenedbsd ([63.88.83.66]) by smtp.gmail.com with ESMTPSA id w34sm29059222qtw.10.2016.12.27.10.50.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Dec 2016 10:50:09 -0800 (PST) Date: Tue, 27 Dec 2016 13:50:08 -0500 From: Shawn Webb To: Adrian Chadd Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r310624 - head/sys/net80211 Message-ID: <20161227185008.ugrmmnwfdpin4mcf@mutt-hardenedbsd> References: <201612270610.uBR6ASrp025710@repo.freebsd.org> <20161227140846.xu4f6lmsgqytuhne@mutt-hardenedbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="yvkoprcmqyatt6gk" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD mutt-hardenedbsd 12.0-CURRENT-HBSD FreeBSD 12.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: NeoMutt/20161126 (1.7.1) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 18:50:11 -0000 --yvkoprcmqyatt6gk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Sounds good. Thanks for the explanation! On Tue, Dec 27, 2016 at 10:48:17AM -0800, Adrian Chadd wrote: > Hi, >=20 > As it's a kernel change in a frequently changing subsystem in -HEAD, > I'm opting not to bump it until I get the 11ac bits "done" enough. > Otherwise there'd be a lot of churn. I did bump it for the userland > facing ABI though as that did have a pretty big impact. >=20 > Anyone using binary-only wifi kernel modules on FreeBSD should know bette= r. :) >=20 > I promise to bump it once 11ac is "done" enough to use, so there is a > good reference point. >=20 > Thanks, >=20 >=20 > -adrian >=20 >=20 > On 27 December 2016 at 06:08, Shawn Webb wro= te: > > On Tue, Dec 27, 2016 at 06:10:28AM +0000, Adrian Chadd wrote: > >> Author: adrian > >> Date: Tue Dec 27 06:10:28 2016 > >> New Revision: 310624 > >> URL: https://svnweb.freebsd.org/changeset/base/310624 > >> > >> Log: > >> [net80211] turn the default TX key configuration (for WEP) into a va= p callback. > >> > >> The ath10k firmware supports hardware WEP offload, and in native wif= i mode > >> (or 802.3 ethernet mode, for that matter) the WEP key isn't actually= included > >> in the TX payload from net80211. Instead, a separate firmware comma= nd is issued > >> that sets the default TX key to be the specified key. > >> > >> However, net80211 doesn't at all inform the driver layer that this is > >> occuring - it just "expects" to be inserting WEP header information > >> when doing WEP TX, even with hardware encryption. > >> > >> So, to better support the newer world order, turn the default TX key= assignment > >> into a VAP method that can be overridden by the driver and ensure it= s wrapped > >> in a crypto begin/end set. That way it should be correctly atomic f= rom the > >> point of view of keychanges (as long as the driver does the right th= ing.) > >> > >> It'd be nice if we passed through to the key_set call a flag that sa= ys > >> "also make this the default key" - that's captured here by calling t= he > >> deftxkey method after the key_set method. Maybe I can do that later. > >> > >> Note: this is a net80211 ABI change, and will require a kernel+modul= es > >> recompile. Happy Holidays, etc. > > > > Hey Adrian, > > > > Thank you very much for your hard work on the wireless stack. Since this > > introduces an ABI change, should __FreeBSD_version be bumped? > > > > Thanks, > > > > -- > > Shawn Webb > > Cofounder and Security Engineer > > HardenedBSD > > > > GPG Key ID: 0x6A84658F52456EEE > > GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --=20 Shawn Webb Cofounder and Security Engineer HardenedBSD GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --yvkoprcmqyatt6gk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEKrq2ve9q9Ia+iT2eaoRlj1JFbu4FAlhit94ACgkQaoRlj1JF bu6imQ/6AoeWLdRHHTj07nDHEE33ER+fpZHlyD2EaMCeh4q1rHo5sqgDRFhVJMdA vVXpQrFUZ6DWwqGoN3s7ATXQqrgYv0iKHO03JtpQTe7bSckel/wYf9mJ/evgOG9o ZMeU4cR5t1Dc9Yybff7AwtTaUskcJm5IV0iCL3iUmoS8qE7JJxzexHxYaUwdHY6x 2SNeinDie4P5yJBBMYzjhD52MCHrmS6DspCkXV+aW6u4MHjL299clI5Txs9HxNxS lIFolrBZjjMUx+t2sZ/Ig7XcFFApCbroDpDbM3bHAK8lrCUfDG6u55i1WpYc75UB ZM1SvNk0GhpHnPCzIbUE+96ATVGH7ygerXC9fnvHz8BY1GX6eKSRQZFrix8F8Gvp vXP7La32axyPfsNu8nTpkXOK9jPn7PtU1VvJcI8iHrmYSqNCa+YXrAo/nkRrppvM 1dVMdASbGQLvHuGCU0U1Ra+UsDjiEa3aeo4+7RELdfwwQtq71yHB0jxP0lsLO69v EkGgOzvx4Cz0d3TCxVVn+/TAVw8l2FcgVB6idjBe2RxpKnukTugZ/babfZF76hff s+4OsQmC2u2d2/S9pIyu5gCyYtJBElmcHE/6p6zeMecOZqDFeMHnjCrcvYhchc21 wthqyvMlVXKp332+od45teTDvQGGGjYr6+i+z/PFIJFFIZbuj2Y= =/aNR -----END PGP SIGNATURE----- --yvkoprcmqyatt6gk-- From owner-svn-src-head@freebsd.org Tue Dec 27 19:08:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A141AC93024; Tue, 27 Dec 2016 19:08:09 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 684AE1454; Tue, 27 Dec 2016 19:08:09 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBRJ88YY046231; Tue, 27 Dec 2016 19:08:08 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBRJ88DE046230; Tue, 27 Dec 2016 19:08:08 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201612271908.uBRJ88DE046230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 27 Dec 2016 19:08:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310636 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 19:08:09 -0000 Author: gonzo Date: Tue Dec 27 19:08:08 2016 New Revision: 310636 URL: https://svnweb.freebsd.org/changeset/base/310636 Log: [rpi] Fix bcm2835_audio locking and samples starvation Rework general approach to locking and working with audio worker thread: - Use flags to signal requested worker action - Fix submitted buffer calculations to avoid samples starvation - Protect buffer pointers with locks to fix race condition between callback and audio worker thread - Remove unnecessary vchi_service_use - Do not use lock to serialize VCHI requests since only one thread issues them now - Fix unloading signaling per hselasky@ suggestion - Add output to detect inconsistent callback data caused by possible firmware bug https://github.com/raspberrypi/firmware/issues/696 - Add stats/debug sysctls to troubleshoot possible bugs PR: 213687, 205979, 215194 MFC after: 1 week Modified: head/sys/arm/broadcom/bcm2835/bcm2835_audio.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_audio.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_audio.c Tue Dec 27 18:23:16 2016 (r310635) +++ head/sys/arm/broadcom/bcm2835/bcm2835_audio.c Tue Dec 27 19:08:08 2016 (r310636) @@ -40,13 +40,33 @@ SND_DECLARE_FILE("$FreeBSD$"); +/* Audio destination */ #define DEST_AUTO 0 #define DEST_HEADPHONES 1 #define DEST_HDMI 2 +/* Playback state */ +#define PLAYBACK_IDLE 0 +#define PLAYBACK_PLAYING 1 +#define PLAYBACK_STOPPING 2 + +/* Worker thread state */ +#define WORKER_RUNNING 0 +#define WORKER_STOPPING 1 +#define WORKER_STOPPED 2 + +/* + * Worker thread flags, set to 1 in flags_pending + * when driver requests one or another operation + * from worker. Cleared to 0 once worker performs + * the operations. + */ +#define AUDIO_PARAMS (1 << 0) +#define AUDIO_PLAY (1 << 1) +#define AUDIO_STOP (1 << 2) + #define VCHIQ_AUDIO_PACKET_SIZE 4000 -#define VCHIQ_AUDIO_BUFFER_SIZE 128000 -#define VCHIQ_AUDIO_PREBUFFER 10 /* Number of pre-buffered audio messages */ +#define VCHIQ_AUDIO_BUFFER_SIZE 10*VCHIQ_AUDIO_PACKET_SIZE #define VCHIQ_AUDIO_MAX_VOLUME /* volume in terms of 0.01dB */ @@ -77,22 +97,25 @@ static struct pcmchan_caps bcm2835_audio struct bcm2835_audio_info; -#define PLAYBACK_IDLE 0 -#define PLAYBACK_STARTING 1 -#define PLAYBACK_PLAYING 2 -#define PLAYBACK_STOPPING 3 - struct bcm2835_audio_chinfo { struct bcm2835_audio_info *parent; struct pcm_channel *channel; struct snd_dbuf *buffer; uint32_t fmt, spd, blksz; - uint32_t complete_pos; - uint32_t free_buffer; - uint32_t buffered_ptr; + /* Pointer to first unsubmitted sample */ + uint32_t unsubmittedptr; + /* + * Number of bytes in "submitted but not played" + * pseudo-buffer + */ + int available_space; int playback_state; - int prebuffered; + uint64_t callbacks; + uint64_t submitted_samples; + uint64_t retrieved_samples; + uint64_t underruns; + int starved; }; struct bcm2835_audio_info { @@ -100,32 +123,25 @@ struct bcm2835_audio_info { unsigned int bufsz; struct bcm2835_audio_chinfo pch; uint32_t dest, volume; - struct mtx *lock; struct intr_config_hook intr_hook; /* VCHI data */ - struct sx vchi_lock; - VCHI_INSTANCE_T vchi_instance; VCHI_CONNECTION_T *vchi_connection; VCHI_SERVICE_HANDLE_T vchi_handle; - struct sx worker_lock; + struct mtx lock; struct cv worker_cv; - bool parameters_update_pending; - bool controls_update_pending; + uint32_t flags_pending; - /* Unloadign module */ - int unloading; + /* Worker thread state */ + int worker_state; }; -#define bcm2835_audio_lock(_ess) snd_mtxlock((_ess)->lock) -#define bcm2835_audio_unlock(_ess) snd_mtxunlock((_ess)->lock) -#define bcm2835_audio_lock_assert(_ess) snd_mtxassert((_ess)->lock) - -#define VCHIQ_VCHI_LOCK(sc) sx_xlock(&(sc)->vchi_lock) -#define VCHIQ_VCHI_UNLOCK(sc) sx_xunlock(&(sc)->vchi_lock) +#define BCM2835_AUDIO_LOCK(sc) mtx_lock(&(sc)->lock) +#define BCM2835_AUDIO_LOCKED(sc) mtx_assert(&(sc)->lock, MA_OWNED) +#define BCM2835_AUDIO_UNLOCK(sc) mtx_unlock(&(sc)->lock) static const char * dest_description(uint32_t dest) @@ -149,6 +165,36 @@ dest_description(uint32_t dest) } static void +bcm2835_worker_update_params(struct bcm2835_audio_info *sc) +{ + + BCM2835_AUDIO_LOCKED(sc); + + sc->flags_pending |= AUDIO_PARAMS; + cv_signal(&sc->worker_cv); +} + +static void +bcm2835_worker_play_start(struct bcm2835_audio_info *sc) +{ + BCM2835_AUDIO_LOCK(sc); + sc->flags_pending &= ~(AUDIO_STOP); + sc->flags_pending |= AUDIO_PLAY; + cv_signal(&sc->worker_cv); + BCM2835_AUDIO_UNLOCK(sc); +} + +static void +bcm2835_worker_play_stop(struct bcm2835_audio_info *sc) +{ + BCM2835_AUDIO_LOCK(sc); + sc->flags_pending &= ~(AUDIO_PLAY); + sc->flags_pending |= AUDIO_STOP; + cv_signal(&sc->worker_cv); + BCM2835_AUDIO_UNLOCK(sc); +} + +static void bcm2835_audio_callback(void *param, const VCHI_CALLBACK_REASON_T reason, void *msg_handle) { struct bcm2835_audio_info *sc = (struct bcm2835_audio_info *)param; @@ -163,7 +209,7 @@ bcm2835_audio_callback(void *param, cons &m, sizeof m, &msg_len, VCHI_FLAGS_NONE); if (m.type == VC_AUDIO_MSG_TYPE_RESULT) { if (m.u.result.success) { - device_printf(sc->dev, + device_printf(sc->dev, "msg type %08x failed\n", m.type); } @@ -172,13 +218,35 @@ bcm2835_audio_callback(void *param, cons int count = m.u.complete.count & 0xffff; int perr = (m.u.complete.count & (1U << 30)) != 0; - - ch->complete_pos = (ch->complete_pos + count) % sndbuf_getsize(ch->buffer); - ch->free_buffer += count; - chn_intr(sc->pch.channel); - - if (perr || ch->free_buffer >= VCHIQ_AUDIO_PACKET_SIZE) - cv_signal(&sc->worker_cv); + ch->callbacks++; + if (perr) + ch->underruns++; + + BCM2835_AUDIO_LOCK(sc); + if (ch->playback_state != PLAYBACK_IDLE) { + /* Prevent LOR */ + BCM2835_AUDIO_UNLOCK(sc); + chn_intr(sc->pch.channel); + BCM2835_AUDIO_LOCK(sc); + } + /* We should check again, state might have changed */ + if (ch->playback_state != PLAYBACK_IDLE) { + if (!perr) { + if ((ch->available_space + count)> VCHIQ_AUDIO_BUFFER_SIZE) { + device_printf(sc->dev, "inconsistent data in callback:\n"); + device_printf(sc->dev, "available_space == %d, count = %d, perr=%d\n", + ch->available_space, count, perr); + device_printf(sc->dev, + "retrieved_samples = %lld, submitted_samples = %lld\n", + ch->retrieved_samples, ch->submitted_samples); + } + ch->available_space += count; + ch->retrieved_samples += count; + } + if (perr || (ch->available_space >= VCHIQ_AUDIO_PACKET_SIZE)) + cv_signal(&sc->worker_cv); + } + BCM2835_AUDIO_UNLOCK(sc); } else printf("%s: unknown m.type: %d\n", __func__, m.type); } @@ -218,10 +286,7 @@ bcm2835_audio_init(struct bcm2835_audio_ status = vchi_service_open(sc->vchi_instance, ¶ms, &sc->vchi_handle); - if (status == 0) - /* Finished with the service for now */ - vchi_service_release(sc->vchi_handle); - else + if (status != 0) sc->vchi_handle = VCHIQ_SERVICE_HANDLE_INVALID; } @@ -231,10 +296,10 @@ bcm2835_audio_release(struct bcm2835_aud int success; if (sc->vchi_handle != VCHIQ_SERVICE_HANDLE_INVALID) { - vchi_service_use(sc->vchi_handle); success = vchi_service_close(sc->vchi_handle); if (success != 0) printf("vchi_service_close failed: %d\n", success); + vchi_service_release(sc->vchi_handle); sc->vchi_handle = VCHIQ_SERVICE_HANDLE_INVALID; } @@ -244,12 +309,9 @@ bcm2835_audio_release(struct bcm2835_aud static void bcm2835_audio_reset_channel(struct bcm2835_audio_chinfo *ch) { - ch->free_buffer = VCHIQ_AUDIO_BUFFER_SIZE; - ch->playback_state = 0; - ch->buffered_ptr = 0; - ch->complete_pos = 0; - ch->prebuffered = 0; + ch->available_space = VCHIQ_AUDIO_BUFFER_SIZE; + ch->unsubmittedptr = 0; sndbuf_reset(ch->buffer); } @@ -260,21 +322,14 @@ bcm2835_audio_start(struct bcm2835_audio int ret; struct bcm2835_audio_info *sc = ch->parent; - VCHIQ_VCHI_LOCK(sc); if (sc->vchi_handle != VCHIQ_SERVICE_HANDLE_INVALID) { - vchi_service_use(sc->vchi_handle); - m.type = VC_AUDIO_MSG_TYPE_START; ret = vchi_msg_queue(sc->vchi_handle, &m, sizeof m, VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); if (ret != 0) printf("%s: vchi_msg_queue failed (err %d)\n", __func__, ret); - - vchi_service_release(sc->vchi_handle); } - VCHIQ_VCHI_UNLOCK(sc); - } static void @@ -284,10 +339,7 @@ bcm2835_audio_stop(struct bcm2835_audio_ int ret; struct bcm2835_audio_info *sc = ch->parent; - VCHIQ_VCHI_LOCK(sc); if (sc->vchi_handle != VCHIQ_SERVICE_HANDLE_INVALID) { - vchi_service_use(sc->vchi_handle); - m.type = VC_AUDIO_MSG_TYPE_STOP; m.u.stop.draining = 0; @@ -296,10 +348,7 @@ bcm2835_audio_stop(struct bcm2835_audio_ if (ret != 0) printf("%s: vchi_msg_queue failed (err %d)\n", __func__, ret); - - vchi_service_release(sc->vchi_handle); } - VCHIQ_VCHI_UNLOCK(sc); } static void @@ -308,20 +357,14 @@ bcm2835_audio_open(struct bcm2835_audio_ VC_AUDIO_MSG_T m; int ret; - VCHIQ_VCHI_LOCK(sc); if (sc->vchi_handle != VCHIQ_SERVICE_HANDLE_INVALID) { - vchi_service_use(sc->vchi_handle); - m.type = VC_AUDIO_MSG_TYPE_OPEN; ret = vchi_msg_queue(sc->vchi_handle, &m, sizeof m, VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); if (ret != 0) printf("%s: vchi_msg_queue failed (err %d)\n", __func__, ret); - - vchi_service_release(sc->vchi_handle); } - VCHIQ_VCHI_UNLOCK(sc); } static void @@ -330,10 +373,7 @@ bcm2835_audio_update_controls(struct bcm VC_AUDIO_MSG_T m; int ret, db; - VCHIQ_VCHI_LOCK(sc); if (sc->vchi_handle != VCHIQ_SERVICE_HANDLE_INVALID) { - vchi_service_use(sc->vchi_handle); - m.type = VC_AUDIO_MSG_TYPE_CONTROL; m.u.control.dest = dest; if (volume > 99) @@ -346,10 +386,7 @@ bcm2835_audio_update_controls(struct bcm if (ret != 0) printf("%s: vchi_msg_queue failed (err %d)\n", __func__, ret); - - vchi_service_release(sc->vchi_handle); } - VCHIQ_VCHI_UNLOCK(sc); } static void @@ -358,10 +395,7 @@ bcm2835_audio_update_params(struct bcm28 VC_AUDIO_MSG_T m; int ret; - VCHIQ_VCHI_LOCK(sc); if (sc->vchi_handle != VCHIQ_SERVICE_HANDLE_INVALID) { - vchi_service_use(sc->vchi_handle); - m.type = VC_AUDIO_MSG_TYPE_CONFIG; m.u.config.channels = AFMT_CHANNEL(fmt); m.u.config.samplerate = speed; @@ -372,76 +406,48 @@ bcm2835_audio_update_params(struct bcm28 if (ret != 0) printf("%s: vchi_msg_queue failed (err %d)\n", __func__, ret); - - vchi_service_release(sc->vchi_handle); } - VCHIQ_VCHI_UNLOCK(sc); } -static __inline uint32_t -vchiq_unbuffered_bytes(struct bcm2835_audio_chinfo *ch) +static bool +bcm2835_audio_buffer_should_sleep(struct bcm2835_audio_chinfo *ch) { - uint32_t size, ready, readyptr, readyend; - - size = sndbuf_getsize(ch->buffer); - readyptr = sndbuf_getreadyptr(ch->buffer); - ready = sndbuf_getready(ch->buffer); + + if (ch->playback_state != PLAYBACK_PLAYING) + return (true); - readyend = readyptr + ready; - /* Normal case */ - if (ch->buffered_ptr >= readyptr) { - if (readyend > ch->buffered_ptr) - return readyend - ch->buffered_ptr; - else - return 0; + /* Not enough data */ + if (sndbuf_getready(ch->buffer) < VCHIQ_AUDIO_PACKET_SIZE) { + printf("starve\n"); + ch->starved++; + return (true); } - else { /* buffered_ptr overflow */ - if (readyend > ch->buffered_ptr + size) - return readyend - ch->buffered_ptr - size; - else - return 0; + + /* Not enough free space */ + if (ch->available_space < VCHIQ_AUDIO_PACKET_SIZE) { + return (true); } + + return (false); } static void -bcm2835_audio_write_samples(struct bcm2835_audio_chinfo *ch) +bcm2835_audio_write_samples(struct bcm2835_audio_chinfo *ch, void *buf, uint32_t count) { struct bcm2835_audio_info *sc = ch->parent; VC_AUDIO_MSG_T m; - void *buf; - uint32_t count, size; int ret; - VCHIQ_VCHI_LOCK(sc); if (sc->vchi_handle == VCHIQ_SERVICE_HANDLE_INVALID) { - VCHIQ_VCHI_UNLOCK(sc); return; } - vchi_service_use(sc->vchi_handle); - - size = sndbuf_getsize(ch->buffer); - count = vchiq_unbuffered_bytes(ch); - buf = (uint8_t*)sndbuf_getbuf(ch->buffer) + ch->buffered_ptr; - - if (ch->buffered_ptr + count > size) - count = size - ch->buffered_ptr; - - if (count < VCHIQ_AUDIO_PACKET_SIZE) - goto done; - - count = min(count, ch->free_buffer); - count -= count % VCHIQ_AUDIO_PACKET_SIZE; - m.type = VC_AUDIO_MSG_TYPE_WRITE; m.u.write.count = count; m.u.write.max_packet = VCHIQ_AUDIO_PACKET_SIZE; m.u.write.callback = NULL; m.u.write.cookie = ch; - if (buf) - m.u.write.silence = 0; - else - m.u.write.silence = 1; + m.u.write.silence = 0; ret = vchi_msg_queue(sc->vchi_handle, &m, sizeof m, VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); @@ -449,25 +455,16 @@ bcm2835_audio_write_samples(struct bcm28 if (ret != 0) printf("%s: vchi_msg_queue failed (err %d)\n", __func__, ret); - if (buf) { - while (count > 0) { - int bytes = MIN((int)m.u.write.max_packet, (int)count); - ch->free_buffer -= bytes; - ch->buffered_ptr += bytes; - ch->buffered_ptr = ch->buffered_ptr % size; - ret = vchi_msg_queue(sc->vchi_handle, - buf, bytes, VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); - if (ret != 0) - printf("%s: vchi_msg_queue failed: %d\n", - __func__, ret); - buf = (char *)buf + bytes; - count -= bytes; - } + while (count > 0) { + int bytes = MIN((int)m.u.write.max_packet, (int)count); + ret = vchi_msg_queue(sc->vchi_handle, + buf, bytes, VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); + if (ret != 0) + printf("%s: vchi_msg_queue failed: %d\n", + __func__, ret); + buf = (char *)buf + bytes; + count -= bytes; } -done: - - vchi_service_release(sc->vchi_handle); - VCHIQ_VCHI_UNLOCK(sc); } static void @@ -477,70 +474,98 @@ bcm2835_audio_worker(void *data) struct bcm2835_audio_chinfo *ch = &sc->pch; uint32_t speed, format; uint32_t volume, dest; - bool parameters_changed, controls_changed; + uint32_t flags; + uint32_t count, size, readyptr; + uint8_t *buf; - sx_slock(&sc->worker_lock); - while(1) { + ch->playback_state = PLAYBACK_IDLE; - if (sc->unloading) + while (1) { + if (sc->worker_state != WORKER_RUNNING) break; - parameters_changed = false; - controls_changed = false; - bcm2835_audio_lock(sc); - if (sc->parameters_update_pending) { - /* TODO: update parameters */ + BCM2835_AUDIO_LOCK(sc); + /* + * wait until there are flags set or buffer is ready + * to consume more samples + */ + while ((sc->flags_pending == 0) && + bcm2835_audio_buffer_should_sleep(ch)) { + cv_wait_sig(&sc->worker_cv, &sc->lock); + } + flags = sc->flags_pending; + /* Clear pending flags */ + sc->flags_pending = 0; + BCM2835_AUDIO_UNLOCK(sc); + + /* Requested to change parameters */ + if (flags & AUDIO_PARAMS) { + BCM2835_AUDIO_LOCK(sc); speed = ch->spd; format = ch->fmt; - sc->parameters_update_pending = false; - parameters_changed = true; - } - - if (sc->controls_update_pending) { volume = sc->volume; dest = sc->dest; - sc->controls_update_pending = false; - controls_changed = true; + BCM2835_AUDIO_UNLOCK(sc); + if (ch->playback_state == PLAYBACK_IDLE) + bcm2835_audio_update_params(sc, format, speed); + bcm2835_audio_update_controls(sc, volume, dest); } - bcm2835_audio_unlock(sc); - - if (parameters_changed) { - bcm2835_audio_update_params(sc, format, speed); + /* Requested to stop playback */ + if ((flags & AUDIO_STOP) && + (ch->playback_state == PLAYBACK_PLAYING)) { + bcm2835_audio_stop(ch); + BCM2835_AUDIO_LOCK(sc); + bcm2835_audio_reset_channel(&sc->pch); + ch->playback_state = PLAYBACK_IDLE; + BCM2835_AUDIO_UNLOCK(sc); + continue; } - if (controls_changed) { - bcm2835_audio_update_controls(sc, volume, dest); + /* Requested to start playback */ + if ((flags & AUDIO_PLAY) && + (ch->playback_state == PLAYBACK_IDLE)) { + BCM2835_AUDIO_LOCK(sc); + ch->playback_state = PLAYBACK_PLAYING; + BCM2835_AUDIO_UNLOCK(sc); + bcm2835_audio_start(ch); } - if (ch->playback_state == PLAYBACK_IDLE) { - cv_wait_sig(&sc->worker_cv, &sc->worker_lock); + if (ch->playback_state == PLAYBACK_IDLE) continue; - } - if (ch->playback_state == PLAYBACK_STOPPING) { - bcm2835_audio_stop(ch); - bcm2835_audio_reset_channel(&sc->pch); - ch->playback_state = PLAYBACK_IDLE; + if (sndbuf_getready(ch->buffer) == 0) continue; - } - if (ch->free_buffer < vchiq_unbuffered_bytes(ch)) { - cv_timedwait_sig(&sc->worker_cv, &sc->worker_lock, 10); + count = sndbuf_getready(ch->buffer); + size = sndbuf_getsize(ch->buffer); + readyptr = sndbuf_getreadyptr(ch->buffer); + + BCM2835_AUDIO_LOCK(sc); + if (readyptr + count > size) + count = size - readyptr; + count = min(count, ch->available_space); + count -= (count % VCHIQ_AUDIO_PACKET_SIZE); + BCM2835_AUDIO_UNLOCK(sc); + + if (count < VCHIQ_AUDIO_PACKET_SIZE) continue; - } - bcm2835_audio_write_samples(ch); + buf = (uint8_t*)sndbuf_getbuf(ch->buffer) + readyptr; - if (ch->playback_state == PLAYBACK_STARTING) { - ch->prebuffered++; - if (ch->prebuffered == VCHIQ_AUDIO_PREBUFFER) { - bcm2835_audio_start(ch); - ch->playback_state = PLAYBACK_PLAYING; - } - } + bcm2835_audio_write_samples(ch, buf, count); + BCM2835_AUDIO_LOCK(sc); + ch->unsubmittedptr = (ch->unsubmittedptr + count) % sndbuf_getsize(ch->buffer); + ch->available_space -= count; + ch->submitted_samples += count; + KASSERT(ch->available_space >= 0, ("ch->available_space == %d\n", ch->available_space)); + BCM2835_AUDIO_UNLOCK(sc); } - sx_sunlock(&sc->worker_lock); + + BCM2835_AUDIO_LOCK(sc); + sc->worker_state = WORKER_STOPPED; + cv_signal(&sc->worker_cv); + BCM2835_AUDIO_UNLOCK(sc); kproc_exit(0); } @@ -550,6 +575,7 @@ bcm2835_audio_create_worker(struct bcm28 { struct proc *newp; + sc->worker_state = WORKER_RUNNING; if (kproc_create(bcm2835_audio_worker, (void*)sc, &newp, 0, 0, "bcm2835_audio_worker") != 0) { printf("failed to create bcm2835_audio_worker\n"); @@ -585,8 +611,9 @@ bcmchan_init(kobj_t obj, void *devinfo, return NULL; } - sc->parameters_update_pending = true; - cv_signal(&sc->worker_cv); + BCM2835_AUDIO_LOCK(sc); + bcm2835_worker_update_params(sc); + BCM2835_AUDIO_UNLOCK(sc); return ch; } @@ -610,12 +637,10 @@ bcmchan_setformat(kobj_t obj, void *data struct bcm2835_audio_chinfo *ch = data; struct bcm2835_audio_info *sc = ch->parent; - bcm2835_audio_lock(sc); + BCM2835_AUDIO_LOCK(sc); ch->fmt = format; - sc->parameters_update_pending = true; - bcm2835_audio_unlock(sc); - - cv_signal(&sc->worker_cv); + bcm2835_worker_update_params(sc); + BCM2835_AUDIO_UNLOCK(sc); return 0; } @@ -626,12 +651,10 @@ bcmchan_setspeed(kobj_t obj, void *data, struct bcm2835_audio_chinfo *ch = data; struct bcm2835_audio_info *sc = ch->parent; - bcm2835_audio_lock(sc); + BCM2835_AUDIO_LOCK(sc); ch->spd = speed; - sc->parameters_update_pending = true; - bcm2835_audio_unlock(sc); - - cv_signal(&sc->worker_cv); + bcm2835_worker_update_params(sc); + BCM2835_AUDIO_UNLOCK(sc); return ch->spd; } @@ -653,25 +676,18 @@ bcmchan_trigger(kobj_t obj, void *data, if (!PCMTRIG_COMMON(go)) return (0); - switch (go) { case PCMTRIG_START: - bcm2835_audio_lock(sc); - bcm2835_audio_reset_channel(ch); - ch->playback_state = PLAYBACK_STARTING; - bcm2835_audio_unlock(sc); /* kickstart data flow */ chn_intr(sc->pch.channel); - /* wakeup worker thread */ - cv_signal(&sc->worker_cv); + ch->submitted_samples = 0; + ch->retrieved_samples = 0; + bcm2835_worker_play_start(sc); break; case PCMTRIG_STOP: case PCMTRIG_ABORT: - bcm2835_audio_lock(sc); - ch->playback_state = PLAYBACK_STOPPING; - bcm2835_audio_unlock(sc); - cv_signal(&sc->worker_cv); + bcm2835_worker_play_stop(sc); break; default: @@ -687,11 +703,9 @@ bcmchan_getptr(kobj_t obj, void *data) struct bcm2835_audio_info *sc = ch->parent; uint32_t ret; - bcm2835_audio_lock(sc); - - ret = ch->complete_pos - (ch->complete_pos % VCHIQ_AUDIO_PACKET_SIZE); - - bcm2835_audio_unlock(sc); + BCM2835_AUDIO_LOCK(sc); + ret = ch->unsubmittedptr; + BCM2835_AUDIO_UNLOCK(sc); return ret; } @@ -734,11 +748,11 @@ bcmmix_set(struct snd_mixer *m, unsigned switch (dev) { case SOUND_MIXER_VOLUME: - bcm2835_audio_lock(sc); + BCM2835_AUDIO_LOCK(sc); sc->volume = left; - sc->controls_update_pending = true; - bcm2835_audio_unlock(sc); - cv_signal(&sc->worker_cv); + bcm2835_worker_update_params(sc); + BCM2835_AUDIO_UNLOCK(sc); + break; default: @@ -771,13 +785,13 @@ sysctl_bcm2835_audio_dest(SYSCTL_HANDLER if ((val < 0) || (val > 2)) return (EINVAL); - bcm2835_audio_lock(sc); + BCM2835_AUDIO_LOCK(sc); sc->dest = val; - sc->controls_update_pending = true; - bcm2835_audio_unlock(sc); + bcm2835_worker_update_params(sc); + BCM2835_AUDIO_UNLOCK(sc); - cv_signal(&sc->worker_cv); - device_printf(sc->dev, "destination set to %s\n", dest_description(val)); + if (bootverbose) + device_printf(sc->dev, "destination set to %s\n", dest_description(val)); return (0); } @@ -799,6 +813,24 @@ vchi_audio_sysctl_init(struct bcm2835_au CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc), sysctl_bcm2835_audio_dest, "IU", "audio destination, " "0 - auto, 1 - headphones, 2 - HDMI"); + SYSCTL_ADD_UQUAD(ctx, tree, OID_AUTO, "callbacks", + CTLFLAG_RD, &sc->pch.callbacks, + "callbacks total"); + SYSCTL_ADD_UQUAD(ctx, tree, OID_AUTO, "submitted", + CTLFLAG_RD, &sc->pch.submitted_samples, + "last play submitted samples"); + SYSCTL_ADD_UQUAD(ctx, tree, OID_AUTO, "retrieved", + CTLFLAG_RD, &sc->pch.retrieved_samples, + "last play retrieved samples"); + SYSCTL_ADD_UQUAD(ctx, tree, OID_AUTO, "underruns", + CTLFLAG_RD, &sc->pch.underruns, + "callback underruns"); + SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "freebuffer", + CTLFLAG_RD, &sc->pch.available_space, + sc->pch.available_space, "callbacks total"); + SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "starved", + CTLFLAG_RD, &sc->pch.starved, + sc->pch.starved, "number of starved conditions"); } static void @@ -816,7 +848,6 @@ bcm2835_audio_probe(device_t dev) return (BUS_PROBE_DEFAULT); } - static void bcm2835_audio_delayed_init(void *xsc) { @@ -837,7 +868,7 @@ bcm2835_audio_delayed_init(void *xsc) goto no; } - if (pcm_register(sc->dev, sc, 1, 1)) { + if (pcm_register(sc->dev, sc, 1, 0)) { device_printf(sc->dev, "pcm_register failed\n"); goto no; } @@ -865,14 +896,12 @@ bcm2835_audio_attach(device_t dev) sc->dev = dev; sc->bufsz = VCHIQ_AUDIO_BUFFER_SIZE; - sc->lock = snd_mtxcreate(device_get_nameunit(dev), "bcm2835_audio softc"); - - sx_init(&sc->vchi_lock, device_get_nameunit(dev)); - sx_init(&sc->worker_lock, "bcm_audio_worker_lock"); + mtx_init(&sc->lock, device_get_nameunit(dev), + "bcm_audio_lock", MTX_DEF); cv_init(&sc->worker_cv, "worker_cv"); sc->vchi_handle = VCHIQ_SERVICE_HANDLE_INVALID; - /* + /* * We need interrupts enabled for VCHI to work properly, * so delay initialization until it happens. */ @@ -896,26 +925,23 @@ bcm2835_audio_detach(device_t dev) sc = pcm_getdevinfo(dev); /* Stop worker thread */ - sx_xlock(&sc->worker_lock); - sc->unloading = 1; - sx_xunlock(&sc->worker_lock); + BCM2835_AUDIO_LOCK(sc); + sc->worker_state = WORKER_STOPPING; cv_signal(&sc->worker_cv); + /* Wait for thread to exit */ + while (sc->worker_state != WORKER_STOPPED) + cv_wait_sig(&sc->worker_cv, &sc->lock); + BCM2835_AUDIO_UNLOCK(sc); r = pcm_unregister(dev); if (r) return r; - sx_destroy(&sc->vchi_lock); - sx_destroy(&sc->worker_lock); + mtx_destroy(&sc->lock); cv_destroy(&sc->worker_cv); bcm2835_audio_release(sc); - if (sc->lock) { - snd_mtxfree(sc->lock); - sc->lock = NULL; - } - free(sc, M_DEVBUF); return 0; From owner-svn-src-head@freebsd.org Tue Dec 27 20:21:13 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3722DC93BB8; Tue, 27 Dec 2016 20:21:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11CE91038; Tue, 27 Dec 2016 20:21:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBRKLCoL075449; Tue, 27 Dec 2016 20:21:12 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBRKLBJd075441; Tue, 27 Dec 2016 20:21:11 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612272021.uBRKLBJd075441@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 27 Dec 2016 20:21:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310638 - in head: lib/libc/gen lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 20:21:13 -0000 Author: jhb Date: Tue Dec 27 20:21:11 2016 New Revision: 310638 URL: https://svnweb.freebsd.org/changeset/base/310638 Log: Rename the 'flags' argument to getfsstat() to 'mode' and validate it. This argument is not a bitmask of flags, but only accepts a single value. Fail with EINVAL if an invalid value is passed to 'flag'. Rename the 'flags' argument to getmntinfo(3) to 'mode' as well to match. This is a followup to r308088. Reviewed by: kib MFC after: 1 month Modified: head/lib/libc/gen/getmntinfo.3 head/lib/libc/gen/getmntinfo.c head/lib/libc/sys/getfsstat.2 head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/syscalls.master head/sys/kern/syscalls.master head/sys/kern/vfs_syscalls.c head/sys/sys/syscallsubr.h Modified: head/lib/libc/gen/getmntinfo.3 ============================================================================== --- head/lib/libc/gen/getmntinfo.3 Tue Dec 27 20:06:26 2016 (r310637) +++ head/lib/libc/gen/getmntinfo.3 Tue Dec 27 20:21:11 2016 (r310638) @@ -28,7 +28,7 @@ .\" @(#)getmntinfo.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd June 9, 1993 +.Dd December 27, 2016 .Dt GETMNTINFO 3 .Os .Sh NAME @@ -41,7 +41,7 @@ .In sys/ucred.h .In sys/mount.h .Ft int -.Fn getmntinfo "struct statfs **mntbufp" "int flags" +.Fn getmntinfo "struct statfs **mntbufp" "int mode" .Sh DESCRIPTION The .Fn getmntinfo @@ -55,7 +55,7 @@ The .Fn getmntinfo function passes its -.Fa flags +.Fa mode argument transparently to .Xr getfsstat 2 . .Sh RETURN VALUES Modified: head/lib/libc/gen/getmntinfo.c ============================================================================== --- head/lib/libc/gen/getmntinfo.c Tue Dec 27 20:06:26 2016 (r310637) +++ head/lib/libc/gen/getmntinfo.c Tue Dec 27 20:21:11 2016 (r310638) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); * Return information about mounted filesystems. */ int -getmntinfo(struct statfs **mntbufp, int flags) +getmntinfo(struct statfs **mntbufp, int mode) { static struct statfs *mntbuf; static int mntsize; @@ -50,7 +50,7 @@ getmntinfo(struct statfs **mntbufp, int if (mntsize <= 0 && (mntsize = getfsstat(0, 0, MNT_NOWAIT)) < 0) return (0); - if (bufsize > 0 && (mntsize = getfsstat(mntbuf, bufsize, flags)) < 0) + if (bufsize > 0 && (mntsize = getfsstat(mntbuf, bufsize, mode)) < 0) return (0); while (bufsize <= mntsize * sizeof(struct statfs)) { if (mntbuf) @@ -58,7 +58,7 @@ getmntinfo(struct statfs **mntbufp, int bufsize = (mntsize + 1) * sizeof(struct statfs); if ((mntbuf = malloc(bufsize)) == NULL) return (0); - if ((mntsize = getfsstat(mntbuf, bufsize, flags)) < 0) + if ((mntsize = getfsstat(mntbuf, bufsize, mode)) < 0) return (0); } *mntbufp = mntbuf; Modified: head/lib/libc/sys/getfsstat.2 ============================================================================== --- head/lib/libc/sys/getfsstat.2 Tue Dec 27 20:06:26 2016 (r310637) +++ head/lib/libc/sys/getfsstat.2 Tue Dec 27 20:21:11 2016 (r310638) @@ -28,7 +28,7 @@ .\" @(#)getfsstat.2 8.3 (Berkeley) 5/25/95 .\" $FreeBSD$ .\" -.Dd November 6, 2016 +.Dd December 27, 2016 .Dt GETFSSTAT 2 .Os .Sh NAME @@ -41,7 +41,7 @@ .In sys/ucred.h .In sys/mount.h .Ft int -.Fn getfsstat "struct statfs *buf" "long bufsize" "int flags" +.Fn getfsstat "struct statfs *buf" "long bufsize" "int mode" .Sh DESCRIPTION The .Fn getfsstat @@ -74,11 +74,11 @@ is given as NULL, returns just the number of mounted file systems. .Pp Normally -.Fa flags +.Fa mode should be specified as .Dv MNT_WAIT . If -.Fa flags +.Fa mode is set to .Dv MNT_NOWAIT , .Fn getfsstat @@ -108,6 +108,12 @@ The .Fa buf argument points to an invalid address. +.It Bq Er EINVAL +.Fa mode +is set to a value other than +.Dv MNT_WAIT +or +.Dv MNT_NOWAIT . .It Bq Er EIO An .Tn I/O Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Tue Dec 27 20:06:26 2016 (r310637) +++ head/sys/compat/freebsd32/freebsd32_misc.c Tue Dec 27 20:21:11 2016 (r310638) @@ -253,7 +253,7 @@ freebsd4_freebsd32_getfsstat(struct thre count = uap->bufsize / sizeof(struct statfs32); size = count * sizeof(struct statfs); - error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE, uap->flags); + error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE, uap->mode); if (size > 0) { sp = buf; copycount = count; Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Tue Dec 27 20:06:26 2016 (r310637) +++ head/sys/compat/freebsd32/syscalls.master Tue Dec 27 20:21:11 2016 (r310638) @@ -89,7 +89,7 @@ obreak_args int 18 AUE_GETFSSTAT COMPAT4 { int freebsd32_getfsstat( \ struct statfs32 *buf, long bufsize, \ - int flags); } + int mode); } 19 AUE_LSEEK COMPAT { int freebsd32_lseek(int fd, int offset, \ int whence); } 20 AUE_GETPID NOPROTO { pid_t getpid(void); } @@ -711,7 +711,7 @@ off_t *sbytes, int flags); } 394 AUE_NULL UNIMPL mac_syscall 395 AUE_GETFSSTAT NOPROTO { int getfsstat(struct statfs *buf, \ - long bufsize, int flags); } + long bufsize, int mode); } 396 AUE_STATFS NOPROTO { int statfs(char *path, \ struct statfs *buf); } 397 AUE_FSTATFS NOPROTO { int fstatfs(int fd, struct statfs *buf); } Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Tue Dec 27 20:06:26 2016 (r310637) +++ head/sys/kern/syscalls.master Tue Dec 27 20:21:11 2016 (r310638) @@ -85,7 +85,7 @@ 17 AUE_NULL STD { int obreak(char *nsize); } break \ obreak_args int 18 AUE_GETFSSTAT COMPAT4 { int getfsstat(struct ostatfs *buf, \ - long bufsize, int flags); } + long bufsize, int mode); } 19 AUE_LSEEK COMPAT { long lseek(int fd, long offset, \ int whence); } 20 AUE_GETPID STD { pid_t getpid(void); } @@ -706,7 +706,7 @@ 394 AUE_NULL STD { int mac_syscall(const char *policy, \ int call, void *arg); } 395 AUE_GETFSSTAT STD { int getfsstat(struct statfs *buf, \ - long bufsize, int flags); } + long bufsize, int mode); } 396 AUE_STATFS STD { int statfs(char *path, \ struct statfs *buf); } 397 AUE_FSTATFS STD { int fstatfs(int fd, struct statfs *buf); } Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Tue Dec 27 20:06:26 2016 (r310637) +++ head/sys/kern/vfs_syscalls.c Tue Dec 27 20:21:11 2016 (r310638) @@ -412,7 +412,7 @@ out: struct getfsstat_args { struct statfs *buf; long bufsize; - int flags; + int mode; }; #endif int @@ -421,7 +421,7 @@ sys_getfsstat(td, uap) register struct getfsstat_args /* { struct statfs *buf; long bufsize; - int flags; + int mode; } */ *uap; { size_t count; @@ -430,7 +430,7 @@ sys_getfsstat(td, uap) if (uap->bufsize < 0 || uap->bufsize > SIZE_MAX) return (EINVAL); error = kern_getfsstat(td, &uap->buf, uap->bufsize, &count, - UIO_USERSPACE, uap->flags); + UIO_USERSPACE, uap->mode); if (error == 0) td->td_retval[0] = count; return (error); @@ -443,13 +443,20 @@ sys_getfsstat(td, uap) */ int kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize, - size_t *countp, enum uio_seg bufseg, int flags) + size_t *countp, enum uio_seg bufseg, int mode) { struct mount *mp, *nmp; struct statfs *sfsp, *sp, sb, *tofree; size_t count, maxcount; int error; + switch (mode) { + case MNT_WAIT: + case MNT_NOWAIT: + break; + default: + return (EINVAL); + } restart: maxcount = bufsize / sizeof(struct statfs); if (bufsize == 0) { @@ -483,7 +490,7 @@ restart: continue; } #endif - if (flags == MNT_WAIT) { + if (mode == MNT_WAIT) { if (vfs_busy(mp, MBF_MNTLSTLOCK) != 0) { /* * If vfs_busy() failed, and MBF_NOWAIT @@ -512,10 +519,10 @@ restart: sp->f_namemax = NAME_MAX; sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; /* - * If MNT_NOWAIT or MNT_LAZY is specified, do not - * refresh the fsstat cache. + * If MNT_NOWAIT is specified, do not refresh + * the fsstat cache. */ - if (flags != MNT_LAZY && flags != MNT_NOWAIT) { + if (mode != MNT_NOWAIT) { error = VFS_STATFS(mp, sp); if (error != 0) { mtx_lock(&mountlist_mtx); @@ -620,7 +627,7 @@ freebsd4_fstatfs(td, uap) struct freebsd4_getfsstat_args { struct ostatfs *buf; long bufsize; - int flags; + int mode; }; #endif int @@ -629,7 +636,7 @@ freebsd4_getfsstat(td, uap) register struct freebsd4_getfsstat_args /* { struct ostatfs *buf; long bufsize; - int flags; + int mode; } */ *uap; { struct statfs *buf, *sp; @@ -644,7 +651,7 @@ freebsd4_getfsstat(td, uap) return (EINVAL); size = count * sizeof(struct statfs); error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE, - uap->flags); + uap->mode); td->td_retval[0] = count; if (size != 0) { sp = buf; Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Tue Dec 27 20:06:26 2016 (r310637) +++ head/sys/sys/syscallsubr.h Tue Dec 27 20:21:11 2016 (r310638) @@ -109,7 +109,7 @@ int kern_futimens(struct thread *td, int int kern_getdirentries(struct thread *td, int fd, char *buf, u_int count, long *basep, ssize_t *residp, enum uio_seg bufseg); int kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize, - size_t *countp, enum uio_seg bufseg, int flags); + size_t *countp, enum uio_seg bufseg, int mode); int kern_getitimer(struct thread *, u_int, struct itimerval *); int kern_getppid(struct thread *); int kern_getpeername(struct thread *td, int fd, struct sockaddr **sa, From owner-svn-src-head@freebsd.org Tue Dec 27 20:22:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10582C93D67; Tue, 27 Dec 2016 20:22:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C567E12BA; Tue, 27 Dec 2016 20:22:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBRKMIdd079142; Tue, 27 Dec 2016 20:22:18 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBRKMH4s079131; Tue, 27 Dec 2016 20:22:17 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612272022.uBRKMH4s079131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 27 Dec 2016 20:22:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310639 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 20:22:20 -0000 Author: jhb Date: Tue Dec 27 20:22:17 2016 New Revision: 310639 URL: https://svnweb.freebsd.org/changeset/base/310639 Log: Regen after r310638. Differential Revision: https://reviews.freebsd.org/D8854 Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Tue Dec 27 20:21:11 2016 (r310638) +++ head/sys/compat/freebsd32/freebsd32_proto.h Tue Dec 27 20:22:17 2016 (r310639) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 305954 2016-09-18 22:03:07Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 310638 2016-12-27 20:21:11Z jhb */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -917,7 +917,7 @@ int ofreebsd32_getdirentries(struct thre struct freebsd4_freebsd32_getfsstat_args { char buf_l_[PADL_(struct statfs32 *)]; struct statfs32 * buf; char buf_r_[PADR_(struct statfs32 *)]; char bufsize_l_[PADL_(long)]; long bufsize; char bufsize_r_[PADR_(long)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; }; struct freebsd4_freebsd32_statfs_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Tue Dec 27 20:21:11 2016 (r310638) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Tue Dec 27 20:22:17 2016 (r310639) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 305954 2016-09-18 22:03:07Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 310638 2016-12-27 20:21:11Z jhb */ #define FREEBSD32_SYS_syscall 0 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Tue Dec 27 20:21:11 2016 (r310638) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Tue Dec 27 20:22:17 2016 (r310639) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 305954 2016-09-18 22:03:07Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 310638 2016-12-27 20:21:11Z jhb */ const char *freebsd32_syscallnames[] = { Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Tue Dec 27 20:21:11 2016 (r310638) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Tue Dec 27 20:22:17 2016 (r310639) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 305954 2016-09-18 22:03:07Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 310638 2016-12-27 20:21:11Z jhb */ #include "opt_compat.h" Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Tue Dec 27 20:21:11 2016 (r310638) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Tue Dec 27 20:22:17 2016 (r310639) @@ -1960,7 +1960,7 @@ systrace_args(int sysnum, void *params, struct getfsstat_args *p = params; uarg[0] = (intptr_t) p->buf; /* struct statfs * */ iarg[1] = p->bufsize; /* long */ - iarg[2] = p->flags; /* int */ + iarg[2] = p->mode; /* int */ *n_args = 3; break; } Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Tue Dec 27 20:21:11 2016 (r310638) +++ head/sys/kern/init_sysent.c Tue Dec 27 20:22:17 2016 (r310639) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 309677 2016-12-07 16:11:55Z rwatson + * created from FreeBSD: head/sys/kern/syscalls.master 310638 2016-12-27 20:21:11Z jhb */ #include "opt_compat.h" Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Tue Dec 27 20:21:11 2016 (r310638) +++ head/sys/kern/syscalls.c Tue Dec 27 20:22:17 2016 (r310639) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 309677 2016-12-07 16:11:55Z rwatson + * created from FreeBSD: head/sys/kern/syscalls.master 310638 2016-12-27 20:21:11Z jhb */ const char *syscallnames[] = { Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Tue Dec 27 20:21:11 2016 (r310638) +++ head/sys/kern/systrace_args.c Tue Dec 27 20:22:17 2016 (r310639) @@ -2072,7 +2072,7 @@ systrace_args(int sysnum, void *params, struct getfsstat_args *p = params; uarg[0] = (intptr_t) p->buf; /* struct statfs * */ iarg[1] = p->bufsize; /* long */ - iarg[2] = p->flags; /* int */ + iarg[2] = p->mode; /* int */ *n_args = 3; break; } Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Tue Dec 27 20:21:11 2016 (r310638) +++ head/sys/sys/syscall.h Tue Dec 27 20:22:17 2016 (r310639) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 309677 2016-12-07 16:11:55Z rwatson + * created from FreeBSD: head/sys/kern/syscalls.master 310638 2016-12-27 20:21:11Z jhb */ #define SYS_syscall 0 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Tue Dec 27 20:21:11 2016 (r310638) +++ head/sys/sys/syscall.mk Tue Dec 27 20:22:17 2016 (r310639) @@ -1,7 +1,7 @@ # FreeBSD system call object files. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 309677 2016-12-07 16:11:55Z rwatson +# created from FreeBSD: head/sys/kern/syscalls.master 310638 2016-12-27 20:21:11Z jhb MIASM = \ syscall.o \ exit.o \ Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Tue Dec 27 20:21:11 2016 (r310638) +++ head/sys/sys/sysproto.h Tue Dec 27 20:22:17 2016 (r310639) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 309677 2016-12-07 16:11:55Z rwatson + * created from FreeBSD: head/sys/kern/syscalls.master 310638 2016-12-27 20:21:11Z jhb */ #ifndef _SYS_SYSPROTO_H_ @@ -1102,7 +1102,7 @@ struct mac_syscall_args { struct getfsstat_args { char buf_l_[PADL_(struct statfs *)]; struct statfs * buf; char buf_r_[PADR_(struct statfs *)]; char bufsize_l_[PADL_(long)]; long bufsize; char bufsize_r_[PADR_(long)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; }; struct statfs_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; @@ -2350,7 +2350,7 @@ int ogetdirentries(struct thread *, stru struct freebsd4_getfsstat_args { char buf_l_[PADL_(struct ostatfs *)]; struct ostatfs * buf; char buf_r_[PADR_(struct ostatfs *)]; char bufsize_l_[PADL_(long)]; long bufsize; char bufsize_r_[PADR_(long)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; }; struct freebsd4_statfs_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; From owner-svn-src-head@freebsd.org Tue Dec 27 21:11:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 065CDC9352C; Tue, 27 Dec 2016 21:11:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4E3A14BD; Tue, 27 Dec 2016 21:11:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBRLBtga001229; Tue, 27 Dec 2016 21:11:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBRLBsBf001226; Tue, 27 Dec 2016 21:11:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612272111.uBRLBsBf001226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Dec 2016 21:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310640 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 21:11:56 -0000 Author: mav Date: Tue Dec 27 21:11:54 2016 New Revision: 310640 URL: https://svnweb.freebsd.org/changeset/base/310640 Log: Add support for revert to defaults (RTD) bit in MODE SELECT. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl.h head/sys/cam/ctl/ctl_cmd_table.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Tue Dec 27 20:22:17 2016 (r310639) +++ head/sys/cam/ctl/ctl.c Tue Dec 27 21:11:54 2016 (r310640) @@ -6158,10 +6158,13 @@ bailout_no_done: int ctl_mode_select(struct ctl_scsiio *ctsio) { - int param_len, pf, sp; - int header_size, bd_len; + struct ctl_lun *lun; union ctl_modepage_info *modepage_info; + int bd_len, i, header_size, param_len, pf, rtd, sp; + uint32_t initidx; + lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); switch (ctsio->cdb[0]) { case MODE_SELECT_6: { struct scsi_mode_select_6 *cdb; @@ -6169,6 +6172,7 @@ ctl_mode_select(struct ctl_scsiio *ctsio cdb = (struct scsi_mode_select_6 *)ctsio->cdb; pf = (cdb->byte2 & SMS_PF) ? 1 : 0; + rtd = (cdb->byte2 & SMS_RTD) ? 1 : 0; sp = (cdb->byte2 & SMS_SP) ? 1 : 0; param_len = cdb->length; header_size = sizeof(struct scsi_mode_header_6); @@ -6180,6 +6184,7 @@ ctl_mode_select(struct ctl_scsiio *ctsio cdb = (struct scsi_mode_select_10 *)ctsio->cdb; pf = (cdb->byte2 & SMS_PF) ? 1 : 0; + rtd = (cdb->byte2 & SMS_RTD) ? 1 : 0; sp = (cdb->byte2 & SMS_SP) ? 1 : 0; param_len = scsi_2btoul(cdb->length); header_size = sizeof(struct scsi_mode_header_10); @@ -6191,6 +6196,30 @@ ctl_mode_select(struct ctl_scsiio *ctsio return (CTL_RETVAL_COMPLETE); } + if (rtd) { + if (param_len != 0) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 0, + /*command*/ 1, /*field*/ 0, + /*bit_valid*/ 0, /*bit*/ 0); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + /* Revert to defaults. */ + ctl_init_page_index(lun); + mtx_lock(&lun->lun_lock); + ctl_est_ua_all(lun, initidx, CTL_UA_MODE_CHANGE); + mtx_unlock(&lun->lun_lock); + for (i = 0; i < CTL_NUM_MODE_PAGES; i++) { + ctl_isc_announce_mode(lun, -1, + lun->mode_pages.index[i].page_code & SMPH_PC_MASK, + lun->mode_pages.index[i].subpage); + } + ctl_set_success(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + /* * From SPC-3: * "A parameter list length of zero indicates that the Data-Out Buffer @@ -9563,6 +9592,11 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio * eid_ptr->flags4 = SVPD_EID_LUICLR; /* + * We support revert to defaults (RTD) bit in MODE SELECT. + */ + eid_ptr->flags5 = SVPD_EID_RTD_SUP; + + /* * XXX KDM in order to correctly answer this, we would need * information from the SIM to determine how much sense data it * can send. So this would really be a path inquiry field, most Modified: head/sys/cam/ctl/ctl.h ============================================================================== --- head/sys/cam/ctl/ctl.h Tue Dec 27 20:22:17 2016 (r310639) +++ head/sys/cam/ctl/ctl.h Tue Dec 27 21:11:54 2016 (r310640) @@ -78,14 +78,8 @@ struct ctl_modepage_header { int32_t len_left; }; -struct ctl_modepage_aps { - struct ctl_modepage_header header; - uint8_t lock_active; -}; - union ctl_modepage_info { struct ctl_modepage_header header; - struct ctl_modepage_aps aps; }; /* Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Tue Dec 27 20:22:17 2016 (r310639) +++ head/sys/cam/ctl/ctl_cmd_table.c Tue Dec 27 21:11:54 2016 (r310640) @@ -990,7 +990,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_NONE, 6, {0x11, 0, 0, 0xff, 0x07}}, + CTL_LUN_PAT_NONE, 6, {0x13, 0, 0, 0xff, 0x07}}, /* 16 RESERVE(6) */ {ctl_scsi_reserve, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | @@ -1260,7 +1260,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_NONE, 10, {0x11, 0, 0, 0, 0, 0, 0xff, 0xff, 0x07} }, + CTL_LUN_PAT_NONE, 10, {0x13, 0, 0, 0, 0, 0, 0xff, 0xff, 0x07} }, /* 56 RESERVE(10) */ {ctl_scsi_reserve, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | From owner-svn-src-head@freebsd.org Tue Dec 27 22:14:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D440FC9480C; Tue, 27 Dec 2016 22:14:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87B111A2D; Tue, 27 Dec 2016 22:14:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBRMEfHw028306; Tue, 27 Dec 2016 22:14:41 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBRMEf2c028305; Tue, 27 Dec 2016 22:14:41 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612272214.uBRMEf2c028305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 27 Dec 2016 22:14:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310642 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 22:14:42 -0000 Author: tuexen Date: Tue Dec 27 22:14:41 2016 New Revision: 310642 URL: https://svnweb.freebsd.org/changeset/base/310642 Log: Consistent handling of errors reported from the lower layer. MFC after: 3 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Tue Dec 27 21:16:08 2016 (r310641) +++ head/sys/netinet/sctp_output.c Tue Dec 27 22:14:41 2016 (r310642) @@ -4678,7 +4678,7 @@ sctp_send_initiate(struct sctp_inpcb *in struct sctp_supported_chunk_types_param *pr_supported; struct sctp_paramhdr *ph; int cnt_inits_to = 0; - int ret; + int error; uint16_t num_ext, chunk_len, padding_len, parameter_len; /* INIT's always go to the primary (and usually ONLY address) */ @@ -4927,14 +4927,21 @@ sctp_send_initiate(struct sctp_inpcb *in } } SCTPDBG(SCTP_DEBUG_OUTPUT4, "Sending INIT - calls lowlevel_output\n"); - ret = sctp_lowlevel_chunk_output(inp, stcb, net, + if ((error = sctp_lowlevel_chunk_output(inp, stcb, net, (struct sockaddr *)&net->ro._l_addr, m, 0, NULL, 0, 0, 0, 0, inp->sctp_lport, stcb->rport, htonl(0), net->port, NULL, 0, 0, - so_locked); - SCTPDBG(SCTP_DEBUG_OUTPUT4, "lowlevel_output - %d\n", ret); + so_locked))) { + SCTPDBG(SCTP_DEBUG_OUTPUT4, "Gak send error %d\n", error); + if (error == ENOBUFS) { + stcb->asoc.ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); + } + } else { + stcb->asoc.ifp_had_enobuf = 0; + } SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time); } @@ -5502,6 +5509,7 @@ sctp_send_initiate_ack(struct sctp_inpcb uint16_t his_limit, i_want; int abort_flag; int nat_friendly = 0; + int error; struct socket *so; uint16_t num_ext, chunk_len, padding_len, parameter_len; @@ -6116,12 +6124,24 @@ do_a_abort: over_addr = NULL; } - (void)sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, NULL, 0, 0, + if ((error = sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, NULL, 0, 0, 0, 0, inp->sctp_lport, sh->src_port, init_chk->init.initiate_tag, port, over_addr, mflowtype, mflowid, - SCTP_SO_NOT_LOCKED); + SCTP_SO_NOT_LOCKED))) { + SCTPDBG(SCTP_DEBUG_OUTPUT4, "Gak send error %d\n", error); + if (error == ENOBUFS) { + if (asoc != NULL) { + asoc->ifp_had_enobuf = 1; + } + SCTP_STAT_INCR(sctps_lowlevelerr); + } + } else { + if (asoc != NULL) { + asoc->ifp_had_enobuf = 0; + } + } SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); } @@ -8821,8 +8841,8 @@ no_data_fill: SCTP_STAT_INCR(sctps_lowlevelerrusr); } if (error == ENOBUFS) { - SCTP_STAT_INCR(sctps_lowlevelerr); asoc->ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); } if (error == EHOSTUNREACH) { /* @@ -9509,8 +9529,14 @@ sctp_chunk_retransmission(struct sctp_in chk->whoTo->port, NULL, 0, 0, so_locked))) { - SCTP_STAT_INCR(sctps_lowlevelerr); + SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); + if (error == ENOBUFS) { + asoc->ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); + } return (error); + } else { + asoc->ifp_had_enobuf = 0; } endofchain = NULL; auth = NULL; @@ -9781,8 +9807,14 @@ one_chunk_around: 0, 0, so_locked))) { /* error, we could not output */ - SCTP_STAT_INCR(sctps_lowlevelerr); + SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); + if (error == ENOBUFS) { + asoc->ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); + } return (error); + } else { + asoc->ifp_had_enobuf = 0; } endofchain = NULL; auth = NULL; @@ -10872,6 +10904,7 @@ sctp_send_abort_tcb(struct sctp_tcb *stc struct sctp_nets *net; uint32_t vtag; uint32_t auth_offset = 0; + int error; uint16_t cause_len, chunk_len, padding_len; SCTP_TCB_LOCK_ASSERT(stcb); @@ -10943,13 +10976,21 @@ sctp_send_abort_tcb(struct sctp_tcb *stc return; } } - (void)sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net, + if ((error = sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net, (struct sockaddr *)&net->ro._l_addr, m_out, auth_offset, auth, stcb->asoc.authinfo.active_keyid, 1, 0, 0, stcb->sctp_ep->sctp_lport, stcb->rport, htonl(vtag), stcb->asoc.primary_destination->port, NULL, 0, 0, - so_locked); + so_locked))) { + SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); + if (error == ENOBUFS) { + stcb->asoc.ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); + } + } else { + stcb->asoc.ifp_had_enobuf = 0; + } SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); } @@ -10962,6 +11003,7 @@ sctp_send_shutdown_complete(struct sctp_ struct mbuf *m_shutdown_comp; struct sctp_shutdown_complete_chunk *shutdown_complete; uint32_t vtag; + int error; uint8_t flags; m_shutdown_comp = sctp_get_mbuf_for_msg(sizeof(struct sctp_chunkhdr), 0, M_NOWAIT, 1, MT_HEADER); @@ -10981,14 +11023,22 @@ sctp_send_shutdown_complete(struct sctp_ shutdown_complete->ch.chunk_flags = flags; shutdown_complete->ch.chunk_length = htons(sizeof(struct sctp_shutdown_complete_chunk)); SCTP_BUF_LEN(m_shutdown_comp) = sizeof(struct sctp_shutdown_complete_chunk); - (void)sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net, + if ((error = sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net, (struct sockaddr *)&net->ro._l_addr, m_shutdown_comp, 0, NULL, 0, 1, 0, 0, stcb->sctp_ep->sctp_lport, stcb->rport, htonl(vtag), net->port, NULL, 0, 0, - SCTP_SO_NOT_LOCKED); + SCTP_SO_NOT_LOCKED))) { + SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); + if (error == ENOBUFS) { + stcb->asoc.ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); + } + } else { + stcb->asoc.ifp_had_enobuf = 0; + } SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); return; } From owner-svn-src-head@freebsd.org Tue Dec 27 22:28:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3ADB1C94B5C; Tue, 27 Dec 2016 22:28:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A8321023; Tue, 27 Dec 2016 22:28:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBRMSEuV032474; Tue, 27 Dec 2016 22:28:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBRMSEOK032473; Tue, 27 Dec 2016 22:28:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612272228.uBRMSEOK032473@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Dec 2016 22:28:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310643 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 22:28:15 -0000 Author: mav Date: Tue Dec 27 22:28:14 2016 New Revision: 310643 URL: https://svnweb.freebsd.org/changeset/base/310643 Log: Missed piece of r310640. MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Tue Dec 27 22:14:41 2016 (r310642) +++ head/sys/cam/scsi/scsi_all.h Tue Dec 27 22:28:14 2016 (r310643) @@ -228,6 +228,7 @@ struct scsi_mode_select_6 u_int8_t opcode; u_int8_t byte2; #define SMS_SP 0x01 +#define SMS_RTD 0x02 #define SMS_PF 0x10 u_int8_t unused[2]; u_int8_t length; From owner-svn-src-head@freebsd.org Tue Dec 27 22:31:07 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6EE41C94BE0; Tue, 27 Dec 2016 22:31:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3EBFF1247; Tue, 27 Dec 2016 22:31:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBRMV66W034750; Tue, 27 Dec 2016 22:31:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBRMV6dO034748; Tue, 27 Dec 2016 22:31:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612272231.uBRMV6dO034748@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Dec 2016 22:31:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310644 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 22:31:07 -0000 Author: mav Date: Tue Dec 27 22:31:06 2016 New Revision: 310644 URL: https://svnweb.freebsd.org/changeset/base/310644 Log: Fix/synchronize field types in struct ctl_modepage_header. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Tue Dec 27 22:28:14 2016 (r310643) +++ head/sys/cam/ctl/ctl.c Tue Dec 27 22:31:06 2016 (r310644) @@ -5939,7 +5939,7 @@ ctl_do_mode_select(union ctl_io *io) int page_len, page_len_offset, page_len_size; union ctl_modepage_info *modepage_info; struct ctl_lun *lun; - int *len_left, *len_used; + uint16_t *len_left, *len_used; int retval, i; ctsio = &io->scsiio; Modified: head/sys/cam/ctl/ctl.h ============================================================================== --- head/sys/cam/ctl/ctl.h Tue Dec 27 22:28:14 2016 (r310643) +++ head/sys/cam/ctl/ctl.h Tue Dec 27 22:31:06 2016 (r310644) @@ -74,8 +74,8 @@ struct ctl_port_entry { struct ctl_modepage_header { uint8_t page_code; uint8_t subpage; - int32_t len_used; - int32_t len_left; + uint16_t len_used; + uint16_t len_left; }; union ctl_modepage_info { From owner-svn-src-head@freebsd.org Tue Dec 27 22:37:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 354A3C94E7A; Tue, 27 Dec 2016 22:37:26 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03E9E194C; Tue, 27 Dec 2016 22:37:25 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBRMbPx6036727; Tue, 27 Dec 2016 22:37:25 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBRMbO6S036722; Tue, 27 Dec 2016 22:37:24 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201612272237.uBRMbO6S036722@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 27 Dec 2016 22:37:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310645 - in head/sys: conf dev/intel modules modules/intelspi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 22:37:26 -0000 Author: gonzo Date: Tue Dec 27 22:37:24 2016 New Revision: 310645 URL: https://svnweb.freebsd.org/changeset/base/310645 Log: [intelspi] Add SPI driver for Intel BayTrail SoC Add SPI mode (PIO-only) support for Intel Synchronous Serial Port that can be found in several Intel's products starting from PXA family. Most of implementations have slight differences in behavior and in addresses for registers subset. This driver covers only BayTrail SoC implementation for it's the only hardware I have to test it on. Driver attaches to ACPI bus only and does not have PCI or FDT support for now due to lack of hardware to test it on. "intelspi" is the best name I've managed to come up with. Linux driver name (spi-pxa2xx) does not make sense because current implementation does not support actual PXA2xx SoCs. And as far as I know there is no codename assigned to Intel SSP chip. Reviewed by: br, manu MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D8896 Added: head/sys/dev/intel/ head/sys/dev/intel/spi.c (contents, props changed) head/sys/modules/intelspi/ head/sys/modules/intelspi/Makefile (contents, props changed) Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Dec 27 22:31:06 2016 (r310644) +++ head/sys/conf/files.amd64 Tue Dec 27 22:37:24 2016 (r310645) @@ -228,6 +228,7 @@ dev/if_ndis/if_ndis.c optional ndis dev/if_ndis/if_ndis_pccard.c optional ndis pccard dev/if_ndis/if_ndis_pci.c optional ndis cardbus | ndis pci dev/if_ndis/if_ndis_usb.c optional ndis usb +dev/intel/spi.c optional intelspi dev/io/iodev.c optional io dev/ioat/ioat.c optional ioat pci dev/ioat/ioat_test.c optional ioat pci Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Tue Dec 27 22:31:06 2016 (r310644) +++ head/sys/conf/files.i386 Tue Dec 27 22:37:24 2016 (r310645) @@ -275,6 +275,7 @@ dev/if_ndis/if_ndis.c optional ndis dev/if_ndis/if_ndis_pccard.c optional ndis pccard dev/if_ndis/if_ndis_pci.c optional ndis cardbus | ndis pci dev/if_ndis/if_ndis_usb.c optional ndis usb +dev/intel/spi.c optional intelspi dev/io/iodev.c optional io dev/ipmi/ipmi.c optional ipmi dev/ipmi/ipmi_acpi.c optional ipmi acpi Added: head/sys/dev/intel/spi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/intel/spi.c Tue Dec 27 22:37:24 2016 (r310645) @@ -0,0 +1,533 @@ +/*- + * Copyright (c) 2016 Oleksandr Tymoshenko + * All rights reserved. + * + * 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 AUTHOR 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 AUTHOR 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 +__FBSDID("$FreeBSD$"); + +#include "opt_acpi.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include + +#include "spibus_if.h" + +/** + * Macros for driver mutex locking + */ +#define INTELSPI_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define INTELSPI_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) +#define INTELSPI_LOCK_INIT(_sc) \ + mtx_init(&_sc->sc_mtx, device_get_nameunit((_sc)->sc_dev), \ + "intelspi", MTX_DEF) +#define INTELSPI_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx) +#define INTELSPI_ASSERT_LOCKED(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) +#define INTELSPI_ASSERT_UNLOCKED(_sc) mtx_assert(&(_sc)->sc_mtx, MA_NOTOWNED) + +#define INTELSPI_WRITE(_sc, _off, _val) \ + bus_write_4((_sc)->sc_mem_res, (_off), (_val)) +#define INTELSPI_READ(_sc, _off) \ + bus_read_4((_sc)->sc_mem_res, (_off)) + +#define INTELSPI_BUSY 0x1 +#define TX_FIFO_THRESHOLD 2 +#define RX_FIFO_THRESHOLD 2 +#define CLOCK_DIV_10MHZ 5 +#define DATA_SIZE_8BITS 8 + +#define CS_LOW 0 +#define CS_HIGH 1 + +#define INTELSPI_SSPREG_SSCR0 0x0 +#define SSCR0_SCR(n) (((n) - 1) << 8) +#define SSCR0_SSE (1 << 7) +#define SSCR0_FRF_SPI (0 << 4) +#define SSCR0_DSS(n) (((n) - 1) << 0) +#define INTELSPI_SSPREG_SSCR1 0x4 +#define SSCR1_TINTE (1 << 19) +#define SSCR1_RFT(n) (((n) - 1) << 10) +#define SSCR1_RFT_MASK (0xf << 10) +#define SSCR1_TFT(n) (((n) - 1) << 6) +#define SSCR1_SPI_SPH (1 << 4) +#define SSCR1_SPI_SPO (1 << 3) +#define SSCR1_MODE_MASK (SSCR1_SPI_SPO | SSCR1_SPI_SPH) +#define SSCR1_MODE_0 (0) +#define SSCR1_MODE_1 (SSCR1_SPI_SPH) +#define SSCR1_MODE_2 (SSCR1_SPI_SPO) +#define SSCR1_MODE_3 (SSCR1_SPI_SPO | SSCR1_SPI_SPH) +#define SSCR1_TIE (1 << 1) +#define SSCR1_RIE (1 << 0) +#define INTELSPI_SSPREG_SSSR 0x8 +#define SSSR_RFL_MASK (0xf << 12) +#define SSSR_TFL_MASK (0xf << 8) +#define SSSR_RNE (1 << 3) +#define SSSR_TNF (1 << 2) +#define INTELSPI_SSPREG_SSITR 0xC +#define INTELSPI_SSPREG_SSDR 0x10 +#define INTELSPI_SSPREG_SSTO 0x28 +#define INTELSPI_SSPREG_SSPSP 0x2C +#define INTELSPI_SSPREG_SSTSA 0x30 +#define INTELSPI_SSPREG_SSRSA 0x34 +#define INTELSPI_SSPREG_SSTSS 0x38 +#define INTELSPI_SSPREG_SSACD 0x3C +#define INTELSPI_SSPREG_ITF 0x40 +#define INTELSPI_SSPREG_SITF 0x44 +#define INTELSPI_SSPREG_SIRF 0x48 +#define INTELSPI_SSPREG_PRV_CLOCK_PARAMS 0x400 +#define INTELSPI_SSPREG_RESETS 0x404 +#define INTELSPI_SSPREG_GENERAL 0x408 +#define INTELSPI_SSPREG_SSP_REG 0x40C +#define INTELSPI_SSPREG_SPI_CS_CTRL 0x418 +#define SPI_CS_CTRL_CS_MASK (3) +#define SPI_CS_CTRL_SW_MODE (1 << 0) +#define SPI_CS_CTRL_HW_MODE (1 << 0) +#define SPI_CS_CTRL_CS_HIGH (1 << 1) +#define SPI_CS_CTRL_CS_LOW (0 << 1) + +struct intelspi_softc { + ACPI_HANDLE sc_handle; + device_t sc_dev; + struct mtx sc_mtx; + int sc_mem_rid; + struct resource *sc_mem_res; + int sc_irq_rid; + struct resource *sc_irq_res; + void *sc_irq_ih; + struct spi_command *sc_cmd; + uint32_t sc_len; + uint32_t sc_read; + uint32_t sc_flags; + uint32_t sc_written; +}; + +static int intelspi_probe(device_t dev); +static int intelspi_attach(device_t dev); +static int intelspi_detach(device_t dev); +static void intelspi_intr(void *); + +static int +intelspi_txfifo_full(struct intelspi_softc *sc) +{ + uint32_t sssr; + + INTELSPI_ASSERT_LOCKED(sc); + + sssr = INTELSPI_READ(sc, INTELSPI_SSPREG_SSSR); + if (sssr & SSSR_TNF) + return (0); + + return (1); +} + +static int +intelspi_rxfifo_empty(struct intelspi_softc *sc) +{ + uint32_t sssr; + + INTELSPI_ASSERT_LOCKED(sc); + + sssr = INTELSPI_READ(sc, INTELSPI_SSPREG_SSSR); + if (sssr & SSSR_RNE) + return (0); + else + return (1); +} + +static void +intelspi_fill_tx_fifo(struct intelspi_softc *sc) +{ + struct spi_command *cmd; + uint32_t written; + uint8_t *data; + + INTELSPI_ASSERT_LOCKED(sc); + + cmd = sc->sc_cmd; + while (sc->sc_written < sc->sc_len && + !intelspi_txfifo_full(sc)) { + data = (uint8_t *)cmd->tx_cmd; + written = sc->sc_written++; + + if (written >= cmd->tx_cmd_sz) { + data = (uint8_t *)cmd->tx_data; + written -= cmd->tx_cmd_sz; + } + INTELSPI_WRITE(sc, INTELSPI_SSPREG_SSDR, data[written]); + } +} + +static void +intelspi_drain_rx_fifo(struct intelspi_softc *sc) +{ + struct spi_command *cmd; + uint32_t read; + uint8_t *data; + + INTELSPI_ASSERT_LOCKED(sc); + + cmd = sc->sc_cmd; + while (sc->sc_read < sc->sc_len && + !intelspi_rxfifo_empty(sc)) { + data = (uint8_t *)cmd->rx_cmd; + read = sc->sc_read++; + if (read >= cmd->rx_cmd_sz) { + data = (uint8_t *)cmd->rx_data; + read -= cmd->rx_cmd_sz; + } + data[read] = INTELSPI_READ(sc, INTELSPI_SSPREG_SSDR) & 0xff; + } +} + +static int +intelspi_transaction_done(struct intelspi_softc *sc) +{ + int txfifo_empty; + uint32_t sssr; + + INTELSPI_ASSERT_LOCKED(sc); + + if (sc->sc_written != sc->sc_len || + sc->sc_read != sc->sc_len) + return (0); + + sssr = INTELSPI_READ(sc, INTELSPI_SSPREG_SSSR); + txfifo_empty = ((sssr & SSSR_TFL_MASK) == 0) && + (sssr & SSSR_TNF); + + if (txfifo_empty && !(sssr & SSSR_RNE)) + return (1); + + return (0); +} + +static int +intelspi_transact(struct intelspi_softc *sc) +{ + + INTELSPI_ASSERT_LOCKED(sc); + + /* TX - Fill up the FIFO. */ + intelspi_fill_tx_fifo(sc); + + /* RX - Drain the FIFO. */ + intelspi_drain_rx_fifo(sc); + + /* Check for end of transfer. */ + return intelspi_transaction_done(sc); +} + +static void +intelspi_intr(void *arg) +{ + struct intelspi_softc *sc; + uint32_t reg; + + sc = (struct intelspi_softc *)arg; + + INTELSPI_LOCK(sc); + if ((sc->sc_flags & INTELSPI_BUSY) == 0) { + INTELSPI_UNLOCK(sc); + return; + } + + /* Check if SSP if off */ + reg = INTELSPI_READ(sc, INTELSPI_SSPREG_SSSR); + if (reg == 0xffffffffU) { + INTELSPI_UNLOCK(sc); + return; + } + + /* Check for end of transfer. */ + if (intelspi_transact(sc)) { + /* Disable interrupts */ + reg = INTELSPI_READ(sc, INTELSPI_SSPREG_SSCR1); + reg &= ~(SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE); + INTELSPI_WRITE(sc, INTELSPI_SSPREG_SSCR1, reg); + wakeup(sc->sc_dev); + } + + INTELSPI_UNLOCK(sc); +} + +static void +intelspi_init(struct intelspi_softc *sc) +{ + uint32_t reg; + + INTELSPI_WRITE(sc, INTELSPI_SSPREG_SSCR0, 0); + + /* Manual CS control */ + reg = INTELSPI_READ(sc, INTELSPI_SSPREG_SPI_CS_CTRL); + reg &= ~(SPI_CS_CTRL_CS_MASK); + reg |= (SPI_CS_CTRL_SW_MODE | SPI_CS_CTRL_CS_HIGH); + INTELSPI_WRITE(sc, INTELSPI_SSPREG_SPI_CS_CTRL, reg); + + /* Set TX/RX FIFO IRQ threshold levels */ + reg = SSCR1_TFT(TX_FIFO_THRESHOLD) | SSCR1_RFT(RX_FIFO_THRESHOLD); + /* + * Set SPI mode. This should be part of transaction or sysctl + */ + reg |= SSCR1_MODE_0; + INTELSPI_WRITE(sc, INTELSPI_SSPREG_SSCR1, reg); + + /* + * Parent clock on Minowboard Turbot is 50MHz + * divide it by 5 to set to more or less reasonable + * value. But this should be part of transaction config + * or sysctl + */ + reg = SSCR0_SCR(CLOCK_DIV_10MHZ); + /* Put SSP in SPI mode */ + reg |= SSCR0_FRF_SPI; + /* Data size */ + reg |= SSCR0_DSS(DATA_SIZE_8BITS); + /* Enable SSP */ + reg |= SSCR0_SSE; + INTELSPI_WRITE(sc, INTELSPI_SSPREG_SSCR0, reg); +} + +static void +intelspi_set_cs(struct intelspi_softc *sc, int level) +{ + uint32_t reg; + + reg = INTELSPI_READ(sc, INTELSPI_SSPREG_SPI_CS_CTRL); + reg &= ~(SPI_CS_CTRL_CS_MASK); + reg |= SPI_CS_CTRL_SW_MODE; + + if (level == CS_HIGH) + reg |= SPI_CS_CTRL_CS_HIGH; + else + reg |= SPI_CS_CTRL_CS_LOW; + + INTELSPI_WRITE(sc, INTELSPI_SSPREG_SPI_CS_CTRL, reg); +} + +static int +intelspi_transfer(device_t dev, device_t child, struct spi_command *cmd) +{ + struct intelspi_softc *sc; + int err; + uint32_t sscr1; + + sc = device_get_softc(dev); + err = 0; + + KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz, + ("TX/RX command sizes should be equal")); + KASSERT(cmd->tx_data_sz == cmd->rx_data_sz, + ("TX/RX data sizes should be equal")); + + INTELSPI_LOCK(sc); + + /* If the controller is in use wait until it is available. */ + while (sc->sc_flags & INTELSPI_BUSY) { + err = mtx_sleep(dev, &sc->sc_mtx, 0, "intelspi", 0); + if (err == EINTR) { + INTELSPI_UNLOCK(sc); + return (err); + } + } + + /* Now we have control over SPI controller. */ + sc->sc_flags = INTELSPI_BUSY; + + /* Save a pointer to the SPI command. */ + sc->sc_cmd = cmd; + sc->sc_read = 0; + sc->sc_written = 0; + sc->sc_len = cmd->tx_cmd_sz + cmd->tx_data_sz; + + /* Enable CS */ + intelspi_set_cs(sc, CS_LOW); + /* Transfer as much as possible to FIFOs */ + if (!intelspi_transact(sc)) { + /* If FIFO is not large enough - enable interrupts */ + sscr1 = INTELSPI_READ(sc, INTELSPI_SSPREG_SSCR1); + sscr1 |= (SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE); + INTELSPI_WRITE(sc, INTELSPI_SSPREG_SSCR1, sscr1); + + /* and wait for transaction to complete */ + err = mtx_sleep(dev, &sc->sc_mtx, 0, "intelspi", hz * 2); + } + + /* de-asser CS */ + intelspi_set_cs(sc, CS_HIGH); + + /* Clear transaction details */ + sc->sc_cmd = NULL; + sc->sc_read = 0; + sc->sc_written = 0; + sc->sc_len = 0; + + /* Make sure the SPI engine and interrupts are disabled. */ + sscr1 = INTELSPI_READ(sc, INTELSPI_SSPREG_SSCR1); + sscr1 &= ~(SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE); + INTELSPI_WRITE(sc, INTELSPI_SSPREG_SSCR1, sscr1); + + /* Release the controller and wakeup the next thread waiting for it. */ + sc->sc_flags = 0; + wakeup_one(dev); + INTELSPI_UNLOCK(sc); + + /* + * Check for transfer timeout. The SPI controller doesn't + * return errors. + */ + if (err == EWOULDBLOCK) { + device_printf(sc->sc_dev, "transfer timeout\n"); + err = EIO; + } + + return (err); +} + +static int +intelspi_probe(device_t dev) +{ + static char *gpio_ids[] = { "80860F0E", NULL }; + + if (acpi_disabled("spi") || + ACPI_ID_PROBE(device_get_parent(dev), dev, gpio_ids) == NULL) + return (ENXIO); + + device_set_desc(dev, "Intel SPI Controller"); + return (0); +} + +static int +intelspi_attach(device_t dev) +{ + struct intelspi_softc *sc; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_handle = acpi_get_handle(dev); + + INTELSPI_LOCK_INIT(sc); + + sc->sc_mem_rid = 0; + sc->sc_mem_res = bus_alloc_resource_any(sc->sc_dev, + SYS_RES_MEMORY, &sc->sc_mem_rid, RF_ACTIVE); + if (sc->sc_mem_res == NULL) { + device_printf(dev, "can't allocate memory resource\n"); + goto error; + } + + sc->sc_irq_rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(sc->sc_dev, + SYS_RES_IRQ, &sc->sc_irq_rid, RF_ACTIVE); + if (sc->sc_irq_res == NULL) { + device_printf(dev, "can't allocate IRQ resource\n"); + goto error; + } + + /* Hook up our interrupt handler. */ + if (bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE, + NULL, intelspi_intr, sc, &sc->sc_irq_ih)) { + device_printf(dev, "cannot setup the interrupt handler\n"); + goto error; + } + + intelspi_init(sc); + + device_add_child(dev, "spibus", -1); + + return (bus_generic_attach(dev)); + +error: + INTELSPI_LOCK_DESTROY(sc); + + if (sc->sc_mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, + sc->sc_mem_rid, sc->sc_mem_res); + + if (sc->sc_irq_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, + sc->sc_irq_rid, sc->sc_irq_res); + + return (ENXIO); +} + +static int +intelspi_detach(device_t dev) +{ + struct intelspi_softc *sc; + + sc = device_get_softc(dev); + + INTELSPI_LOCK_DESTROY(sc); + + if (sc->sc_irq_ih) + bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_ih); + + if (sc->sc_mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, + sc->sc_mem_rid, sc->sc_mem_res); + + if (sc->sc_irq_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, + sc->sc_irq_rid, sc->sc_irq_res); + + return (0); +} + +static device_method_t intelspi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, intelspi_probe), + DEVMETHOD(device_attach, intelspi_attach), + DEVMETHOD(device_detach, intelspi_detach), + + /* SPI interface */ + DEVMETHOD(spibus_transfer, intelspi_transfer), + + DEVMETHOD_END +}; + +static driver_t intelspi_driver = { + "spi", + intelspi_methods, + sizeof(struct intelspi_softc), +}; + +static devclass_t intelspi_devclass; +DRIVER_MODULE(intelspi, acpi, intelspi_driver, intelspi_devclass, 0, 0); +MODULE_DEPEND(intelspi, acpi, 1, 1, 1); +MODULE_DEPEND(intelspi, spibus, 1, 1, 1); Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Tue Dec 27 22:31:06 2016 (r310644) +++ head/sys/modules/Makefile Tue Dec 27 22:37:24 2016 (r310645) @@ -166,6 +166,7 @@ SUBDIR= \ ${_igb} \ ${_iir} \ imgact_binmisc \ + ${_intelspi} \ ${_io} \ ${_ioat} \ ${_ipoib} \ @@ -627,6 +628,7 @@ _hyperv= hyperv _ichwd= ichwd _ida= ida _iir= iir +_intelspi= intelspi _ipmi= ipmi _ips= ips _isci= isci Added: head/sys/modules/intelspi/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/intelspi/Makefile Tue Dec 27 22:37:24 2016 (r310645) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../dev/intel +KMOD= intelspi +SRCS= spi.c +SRCS+= acpi_if.h device_if.h bus_if.h spibus_if.h + +.include From owner-svn-src-head@freebsd.org Tue Dec 27 22:38:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28265C94EEB; Tue, 27 Dec 2016 22:38:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC0A51AE6; Tue, 27 Dec 2016 22:38:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBRMcjiH036831; Tue, 27 Dec 2016 22:38:45 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBRMcjxJ036830; Tue, 27 Dec 2016 22:38:45 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612272238.uBRMcjxJ036830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Dec 2016 22:38:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310646 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 22:38:46 -0000 Author: mav Date: Tue Dec 27 22:38:44 2016 New Revision: 310646 URL: https://svnweb.freebsd.org/changeset/base/310646 Log: Do not update "saved" mode page on every MODE SELECT. We do not have non-volatile memory to really save those values, so we neither report nor support this capability. Also saved mode pages are not replicated between HA peers now. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Tue Dec 27 22:37:24 2016 (r310645) +++ head/sys/cam/ctl/ctl.c Tue Dec 27 22:38:44 2016 (r310646) @@ -5833,7 +5833,7 @@ ctl_default_page_handler(struct ctl_scsi struct ctl_page_index *page_index, uint8_t *page_ptr) { struct ctl_lun *lun; - uint8_t *current_cp, *saved_cp; + uint8_t *current_cp; int set_ua; uint32_t initidx; @@ -5843,13 +5843,10 @@ ctl_default_page_handler(struct ctl_scsi current_cp = (page_index->page_data + (page_index->page_len * CTL_PAGE_CURRENT)); - saved_cp = (page_index->page_data + (page_index->page_len * - CTL_PAGE_SAVED)); mtx_lock(&lun->lun_lock); if (memcmp(current_cp, page_ptr, page_index->page_len)) { memcpy(current_cp, page_ptr, page_index->page_len); - memcpy(saved_cp, page_ptr, page_index->page_len); set_ua = 1; } if (set_ua != 0) From owner-svn-src-head@freebsd.org Tue Dec 27 23:31:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52723C93DF2; Tue, 27 Dec 2016 23:31:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 21EAD1F7D; Tue, 27 Dec 2016 23:31:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBRNVWb7060821; Tue, 27 Dec 2016 23:31:32 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBRNVWhW060820; Tue, 27 Dec 2016 23:31:32 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201612272331.uBRNVWhW060820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 27 Dec 2016 23:31:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310647 - head/sys/cddl/contrib/opensolaris/uts/common/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 23:31:33 -0000 Author: markj Date: Tue Dec 27 23:31:32 2016 New Revision: 310647 URL: https://svnweb.freebsd.org/changeset/base/310647 Log: Remove an obsolete pragma from dtrace.h. It triggers a compiler warning and has been removed upstream. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Tue Dec 27 22:38:44 2016 (r310646) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Tue Dec 27 23:31:32 2016 (r310647) @@ -32,8 +32,6 @@ #ifndef _SYS_DTRACE_H #define _SYS_DTRACE_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif From owner-svn-src-head@freebsd.org Tue Dec 27 23:33:00 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F641C93FB3; Tue, 27 Dec 2016 23:33:00 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7C6412D5; Tue, 27 Dec 2016 23:32:59 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBRNWwKj061715; Tue, 27 Dec 2016 23:32:58 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBRNWtca061677; Tue, 27 Dec 2016 23:32:55 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612272332.uBRNWtca061677@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 27 Dec 2016 23:32:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310648 - in head: contrib/bsnmp/gensnmpdef contrib/bsnmp/gensnmptree contrib/bsnmp/lib contrib/bsnmp/snmp_mibII contrib/bsnmp/snmp_ntp contrib/bsnmp/snmp_target contrib/bsnmp/snmp_usm ... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 23:33:00 -0000 Author: ngie Date: Tue Dec 27 23:32:54 2016 New Revision: 310648 URL: https://svnweb.freebsd.org/changeset/base/310648 Log: style(9): clean up trailing whitespace MFC after: 3 weeks Modified: head/contrib/bsnmp/gensnmpdef/gensnmpdef.1 head/contrib/bsnmp/gensnmpdef/gensnmpdef.c head/contrib/bsnmp/gensnmptree/gensnmptree.1 head/contrib/bsnmp/gensnmptree/gensnmptree.c head/contrib/bsnmp/lib/asn1.3 head/contrib/bsnmp/lib/asn1.c head/contrib/bsnmp/lib/asn1.h head/contrib/bsnmp/lib/bsnmpagent.3 head/contrib/bsnmp/lib/bsnmpclient.3 head/contrib/bsnmp/lib/bsnmplib.3 head/contrib/bsnmp/lib/snmp.c head/contrib/bsnmp/lib/snmp.h head/contrib/bsnmp/lib/snmpagent.c head/contrib/bsnmp/lib/snmpagent.h head/contrib/bsnmp/lib/snmpclient.c head/contrib/bsnmp/lib/snmpclient.h head/contrib/bsnmp/lib/snmpcrypto.c head/contrib/bsnmp/lib/snmppriv.h head/contrib/bsnmp/lib/support.c head/contrib/bsnmp/lib/support.h head/contrib/bsnmp/snmp_mibII/mibII.c head/contrib/bsnmp/snmp_mibII/mibII.h head/contrib/bsnmp/snmp_mibII/mibII_begemot.c head/contrib/bsnmp/snmp_mibII/mibII_ifmib.c head/contrib/bsnmp/snmp_mibII/mibII_ifstack.c head/contrib/bsnmp/snmp_mibII/mibII_interfaces.c head/contrib/bsnmp/snmp_mibII/mibII_ip.c head/contrib/bsnmp/snmp_mibII/mibII_ipaddr.c head/contrib/bsnmp/snmp_mibII/mibII_nettomedia.c head/contrib/bsnmp/snmp_mibII/mibII_rcvaddr.c head/contrib/bsnmp/snmp_mibII/mibII_route.c head/contrib/bsnmp/snmp_mibII/mibII_tcp.c head/contrib/bsnmp/snmp_mibII/mibII_tree.def head/contrib/bsnmp/snmp_mibII/mibII_udp.c head/contrib/bsnmp/snmp_mibII/snmp_mibII.3 head/contrib/bsnmp/snmp_mibII/snmp_mibII.h head/contrib/bsnmp/snmp_ntp/NTP-MIB.txt head/contrib/bsnmp/snmp_ntp/NTP-PROXY-MIB.txt head/contrib/bsnmp/snmp_target/snmp_target.3 head/contrib/bsnmp/snmp_usm/snmp_usm.3 head/contrib/bsnmp/snmp_usm/usm_snmp.c head/contrib/bsnmp/snmp_vacm/snmp_vacm.3 head/contrib/bsnmp/snmp_vacm/vacm_snmp.c head/contrib/bsnmp/snmpd/BEGEMOT-MIB.txt head/contrib/bsnmp/snmpd/BEGEMOT-SNMPD.txt head/contrib/bsnmp/snmpd/FOKUS-MIB.txt head/contrib/bsnmp/snmpd/action.c head/contrib/bsnmp/snmpd/config.c head/contrib/bsnmp/snmpd/export.c head/contrib/bsnmp/snmpd/main.c head/contrib/bsnmp/snmpd/snmpd.config head/contrib/bsnmp/snmpd/snmpd.h head/contrib/bsnmp/snmpd/snmpd.sh head/contrib/bsnmp/snmpd/snmpmod.3 head/contrib/bsnmp/snmpd/snmpmod.h head/contrib/bsnmp/snmpd/trans_lsock.c head/contrib/bsnmp/snmpd/trans_lsock.h head/contrib/bsnmp/snmpd/trans_udp.c head/contrib/bsnmp/snmpd/trans_udp.h head/contrib/bsnmp/snmpd/trap.c head/contrib/bsnmp/snmpd/tree.def head/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt head/usr.sbin/bsnmpd/modules/snmp_atm/atm_sys.c head/usr.sbin/bsnmpd/modules/snmp_bridge/BEGEMOT-BRIDGE-MIB.txt head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_addrs.c head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c head/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3 head/usr.sbin/bsnmpd/modules/snmp_hostres/snmp_hostres.3 head/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.c head/usr.sbin/bsnmpd/modules/snmp_pf/BEGEMOT-PF-MIB.txt head/usr.sbin/bsnmpd/modules/snmp_pf/Makefile head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c head/usr.sbin/bsnmpd/modules/snmp_target/Makefile head/usr.sbin/bsnmpd/modules/snmp_usm/Makefile head/usr.sbin/bsnmpd/modules/snmp_vacm/Makefile head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.c head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Modified: head/contrib/bsnmp/gensnmpdef/gensnmpdef.1 ============================================================================== --- head/contrib/bsnmp/gensnmpdef/gensnmpdef.1 Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/gensnmpdef/gensnmpdef.1 Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ .\" All rights reserved. .\" .\" Author: Harti Brandt -.\" +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -13,7 +13,7 @@ .\" 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 AUTHOR 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 Modified: head/contrib/bsnmp/gensnmpdef/gensnmpdef.c ============================================================================== --- head/contrib/bsnmp/gensnmpdef/gensnmpdef.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/gensnmpdef/gensnmpdef.c Tue Dec 27 23:32:54 2016 (r310648) @@ -1,10 +1,10 @@ -/* +/* * Copyright (C) 2004-2006 * Hartmut Brandt. * All rights reserved. - * + * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 @@ -233,7 +233,7 @@ print_scalar(SmiNode *n, u_int level) printf(" op_%s", p->name); print_access(n->access); - + printf(")\n"); } @@ -422,7 +422,7 @@ static void print_enum_typedef(SmiType *t) { SmiNamedNumber *nnum; - + for (nnum = smiGetFirstNamedNumber(t); nnum != NULL; nnum = smiGetNextNamedNumber(nnum)) { printf("\t%ld %s\n" , nnum->value.value.integer32, nnum->name); @@ -434,10 +434,10 @@ print_stype(SmiNode *n) { SmiType *type; struct tdef *t = NULL; - + type = smiGetNodeType(n); assert(type != NULL); - + if (type->basetype == SMI_BASETYPE_ENUM) { if (do_typedef == 'e' && type->name != NULL) { SLIST_FOREACH(t, &tdefs, link) { @@ -450,7 +450,7 @@ print_stype(SmiNode *n) printf("typedef %sType ENUM (\n", n->name); else return; - + print_enum_typedef(type); printf(")\n\n"); @@ -476,7 +476,7 @@ static void print_typdefs(SmiNode *n) { SmiNode *p; - + p = n; n = smiGetFirstChildNode(n); while (n != NULL) { Modified: head/contrib/bsnmp/gensnmptree/gensnmptree.1 ============================================================================== --- head/contrib/bsnmp/gensnmptree/gensnmptree.1 Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/gensnmptree/gensnmptree.1 Tue Dec 27 23:32:54 2016 (r310648) @@ -7,7 +7,7 @@ .\" All rights reserved. .\" .\" Author: Harti Brandt -.\" +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -16,7 +16,7 @@ .\" 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 AUTHOR 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 Modified: head/contrib/bsnmp/gensnmptree/gensnmptree.c ============================================================================== --- head/contrib/bsnmp/gensnmptree/gensnmptree.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/gensnmptree/gensnmptree.c Tue Dec 27 23:32:54 2016 (r310648) @@ -8,7 +8,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -17,7 +17,7 @@ * 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 AUTHOR 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 @@ -738,7 +738,7 @@ parse_type(enum tok *tok, struct type *t e->value = -(long)val; } else e->value = val; - + if (*tok != TOK_NUM) report("need value for ENUM/BITS"); if (gettoken() != TOK_STR) Modified: head/contrib/bsnmp/lib/asn1.3 ============================================================================== --- head/contrib/bsnmp/lib/asn1.3 Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/lib/asn1.3 Tue Dec 27 23:32:54 2016 (r310648) @@ -5,9 +5,9 @@ .\" Copyright (c) 2001-2003 .\" Fraunhofer Institute for Open Communication Systems (FhG Fokus). .\" All rights reserved. -.\" +.\" .\" Author: Harti Brandt -.\" +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -16,7 +16,7 @@ .\" 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 AUTHOR 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 Modified: head/contrib/bsnmp/lib/asn1.c ============================================================================== --- head/contrib/bsnmp/lib/asn1.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/lib/asn1.c Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 @@ -285,7 +285,7 @@ asn_put_real_integer(struct asn_buf *b, enum asn_err ret; if (ival < 0) { - /* this may fail if |INT64_MIN| > |INT64_MAX| and + /* this may fail if |INT64_MIN| > |INT64_MAX| and * the value is between * INT64_MIN <= ival < -(INT64_MAX+1) */ val = (uint64_t)-(ival + 1); neg = 1; @@ -890,7 +890,7 @@ asn_slice_oid(struct asn_oid *dest, cons memcpy(dest->subs, &src->subs[from], dest->len * sizeof(dest->subs[0])); } -/* +/* * Append from to to */ void Modified: head/contrib/bsnmp/lib/asn1.h ============================================================================== --- head/contrib/bsnmp/lib/asn1.h Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/lib/asn1.h Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/lib/bsnmpagent.3 ============================================================================== --- head/contrib/bsnmp/lib/bsnmpagent.3 Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/lib/bsnmpagent.3 Tue Dec 27 23:32:54 2016 (r310648) @@ -7,7 +7,7 @@ .\" All rights reserved. .\" .\" Author: Harti Brandt -.\" +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -16,7 +16,7 @@ .\" 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 AUTHOR 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 Modified: head/contrib/bsnmp/lib/bsnmpclient.3 ============================================================================== --- head/contrib/bsnmp/lib/bsnmpclient.3 Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/lib/bsnmpclient.3 Tue Dec 27 23:32:54 2016 (r310648) @@ -7,7 +7,7 @@ .\" All rights reserved. .\" .\" Author: Harti Brandt -.\" +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -16,7 +16,7 @@ .\" 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 AUTHOR 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 Modified: head/contrib/bsnmp/lib/bsnmplib.3 ============================================================================== --- head/contrib/bsnmp/lib/bsnmplib.3 Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/lib/bsnmplib.3 Tue Dec 27 23:32:54 2016 (r310648) @@ -13,7 +13,7 @@ .\" All rights reserved. .\" .\" Author: Harti Brandt -.\" +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -22,7 +22,7 @@ .\" 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 AUTHOR 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 Modified: head/contrib/bsnmp/lib/snmp.c ============================================================================== --- head/contrib/bsnmp/lib/snmp.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/lib/snmp.c Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Copyright (c) 2010 The FreeBSD Foundation * All rights reserved. * @@ -19,7 +19,7 @@ * 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 AUTHOR 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 @@ -684,7 +684,7 @@ snmp_pdu_snoop(const struct asn_buf *b0) struct asn_buf b = *b0; /* <0x10|0x20> */ - + if (b.asn_len == 0) return (0); if (b.asn_cptr[0] != (ASN_TYPE_SEQUENCE | ASN_TYPE_CONSTRUCTED)) { @@ -759,7 +759,7 @@ snmp_pdu_encode_header(struct asn_buf *b if (asn_put_temp_header(b, (ASN_TYPE_SEQUENCE | ASN_TYPE_CONSTRUCTED), &v3_hdr_ptr) != ASN_ERR_OK) return (SNMP_CODE_FAILED); - + if (asn_put_integer(b, pdu->identifier) != ASN_ERR_OK) return (SNMP_CODE_FAILED); Modified: head/contrib/bsnmp/lib/snmp.h ============================================================================== --- head/contrib/bsnmp/lib/snmp.h Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/lib/snmp.h Tue Dec 27 23:32:54 2016 (r310648) @@ -4,14 +4,14 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Copyright (c) 2010 The FreeBSD Foundation * All rights reserved. * * Portions of this software were developed by Shteryana Sotirova Shopova * under sponsorship from the FreeBSD Foundation. * - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -20,7 +20,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/lib/snmpagent.c ============================================================================== --- head/contrib/bsnmp/lib/snmpagent.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/lib/snmpagent.c Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 @@ -518,7 +518,7 @@ snmp_getbulk(struct snmp_pdu *pdu, struc /* PDU is full */ goto done; - if (cnt == 0) + if (cnt == 0) result = do_getnext(&context, &pdu->bindings[i], &resp->bindings[resp->nbindings], pdu); else @@ -692,7 +692,7 @@ snmp_set(struct snmp_pdu *pdu, struct as if (snmp_pdu_encode_header(resp_b, resp)) return (SNMP_RET_IGN); - /* + /* * 1. Find all nodes, check that they are writeable and * that the syntax is ok, copy over the binding to the response. */ @@ -970,7 +970,7 @@ snmp_dep_lookup(struct snmp_context *ctx /* * Make an error response from a PDU. We do this without decoding the * variable bindings. This means we can sent the junk back to a caller - * that has sent us junk in the first place. + * that has sent us junk in the first place. */ enum snmp_ret snmp_make_errresp(const struct snmp_pdu *pdu, struct asn_buf *pdu_b, Modified: head/contrib/bsnmp/lib/snmpagent.h ============================================================================== --- head/contrib/bsnmp/lib/snmpagent.h Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/lib/snmpagent.h Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/lib/snmpclient.c ============================================================================== --- head/contrib/bsnmp/lib/snmpclient.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/lib/snmpclient.c Tue Dec 27 23:32:54 2016 (r310648) @@ -68,7 +68,7 @@ struct snmp_client snmp_client; /* List of all outstanding requests */ -struct sent_pdu { +struct sent_pdu { int reqid; struct snmp_pdu *pdu; struct timeval time; @@ -510,7 +510,7 @@ table_check_response(struct tabwork *wor table_free(work, 1); return (-2); } - + continue; } if (!asn_is_suboid(&work->descr->table, &b->var) || @@ -754,7 +754,7 @@ snmp_oid_append(struct asn_oid *oid, con ret = 0; while (*fmt != '\0') { switch (*fmt++) { - case 'i': + case 'i': /* just an integer more */ if (oid->len + 1 > ASN_MAXOIDLEN) { warnx("%s: OID too long for integer", __func__); @@ -804,7 +804,7 @@ snmp_oid_append(struct asn_oid *oid, con break; case 'b': - /* append `size` characters */ + /* append `size` characters */ str = (const u_char *)va_arg(va, const char *); if (oid->len + size > ASN_MAXOIDLEN) { warnx("%s: OID too long for string", __func__); @@ -852,7 +852,7 @@ snmp_client_init(struct snmp_client *c) strcpy(c->read_community, "public"); strcpy(c->write_community, "private"); - + c->security_model = SNMP_SECMODEL_USM; strcpy(c->cname, ""); @@ -863,7 +863,7 @@ snmp_client_init(struct snmp_client *c) c->txbuflen = c->rxbuflen = 10000; c->fd = -1; - + c->max_reqid = INT32_MAX; c->min_reqid = 0; c->next_reqid = 0; Modified: head/contrib/bsnmp/lib/snmpclient.h ============================================================================== --- head/contrib/bsnmp/lib/snmpclient.h Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/lib/snmpclient.h Tue Dec 27 23:32:54 2016 (r310648) @@ -5,7 +5,7 @@ * * Author: Harti Brandt * Kendy Kutzner - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -14,7 +14,7 @@ * 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 AUTHOR 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 @@ -59,7 +59,7 @@ typedef void (*snmp_send_cb_f)(struct sn typedef void (*snmp_timeout_cb_f)(void * ); /* timeout start function */ -typedef void *(*snmp_timeout_start_f)(struct timeval *timeout, +typedef void *(*snmp_timeout_start_f)(struct timeval *timeout, snmp_timeout_cb_f callback, void *); /* timeout stop function */ Modified: head/contrib/bsnmp/lib/snmpcrypto.c ============================================================================== --- head/contrib/bsnmp/lib/snmpcrypto.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/lib/snmpcrypto.c Tue Dec 27 23:32:54 2016 (r310648) @@ -322,7 +322,7 @@ snmp_calc_keychange(struct snmp_user *us for (i = 0; i < keylen / 4; i++) rvalue[i] = random(); - + memcpy(keychange, user->auth_key, keylen); memcpy(keychange + keylen, rvalue, keylen); Modified: head/contrib/bsnmp/lib/snmppriv.h ============================================================================== --- head/contrib/bsnmp/lib/snmppriv.h Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/lib/snmppriv.h Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/lib/support.c ============================================================================== --- head/contrib/bsnmp/lib/support.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/lib/support.c Tue Dec 27 23:32:54 2016 (r310648) @@ -1,10 +1,10 @@ -/* +/* * Copyright (C) 2004 * Hartmut Brandt. * All rights reserved. - * + * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/lib/support.h ============================================================================== --- head/contrib/bsnmp/lib/support.h Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/lib/support.h Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/snmp_mibII/mibII.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_mibII/mibII.c Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 @@ -1228,7 +1228,7 @@ mib_fetch_rtab(int af, int info, int arg return (NULL); } buf = newbuf; - + if (sysctl(name, 6, buf, lenp, NULL, 0) == 0) break; @@ -1329,7 +1329,7 @@ mib_arp_update(void) in_update_arp = 0; return; } - + next = buf; while (next < buf + needed) { rtm = (struct rt_msghdr *)(void *)next; @@ -1521,7 +1521,7 @@ mib_unmodify_ifa(struct mibifa *ifa) } /* - * Modify an IFA. + * Modify an IFA. */ int mib_modify_ifa(struct mibifa *ifa) Modified: head/contrib/bsnmp/snmp_mibII/mibII.h ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII.h Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_mibII/mibII.h Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/snmp_mibII/mibII_begemot.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII_begemot.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_mibII/mibII_begemot.c Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/snmp_mibII/mibII_ifmib.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII_ifmib.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_mibII/mibII_ifmib.c Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/snmp_mibII/mibII_ifstack.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII_ifstack.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_mibII/mibII_ifstack.c Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/snmp_mibII/mibII_interfaces.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII_interfaces.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_mibII/mibII_interfaces.c Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/snmp_mibII/mibII_ip.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII_ip.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_mibII/mibII_ip.c Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/snmp_mibII/mibII_ipaddr.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII_ipaddr.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_mibII/mibII_ipaddr.c Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/snmp_mibII/mibII_nettomedia.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII_nettomedia.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_mibII/mibII_nettomedia.c Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/snmp_mibII/mibII_rcvaddr.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII_rcvaddr.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_mibII/mibII_rcvaddr.c Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/snmp_mibII/mibII_route.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII_route.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_mibII/mibII_route.c Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 @@ -257,7 +257,7 @@ mib_fetch_route(void) continue; mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs); - + mib_sroute_process(rtm, addrs[RTAX_GATEWAY], addrs[RTAX_DST], addrs[RTAX_NETMASK]); } Modified: head/contrib/bsnmp/snmp_mibII/mibII_tcp.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII_tcp.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_mibII/mibII_tcp.c Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/snmp_mibII/mibII_tree.def ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII_tree.def Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_mibII/mibII_tree.def Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ # All rights reserved. # # Author: Harti Brandt -# +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: @@ -13,7 +13,7 @@ # 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 AUTHOR 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 Modified: head/contrib/bsnmp/snmp_mibII/mibII_udp.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII_udp.c Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_mibII/mibII_udp.c Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/snmp_mibII/snmp_mibII.3 ============================================================================== --- head/contrib/bsnmp/snmp_mibII/snmp_mibII.3 Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_mibII/snmp_mibII.3 Tue Dec 27 23:32:54 2016 (r310648) @@ -7,7 +7,7 @@ .\" All rights reserved. .\" .\" Author: Harti Brandt -.\" +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -16,7 +16,7 @@ .\" 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 AUTHOR 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 Modified: head/contrib/bsnmp/snmp_mibII/snmp_mibII.h ============================================================================== --- head/contrib/bsnmp/snmp_mibII/snmp_mibII.h Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_mibII/snmp_mibII.h Tue Dec 27 23:32:54 2016 (r310648) @@ -4,7 +4,7 @@ * All rights reserved. * * Author: Harti Brandt - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 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 AUTHOR 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 Modified: head/contrib/bsnmp/snmp_ntp/NTP-MIB.txt ============================================================================== --- head/contrib/bsnmp/snmp_ntp/NTP-MIB.txt Tue Dec 27 23:31:32 2016 (r310647) +++ head/contrib/bsnmp/snmp_ntp/NTP-MIB.txt Tue Dec 27 23:32:54 2016 (r310648) @@ -5,7 +5,7 @@ NTP-MIB DEFINITIONS ::= BEGIN IMPORTS - Integer32, IpAddress, MODULE-IDENTITY, OBJECT-TYPE, Unsigned32, + Integer32, IpAddress, MODULE-IDENTITY, OBJECT-TYPE, Unsigned32, enterprises FROM SNMPv2-SMI @@ -14,9 +14,9 @@ IMPORTS ntpMIB MODULE-IDENTITY LAST-UPDATED "199707251530Z" - ORGANIZATION + ORGANIZATION "University of Delaware" - CONTACT-INFO + CONTACT-INFO "Adarsh Sethi Department of Computer & Information Sciences University of Delaware @@ -30,7 +30,7 @@ ntpMIB MODULE-IDENTITY Newark, DE 19716 Tel: +1 302 831 ???? E-mail: mills@ee.udel.edu" - DESCRIPTION + DESCRIPTION "This MIB module defines a MIB which provides mechanisms to monitor and control an NTP server." ::= { udel 3 } @@ -60,18 +60,18 @@ ntpFilter OBJECT IDENTIFIER NTPTimeStamp ::= TEXTUAL-CONVENTION DISPLAY-HINT "4x.4x" STATUS current - DESCRIPTION + DESCRIPTION "" SYNTAX OCTET STRING (SIZE(8)) NTPLeapIndicator ::= TEXTUAL-CONVENTION STATUS current - DESCRIPTION + DESCRIPTION "" SYNTAX INTEGER { noWarning(0), addSecond(1), - subtractSecond(2), + subtractSecond(2), alarm(3) } -- @@ -82,7 +82,7 @@ ntpSysLeap OBJECT-TYPE SYNTAX NTPLeapIndicator MAX-ACCESS read-only STATUS current - DESCRIPTION + DESCRIPTION " two-bit code warning of an impending leap second to be inserted in the NTP timescale." ::= { ntpSystem 1 } @@ -91,7 +91,7 @@ ntpSysStratum OBJECT-TYPE SYNTAX Integer32 (0..255) MAX-ACCESS read-only *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Dec 27 23:56:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A21BC944F8; Tue, 27 Dec 2016 23:56:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A0901CB0; Tue, 27 Dec 2016 23:56:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBRNuk5p069991; Tue, 27 Dec 2016 23:56:46 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBRNukwC069989; Tue, 27 Dec 2016 23:56:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612272356.uBRNukwC069989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Dec 2016 23:56:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310649 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 23:56:47 -0000 Author: mav Date: Tue Dec 27 23:56:46 2016 New Revision: 310649 URL: https://svnweb.freebsd.org/changeset/base/310649 Log: Allow more efficient use of private area. There are 16 bytes of space, so we may store two pointers in one. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl_io.h head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/ctl_io.h ============================================================================== --- head/sys/cam/ctl/ctl_io.h Tue Dec 27 23:32:54 2016 (r310648) +++ head/sys/cam/ctl/ctl_io.h Tue Dec 27 23:56:46 2016 (r310649) @@ -145,7 +145,9 @@ struct ctl_ptr_len_flags { union ctl_priv { uint8_t bytes[sizeof(uint64_t) * 2]; uint64_t integer; + uint64_t integers[2]; void *ptr; + void *ptrs[2]; }; /* Modified: head/sys/cam/ctl/scsi_ctl.c ============================================================================== --- head/sys/cam/ctl/scsi_ctl.c Tue Dec 27 23:32:54 2016 (r310648) +++ head/sys/cam/ctl/scsi_ctl.c Tue Dec 27 23:56:46 2016 (r310649) @@ -185,6 +185,9 @@ MALLOC_DEFINE(M_CTLFE, "CAM CTL FE", "CA /* This is only used in the CTIO */ #define ccb_atio ppriv_ptr1 +#define PRIV_CCB(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptrs[0]) +#define PRIV_INFO(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptrs[1]) + int ctlfeinitialize(void); void ctlfeshutdown(void); static periph_init_t ctlfeperiphinit; @@ -554,7 +557,7 @@ ctlferegister(struct cam_periph *periph, status = CAM_RESRC_UNAVAIL; break; } - new_io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr = cmd_info; + PRIV_INFO(new_io) = cmd_info; softc->atios_alloced++; new_ccb->ccb_h.io_ptr = new_io; @@ -702,7 +705,7 @@ ctlfedata(struct ctlfe_lun_softc *softc, size_t off; int i, idx; - cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr; + cmd_info = PRIV_INFO(io); bus_softc = softc->parent_softc; /* @@ -806,7 +809,7 @@ ctlfestart(struct cam_periph *periph, un flags = atio->ccb_h.flags & (CAM_DIS_DISCONNECT|CAM_TAG_ACTION_VALID|CAM_DIR_MASK); - cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr; + cmd_info = PRIV_INFO(io); cmd_info->cur_transfer_index = 0; cmd_info->cur_transfer_off = 0; cmd_info->flags = 0; @@ -987,7 +990,7 @@ ctlfe_free_ccb(struct cam_periph *periph switch (ccb->ccb_h.func_code) { case XPT_ACCEPT_TARGET_IO: softc->atios_freed++; - cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr; + cmd_info = PRIV_INFO(io); free(cmd_info, M_CTLFE); break; case XPT_IMMEDIATE_NOTIFY: @@ -1154,12 +1157,12 @@ ctlfedone(struct cam_periph *periph, uni */ mtx_unlock(mtx); io = done_ccb->ccb_h.io_ptr; - cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr; + cmd_info = PRIV_INFO(io); ctl_zero_io(io); /* Save pointers on both sides */ - io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = done_ccb; - io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr = cmd_info; + PRIV_CCB(io) = done_ccb; + PRIV_INFO(io) = cmd_info; done_ccb->ccb_h.io_ptr = io; /* @@ -1315,7 +1318,7 @@ ctlfedone(struct cam_periph *periph, uni struct ccb_scsiio *csio; csio = &done_ccb->csio; - cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr; + cmd_info = PRIV_INFO(io); io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; @@ -1444,7 +1447,7 @@ ctlfedone(struct cam_periph *periph, uni send_ctl_io = 1; io->io_hdr.io_type = CTL_IO_TASK; - io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr =done_ccb; + PRIV_CCB(io) = done_ccb; inot->ccb_h.io_ptr = io; io->io_hdr.nexus.initid = inot->initiator_id; io->io_hdr.nexus.targ_port = bus_softc->port.targ_port; @@ -2002,7 +2005,7 @@ ctlfe_datamove(union ctl_io *io) KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, ("Unexpected io_type (%d) in ctlfe_datamove", io->io_hdr.io_type)); - ccb = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; + ccb = PRIV_CCB(io); periph = xpt_path_periph(ccb->ccb_h.path); cam_periph_lock(periph); softc = (struct ctlfe_lun_softc *)periph->softc; @@ -2022,7 +2025,7 @@ ctlfe_done(union ctl_io *io) struct cam_periph *periph; struct ctlfe_lun_softc *softc; - ccb = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; + ccb = PRIV_CCB(io); periph = xpt_path_periph(ccb->ccb_h.path); cam_periph_lock(periph); softc = (struct ctlfe_lun_softc *)periph->softc; From owner-svn-src-head@freebsd.org Wed Dec 28 02:55:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C9B1C93625; Wed, 28 Dec 2016 02:55:28 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D3171DEF; Wed, 28 Dec 2016 02:55:28 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS2tRaj045517; Wed, 28 Dec 2016 02:55:27 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS2tQeR045512; Wed, 28 Dec 2016 02:55:26 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201612280255.uBS2tQeR045512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Wed, 28 Dec 2016 02:55:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310650 - in head/sys/mips: include mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 02:55:28 -0000 Author: kan Date: Wed Dec 28 02:55:26 2016 New Revision: 310650 URL: https://svnweb.freebsd.org/changeset/base/310650 Log: Implement pmap_change_attr and related APIs on MIPS On platforms that have uncached-accelerate cache attribute, map it to VM_MEMATTR_WRITE_COMBINING. Otherwise, leave write comining undefined. Reviewed by: adrian, jhb (glance) Differential Revision: https://reviews.freebsd.org/D8894 Modified: head/sys/mips/include/cpuregs.h head/sys/mips/include/pmap.h head/sys/mips/include/pte.h head/sys/mips/include/vm.h head/sys/mips/mips/pmap.c Modified: head/sys/mips/include/cpuregs.h ============================================================================== --- head/sys/mips/include/cpuregs.h Tue Dec 27 23:56:46 2016 (r310649) +++ head/sys/mips/include/cpuregs.h Wed Dec 28 02:55:26 2016 (r310650) @@ -171,6 +171,10 @@ #define MIPS_CCA_CACHED MIPS_CCA_CCS #endif +#if defined(CPU_XBURST) +#define MIPS_CCA_UA 0x01 +#endif + #ifndef MIPS_CCA_UNCACHED #define MIPS_CCA_UNCACHED MIPS_CCA_UC #endif @@ -188,6 +192,16 @@ #endif #endif +/* + * Use uncached-accelerated mode for write-combining maps, if one is defined, + * otherwise fall back to uncached + */ +#ifndef MIPS_CCA_WC +#ifdef MIPS_CCA_UA +#define MIPS_CCA_WC MIPS_CCA_UA +#endif +#endif + #define MIPS_PHYS_TO_XKPHYS(cca,x) \ ((0x2ULL << 62) | ((unsigned long long)(cca) << 59) | (x)) #define MIPS_PHYS_TO_XKPHYS_CACHED(x) \ Modified: head/sys/mips/include/pmap.h ============================================================================== --- head/sys/mips/include/pmap.h Tue Dec 27 23:56:46 2016 (r310649) +++ head/sys/mips/include/pmap.h Wed Dec 28 02:55:26 2016 (r310650) @@ -74,7 +74,8 @@ struct md_page { }; #define PV_TABLE_REF 0x02 /* referenced */ -#define PV_MEMATTR_UNCACHEABLE 0x04 +#define PV_MEMATTR_MASK 0xf0 /* store vm_memattr_t here */ +#define PV_MEMATTR_SHIFT 0x04 #define ASID_BITS 8 #define ASIDGEN_BITS (32 - ASID_BITS) @@ -163,22 +164,24 @@ extern vm_offset_t virtual_end; extern vm_paddr_t dump_avail[PHYS_AVAIL_ENTRIES + 2]; -#define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT +#define pmap_page_get_memattr(m) (((m)->md.pv_flags & PV_MEMATTR_MASK) >> PV_MEMATTR_SHIFT) #define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) #define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITEABLE) != 0) void pmap_bootstrap(void); void *pmap_mapdev(vm_paddr_t, vm_size_t); +void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, vm_memattr_t); void pmap_unmapdev(vm_offset_t, vm_size_t); vm_offset_t pmap_steal_memory(vm_size_t size); void pmap_kenter(vm_offset_t va, vm_paddr_t pa); -void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int attr); +void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, vm_memattr_t attr); void pmap_kremove(vm_offset_t va); void *pmap_kenter_temporary(vm_paddr_t pa, int i); void pmap_kenter_temporary_free(vm_paddr_t pa); void pmap_flush_pvcache(vm_page_t m); int pmap_emulate_modified(pmap_t pmap, vm_offset_t va); void pmap_page_set_memattr(vm_page_t, vm_memattr_t); +int pmap_change_attr(vm_offset_t, vm_size_t, vm_memattr_t); #endif /* _KERNEL */ Modified: head/sys/mips/include/pte.h ============================================================================== --- head/sys/mips/include/pte.h Tue Dec 27 23:56:46 2016 (r310649) +++ head/sys/mips/include/pte.h Wed Dec 28 02:55:26 2016 (r310650) @@ -132,8 +132,10 @@ typedef pt_entry_t *pd_entry_t; * it is matched. */ #define PTE_C(attr) ((attr & 0x07) << 3) +#define PTE_C_MASK (PTE_C(0x07)) #define PTE_C_UNCACHED (PTE_C(MIPS_CCA_UNCACHED)) #define PTE_C_CACHE (PTE_C(MIPS_CCA_CACHED)) +#define PTE_C_WC (PTE_C(MIPS_CCA_WC)) #define PTE_D 0x04 #define PTE_V 0x02 #define PTE_G 0x01 @@ -158,6 +160,7 @@ typedef pt_entry_t *pd_entry_t; #define pte_clear(pte, bit) (*(pte) &= ~(bit)) #define pte_set(pte, bit) (*(pte) |= (bit)) #define pte_test(pte, bit) ((*(pte) & (bit)) == (bit)) +#define pte_cache_bits(pte) ((*(pte) >> 3) & 0x07) /* Assembly support for PTE access*/ #ifdef LOCORE Modified: head/sys/mips/include/vm.h ============================================================================== --- head/sys/mips/include/vm.h Tue Dec 27 23:56:46 2016 (r310649) +++ head/sys/mips/include/vm.h Wed Dec 28 02:55:26 2016 (r310650) @@ -32,7 +32,11 @@ #include /* Memory attributes. */ -#define VM_MEMATTR_UNCACHEABLE ((vm_memattr_t)PTE_C_UNCACHED) -#define VM_MEMATTR_DEFAULT ((vm_memattr_t)PTE_C_CACHE) +#define VM_MEMATTR_UNCACHEABLE ((vm_memattr_t)MIPS_CCA_UNCACHED) +#define VM_MEMATTR_WRITE_BACK ((vm_memattr_t)MIPS_CCA_CACHED) +#define VM_MEMATTR_DEFAULT VM_MEMATTR_WRITE_BACK +#ifdef MIPS_CCA_WC +#define VM_MEMATTR_WRITE_COMBINING ((vm_memattr_t)MIPS_CCA_WC) +#endif #endif /* !_MACHINE_VM_H_ */ Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Tue Dec 27 23:56:46 2016 (r310649) +++ head/sys/mips/mips/pmap.c Wed Dec 28 02:55:26 2016 (r310650) @@ -189,10 +189,10 @@ static void pmap_update_page_action(void * The highmem area does not have a KSEG0 mapping, and we need a mechanism to * do temporary per-CPU mappings for pmap_zero_page, pmap_copy_page etc. * - * At bootup, we reserve 2 virtual pages per CPU for mapping highmem pages. To + * At bootup, we reserve 2 virtual pages per CPU for mapping highmem pages. To * access a highmem physical address on a CPU, we map the physical address to - * the reserved virtual address for the CPU in the kernel pagetable. This is - * done with interrupts disabled(although a spinlock and sched_pin would be + * the reserved virtual address for the CPU in the kernel pagetable. This is + * done with interrupts disabled(although a spinlock and sched_pin would be * sufficient). */ struct local_sysmaps { @@ -303,7 +303,7 @@ pmap_lmem_map2(vm_paddr_t phys1, vm_padd return (0); } -static __inline vm_offset_t +static __inline vm_offset_t pmap_lmem_unmap(void) { @@ -312,12 +312,18 @@ pmap_lmem_unmap(void) #endif /* !__mips_n64 */ static __inline int -is_cacheable_page(vm_paddr_t pa, vm_page_t m) +pmap_pte_cache_bits(vm_paddr_t pa, vm_page_t m) { + vm_memattr_t ma; - return ((m->md.pv_flags & PV_MEMATTR_UNCACHEABLE) == 0 && - is_cacheable_mem(pa)); - + ma = pmap_page_get_memattr(m); + if (ma == VM_MEMATTR_WRITE_BACK && !is_cacheable_mem(pa)) + ma = VM_MEMATTR_UNCACHEABLE; + return PTE_C(ma); +} +#define PMAP_PTE_SET_CACHE_BITS(pte, ps, m) { \ + pte &= ~PTE_C_MASK; \ + pte |= pmap_pte_cache_bits(pa, m); \ } /* @@ -359,7 +365,7 @@ pmap_pdpe_to_pde(pd_entry_t *pdpe, vm_of return (pdpe); } -static __inline +static __inline pd_entry_t *pmap_pde(pmap_t pmap, vm_offset_t va) { @@ -423,7 +429,7 @@ pmap_steal_memory(vm_size_t size) * Bootstrap the system enough to run with virtual memory. This * assumes that the phys_avail array has been initialized. */ -static void +static void pmap_create_kernel_pagetable(void) { int i, j; @@ -486,7 +492,7 @@ void pmap_bootstrap(void) { int i; - int need_local_mappings = 0; + int need_local_mappings = 0; /* Sort. */ again: @@ -600,7 +606,7 @@ pmap_page_init(vm_page_t m) { TAILQ_INIT(&m->md.pv_list); - m->md.pv_flags = 0; + m->md.pv_flags = VM_MEMATTR_DEFAULT << PV_MEMATTR_SHIFT; } /* @@ -635,8 +641,8 @@ pmap_call_on_active_cpus(pmap_t pmap, vo pmap->pm_asid[cpu].gen = 0; } cpuid = PCPU_GET(cpuid); - /* - * XXX: barrier/locking for active? + /* + * XXX: barrier/locking for active? * * Take a snapshot of active here, any further changes are ignored. * tlb update/invalidate should be harmless on inactive CPUs @@ -819,7 +825,7 @@ retry: * add a wired page to the kva */ void -pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int attr) +pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, vm_memattr_t ma) { pt_entry_t *pte; pt_entry_t opte, npte; @@ -830,7 +836,7 @@ pmap_kenter_attr(vm_offset_t va, vm_padd pte = pmap_pte(kernel_pmap, va); opte = *pte; - npte = TLBLO_PA_TO_PFN(pa) | attr | PTE_D | PTE_V | PTE_G; + npte = TLBLO_PA_TO_PFN(pa) | PTE_C(ma) | PTE_D | PTE_V | PTE_G; *pte = npte; if (pte_test(&opte, PTE_V) && opte != npte) pmap_update_page(kernel_pmap, va, npte); @@ -843,7 +849,7 @@ pmap_kenter(vm_offset_t va, vm_paddr_t p KASSERT(is_cacheable_mem(pa), ("pmap_kenter: memory at 0x%lx is not cacheable", (u_long)pa)); - pmap_kenter_attr(va, pa, PTE_C_CACHE); + pmap_kenter_attr(va, pa, VM_MEMATTR_DEFAULT); } /* @@ -1144,11 +1150,11 @@ _pmap_allocpte(pmap_t pmap, unsigned pte int segindex = ptepindex >> (SEGSHIFT - PDRSHIFT); int pdeindex = ptepindex & (NPDEPG - 1); vm_page_t pg; - + pdep = &pmap->pm_segtab[segindex]; - if (*pdep == NULL) { + if (*pdep == NULL) { /* recurse for allocating page dir */ - if (_pmap_allocpte(pmap, NUPDE + segindex, + if (_pmap_allocpte(pmap, NUPDE + segindex, flags) == NULL) { /* alloc failed, release current */ --m->wire_count; @@ -1680,7 +1686,7 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm * pmap_remove_pte: do the things to unmap a page in a process */ static int -pmap_remove_pte(struct pmap *pmap, pt_entry_t *ptq, vm_offset_t va, +pmap_remove_pte(struct pmap *pmap, pt_entry_t *ptq, vm_offset_t va, pd_entry_t pde) { pt_entry_t oldpte; @@ -1864,7 +1870,7 @@ pmap_remove_all(vm_page_t m) PMAP_LOCK(pmap); /* - * If it's last mapping writeback all caches from + * If it's last mapping writeback all caches from * the page being destroyed */ if (TAILQ_NEXT(pv, pv_list) == NULL) @@ -2030,10 +2036,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, newpte |= PTE_W; if (is_kernel_pmap(pmap)) newpte |= PTE_G; - if (is_cacheable_page(pa, m)) - newpte |= PTE_C_CACHE; - else - newpte |= PTE_C_UNCACHED; + PMAP_PTE_SET_CACHE_BITS(newpte, pa, m); mpte = NULL; @@ -2218,7 +2221,7 @@ static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte) { - pt_entry_t *pte; + pt_entry_t *pte, npte; vm_paddr_t pa; KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || @@ -2297,18 +2300,16 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ /* * Now validate mapping with RO protection */ - *pte = PTE_RO | TLBLO_PA_TO_PFN(pa) | PTE_V; + npte = PTE_RO | TLBLO_PA_TO_PFN(pa) | PTE_V; if ((m->oflags & VPO_UNMANAGED) == 0) - *pte |= PTE_MANAGED; + npte |= PTE_MANAGED; - if (is_cacheable_page(pa, m)) - *pte |= PTE_C_CACHE; - else - *pte |= PTE_C_UNCACHED; + PMAP_PTE_SET_CACHE_BITS(npte, pa, m); if (is_kernel_pmap(pmap)) - *pte |= PTE_G; + *pte = npte | PTE_G; else { + *pte = npte; /* * Sync I & D caches. Do this only if the target pmap * belongs to the current process. Otherwise, an @@ -2649,12 +2650,12 @@ pmap_quick_enter_page(vm_page_t m) #else vm_paddr_t pa; struct local_sysmaps *sysm; - pt_entry_t *pte; + pt_entry_t *pte, npte; pa = VM_PAGE_TO_PHYS(m); if (MIPS_DIRECT_MAPPABLE(pa)) { - if (m->md.pv_flags & PV_MEMATTR_UNCACHEABLE) + if (pmap_page_get_memattr(m) != VM_MEMATTR_WRITE_BACK) return (MIPS_PHYS_TO_DIRECT_UNCACHED(pa)); else return (MIPS_PHYS_TO_DIRECT(pa)); @@ -2665,8 +2666,9 @@ pmap_quick_enter_page(vm_page_t m) KASSERT(sysm->valid1 == 0, ("pmap_quick_enter_page: PTE busy")); pte = pmap_pte(kernel_pmap, sysm->base); - *pte = TLBLO_PA_TO_PFN(pa) | PTE_D | PTE_V | PTE_G | - (is_cacheable_page(pa, m) ? PTE_C_CACHE : PTE_C_UNCACHED); + npte = TLBLO_PA_TO_PFN(pa) | PTE_D | PTE_V | PTE_G; + PMAP_PTE_SET_CACHE_BITS(npte, pa, m); + *pte = npte; sysm->valid1 = 1; return (sysm->base); @@ -3146,26 +3148,26 @@ pmap_is_referenced(vm_page_t m) * Use XKPHYS uncached for 64 bit, and KSEG1 where possible for 32 bit. */ void * -pmap_mapdev(vm_paddr_t pa, vm_size_t size) +pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, vm_memattr_t ma) { vm_offset_t va, tmpva, offset; - /* - * KSEG1 maps only first 512M of phys address space. For + /* + * KSEG1 maps only first 512M of phys address space. For * pa > 0x20000000 we should make proper mapping * using pmap_kenter. */ - if (MIPS_DIRECT_MAPPABLE(pa + size - 1)) + if (MIPS_DIRECT_MAPPABLE(pa + size - 1) && ma == VM_MEMATTR_UNCACHEABLE) return ((void *)MIPS_PHYS_TO_DIRECT_UNCACHED(pa)); else { offset = pa & PAGE_MASK; size = roundup(size + offset, PAGE_SIZE); - + va = kva_alloc(size); if (!va) panic("pmap_mapdev: Couldn't alloc kernel virtual memory"); pa = trunc_page(pa); for (tmpva = va; size > 0;) { - pmap_kenter_attr(tmpva, pa, PTE_C_UNCACHED); + pmap_kenter_attr(tmpva, pa, ma); size -= PAGE_SIZE; tmpva += PAGE_SIZE; pa += PAGE_SIZE; @@ -3175,6 +3177,12 @@ pmap_mapdev(vm_paddr_t pa, vm_size_t siz return ((void *)(va + offset)); } +void * +pmap_mapdev(vm_paddr_t pa, vm_size_t size) +{ + return pmap_mapdev_attr(pa, size, VM_MEMATTR_UNCACHEABLE); +} + void pmap_unmapdev(vm_offset_t va, vm_size_t size) { @@ -3220,7 +3228,7 @@ retry: * This may falsely report the given address as * MINCORE_REFERENCED. Unfortunately, due to the lack of * per-PTE reference information, it is impossible to - * determine if the address is MINCORE_REFERENCED. + * determine if the address is MINCORE_REFERENCED. */ m = PHYS_TO_VM_PAGE(pa); if ((m->aflags & PGA_REFERENCED) != 0) @@ -3500,7 +3508,7 @@ pmap_kextract(vm_offset_t va) mapped = (va >= MIPS_KSEG2_START || va < MIPS_KSEG2_END); #if defined(__mips_n64) mapped = mapped || (va >= MIPS_XKSEG_START || va < MIPS_XKSEG_END); -#endif +#endif /* * Kernel virtual. */ @@ -3524,7 +3532,7 @@ pmap_kextract(vm_offset_t va) } -void +void pmap_flush_pvcache(vm_page_t m) { pv_entry_t pv; @@ -3551,12 +3559,85 @@ pmap_page_set_memattr(vm_page_t m, vm_me if (TAILQ_FIRST(&m->md.pv_list) != NULL) panic("Can't change memattr on page with existing mappings"); - /* - * The only memattr we support is UNCACHEABLE, translate the (semi-)MI - * representation of that into our internal flag in the page MD struct. - */ - if (ma == VM_MEMATTR_UNCACHEABLE) - m->md.pv_flags |= PV_MEMATTR_UNCACHEABLE; - else - m->md.pv_flags &= ~PV_MEMATTR_UNCACHEABLE; + /* Clean memattr portion of pv_flags */ + m->md.pv_flags &= ~PV_MEMATTR_MASK; + m->md.pv_flags |= (ma << PV_MEMATTR_SHIFT) & PV_MEMATTR_MASK; +} + +static __inline void +pmap_pte_attr(pt_entry_t *pte, vm_memattr_t ma) +{ + u_int npte; + + npte = *(u_int *)pte; + npte &= ~PTE_C_MASK; + npte |= PTE_C(ma); + *pte = npte; +} + +int +pmap_change_attr(vm_offset_t sva, vm_size_t size, vm_memattr_t ma) +{ + pd_entry_t *pde, *pdpe; + pt_entry_t *pte; + vm_offset_t ova, eva, va, va_next; + pmap_t pmap; + + ova = sva; + eva = sva + size; + if (eva < sva) + return (EINVAL); + + pmap = kernel_pmap; + PMAP_LOCK(pmap); + + for (; sva < eva; sva = va_next) { + pdpe = pmap_segmap(pmap, sva); +#ifdef __mips_n64 + if (*pdpe == 0) { + va_next = (sva + NBSEG) & ~SEGMASK; + if (va_next < sva) + va_next = eva; + continue; + } +#endif + va_next = (sva + NBPDR) & ~PDRMASK; + if (va_next < sva) + va_next = eva; + + pde = pmap_pdpe_to_pde(pdpe, sva); + if (*pde == NULL) + continue; + + /* + * Limit our scan to either the end of the va represented + * by the current page table page, or to the end of the + * range being removed. + */ + if (va_next > eva) + va_next = eva; + + va = va_next; + for (pte = pmap_pde_to_pte(pde, sva); sva != va_next; pte++, + sva += PAGE_SIZE) { + if (!pte_test(pte, PTE_V) || pte_cache_bits(pte) == ma) { + if (va != va_next) { + pmap_invalidate_range(pmap, va, sva); + va = va_next; + } + continue; + } + if (va == va_next) + va = sva; + + pmap_pte_attr(pte, ma); + } + if (va != va_next) + pmap_invalidate_range(pmap, va, sva); + } + PMAP_UNLOCK(pmap); + + /* Flush caches to be in the safe side */ + mips_dcache_wbinv_range(ova, size); + return 0; } From owner-svn-src-head@freebsd.org Wed Dec 28 03:08:00 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00D6BC94126; Wed, 28 Dec 2016 03:08:00 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFA681EA4; Wed, 28 Dec 2016 03:07:59 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS37x8d051160; Wed, 28 Dec 2016 03:07:59 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS37wRP051157; Wed, 28 Dec 2016 03:07:58 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612280307.uBS37wRP051157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 28 Dec 2016 03:07:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310651 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 03:08:00 -0000 Author: sephe Date: Wed Dec 28 03:07:58 2016 New Revision: 310651 URL: https://svnweb.freebsd.org/changeset/base/310651 Log: hyperv/vmbus: Nuke unnecessary critical sections. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8906 Modified: head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_chan.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Wed Dec 28 02:55:26 2016 (r310650) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Dec 28 03:07:58 2016 (r310651) @@ -1393,7 +1393,7 @@ cleanup: vmbus_xact_ctx_destroy(sc->vmbus_xc); sc->vmbus_xc = NULL; } - free(sc->vmbus_chmap, M_DEVBUF); + free(__DEVOLATILE(void *, sc->vmbus_chmap), M_DEVBUF); mtx_destroy(&sc->vmbus_prichan_lock); mtx_destroy(&sc->vmbus_chan_lock); @@ -1480,7 +1480,7 @@ vmbus_detach(device_t dev) sc->vmbus_xc = NULL; } - free(sc->vmbus_chmap, M_DEVBUF); + free(__DEVOLATILE(void *, sc->vmbus_chmap), M_DEVBUF); mtx_destroy(&sc->vmbus_prichan_lock); mtx_destroy(&sc->vmbus_chan_lock); Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Dec 28 02:55:26 2016 (r310650) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Dec 28 03:07:58 2016 (r310651) @@ -775,9 +775,7 @@ vmbus_chan_clrchmap_task(void *xchan, in { struct vmbus_channel *chan = xchan; - critical_enter(); chan->ch_vmbus->vmbus_chmap[chan->ch_id] = NULL; - critical_exit(); } static void @@ -1308,15 +1306,17 @@ vmbus_chan_pollcfg_task(void *xarg, int chan->ch_poll_flags = poll_flags; /* - * Disable interrupt from the RX bufring (TX bufring does not - * generate interrupt to VM), and disconnect this channel from - * the channel map to make sure that ISR can not enqueue this - * channel task anymore. + * Disconnect this channel from the channel map to make sure that + * the RX bufring interrupt enabling bit can not be touched, and + * ISR can not enqueue this channel task anymore. THEN, disable + * interrupt from the RX bufring (TX bufring does not generate + * interrupt to VM). + * + * NOTE: order is critical. */ - critical_enter(); - vmbus_rxbr_intr_mask(&chan->ch_rxbr); chan->ch_vmbus->vmbus_chmap[chan->ch_id] = NULL; - critical_exit(); + __compiler_membar(); + vmbus_rxbr_intr_mask(&chan->ch_rxbr); /* * NOTE: @@ -1380,11 +1380,9 @@ vmbus_chan_polldis_task(void *xchan, int * Plug this channel back to the channel map and unmask * the RX bufring interrupt. */ - critical_enter(); chan->ch_vmbus->vmbus_chmap[chan->ch_id] = chan; __compiler_membar(); vmbus_rxbr_intr_unmask(&chan->ch_rxbr); - critical_exit(); /* * Kick start the interrupt task, just in case unmasking Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Wed Dec 28 02:55:26 2016 (r310650) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Wed Dec 28 03:07:58 2016 (r310651) @@ -93,7 +93,7 @@ struct vmbus_softc { u_long *vmbus_rx_evtflags; /* compat evtflgs from host */ - struct vmbus_channel **vmbus_chmap; + struct vmbus_channel *volatile *vmbus_chmap; struct vmbus_xact_ctx *vmbus_xc; struct vmbus_pcpu_data vmbus_pcpu[MAXCPU]; From owner-svn-src-head@freebsd.org Wed Dec 28 03:20:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BC37C944D2; Wed, 28 Dec 2016 03:20:01 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF5AA18D6; Wed, 28 Dec 2016 03:20:00 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS3K0mk055782; Wed, 28 Dec 2016 03:20:00 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS3K00r055781; Wed, 28 Dec 2016 03:20:00 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612280320.uBS3K00r055781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 28 Dec 2016 03:20:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310652 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 03:20:01 -0000 Author: sephe Date: Wed Dec 28 03:19:59 2016 New Revision: 310652 URL: https://svnweb.freebsd.org/changeset/base/310652 Log: hyperv/hn: Consolidate hn_{suspend,resume} MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8907 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Dec 28 03:07:58 2016 (r310651) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Dec 28 03:19:59 2016 (r310652) @@ -2367,9 +2367,6 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, break; } - /* Disable polling. */ - hn_polling(sc, 0); - /* * Suspend this interface before the synthetic parts * are ripped. @@ -2415,13 +2412,6 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, */ hn_resume(sc); - /* - * Re-enable polling if this interface is running and - * the polling is requested. - */ - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && sc->hn_pollhz > 0) - hn_polling(sc, sc->hn_pollhz); - HN_UNLOCK(sc); break; @@ -4900,6 +4890,9 @@ static void hn_suspend(struct hn_softc *sc) { + /* Disable polling. */ + hn_polling(sc, 0); + if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) hn_suspend_data(sc); hn_suspend_mgmt(sc); @@ -4992,6 +4985,13 @@ hn_resume(struct hn_softc *sc) if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) hn_resume_data(sc); hn_resume_mgmt(sc); + + /* + * Re-enable polling if this interface is running and + * the polling is requested. + */ + if ((sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) && sc->hn_pollhz > 0) + hn_polling(sc, sc->hn_pollhz); } static void From owner-svn-src-head@freebsd.org Wed Dec 28 03:40:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 058A4C94B91; Wed, 28 Dec 2016 03:40:56 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0E62179A; Wed, 28 Dec 2016 03:40:55 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS3esA4064784; Wed, 28 Dec 2016 03:40:54 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS3esDp064783; Wed, 28 Dec 2016 03:40:54 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612280340.uBS3esDp064783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 28 Dec 2016 03:40:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310653 - head/sys/powerpc/powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 03:40:56 -0000 Author: jhibbits Date: Wed Dec 28 03:40:54 2016 New Revision: 310653 URL: https://svnweb.freebsd.org/changeset/base/310653 Log: Restrict SLB handler to powerpc64 and AIM Only Book-S has SLBs. Book-E does not, so restrict it to only Book-S (which we call AIM). Modified: head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Wed Dec 28 03:19:59 2016 (r310652) +++ head/sys/powerpc/powerpc/trap.c Wed Dec 28 03:40:54 2016 (r310653) @@ -88,7 +88,7 @@ static int fix_unaligned(struct thread * static int handle_onfault(struct trapframe *frame); static void syscall(struct trapframe *frame); -#ifdef __powerpc64__ +#if defined(__powerpc64__) && defined(AIM) void handle_kernel_slb_spill(int, register_t, register_t); static int handle_user_slb_spill(pmap_t pm, vm_offset_t addr); extern int n_slbs; @@ -208,7 +208,7 @@ trap(struct trapframe *frame) ucode = TRAP_TRACE; break; -#ifdef __powerpc64__ +#if defined(__powerpc64__) && defined(AIM) case EXC_ISE: case EXC_DSE: if (handle_user_slb_spill(&p->p_vmspace->vm_pmap, @@ -347,7 +347,7 @@ trap(struct trapframe *frame) } break; #endif -#ifdef __powerpc64__ +#if defined(__powerpc64__) && defined(AIM) case EXC_DSE: if ((frame->dar & SEGMENT_MASK) == USER_ADDR) { __asm __volatile ("slbmte %0, %1" :: @@ -578,7 +578,7 @@ syscall(struct trapframe *frame) td = curthread; td->td_frame = frame; -#ifdef __powerpc64__ +#if defined(__powerpc64__) && defined(AIM) /* * Speculatively restore last user SLB segment, which we know is * invalid already, since we are likely to do copyin()/copyout(). @@ -591,7 +591,7 @@ syscall(struct trapframe *frame) syscallret(td, error, &sa); } -#ifdef __powerpc64__ +#if defined(__powerpc64__) && defined(AIM) /* Handle kernel SLB faults -- runs in real mode, all seat belts off */ void handle_kernel_slb_spill(int type, register_t dar, register_t srr0) From owner-svn-src-head@freebsd.org Wed Dec 28 03:56:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AA44C94F8F; Wed, 28 Dec 2016 03:56:26 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C1E81E7A; Wed, 28 Dec 2016 03:56:26 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS3uPvR072683; Wed, 28 Dec 2016 03:56:25 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS3uP9R072681; Wed, 28 Dec 2016 03:56:25 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612280356.uBS3uP9R072681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 28 Dec 2016 03:56:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310654 - in head: tools/build/mk usr.sbin/bsnmpd/bsnmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 03:56:26 -0000 Author: ngie Date: Wed Dec 28 03:56:25 2016 New Revision: 310654 URL: https://svnweb.freebsd.org/changeset/base/310654 Log: Install snmpmod.3 as all of the bsnmpd APIs it documents MFC after: 3 days Modified: head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.sbin/bsnmpd/bsnmpd/Makefile Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Wed Dec 28 03:40:54 2016 (r310653) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Wed Dec 28 03:56:25 2016 (r310654) @@ -782,22 +782,119 @@ OLD_FILES+=usr/share/man/man1/bsnmpget.1 OLD_FILES+=usr/share/man/man1/bsnmpset.1.gz OLD_FILES+=usr/share/man/man1/bsnmpwalk.1.gz OLD_FILES+=usr/share/man/man1/gensnmptree.1.gz +OLD_FILES+=usr/share/man/man3/FIND_OBJECT_INT.3.gz +OLD_FILES+=usr/share/man/man3/FIND_OBJECT_INT_LINK.3.gz +OLD_FILES+=usr/share/man/man3/FIND_OBJECT_INT_LINK_INDEX.3.gz +OLD_FILES+=usr/share/man/man3/FIND_OBJECT_OID.3.gz +OLD_FILES+=usr/share/man/man3/FIND_OBJECT_OID_LINK.3.gz +OLD_FILES+=usr/share/man/man3/FIND_OBJECT_OID_LINK_INDEX.3.gz +OLD_FILES+=usr/share/man/man3/INSERT_OBJECT_INT.3.gz +OLD_FILES+=usr/share/man/man3/INSERT_OBJECT_INT_LINK.3.gz +OLD_FILES+=usr/share/man/man3/INSERT_OBJECT_INT_LINK_INDEX.3.gz +OLD_FILES+=usr/share/man/man3/INSERT_OBJECT_OID.3.gz +OLD_FILES+=usr/share/man/man3/INSERT_OBJECT_OID_LINK.3.gz +OLD_FILES+=usr/share/man/man3/INSERT_OBJECT_OID_LINK_INDEX.3.gz +OLD_FILES+=usr/share/man/man3/NEXT_OBJECT_INT.3.gz +OLD_FILES+=usr/share/man/man3/NEXT_OBJECT_INT_LINK.3.gz +OLD_FILES+=usr/share/man/man3/NEXT_OBJECT_INT_LINK_INDEX.3.gz +OLD_FILES+=usr/share/man/man3/NEXT_OBJECT_OID.3.gz +OLD_FILES+=usr/share/man/man3/NEXT_OBJECT_OID_LINK.3.gz +OLD_FILES+=usr/share/man/man3/NEXT_OBJECT_OID_LINK_INDEX.3.gz OLD_FILES+=usr/share/man/man3/asn1.3.gz OLD_FILES+=usr/share/man/man3/bsnmpagent.3.gz OLD_FILES+=usr/share/man/man3/bsnmpclient.3.gz +OLD_FILES+=usr/share/man/man3/bsnmpd_get_target_stats.3.gz +OLD_FILES+=usr/share/man/man3/bsnmpd_get_usm_stats.3.gz +OLD_FILES+=usr/share/man/man3/bsnmpd_reset_usm_stats.3.gz OLD_FILES+=usr/share/man/man3/bsnmplib.3.gz +OLD_FILES+=usr/share/man/man3/buf_alloc.3.gz +OLD_FILES+=usr/share/man/man3/buf_size.3.gz +OLD_FILES+=usr/share/man/man3/comm_define.3.gz +OLD_FILES+=usr/share/man/man3/community.3.gz +OLD_FILES+=usr/share/man/man3/fd_deselect.3.gz +OLD_FILES+=usr/share/man/man3/fd_resume.3.gz +OLD_FILES+=usr/share/man/man3/fd_select.3.gz +OLD_FILES+=usr/share/man/man3/fd_suspend.3.gz +OLD_FILES+=usr/share/man/man3/get_ticks.3.gz +OLD_FILES+=usr/share/man/man3/index_append.3.gz +OLD_FILES+=usr/share/man/man3/index_append_off.3.gz +OLD_FILES+=usr/share/man/man3/index_compare.3.gz +OLD_FILES+=usr/share/man/man3/index_compare_off.3.gz +OLD_FILES+=usr/share/man/man3/index_decode.3.gz +OLD_FILES+=usr/share/man/man3/ip_commit.3.gz +OLD_FILES+=usr/share/man/man3/ip_get.3.gz +OLD_FILES+=usr/share/man/man3/ip_rollback.3.gz +OLD_FILES+=usr/share/man/man3/ip_save.3.gz +OLD_FILES+=usr/share/man/man3/or_register.3.gz +OLD_FILES+=usr/share/man/man3/or_unregister.3.gz +OLD_FILES+=usr/share/man/man3/oid_commit.3.gz +OLD_FILES+=usr/share/man/man3/oid_get.3.gz +OLD_FILES+=usr/share/man/man3/oid_rollback.3.gz +OLD_FILES+=usr/share/man/man3/oid_save.3.gz +OLD_FILES+=usr/share/man/man3/oid_usmNotInTimeWindows.3.gz +OLD_FILES+=usr/share/man/man3/oid_usmUnknownEngineIDs.3.gz +OLD_FILES+=usr/share/man/man3/oid_zeroDotZero.3.gz +OLD_FILES+=usr/share/man/man3/reqid_allocate.3.gz +OLD_FILES+=usr/share/man/man3/reqid_base.3.gz +OLD_FILES+=usr/share/man/man3/reqid_istype.3.gz +OLD_FILES+=usr/share/man/man3/reqid_next.3.gz +OLD_FILES+=usr/share/man/man3/reqid_type.3.gz OLD_FILES+=usr/share/man/man3/snmp_atm.3.gz OLD_FILES+=usr/share/man/man3/snmp_bridge.3.gz OLD_FILES+=usr/share/man/man3/snmp_hast.3.gz OLD_FILES+=usr/share/man/man3/snmp_hostres.3.gz +OLD_FILES+=usr/share/man/man3/snmp_input_finish.3.gz +OLD_FILES+=usr/share/man/man3/snmp_input_start.3.gz OLD_FILES+=usr/share/man/man3/snmp_lm75.3.gz OLD_FILES+=usr/share/man/man3/snmp_mibII.3.gz OLD_FILES+=usr/share/man/man3/snmp_netgraph.3.gz +OLD_FILES+=usr/share/man/man3/snmp_output.3.gz +OLD_FILES+=usr/share/man/man3/snmp_pdu_auth_access.3.gz +OLD_FILES+=usr/share/man/man3/snmp_send_port.3.gz +OLD_FILES+=usr/share/man/man3/snmp_send_trap.3.gz OLD_FILES+=usr/share/man/man3/snmp_target.3.gz OLD_FILES+=usr/share/man/man3/snmp_usm.3.gz OLD_FILES+=usr/share/man/man3/snmp_vacm.3.gz OLD_FILES+=usr/share/man/man3/snmp_wlan.3.gz +OLD_FILES+=usr/share/man/man3/snmpd_target_stat.3.gz +OLD_FILES+=usr/share/man/man3/snmpd_usmstats.3.gz OLD_FILES+=usr/share/man/man3/snmpmod.3.gz +OLD_FILES+=usr/share/man/man3/start_tick.3.gz +OLD_FILES+=usr/share/man/man3/string_commit.3.gz +OLD_FILES+=usr/share/man/man3/string_free.3.gz +OLD_FILES+=usr/share/man/man3/string_get.3.gz +OLD_FILES+=usr/share/man/man3/string_get_max.3.gz +OLD_FILES+=usr/share/man/man3/string_rollback.3.gz +OLD_FILES+=usr/share/man/man3/string_save.3.gz +OLD_FILES+=usr/share/man/man3/systemg.3.gz +OLD_FILES+=usr/share/man/man3/this_tick.3.gz +OLD_FILES+=usr/share/man/man3/timer_start.3.gz +OLD_FILES+=usr/share/man/man3/timer_start_repeat.3.gz +OLD_FILES+=usr/share/man/man3/timer_stop.3.gz +OLD_FILES+=usr/share/man/man3/target_activate_address.3.gz +OLD_FILES+=usr/share/man/man3/target_address.3.gz +OLD_FILES+=usr/share/man/man3/target_delete_address.3.gz +OLD_FILES+=usr/share/man/man3/target_delete_notify.3.gz +OLD_FILES+=usr/share/man/man3/target_delete_param.3.gz +OLD_FILES+=usr/share/man/man3/target_first_address.3.gz +OLD_FILES+=usr/share/man/man3/target_first_notify.3.gz +OLD_FILES+=usr/share/man/man3/target_first_param.3.gz +OLD_FILES+=usr/share/man/man3/target_flush_all.3.gz +OLD_FILES+=usr/share/man/man3/target_next_address.3.gz +OLD_FILES+=usr/share/man/man3/target_next_notify.3.gz +OLD_FILES+=usr/share/man/man3/target_next_param.3.gz +OLD_FILES+=usr/share/man/man3/target_new_address.3.gz +OLD_FILES+=usr/share/man/man3/target_new_notify.3.gz +OLD_FILES+=usr/share/man/man3/target_new_param.3.gz +OLD_FILES+=usr/share/man/man3/target_notify.3.gz +OLD_FILES+=usr/share/man/man3/target_param.3.gz +OLD_FILES+=usr/share/man/man3/usm_delete_user.3.gz +OLD_FILES+=usr/share/man/man3/usm_find_user.3.gz +OLD_FILES+=usr/share/man/man3/usm_first_user.3.gz +OLD_FILES+=usr/share/man/man3/usm_flush_users.3.gz +OLD_FILES+=usr/share/man/man3/usm_next_user.3.gz +OLD_FILES+=usr/share/man/man3/usm_new_user.3.gz +OLD_FILES+=usr/share/man/man3/usm_user.3.gz OLD_FILES+=usr/share/snmp/defs/atm_freebsd.def OLD_FILES+=usr/share/snmp/defs/atm_tree.def OLD_FILES+=usr/share/snmp/defs/bridge_tree.def Modified: head/usr.sbin/bsnmpd/bsnmpd/Makefile ============================================================================== --- head/usr.sbin/bsnmpd/bsnmpd/Makefile Wed Dec 28 03:40:54 2016 (r310653) +++ head/usr.sbin/bsnmpd/bsnmpd/Makefile Wed Dec 28 03:56:25 2016 (r310654) @@ -15,8 +15,107 @@ XSYM= snmpMIB begemotSnmpdModuleTable be begemotSnmpdTransUdp begemotSnmpdTransLsock begemotSnmpdLocalPortTable \ freeBSD freeBSDVersion CLEANFILES= oid.h tree.c tree.h + MAN= bsnmpd.1 snmpmod.3 +MLINKS+= snmpmod.3 FIND_OBJECT_INT.3 +MLINKS+= snmpmod.3 FIND_OBJECT_INT_LINK.3 +MLINKS+= snmpmod.3 FIND_OBJECT_INT_LINK_INDEX.3 +MLINKS+= snmpmod.3 FIND_OBJECT_OID.3 +MLINKS+= snmpmod.3 FIND_OBJECT_OID_LINK.3 +MLINKS+= snmpmod.3 FIND_OBJECT_OID_LINK_INDEX.3 +MLINKS+= snmpmod.3 INSERT_OBJECT_INT.3 +MLINKS+= snmpmod.3 INSERT_OBJECT_INT_LINK.3 +MLINKS+= snmpmod.3 INSERT_OBJECT_INT_LINK_INDEX.3 +MLINKS+= snmpmod.3 INSERT_OBJECT_OID.3 +MLINKS+= snmpmod.3 INSERT_OBJECT_OID_LINK.3 +MLINKS+= snmpmod.3 INSERT_OBJECT_OID_LINK_INDEX.3 +MLINKS+= snmpmod.3 NEXT_OBJECT_INT.3 +MLINKS+= snmpmod.3 NEXT_OBJECT_INT_LINK.3 +MLINKS+= snmpmod.3 NEXT_OBJECT_INT_LINK_INDEX.3 +MLINKS+= snmpmod.3 NEXT_OBJECT_OID.3 +MLINKS+= snmpmod.3 NEXT_OBJECT_OID_LINK.3 +MLINKS+= snmpmod.3 NEXT_OBJECT_OID_LINK_INDEX.3 +MLINKS+= snmpmod.3 bsnmpd_get_target_stats.3 +MLINKS+= snmpmod.3 bsnmpd_get_usm_stats.3 +MLINKS+= snmpmod.3 bsnmpd_reset_usm_stats.3 +MLINKS+= snmpmod.3 buf_alloc.3 +MLINKS+= snmpmod.3 buf_size.3 +MLINKS+= snmpmod.3 comm_define.3 +MLINKS+= snmpmod.3 community.3 +MLINKS+= snmpmod.3 fd_deselect.3 +MLINKS+= snmpmod.3 fd_resume.3 +MLINKS+= snmpmod.3 fd_select.3 +MLINKS+= snmpmod.3 fd_suspend.3 +MLINKS+= snmpmod.3 get_ticks.3 +MLINKS+= snmpmod.3 index_append.3 +MLINKS+= snmpmod.3 index_append_off.3 +MLINKS+= snmpmod.3 index_compare.3 +MLINKS+= snmpmod.3 index_compare_off.3 +MLINKS+= snmpmod.3 index_decode.3 +MLINKS+= snmpmod.3 ip_commit.3 +MLINKS+= snmpmod.3 ip_get.3 +MLINKS+= snmpmod.3 ip_rollback.3 +MLINKS+= snmpmod.3 ip_save.3 +MLINKS+= snmpmod.3 or_register.3 +MLINKS+= snmpmod.3 or_unregister.3 +MLINKS+= snmpmod.3 oid_commit.3 +MLINKS+= snmpmod.3 oid_get.3 +MLINKS+= snmpmod.3 oid_rollback.3 +MLINKS+= snmpmod.3 oid_save.3 +MLINKS+= snmpmod.3 oid_usmNotInTimeWindows.3 +MLINKS+= snmpmod.3 oid_usmUnknownEngineIDs.3 +MLINKS+= snmpmod.3 oid_zeroDotZero.3 +MLINKS+= snmpmod.3 reqid_allocate.3 +MLINKS+= snmpmod.3 reqid_base.3 +MLINKS+= snmpmod.3 reqid_istype.3 +MLINKS+= snmpmod.3 reqid_next.3 +MLINKS+= snmpmod.3 reqid_type.3 +MLINKS+= snmpmod.3 snmp_input_finish.3 +MLINKS+= snmpmod.3 snmp_input_start.3 +MLINKS+= snmpmod.3 snmp_output.3 +MLINKS+= snmpmod.3 snmp_pdu_auth_access.3 +MLINKS+= snmpmod.3 snmp_send_port.3 +MLINKS+= snmpmod.3 snmp_send_trap.3 +MLINKS+= snmpmod.3 snmpd_target_stat.3 +MLINKS+= snmpmod.3 snmpd_usmstats.3 +MLINKS+= snmpmod.3 start_tick.3 +MLINKS+= snmpmod.3 string_commit.3 +MLINKS+= snmpmod.3 string_free.3 +MLINKS+= snmpmod.3 string_get.3 +MLINKS+= snmpmod.3 string_get_max.3 +MLINKS+= snmpmod.3 string_rollback.3 +MLINKS+= snmpmod.3 string_save.3 +MLINKS+= snmpmod.3 systemg.3 +MLINKS+= snmpmod.3 this_tick.3 +MLINKS+= snmpmod.3 timer_start.3 +MLINKS+= snmpmod.3 timer_start_repeat.3 +MLINKS+= snmpmod.3 timer_stop.3 +MLINKS+= snmpmod.3 target_activate_address.3 +MLINKS+= snmpmod.3 target_address.3 +MLINKS+= snmpmod.3 target_delete_address.3 +MLINKS+= snmpmod.3 target_delete_notify.3 +MLINKS+= snmpmod.3 target_delete_param.3 +MLINKS+= snmpmod.3 target_first_address.3 +MLINKS+= snmpmod.3 target_first_notify.3 +MLINKS+= snmpmod.3 target_first_param.3 +MLINKS+= snmpmod.3 target_flush_all.3 +MLINKS+= snmpmod.3 target_next_address.3 +MLINKS+= snmpmod.3 target_next_notify.3 +MLINKS+= snmpmod.3 target_next_param.3 +MLINKS+= snmpmod.3 target_new_address.3 +MLINKS+= snmpmod.3 target_new_notify.3 +MLINKS+= snmpmod.3 target_new_param.3 +MLINKS+= snmpmod.3 target_notify.3 +MLINKS+= snmpmod.3 target_param.3 +MLINKS+= snmpmod.3 usm_delete_user.3 +MLINKS+= snmpmod.3 usm_find_user.3 +MLINKS+= snmpmod.3 usm_first_user.3 +MLINKS+= snmpmod.3 usm_flush_users.3 +MLINKS+= snmpmod.3 usm_next_user.3 +MLINKS+= snmpmod.3 usm_new_user.3 +MLINKS+= snmpmod.3 usm_user.3 + FILESGROUPS= BMIBS DEFS BMIBS= FOKUS-MIB.txt BEGEMOT-MIB.txt BEGEMOT-SNMPD.txt From owner-svn-src-head@freebsd.org Wed Dec 28 04:29:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 806EDC90E44; Wed, 28 Dec 2016 04:29:11 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5AF551022; Wed, 28 Dec 2016 04:29:11 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS4TANU085326; Wed, 28 Dec 2016 04:29:10 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS4TA1W085321; Wed, 28 Dec 2016 04:29:10 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612280429.uBS4TA1W085321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 28 Dec 2016 04:29:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310655 - head/contrib/bsnmp/snmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 04:29:11 -0000 Author: ngie Date: Wed Dec 28 04:29:09 2016 New Revision: 310655 URL: https://svnweb.freebsd.org/changeset/base/310655 Log: Fix bsnmpd sending/receiving with multi-homed configurations or INADDR_ANY used as the listening address in snmpd_input(..) Stash the IPv4 address of the receiver via the recv(..) callback and use it in the send(..) callback for the transport by specifying IP_SENDSRCADDR for the control message type. Add sendmsg logic to the UDP transport's send(..) callback and use the respective send(..) callback for the transport instead of calling sendto in snmpd_input(..). MFC after: 3 weeks Obtained from: Isilon OneFS (^/onefs/branches/BR_8_0_0_DEV@r507595) Submitted by: Thor Steingrimsson Sponsored by: Dell EMC Isilon Modified: head/contrib/bsnmp/snmpd/main.c head/contrib/bsnmp/snmpd/snmpd.h head/contrib/bsnmp/snmpd/trans_lsock.c head/contrib/bsnmp/snmpd/trans_udp.c head/contrib/bsnmp/snmpd/trans_udp.h Modified: head/contrib/bsnmp/snmpd/main.c ============================================================================== --- head/contrib/bsnmp/snmpd/main.c Wed Dec 28 03:56:25 2016 (r310654) +++ head/contrib/bsnmp/snmpd/main.c Wed Dec 28 04:29:09 2016 (r310655) @@ -1040,10 +1040,8 @@ snmpd_input(struct port_input *pi, struc #ifdef USE_TCPWRAPPERS char client[16]; #endif - struct msghdr msg; - struct iovec iov[1]; - ret = tport->transport->vtab->recv(pi); + ret = tport->transport->vtab->recv(tport, pi); if (ret == -1) return (-1); @@ -1186,21 +1184,15 @@ snmpd_input(struct port_input *pi, struc sndbuf, &sndlen, "SNMP", ierr, vi, NULL); if (ferr == SNMPD_INPUT_OK) { - msg.msg_name = pi->peer; - msg.msg_namelen = pi->peerlen; - msg.msg_iov = iov; - msg.msg_iovlen = 1; - msg.msg_flags = 0; - iov[0].iov_base = sndbuf; - iov[0].iov_len = sndlen; - - slen = sendmsg(pi->fd, &msg, 0); + slen = tport->transport->vtab->send(tport, sndbuf, sndlen, + pi->peer, pi->peerlen); if (slen == -1) - syslog(LOG_ERR, "sendmsg: %m"); + syslog(LOG_ERR, "send*: %m"); else if ((size_t)slen != sndlen) - syslog(LOG_ERR, "sendmsg: short write %zu/%zu", - sndlen, (size_t)slen); + syslog(LOG_ERR, "send*: short write %zu/%zu", sndlen, + (size_t)slen); } + snmp_pdu_free(&pdu); free(sndbuf); snmp_input_consume(pi); Modified: head/contrib/bsnmp/snmpd/snmpd.h ============================================================================== --- head/contrib/bsnmp/snmpd/snmpd.h Wed Dec 28 03:56:25 2016 (r310654) +++ head/contrib/bsnmp/snmpd/snmpd.h Wed Dec 28 04:29:09 2016 (r310655) @@ -193,7 +193,7 @@ struct transport_def { ssize_t (*send)(struct tport *, const u_char *, size_t, const struct sockaddr *, size_t); - ssize_t (*recv)(struct port_input *); + ssize_t (*recv)(struct tport *, struct port_input *); }; struct transport { struct asn_oid index; /* transport table index */ Modified: head/contrib/bsnmp/snmpd/trans_lsock.c ============================================================================== --- head/contrib/bsnmp/snmpd/trans_lsock.c Wed Dec 28 03:56:25 2016 (r310654) +++ head/contrib/bsnmp/snmpd/trans_lsock.c Wed Dec 28 04:29:09 2016 (r310655) @@ -59,7 +59,7 @@ static void lsock_close_port(struct tpor static int lsock_init_port(struct tport *); static ssize_t lsock_send(struct tport *, const u_char *, size_t, const struct sockaddr *, size_t); -static ssize_t lsock_recv(struct port_input *); +static ssize_t lsock_recv(struct tport *, struct port_input *); /* exported */ const struct transport_def lsock_trans = { @@ -444,7 +444,7 @@ check_priv_stream(struct port_input *pi) * Receive something */ static ssize_t -lsock_recv(struct port_input *pi) +lsock_recv(struct tport *tp __unused, struct port_input *pi) { struct msghdr msg; struct iovec iov[1]; Modified: head/contrib/bsnmp/snmpd/trans_udp.c ============================================================================== --- head/contrib/bsnmp/snmpd/trans_udp.c Wed Dec 28 03:56:25 2016 (r310654) +++ head/contrib/bsnmp/snmpd/trans_udp.c Wed Dec 28 04:29:09 2016 (r310655) @@ -55,7 +55,7 @@ static void udp_close_port(struct tport static int udp_init_port(struct tport *); static ssize_t udp_send(struct tport *, const u_char *, size_t, const struct sockaddr *, size_t); -static ssize_t udp_recv(struct port_input *); +static ssize_t udp_recv(struct tport *, struct port_input *); /* exported */ const struct transport_def udp_trans = { @@ -217,8 +217,30 @@ udp_send(struct tport *tp, const u_char const struct sockaddr *addr, size_t addrlen) { struct udp_port *p = (struct udp_port *)tp; + struct cmsghdr *cmsg; + struct in_addr *src_addr; + struct msghdr msg; + char cbuf[CMSG_SPACE(sizeof(struct in_addr))]; + struct iovec iov; - return (sendto(p->input.fd, buf, len, 0, addr, addrlen)); + iov.iov_base = __DECONST(void*, buf); + iov.iov_len = len; + + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_name = __DECONST(void *, addr); + msg.msg_namelen = addrlen; + msg.msg_control = cbuf; + msg.msg_controllen = sizeof(cbuf); + + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_level = IPPROTO_IP; + cmsg->cmsg_type = IP_SENDSRCADDR; + cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_addr)); + src_addr = (struct in_addr *)(void*)CMSG_DATA(cmsg); + memcpy(src_addr, &p->recv_addr, sizeof(struct in_addr)); + + return (sendmsg(p->input.fd, &msg, 0)); } static void @@ -309,8 +331,9 @@ recv_dgram(struct port_input *pi, struct * Receive something */ static ssize_t -udp_recv(struct port_input *pi) +udp_recv(struct tport *tp, struct port_input *pi) { + struct udp_port *p = (struct udp_port *)tp; struct in_addr *laddr; struct msghdr msg; char cbuf[CMSG_SPACE(sizeof(struct in_addr))]; @@ -330,6 +353,8 @@ udp_recv(struct port_input *pi) ret = recv_dgram(pi, laddr); + memcpy(&p->recv_addr, laddr, sizeof(struct in_addr)); + if (laddr->s_addr == INADDR_ANY) { msg.msg_control = NULL; msg.msg_controllen = 0; Modified: head/contrib/bsnmp/snmpd/trans_udp.h ============================================================================== --- head/contrib/bsnmp/snmpd/trans_udp.h Wed Dec 28 03:56:25 2016 (r310654) +++ head/contrib/bsnmp/snmpd/trans_udp.h Wed Dec 28 04:29:09 2016 (r310655) @@ -39,6 +39,7 @@ struct udp_port { struct port_input input; /* common input stuff */ struct sockaddr_in ret; /* the return address */ + struct in_addr recv_addr; /* the address the request was sent to */ }; /* argument for open call */ From owner-svn-src-head@freebsd.org Wed Dec 28 04:31:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E546C90F0B; Wed, 28 Dec 2016 04:31:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E21DA1239; Wed, 28 Dec 2016 04:31:08 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS4V8PD088303; Wed, 28 Dec 2016 04:31:08 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS4V8hA088302; Wed, 28 Dec 2016 04:31:08 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612280431.uBS4V8hA088302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 28 Dec 2016 04:31:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310656 - head/contrib/bsnmp/snmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 04:31:09 -0000 Author: ngie Date: Wed Dec 28 04:31:07 2016 New Revision: 310656 URL: https://svnweb.freebsd.org/changeset/base/310656 Log: style(9): sort alignment in udp_recv(..) MFC after: 3 weeks Modified: head/contrib/bsnmp/snmpd/trans_udp.c Modified: head/contrib/bsnmp/snmpd/trans_udp.c ============================================================================== --- head/contrib/bsnmp/snmpd/trans_udp.c Wed Dec 28 04:29:09 2016 (r310655) +++ head/contrib/bsnmp/snmpd/trans_udp.c Wed Dec 28 04:31:07 2016 (r310656) @@ -334,10 +334,10 @@ static ssize_t udp_recv(struct tport *tp, struct port_input *pi) { struct udp_port *p = (struct udp_port *)tp; + struct cmsghdr *cmsgp; struct in_addr *laddr; struct msghdr msg; char cbuf[CMSG_SPACE(sizeof(struct in_addr))]; - struct cmsghdr *cmsgp; ssize_t ret; memset(cbuf, 0, sizeof(cbuf)); From owner-svn-src-head@freebsd.org Wed Dec 28 04:35:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DC6FC910E0; Wed, 28 Dec 2016 04:35:54 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A9EE9164F; Wed, 28 Dec 2016 04:35:53 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS4Zqhk089214; Wed, 28 Dec 2016 04:35:52 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS4Zqk3089213; Wed, 28 Dec 2016 04:35:52 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612280435.uBS4Zqk3089213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 28 Dec 2016 04:35:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310657 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 04:35:54 -0000 Author: sephe Date: Wed Dec 28 04:35:52 2016 New Revision: 310657 URL: https://svnweb.freebsd.org/changeset/base/310657 Log: hyperv/hn: Function renaming; no functional changes. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8908 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Dec 28 04:31:07 2016 (r310656) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Dec 28 04:35:52 2016 (r310657) @@ -333,7 +333,7 @@ static void hn_link_status(struct hn_s static int hn_create_rx_data(struct hn_softc *, int); static void hn_destroy_rx_data(struct hn_softc *); static int hn_check_iplen(const struct mbuf *, int); -static int hn_set_rxfilter(struct hn_softc *); +static int hn_rxfilter_config(struct hn_softc *); #ifndef RSS static int hn_rss_reconfig(struct hn_softc *); #endif @@ -684,7 +684,7 @@ do { \ #endif /* INET6 || INET */ static int -hn_set_rxfilter(struct hn_softc *sc) +hn_rxfilter_config(struct hn_softc *sc) { struct ifnet *ifp = sc->hn_ifp; uint32_t filter; @@ -2431,7 +2431,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, * reply. */ HN_NO_SLEEPING(sc); - hn_set_rxfilter(sc); + hn_rxfilter_config(sc); HN_SLEEPING_OK(sc); } else { hn_init_locked(sc); @@ -2508,7 +2508,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, * the RNDIS reply. */ HN_NO_SLEEPING(sc); - hn_set_rxfilter(sc); + hn_rxfilter_config(sc); HN_SLEEPING_OK(sc); } @@ -2566,7 +2566,7 @@ hn_init_locked(struct hn_softc *sc) return; /* Configure RX filter */ - hn_set_rxfilter(sc); + hn_rxfilter_config(sc); /* Clear OACTIVE bit. */ atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); @@ -4925,7 +4925,7 @@ hn_resume_data(struct hn_softc *sc) /* * Re-enable RX. */ - hn_set_rxfilter(sc); + hn_rxfilter_config(sc); /* * Make sure to clear suspend status on "all" TX rings, From owner-svn-src-head@freebsd.org Wed Dec 28 04:47:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69F95C9136A; Wed, 28 Dec 2016 04:47:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 147FD1BCB; Wed, 28 Dec 2016 04:47:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS4lHqQ093641; Wed, 28 Dec 2016 04:47:17 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS4lHok093639; Wed, 28 Dec 2016 04:47:17 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612280447.uBS4lHok093639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 28 Dec 2016 04:47:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310658 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 04:47:18 -0000 Author: sephe Date: Wed Dec 28 04:47:17 2016 New Revision: 310658 URL: https://svnweb.freebsd.org/changeset/base/310658 Log: hyperv/hn: Factor out function to set rxfilter. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8928 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Dec 28 04:35:52 2016 (r310657) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Dec 28 04:47:17 2016 (r310658) @@ -333,6 +333,7 @@ static void hn_link_status(struct hn_s static int hn_create_rx_data(struct hn_softc *, int); static void hn_destroy_rx_data(struct hn_softc *); static int hn_check_iplen(const struct mbuf *, int); +static int hn_set_rxfilter(struct hn_softc *, uint32_t); static int hn_rxfilter_config(struct hn_softc *); #ifndef RSS static int hn_rss_reconfig(struct hn_softc *); @@ -684,11 +685,25 @@ do { \ #endif /* INET6 || INET */ static int +hn_set_rxfilter(struct hn_softc *sc, uint32_t filter) +{ + int error = 0; + + HN_LOCK_ASSERT(sc); + + if (sc->hn_rx_filter != filter) { + error = hn_rndis_set_rxfilter(sc, filter); + if (!error) + sc->hn_rx_filter = filter; + } + return (error); +} + +static int hn_rxfilter_config(struct hn_softc *sc) { struct ifnet *ifp = sc->hn_ifp; uint32_t filter; - int error = 0; HN_LOCK_ASSERT(sc); @@ -703,13 +718,7 @@ hn_rxfilter_config(struct hn_softc *sc) !TAILQ_EMPTY(&ifp->if_multiaddrs)) filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; } - - if (sc->hn_rx_filter != filter) { - error = hn_rndis_set_rxfilter(sc, filter); - if (!error) - sc->hn_rx_filter = filter; - } - return (error); + return (hn_set_rxfilter(sc, filter)); } static void @@ -4817,8 +4826,7 @@ hn_suspend_data(struct hn_softc *sc) /* * Disable RX by clearing RX filter. */ - sc->hn_rx_filter = NDIS_PACKET_TYPE_NONE; - hn_rndis_set_rxfilter(sc, sc->hn_rx_filter); + hn_set_rxfilter(sc, NDIS_PACKET_TYPE_NONE); /* * Give RNDIS enough time to flush all pending data packets. From owner-svn-src-head@freebsd.org Wed Dec 28 04:53:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8BC0C915F4; Wed, 28 Dec 2016 04:53:53 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B84321164; Wed, 28 Dec 2016 04:53:53 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS4rqZQ097694; Wed, 28 Dec 2016 04:53:52 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS4rqen097693; Wed, 28 Dec 2016 04:53:52 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612280453.uBS4rqen097693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 28 Dec 2016 04:53:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310660 - head/contrib/bsnmp/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 04:53:54 -0000 Author: ngie Date: Wed Dec 28 04:53:52 2016 New Revision: 310660 URL: https://svnweb.freebsd.org/changeset/base/310660 Log: style(9): fix whitespace in pdu_encode_secparams(..) MFC after: 3 days Modified: head/contrib/bsnmp/lib/snmp.c Modified: head/contrib/bsnmp/lib/snmp.c ============================================================================== --- head/contrib/bsnmp/lib/snmp.c Wed Dec 28 04:48:30 2016 (r310659) +++ head/contrib/bsnmp/lib/snmp.c Wed Dec 28 04:53:52 2016 (r310660) @@ -357,8 +357,8 @@ static enum snmp_code pdu_encode_secparams(struct asn_buf *b, struct snmp_pdu *pdu) { u_char buf[256], *sptr; - struct asn_buf tb; - size_t auth_off, moved = 0; + struct asn_buf tb; + size_t auth_off, moved = 0; auth_off = 0; memset(buf, 0, 256); From owner-svn-src-head@freebsd.org Wed Dec 28 04:55:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C30FC916D0; Wed, 28 Dec 2016 04:55:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BD75130D; Wed, 28 Dec 2016 04:55:43 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS4thbe097846; Wed, 28 Dec 2016 04:55:43 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS4thlR097845; Wed, 28 Dec 2016 04:55:43 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612280455.uBS4thlR097845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 28 Dec 2016 04:55:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310661 - head/sys/boot/i386/loader X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 04:55:44 -0000 Author: emaste Date: Wed Dec 28 04:55:43 2016 New Revision: 310661 URL: https://svnweb.freebsd.org/changeset/base/310661 Log: loader: use strip -o instead of cp and strip in place It is simpler and cleaner to have strip produce the stripped output directly than copying the input to the output first. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/boot/i386/loader/Makefile Modified: head/sys/boot/i386/loader/Makefile ============================================================================== --- head/sys/boot/i386/loader/Makefile Wed Dec 28 04:53:52 2016 (r310660) +++ head/sys/boot/i386/loader/Makefile Wed Dec 28 04:55:43 2016 (r310661) @@ -99,8 +99,7 @@ ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTX -b ${BTXKERN} ${LOADER}.bin ${LOADER}.bin: ${LOADER}.sym - cp ${.ALLSRC} ${.TARGET} - strip -R .comment -R .note ${.TARGET} + strip -R .comment -R .note -o ${.TARGET} ${.ALLSRC} loader.help: help.common help.i386 cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} From owner-svn-src-head@freebsd.org Wed Dec 28 04:56:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D03FC91786; Wed, 28 Dec 2016 04:56:16 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CBD214D2; Wed, 28 Dec 2016 04:56:16 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS4uFJV097921; Wed, 28 Dec 2016 04:56:15 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS4uFHs097920; Wed, 28 Dec 2016 04:56:15 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612280456.uBS4uFHs097920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 28 Dec 2016 04:56:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310662 - head/contrib/bsnmp/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 04:56:16 -0000 Author: ngie Date: Wed Dec 28 04:56:15 2016 New Revision: 310662 URL: https://svnweb.freebsd.org/changeset/base/310662 Log: style(9): snmp_send_packet(..): fix whitespace MFC after: 3 days Modified: head/contrib/bsnmp/lib/snmpclient.c Modified: head/contrib/bsnmp/lib/snmpclient.c ============================================================================== --- head/contrib/bsnmp/lib/snmpclient.c Wed Dec 28 04:55:43 2016 (r310661) +++ head/contrib/bsnmp/lib/snmpclient.c Wed Dec 28 04:56:15 2016 (r310662) @@ -1227,9 +1227,9 @@ snmp_next_reqid(struct snmp_client * c) static int32_t snmp_send_packet(struct snmp_pdu * pdu) { - u_char *buf; - struct asn_buf b; - ssize_t ret; + u_char *buf; + struct asn_buf b; + ssize_t ret; if ((buf = malloc(snmp_client.txbuflen)) == NULL) { seterr(&snmp_client, "%s", strerror(errno)); From owner-svn-src-head@freebsd.org Wed Dec 28 05:05:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32F04C919AB; Wed, 28 Dec 2016 05:05:10 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 029E51949; Wed, 28 Dec 2016 05:05:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS559Nb002081; Wed, 28 Dec 2016 05:05:09 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS559rZ002080; Wed, 28 Dec 2016 05:05:09 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612280505.uBS559rZ002080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 28 Dec 2016 05:05:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310663 - head/contrib/bsnmp/snmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 05:05:10 -0000 Author: ngie Date: Wed Dec 28 05:05:08 2016 New Revision: 310663 URL: https://svnweb.freebsd.org/changeset/base/310663 Log: style(9): ip_get(..): clean up whitespace MFC after: 3 days Modified: head/contrib/bsnmp/snmpd/export.c Modified: head/contrib/bsnmp/snmpd/export.c ============================================================================== --- head/contrib/bsnmp/snmpd/export.c Wed Dec 28 04:56:15 2016 (r310662) +++ head/contrib/bsnmp/snmpd/export.c Wed Dec 28 05:05:08 2016 (r310663) @@ -194,6 +194,7 @@ ip_get(struct snmp_value *value, u_char value->v.ipaddress[1] = valp[1]; value->v.ipaddress[2] = valp[2]; value->v.ipaddress[3] = valp[3]; + return (SNMP_ERR_NOERROR); } From owner-svn-src-head@freebsd.org Wed Dec 28 05:16:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C753FC91CE6; Wed, 28 Dec 2016 05:16:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8930E1049; Wed, 28 Dec 2016 05:16:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS5Gfnx006672; Wed, 28 Dec 2016 05:16:41 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS5Gfxl006670; Wed, 28 Dec 2016 05:16:41 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612280516.uBS5Gfxl006670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 28 Dec 2016 05:16:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310664 - in head: tools/build/mk usr.sbin/bsnmpd/modules X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 05:16:42 -0000 Author: ngie Date: Wed Dec 28 05:16:41 2016 New Revision: 310664 URL: https://svnweb.freebsd.org/changeset/base/310664 Log: Only build/install usr.sbin/bsnmpd/modules/snmp_wlan if MK_WIRELESS != no MFC after: 1 week Modified: head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.sbin/bsnmpd/modules/Makefile Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Wed Dec 28 05:05:08 2016 (r310663) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Wed Dec 28 05:16:41 2016 (r310664) @@ -9021,6 +9021,12 @@ OLD_FILES+=usr/share/man/man8/wlandebug. OLD_FILES+=usr/share/man/man8/wpa_cli.8.gz OLD_FILES+=usr/share/man/man8/wpa_passphrase.8.gz OLD_FILES+=usr/share/man/man8/wpa_supplicant.8.gz +OLD_FILES+=usr/lib/snmp_wlan.so +OLD_LIBS+=usr/lib/snmp_wlan.so.6 +# bsnmp module +OLD_FILES+=usr/share/man/man3/snmp_wlan.3.gz +OLD_FILES+=usr/share/snmp/defs/wlan_tree.def +OLD_FILES+=usr/share/snmp/mibs/BEGEMOT-WIRELESS-MIB.txt .endif .if ${MK_SVNLITE} == no || ${MK_SVN} == yes Modified: head/usr.sbin/bsnmpd/modules/Makefile ============================================================================== --- head/usr.sbin/bsnmpd/modules/Makefile Wed Dec 28 05:05:08 2016 (r310663) +++ head/usr.sbin/bsnmpd/modules/Makefile Wed Dec 28 05:16:41 2016 (r310664) @@ -17,7 +17,6 @@ SUBDIR= ${_snmp_atm} \ snmp_target \ snmp_usm \ snmp_vacm \ - snmp_wlan .if ${MK_PF} != "no" SUBDIR+=snmp_pf @@ -27,6 +26,10 @@ SUBDIR+=snmp_pf SUBDIR+=snmp_netgraph .endif +.if ${MK_WIRELESS} != "no" +SUBDIR+=snmp_wlan +.endif + INCS= snmpmod.h INCSDIR= ${INCLUDEDIR}/bsnmp From owner-svn-src-head@freebsd.org Wed Dec 28 05:21:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D024C92078; Wed, 28 Dec 2016 05:21:23 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 458151322; Wed, 28 Dec 2016 05:21:23 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS5LMvW007576; Wed, 28 Dec 2016 05:21:22 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS5LMrT007574; Wed, 28 Dec 2016 05:21:22 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612280521.uBS5LMrT007574@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 28 Dec 2016 05:21:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310665 - in head: tools/build/mk usr.sbin/bsnmpd/modules X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 05:21:23 -0000 Author: ngie Date: Wed Dec 28 05:21:22 2016 New Revision: 310665 URL: https://svnweb.freebsd.org/changeset/base/310665 Log: Only build/install usr.sbin/bsnmpd/modules/snmp_hast if MK_HAST != no MFC after: 1 week Modified: head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.sbin/bsnmpd/modules/Makefile Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Wed Dec 28 05:16:41 2016 (r310664) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Wed Dec 28 05:21:22 2016 (r310665) @@ -3004,6 +3004,12 @@ OLD_FILES+=usr/share/man/man5/hast.conf. OLD_FILES+=usr/share/man/man8/hastctl.8.gz OLD_FILES+=usr/share/man/man8/hastd.8.gz OLD_DIRS+=usr/share/examples/hast +# bsnmp +OLD_FILES+=usr/lib/snmp_hast.so +OLD_LIBS+=usr/lib/snmp_hast.so.6 +OLD_FILES+=usr/share/man/man3/snmp_hast.3.gz +OLD_FILES+=usr/share/snmp/defs/hast_tree.def +OLD_FILES+=usr/share/snmp/mibs/BEGEMOT-HAST-MIB.txt .endif .if ${MK_HESIOD} == no Modified: head/usr.sbin/bsnmpd/modules/Makefile ============================================================================== --- head/usr.sbin/bsnmpd/modules/Makefile Wed Dec 28 05:16:41 2016 (r310664) +++ head/usr.sbin/bsnmpd/modules/Makefile Wed Dec 28 05:21:22 2016 (r310665) @@ -10,7 +10,6 @@ _snmp_atm= snmp_atm SUBDIR= ${_snmp_atm} \ snmp_bridge \ - snmp_hast \ snmp_hostres \ snmp_lm75 \ snmp_mibII \ @@ -18,6 +17,10 @@ SUBDIR= ${_snmp_atm} \ snmp_usm \ snmp_vacm \ +.if ${MK_HAST} != "no" +SUBDIR+=snmp_hast +.endif + .if ${MK_PF} != "no" SUBDIR+=snmp_pf .endif From owner-svn-src-head@freebsd.org Wed Dec 28 05:41:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25CA0C9240F; Wed, 28 Dec 2016 05:41:55 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA47F1E6E; Wed, 28 Dec 2016 05:41:54 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS5fsot018290; Wed, 28 Dec 2016 05:41:54 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS5frw9018284; Wed, 28 Dec 2016 05:41:53 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612280541.uBS5frw9018284@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 28 Dec 2016 05:41:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310666 - head/usr.sbin/bsnmpd/modules/snmp_hostres X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 05:41:55 -0000 Author: ngie Date: Wed Dec 28 05:41:53 2016 New Revision: 310666 URL: https://svnweb.freebsd.org/changeset/base/310666 Log: style(9) fixes - Clean up trailing whitespace - Fix variable type alignment in storage_OS_get_swap(..) MFC after: 3 days Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_fs_tbl.c head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swinstalled_tbl.c Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c Wed Dec 28 05:21:22 2016 (r310665) +++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c Wed Dec 28 05:41:53 2016 (r310666) @@ -123,7 +123,7 @@ device_entry_create(const char *name, co if (map == NULL) { /* new object - get a new index */ if (next_device_index > INT_MAX) { - syslog(LOG_ERR, + syslog(LOG_ERR, "%s: hrDeviceTable index wrap", __func__); /* There isn't much we can do here. * If the next_swins_index is consumed Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_fs_tbl.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_fs_tbl.c Wed Dec 28 05:21:22 2016 (r310665) +++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_fs_tbl.c Wed Dec 28 05:41:53 2016 (r310666) @@ -131,7 +131,7 @@ static const struct { const struct asn_oid *oid; /* the OID to return */ } fs_type_map[] = { { "ufs", &OIDX_hrFSBerkeleyFFS_c }, - { "zfs", &OIDX_hrFSOther_c }, + { "zfs", &OIDX_hrFSOther_c }, { "cd9660", &OIDX_hrFSiso9660_c }, { "nfs", &OIDX_hrFSNFS_c }, { "ext2fs", &OIDX_hrFSLinuxExt2_c }, @@ -167,7 +167,7 @@ fs_entry_create(const char *name) /* new object - get a new index */ if (next_fs_index > INT_MAX) { /* Unrecoverable error - die clean and quicly*/ - syslog(LOG_ERR, "%s: hrFSTable index wrap", __func__); + syslog(LOG_ERR, "%s: hrFSTable index wrap", __func__); errx(EX_SOFTWARE, "hrFSTable index wrap"); } Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c Wed Dec 28 05:21:22 2016 (r310665) +++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c Wed Dec 28 05:41:53 2016 (r310666) @@ -177,7 +177,7 @@ partition_entry_create(int32_t ds_index, if (next_partition_index > INT_MAX) { /* Unrecoverable error - die clean and quicly*/ - syslog(LOG_ERR, "%s: hrPartitionTable index wrap", + syslog(LOG_ERR, "%s: hrPartitionTable index wrap", __func__); errx(EX_SOFTWARE, "hrPartitionTable index wrap"); } Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c Wed Dec 28 05:21:22 2016 (r310665) +++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c Wed Dec 28 05:41:53 2016 (r310666) @@ -193,7 +193,7 @@ OS_getSystemInitialLoadParameters(u_char syslog(LOG_ERR, "malloc failed"); return (SNMP_ERR_GENERR); } - if (sysctl(mib, 2, buf, &buf_len, NULL, 0)) { + if (sysctl(mib, 2, buf, &buf_len, NULL, 0)) { syslog(LOG_ERR, "sysctl({CTL_KERN,KERN_BOOTFILE}) failed: %m"); free(buf); @@ -296,7 +296,7 @@ OS_getMemorySize(uint32_t *ms) *ms = UINT32_MAX; else *ms = phys_mem_size; - return (SNMP_ERR_NOERROR); + return (SNMP_ERR_NOERROR); } /* @@ -360,7 +360,7 @@ OS_setSystemDate(const struct timeval *t if (settimeofday(timeval_to_set, NULL) == -1) { syslog(LOG_ERR, "settimeofday failed: %m"); return (SNMP_ERR_GENERR); - } + } return (SNMP_ERR_NOERROR); } @@ -378,7 +378,7 @@ op_hrSystem(struct snmp_context *ctx, st switch (curr_op) { - case SNMP_OP_GET: + case SNMP_OP_GET: switch (value->var.subs[sub - 1]) { case LEAF_hrSystemUptime: Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c Wed Dec 28 05:21:22 2016 (r310665) +++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c Wed Dec 28 05:41:53 2016 (r310666) @@ -163,7 +163,7 @@ hostres_start(void) start_processor_tbl(hostres_module); start_network_tbl(); - HRDBG("done."); + HRDBG("done."); } /* this identifies the HOST RESOURCES mib module */ @@ -175,8 +175,8 @@ const struct snmp_module config = { NULL, NULL, hostres_start, - NULL, /* proxy a PDU */ - hostres_ctree, /* see the generated hostres_tree.h */ + NULL, /* proxy a PDU */ + hostres_ctree, /* see the generated hostres_tree.h */ hostres_CTREE_SIZE, /* see the generated hostres_tree.h */ NULL }; Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c Wed Dec 28 05:21:22 2016 (r310665) +++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c Wed Dec 28 05:41:53 2016 (r310666) @@ -153,7 +153,7 @@ storage_entry_create(const char *name) if (map == NULL) { /* new object - get a new index */ if (next_storage_index > INT_MAX) { - syslog(LOG_ERR, + syslog(LOG_ERR, "%s: hrStorageTable index wrap", __func__); errx(EX_SOFTWARE, "hrStorageTable index wrap"); } @@ -188,7 +188,7 @@ storage_entry_create(const char *name) syslog(LOG_WARNING, "%s: %m", __func__); return (NULL); } - memset(entry, 0, sizeof(*entry)); + memset(entry, 0, sizeof(*entry)); entry->index = map->hrIndex; @@ -374,10 +374,10 @@ storage_OS_get_memstat(void) static void storage_OS_get_swap(void) { - int nswapdev = 0; - size_t len = sizeof(nswapdev); struct storage_entry *entry; char swap_w_prefix[SE_DESC_MLEN]; + size_t len = sizeof(nswapdev); + int nswapdev = 0; if (sysctlbyname("vm.nswapdev", &nswapdev, &len, NULL,0 ) < 0) { syslog(LOG_ERR, Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swinstalled_tbl.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swinstalled_tbl.c Wed Dec 28 05:21:22 2016 (r310665) +++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swinstalled_tbl.c Wed Dec 28 05:41:53 2016 (r310666) @@ -50,7 +50,7 @@ #include "hostres_oid.h" #include "hostres_tree.h" -#define CONTENTS_FNAME "+CONTENTS" +#define CONTENTS_FNAME "+CONTENTS" enum SWInstalledType { SWI_UNKNOWN = 1, @@ -136,7 +136,7 @@ swins_entry_create(const char *name) size_t name_len; /* new object - get a new index */ if (next_swins_index > INT_MAX) { - syslog(LOG_ERR, "%s: hrSWInstalledTable index wrap", + syslog(LOG_ERR, "%s: hrSWInstalledTable index wrap", __func__ ); /* There isn't much we can do here. * If the next_swins_index is consumed @@ -292,7 +292,7 @@ swins_get_packages(void) struct stat sb; DIR *p_dir; struct dirent *ent; - struct tm k_ts; + struct tm k_ts; char *pkg_file; struct swins_entry *entry; int ret = 0; @@ -327,7 +327,7 @@ swins_get_packages(void) return (-1); } - while (errno = 0, (ent = readdir(p_dir)) != NULL) { + while (errno = 0, (ent = readdir(p_dir)) != NULL) { HRDBG(" pkg file: %s", ent->d_name); /* check that the contents file is a regular file */ @@ -371,7 +371,7 @@ swins_get_packages(void) entry->type = (int32_t)SWI_APPLICATION; entry->date_len = make_date_time(entry->date, &k_ts, 0); - } + } if (errno != 0) { syslog(LOG_ERR, "hrSWInstalledTable: readdir_r(\"%s\") failed:" From owner-svn-src-head@freebsd.org Wed Dec 28 05:42:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FDBEC925ED; Wed, 28 Dec 2016 05:42:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F559105C; Wed, 28 Dec 2016 05:42:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS5gfnO019220; Wed, 28 Dec 2016 05:42:41 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS5gfj8019219; Wed, 28 Dec 2016 05:42:41 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612280542.uBS5gfj8019219@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 28 Dec 2016 05:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310667 - head/usr.sbin/bsnmpd/modules/snmp_bridge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 05:42:42 -0000 Author: ngie Date: Wed Dec 28 05:42:41 2016 New Revision: 310667 URL: https://svnweb.freebsd.org/changeset/base/310667 Log: style(9) fixes: clean up leading whitespace MFC after: 3 days Modified: head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c Modified: head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c Wed Dec 28 05:41:53 2016 (r310666) +++ head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c Wed Dec 28 05:42:41 2016 (r310667) @@ -1472,7 +1472,7 @@ bridge_do_pfctl(int32_t bridge_ctl, enum } else s_len = 0; - len = sizeof(i); + len = sizeof(i); strcpy(mib_name, bridge_sysctl); From owner-svn-src-head@freebsd.org Wed Dec 28 05:43:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 345AFC9265B; Wed, 28 Dec 2016 05:43:16 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 041B011D7; Wed, 28 Dec 2016 05:43:15 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS5hFMc019285; Wed, 28 Dec 2016 05:43:15 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS5hFQj019284; Wed, 28 Dec 2016 05:43:15 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612280543.uBS5hFQj019284@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 28 Dec 2016 05:43:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310668 - head/usr.sbin/bsnmpd/tools/libbsnmptools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 05:43:16 -0000 Author: ngie Date: Wed Dec 28 05:43:14 2016 New Revision: 310668 URL: https://svnweb.freebsd.org/changeset/base/310668 Log: style(9) fixes: clean up leading whitespace MFC after: 3 days Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c ============================================================================== --- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Wed Dec 28 05:42:41 2016 (r310667) +++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Wed Dec 28 05:43:14 2016 (r310668) @@ -1090,6 +1090,7 @@ snmp_ip2asn_oid(char *str, struct asn_oi char *endptr, *ptr; ptr = str; + for (i = 0; i < 4; i++) { v = strtoul(ptr, &endptr, 10); if (v > 0xff) From owner-svn-src-head@freebsd.org Wed Dec 28 05:50:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33FC5C927EC; Wed, 28 Dec 2016 05:50:36 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wj0-x241.google.com (mail-wj0-x241.google.com [IPv6:2a00:1450:400c:c01::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AD5B2142F; Wed, 28 Dec 2016 05:50:35 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wj0-x241.google.com with SMTP id hb5so20146502wjc.2; Tue, 27 Dec 2016 21:50:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=tTBsUyC/ATHDANXIUrVm0CJxWmQ2yX7avsB/X5sP6K0=; b=TA6DWbV3Hvca6ag4Yj0T2oLN9RjF+UGG/LH3xva3/AuBqfqS3lE6oCaCGB5FCpNDcm RAcmgChjPE8n5NltDIqcp+P6gkXAq6mzZqG9e241BSda6+P4VAQFhtG9ZGfvm6eyjYsi srRHnWwa6BMVvGoX4mZ1CZNcPJZvhAdGi14+ZDxk1cWsiDeHxmfsfcAVwbBhkqgdC0XC pEUUB2vFa4KSJW9jCTbWPmovWksnlC8xaU2vpvG3cXSZ9cI3Bh+vCEzGAbuU/u1Ugoo8 M3T2co5nle4L9hli0cdijPhhrWNOYOLab46awf2v+gQWCcScw2xKYHxu3JO5DuBJ9RLM jsXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=tTBsUyC/ATHDANXIUrVm0CJxWmQ2yX7avsB/X5sP6K0=; b=YykA1diOHN9Qcx76MPt9VrRhvf8q11E6gPJSVzjfXcZs+EX+VhBuUTrs//ctjJc+vM KWpYxDNxfjZddgvvL9NvcKthrneLeVWjxW6tQ1Lz33UMukmRoTMPh6TwuXlm+RrmkZpP 9fW3V2ttAJ60A6kfWLxQ/Ks4MwbpyhWQFmFiB89xrB8zgzx2Q/v7l/0GhtXIcNwHFl/7 tjaYuMzYlWdZST6lAJTi6tukdknUMWDMY7MaT7fnFf/AQt0KUuhtvlmf54JBCi6bqYRq wxunOb2mDIfvBRbVzSMfYMQIgD+PUYukKczJnyTVXm2uuCj2Ct8v2gwVC6Mvu+YL8Uin Ealg== X-Gm-Message-State: AIkVDXK+iTHAwiNmK/MTp12g+iPn324pBgpVcHumfd1sslFfLN3F4pnKSzSrWyqg8eOAFiK2+EKYAwREGKh8Rg== X-Received: by 10.194.67.67 with SMTP id l3mr33322622wjt.151.1482904233541; Tue, 27 Dec 2016 21:50:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.44.1 with HTTP; Tue, 27 Dec 2016 21:50:32 -0800 (PST) In-Reply-To: <201612280255.uBS2tQeR045512@repo.freebsd.org> References: <201612280255.uBS2tQeR045512@repo.freebsd.org> From: Adrian Chadd Date: Tue, 27 Dec 2016 21:50:32 -0800 Message-ID: Subject: Re: svn commit: r310650 - in head/sys/mips: include mips To: Alexander Kabaev Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 05:50:36 -0000 hiya, so I dug into the mips24k definition of this. It says this: " 3.4.3 Uncached accelerated writes The 24K core permits memory regions to be marked as =E2=80=9Cuncached accelerated=E2=80=9D. This type of region is useful to hard- ware which is =E2=80=9Cwrite only=E2=80=9D - perhaps video frame buffers, o= r some other hardware stream. Sequential word stores in such regions are gathered into cache-line-sized chunks, before being written with a single burst cycle on the CPU interface. Such regions are uncached for read, and partial-word or out-of-sequence writes have =E2=80=9Cunpredictable=E2=80=9D effects - don= =E2=80=99t do them. The burst write is normally performed when software writes to the last location in the memory block or does an uncached-accelerated write to some other block; but it can also be triggered by a sync instruction, a pref nudge, a matching load or any exception. If the block is not completely written by the time it=E2=80=99s pushed out, it will be written using a series of doubleword or smaller write cycles over the 24K core=E2=80=99s 64-bit memory interface. " So, question is - is our write combining page attribute in the VM suitable for this? Is it defined as "only do full sequential word writes"? Or do we risk having some other platform use it in a less "don't do this" way and then MIPS is the one at fault again? :) -adrian On 27 December 2016 at 18:55, Alexander Kabaev wrote: > Author: kan > Date: Wed Dec 28 02:55:26 2016 > New Revision: 310650 > URL: https://svnweb.freebsd.org/changeset/base/310650 > > Log: > Implement pmap_change_attr and related APIs on MIPS > > On platforms that have uncached-accelerate cache attribute, map it > to VM_MEMATTR_WRITE_COMBINING. Otherwise, leave write comining > undefined. > > Reviewed by: adrian, jhb (glance) > Differential Revision: https://reviews.freebsd.org/D8894 > > Modified: > head/sys/mips/include/cpuregs.h > head/sys/mips/include/pmap.h > head/sys/mips/include/pte.h > head/sys/mips/include/vm.h > head/sys/mips/mips/pmap.c > > Modified: head/sys/mips/include/cpuregs.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/mips/include/cpuregs.h Tue Dec 27 23:56:46 2016 (= r310649) > +++ head/sys/mips/include/cpuregs.h Wed Dec 28 02:55:26 2016 (= r310650) > @@ -171,6 +171,10 @@ > #define MIPS_CCA_CACHED MIPS_CCA_CCS > #endif > > +#if defined(CPU_XBURST) > +#define MIPS_CCA_UA 0x01 > +#endif > + > #ifndef MIPS_CCA_UNCACHED > #define MIPS_CCA_UNCACHED MIPS_CCA_UC > #endif > @@ -188,6 +192,16 @@ > #endif > #endif > > +/* > + * Use uncached-accelerated mode for write-combining maps, if one is def= ined, > + * otherwise fall back to uncached > + */ > +#ifndef MIPS_CCA_WC > +#ifdef MIPS_CCA_UA > +#define MIPS_CCA_WC MIPS_CCA_UA > +#endif > +#endif > + > #define MIPS_PHYS_TO_XKPHYS(cca,x) \ > ((0x2ULL << 62) | ((unsigned long long)(cca) << 59) | (x)) > #define MIPS_PHYS_TO_XKPHYS_CACHED(x) \ > > Modified: head/sys/mips/include/pmap.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/mips/include/pmap.h Tue Dec 27 23:56:46 2016 (= r310649) > +++ head/sys/mips/include/pmap.h Wed Dec 28 02:55:26 2016 (= r310650) > @@ -74,7 +74,8 @@ struct md_page { > }; > > #define PV_TABLE_REF 0x02 /* referenced */ > -#define PV_MEMATTR_UNCACHEABLE 0x04 > +#define PV_MEMATTR_MASK 0xf0 /* store vm_memattr_t her= e */ > +#define PV_MEMATTR_SHIFT 0x04 > > #define ASID_BITS 8 > #define ASIDGEN_BITS (32 - ASID_BITS) > @@ -163,22 +164,24 @@ extern vm_offset_t virtual_end; > > extern vm_paddr_t dump_avail[PHYS_AVAIL_ENTRIES + 2]; > > -#define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT > +#define pmap_page_get_memattr(m) (((m)->md.pv_flags & PV_MEMATTR_= MASK) >> PV_MEMATTR_SHIFT) > #define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) > #define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITE= ABLE) !=3D 0) > > void pmap_bootstrap(void); > void *pmap_mapdev(vm_paddr_t, vm_size_t); > +void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, vm_memattr_t); > void pmap_unmapdev(vm_offset_t, vm_size_t); > vm_offset_t pmap_steal_memory(vm_size_t size); > void pmap_kenter(vm_offset_t va, vm_paddr_t pa); > -void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int attr); > +void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, vm_memattr_t attr); > void pmap_kremove(vm_offset_t va); > void *pmap_kenter_temporary(vm_paddr_t pa, int i); > void pmap_kenter_temporary_free(vm_paddr_t pa); > void pmap_flush_pvcache(vm_page_t m); > int pmap_emulate_modified(pmap_t pmap, vm_offset_t va); > void pmap_page_set_memattr(vm_page_t, vm_memattr_t); > +int pmap_change_attr(vm_offset_t, vm_size_t, vm_memattr_t); > > #endif /* _KERNEL */ > > > Modified: head/sys/mips/include/pte.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/mips/include/pte.h Tue Dec 27 23:56:46 2016 (r310649) > +++ head/sys/mips/include/pte.h Wed Dec 28 02:55:26 2016 (r310650) > @@ -132,8 +132,10 @@ typedef pt_entry_t *pd_entry_t; > * it is matched. > */ > #define PTE_C(attr) ((attr & 0x07) << 3) > +#define PTE_C_MASK (PTE_C(0x07)) > #define PTE_C_UNCACHED (PTE_C(MIPS_CCA_UNCACHED)) > #define PTE_C_CACHE (PTE_C(MIPS_CCA_CACHED)) > +#define PTE_C_WC (PTE_C(MIPS_CCA_WC)) > #define PTE_D 0x04 > #define PTE_V 0x02 > #define PTE_G 0x01 > @@ -158,6 +160,7 @@ typedef pt_entry_t *pd_entry_t; > #define pte_clear(pte, bit) (*(pte) &=3D ~(bit)) > #define pte_set(pte, bit) (*(pte) |=3D (bit)) > #define pte_test(pte, bit) ((*(pte) & (bit)) =3D=3D (bit)) > +#define pte_cache_bits(pte) ((*(pte) >> 3) & 0x07) > > /* Assembly support for PTE access*/ > #ifdef LOCORE > > Modified: head/sys/mips/include/vm.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/mips/include/vm.h Tue Dec 27 23:56:46 2016 (r310649) > +++ head/sys/mips/include/vm.h Wed Dec 28 02:55:26 2016 (r310650) > @@ -32,7 +32,11 @@ > #include > > /* Memory attributes. */ > -#define VM_MEMATTR_UNCACHEABLE ((vm_memattr_t)PTE_C_UNCACHED) > -#define VM_MEMATTR_DEFAULT ((vm_memattr_t)PTE_C_CACHE) > +#define VM_MEMATTR_UNCACHEABLE ((vm_memattr_t)MIPS_CCA_U= NCACHED) > +#define VM_MEMATTR_WRITE_BACK ((vm_memattr_t)MIPS_CCA_C= ACHED) > +#define VM_MEMATTR_DEFAULT VM_MEMATTR_WRITE_BACK > +#ifdef MIPS_CCA_WC > +#define VM_MEMATTR_WRITE_COMBINING ((vm_memattr_t)MIPS_CCA_W= C) > +#endif > > #endif /* !_MACHINE_VM_H_ */ > > Modified: head/sys/mips/mips/pmap.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/mips/mips/pmap.c Tue Dec 27 23:56:46 2016 (r310649) > +++ head/sys/mips/mips/pmap.c Wed Dec 28 02:55:26 2016 (r310650) > @@ -189,10 +189,10 @@ static void pmap_update_page_action(void > * The highmem area does not have a KSEG0 mapping, and we need a mechani= sm to > * do temporary per-CPU mappings for pmap_zero_page, pmap_copy_page etc. > * > - * At bootup, we reserve 2 virtual pages per CPU for mapping highmem pag= es. To > + * At bootup, we reserve 2 virtual pages per CPU for mapping highmem pag= es. To > * access a highmem physical address on a CPU, we map the physical addre= ss to > - * the reserved virtual address for the CPU in the kernel pagetable. Th= is is > - * done with interrupts disabled(although a spinlock and sched_pin would= be > + * the reserved virtual address for the CPU in the kernel pagetable. Th= is is > + * done with interrupts disabled(although a spinlock and sched_pin would= be > * sufficient). > */ > struct local_sysmaps { > @@ -303,7 +303,7 @@ pmap_lmem_map2(vm_paddr_t phys1, vm_padd > return (0); > } > > -static __inline vm_offset_t > +static __inline vm_offset_t > pmap_lmem_unmap(void) > { > > @@ -312,12 +312,18 @@ pmap_lmem_unmap(void) > #endif /* !__mips_n64 */ > > static __inline int > -is_cacheable_page(vm_paddr_t pa, vm_page_t m) > +pmap_pte_cache_bits(vm_paddr_t pa, vm_page_t m) > { > + vm_memattr_t ma; > > - return ((m->md.pv_flags & PV_MEMATTR_UNCACHEABLE) =3D=3D 0 && > - is_cacheable_mem(pa)); > - > + ma =3D pmap_page_get_memattr(m); > + if (ma =3D=3D VM_MEMATTR_WRITE_BACK && !is_cacheable_mem(pa)) > + ma =3D VM_MEMATTR_UNCACHEABLE; > + return PTE_C(ma); > +} > +#define PMAP_PTE_SET_CACHE_BITS(pte, ps, m) { \ > + pte &=3D ~PTE_C_MASK; \ > + pte |=3D pmap_pte_cache_bits(pa, m); \ > } > > /* > @@ -359,7 +365,7 @@ pmap_pdpe_to_pde(pd_entry_t *pdpe, vm_of > return (pdpe); > } > > -static __inline > +static __inline > pd_entry_t *pmap_pde(pmap_t pmap, vm_offset_t va) > { > > @@ -423,7 +429,7 @@ pmap_steal_memory(vm_size_t size) > * Bootstrap the system enough to run with virtual memory. This > * assumes that the phys_avail array has been initialized. > */ > -static void > +static void > pmap_create_kernel_pagetable(void) > { > int i, j; > @@ -486,7 +492,7 @@ void > pmap_bootstrap(void) > { > int i; > - int need_local_mappings =3D 0; > + int need_local_mappings =3D 0; > > /* Sort. */ > again: > @@ -600,7 +606,7 @@ pmap_page_init(vm_page_t m) > { > > TAILQ_INIT(&m->md.pv_list); > - m->md.pv_flags =3D 0; > + m->md.pv_flags =3D VM_MEMATTR_DEFAULT << PV_MEMATTR_SHIFT; > } > > /* > @@ -635,8 +641,8 @@ pmap_call_on_active_cpus(pmap_t pmap, vo > pmap->pm_asid[cpu].gen =3D 0; > } > cpuid =3D PCPU_GET(cpuid); > - /* > - * XXX: barrier/locking for active? > + /* > + * XXX: barrier/locking for active? > * > * Take a snapshot of active here, any further changes are ignore= d. > * tlb update/invalidate should be harmless on inactive CPUs > @@ -819,7 +825,7 @@ retry: > * add a wired page to the kva > */ > void > -pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int attr) > +pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, vm_memattr_t ma) > { > pt_entry_t *pte; > pt_entry_t opte, npte; > @@ -830,7 +836,7 @@ pmap_kenter_attr(vm_offset_t va, vm_padd > > pte =3D pmap_pte(kernel_pmap, va); > opte =3D *pte; > - npte =3D TLBLO_PA_TO_PFN(pa) | attr | PTE_D | PTE_V | PTE_G; > + npte =3D TLBLO_PA_TO_PFN(pa) | PTE_C(ma) | PTE_D | PTE_V | PTE_G; > *pte =3D npte; > if (pte_test(&opte, PTE_V) && opte !=3D npte) > pmap_update_page(kernel_pmap, va, npte); > @@ -843,7 +849,7 @@ pmap_kenter(vm_offset_t va, vm_paddr_t p > KASSERT(is_cacheable_mem(pa), > ("pmap_kenter: memory at 0x%lx is not cacheable", (u_long= )pa)); > > - pmap_kenter_attr(va, pa, PTE_C_CACHE); > + pmap_kenter_attr(va, pa, VM_MEMATTR_DEFAULT); > } > > /* > @@ -1144,11 +1150,11 @@ _pmap_allocpte(pmap_t pmap, unsigned pte > int segindex =3D ptepindex >> (SEGSHIFT - PDRSHIFT); > int pdeindex =3D ptepindex & (NPDEPG - 1); > vm_page_t pg; > - > + > pdep =3D &pmap->pm_segtab[segindex]; > - if (*pdep =3D=3D NULL) { > + if (*pdep =3D=3D NULL) { > /* recurse for allocating page dir */ > - if (_pmap_allocpte(pmap, NUPDE + segindex, > + if (_pmap_allocpte(pmap, NUPDE + segindex, > flags) =3D=3D NULL) { > /* alloc failed, release current */ > --m->wire_count; > @@ -1680,7 +1686,7 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm > * pmap_remove_pte: do the things to unmap a page in a process > */ > static int > -pmap_remove_pte(struct pmap *pmap, pt_entry_t *ptq, vm_offset_t va, > +pmap_remove_pte(struct pmap *pmap, pt_entry_t *ptq, vm_offset_t va, > pd_entry_t pde) > { > pt_entry_t oldpte; > @@ -1864,7 +1870,7 @@ pmap_remove_all(vm_page_t m) > PMAP_LOCK(pmap); > > /* > - * If it's last mapping writeback all caches from > + * If it's last mapping writeback all caches from > * the page being destroyed > */ > if (TAILQ_NEXT(pv, pv_list) =3D=3D NULL) > @@ -2030,10 +2036,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, > newpte |=3D PTE_W; > if (is_kernel_pmap(pmap)) > newpte |=3D PTE_G; > - if (is_cacheable_page(pa, m)) > - newpte |=3D PTE_C_CACHE; > - else > - newpte |=3D PTE_C_UNCACHED; > + PMAP_PTE_SET_CACHE_BITS(newpte, pa, m); > > mpte =3D NULL; > > @@ -2218,7 +2221,7 @@ static vm_page_t > pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, > vm_prot_t prot, vm_page_t mpte) > { > - pt_entry_t *pte; > + pt_entry_t *pte, npte; > vm_paddr_t pa; > > KASSERT(va < kmi.clean_sva || va >=3D kmi.clean_eva || > @@ -2297,18 +2300,16 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ > /* > * Now validate mapping with RO protection > */ > - *pte =3D PTE_RO | TLBLO_PA_TO_PFN(pa) | PTE_V; > + npte =3D PTE_RO | TLBLO_PA_TO_PFN(pa) | PTE_V; > if ((m->oflags & VPO_UNMANAGED) =3D=3D 0) > - *pte |=3D PTE_MANAGED; > + npte |=3D PTE_MANAGED; > > - if (is_cacheable_page(pa, m)) > - *pte |=3D PTE_C_CACHE; > - else > - *pte |=3D PTE_C_UNCACHED; > + PMAP_PTE_SET_CACHE_BITS(npte, pa, m); > > if (is_kernel_pmap(pmap)) > - *pte |=3D PTE_G; > + *pte =3D npte | PTE_G; > else { > + *pte =3D npte; > /* > * Sync I & D caches. Do this only if the target pmap > * belongs to the current process. Otherwise, an > @@ -2649,12 +2650,12 @@ pmap_quick_enter_page(vm_page_t m) > #else > vm_paddr_t pa; > struct local_sysmaps *sysm; > - pt_entry_t *pte; > + pt_entry_t *pte, npte; > > pa =3D VM_PAGE_TO_PHYS(m); > > if (MIPS_DIRECT_MAPPABLE(pa)) { > - if (m->md.pv_flags & PV_MEMATTR_UNCACHEABLE) > + if (pmap_page_get_memattr(m) !=3D VM_MEMATTR_WRITE_BACK) > return (MIPS_PHYS_TO_DIRECT_UNCACHED(pa)); > else > return (MIPS_PHYS_TO_DIRECT(pa)); > @@ -2665,8 +2666,9 @@ pmap_quick_enter_page(vm_page_t m) > KASSERT(sysm->valid1 =3D=3D 0, ("pmap_quick_enter_page: PTE busy"= )); > > pte =3D pmap_pte(kernel_pmap, sysm->base); > - *pte =3D TLBLO_PA_TO_PFN(pa) | PTE_D | PTE_V | PTE_G | > - (is_cacheable_page(pa, m) ? PTE_C_CACHE : PTE_C_UNCACHED); > + npte =3D TLBLO_PA_TO_PFN(pa) | PTE_D | PTE_V | PTE_G; > + PMAP_PTE_SET_CACHE_BITS(npte, pa, m); > + *pte =3D npte; > sysm->valid1 =3D 1; > > return (sysm->base); > @@ -3146,26 +3148,26 @@ pmap_is_referenced(vm_page_t m) > * Use XKPHYS uncached for 64 bit, and KSEG1 where possible for 32 bit. > */ > void * > -pmap_mapdev(vm_paddr_t pa, vm_size_t size) > +pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, vm_memattr_t ma) > { > vm_offset_t va, tmpva, offset; > > - /* > - * KSEG1 maps only first 512M of phys address space. For > + /* > + * KSEG1 maps only first 512M of phys address space. For > * pa > 0x20000000 we should make proper mapping * using pmap_ken= ter. > */ > - if (MIPS_DIRECT_MAPPABLE(pa + size - 1)) > + if (MIPS_DIRECT_MAPPABLE(pa + size - 1) && ma =3D=3D VM_MEMATTR_U= NCACHEABLE) > return ((void *)MIPS_PHYS_TO_DIRECT_UNCACHED(pa)); > else { > offset =3D pa & PAGE_MASK; > size =3D roundup(size + offset, PAGE_SIZE); > - > + > va =3D kva_alloc(size); > if (!va) > panic("pmap_mapdev: Couldn't alloc kernel virtual= memory"); > pa =3D trunc_page(pa); > for (tmpva =3D va; size > 0;) { > - pmap_kenter_attr(tmpva, pa, PTE_C_UNCACHED); > + pmap_kenter_attr(tmpva, pa, ma); > size -=3D PAGE_SIZE; > tmpva +=3D PAGE_SIZE; > pa +=3D PAGE_SIZE; > @@ -3175,6 +3177,12 @@ pmap_mapdev(vm_paddr_t pa, vm_size_t siz > return ((void *)(va + offset)); > } > > +void * > +pmap_mapdev(vm_paddr_t pa, vm_size_t size) > +{ > + return pmap_mapdev_attr(pa, size, VM_MEMATTR_UNCACHEABLE); > +} > + > void > pmap_unmapdev(vm_offset_t va, vm_size_t size) > { > @@ -3220,7 +3228,7 @@ retry: > * This may falsely report the given address as > * MINCORE_REFERENCED. Unfortunately, due to the lack of > * per-PTE reference information, it is impossible to > - * determine if the address is MINCORE_REFERENCED. > + * determine if the address is MINCORE_REFERENCED. > */ > m =3D PHYS_TO_VM_PAGE(pa); > if ((m->aflags & PGA_REFERENCED) !=3D 0) > @@ -3500,7 +3508,7 @@ pmap_kextract(vm_offset_t va) > mapped =3D (va >=3D MIPS_KSEG2_START || va < MIPS_KSEG2_END); > #if defined(__mips_n64) > mapped =3D mapped || (va >=3D MIPS_XKSEG_START || va < MIPS_XKSEG= _END); > -#endif > +#endif > /* > * Kernel virtual. > */ > @@ -3524,7 +3532,7 @@ pmap_kextract(vm_offset_t va) > } > > > -void > +void > pmap_flush_pvcache(vm_page_t m) > { > pv_entry_t pv; > @@ -3551,12 +3559,85 @@ pmap_page_set_memattr(vm_page_t m, vm_me > if (TAILQ_FIRST(&m->md.pv_list) !=3D NULL) > panic("Can't change memattr on page with existing mapping= s"); > > - /* > - * The only memattr we support is UNCACHEABLE, translate the (sem= i-)MI > - * representation of that into our internal flag in the page MD s= truct. > - */ > - if (ma =3D=3D VM_MEMATTR_UNCACHEABLE) > - m->md.pv_flags |=3D PV_MEMATTR_UNCACHEABLE; > - else > - m->md.pv_flags &=3D ~PV_MEMATTR_UNCACHEABLE; > + /* Clean memattr portion of pv_flags */ > + m->md.pv_flags &=3D ~PV_MEMATTR_MASK; > + m->md.pv_flags |=3D (ma << PV_MEMATTR_SHIFT) & PV_MEMATTR_MASK; > +} > + > +static __inline void > +pmap_pte_attr(pt_entry_t *pte, vm_memattr_t ma) > +{ > + u_int npte; > + > + npte =3D *(u_int *)pte; > + npte &=3D ~PTE_C_MASK; > + npte |=3D PTE_C(ma); > + *pte =3D npte; > +} > + > +int > +pmap_change_attr(vm_offset_t sva, vm_size_t size, vm_memattr_t ma) > +{ > + pd_entry_t *pde, *pdpe; > + pt_entry_t *pte; > + vm_offset_t ova, eva, va, va_next; > + pmap_t pmap; > + > + ova =3D sva; > + eva =3D sva + size; > + if (eva < sva) > + return (EINVAL); > + > + pmap =3D kernel_pmap; > + PMAP_LOCK(pmap); > + > + for (; sva < eva; sva =3D va_next) { > + pdpe =3D pmap_segmap(pmap, sva); > +#ifdef __mips_n64 > + if (*pdpe =3D=3D 0) { > + va_next =3D (sva + NBSEG) & ~SEGMASK; > + if (va_next < sva) > + va_next =3D eva; > + continue; > + } > +#endif > + va_next =3D (sva + NBPDR) & ~PDRMASK; > + if (va_next < sva) > + va_next =3D eva; > + > + pde =3D pmap_pdpe_to_pde(pdpe, sva); > + if (*pde =3D=3D NULL) > + continue; > + > + /* > + * Limit our scan to either the end of the va represented > + * by the current page table page, or to the end of the > + * range being removed. > + */ > + if (va_next > eva) > + va_next =3D eva; > + > + va =3D va_next; > + for (pte =3D pmap_pde_to_pte(pde, sva); sva !=3D va_next;= pte++, > + sva +=3D PAGE_SIZE) { > + if (!pte_test(pte, PTE_V) || pte_cache_bits(pte) = =3D=3D ma) { > + if (va !=3D va_next) { > + pmap_invalidate_range(pmap, va, s= va); > + va =3D va_next; > + } > + continue; > + } > + if (va =3D=3D va_next) > + va =3D sva; > + > + pmap_pte_attr(pte, ma); > + } > + if (va !=3D va_next) > + pmap_invalidate_range(pmap, va, sva); > + } > + PMAP_UNLOCK(pmap); > + > + /* Flush caches to be in the safe side */ > + mips_dcache_wbinv_range(ova, size); > + return 0; > } > From owner-svn-src-head@freebsd.org Wed Dec 28 06:10:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FFB7C92CD2; Wed, 28 Dec 2016 06:10:59 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F8671CE4; Wed, 28 Dec 2016 06:10:59 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS6Aw1r027880; Wed, 28 Dec 2016 06:10:58 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS6AwlU027879; Wed, 28 Dec 2016 06:10:58 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612280610.uBS6AwlU027879@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 28 Dec 2016 06:10:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310669 - head/usr.sbin/bsnmpd/modules/snmp_pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 06:10:59 -0000 Author: ngie Date: Wed Dec 28 06:10:58 2016 New Revision: 310669 URL: https://svnweb.freebsd.org/changeset/base/310669 Log: style(9): clean up whitespace MFC after: 3 days Modified: head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c Modified: head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c Wed Dec 28 05:43:14 2016 (r310668) +++ head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c Wed Dec 28 06:10:58 2016 (r310669) @@ -1640,20 +1640,20 @@ err: static int altq_is_enabled(int pfdev) { - struct pfioc_altq pa; + struct pfioc_altq pa; errno = 0; - if (ioctl(pfdev, DIOCGETALTQS, &pa)) { - if (errno == ENODEV) { + if (ioctl(pfdev, DIOCGETALTQS, &pa)) { + if (errno == ENODEV) { syslog(LOG_INFO, "No ALTQ support in kernel\n" "ALTQ related functions disabled\n"); - return (0); - } else - syslog(LOG_ERR, "DIOCGETALTQS returned an error: %s", + return (0); + } else + syslog(LOG_ERR, "DIOCGETALTQS returned an error: %s", strerror(errno)); return (-1); - } - return (1); + } + return (1); } /* From owner-svn-src-head@freebsd.org Wed Dec 28 07:37:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45D1BC90214; Wed, 28 Dec 2016 07:37:28 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF09E179E; Wed, 28 Dec 2016 07:37:27 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS7bR6I065394; Wed, 28 Dec 2016 07:37:27 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS7bQQJ065391; Wed, 28 Dec 2016 07:37:26 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201612280737.uBS7bQQJ065391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 28 Dec 2016 07:37:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310674 - head/sys/dev/sound/pci/hda X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 07:37:28 -0000 Author: mmel Date: Wed Dec 28 07:37:26 2016 New Revision: 310674 URL: https://svnweb.freebsd.org/changeset/base/310674 Log: Limit number of stripes supported by HDA codec to maximum number announced by HDA controller. Incorrectly implermented HDA codec may report support for more stripes that HDA controller already have. Due to this, always limit number of enabled stripes by global controller maximum. Reviewed by: mav MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D8922 Modified: head/sys/dev/sound/pci/hda/hdaa.c head/sys/dev/sound/pci/hda/hdac.c head/sys/dev/sound/pci/hda/hdac.h Modified: head/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa.c Wed Dec 28 06:16:55 2016 (r310673) +++ head/sys/dev/sound/pci/hda/hdaa.c Wed Dec 28 07:37:26 2016 (r310674) @@ -2130,7 +2130,8 @@ hdaa_channel_start(struct hdaa_chan *ch) uint32_t fmt; fmt = hdaa_stream_format(ch); - ch->stripectl = fls(ch->stripecap & hdaa_allowed_stripes(fmt)) - 1; + ch->stripectl = fls(ch->stripecap & hdaa_allowed_stripes(fmt) & + hda_get_stripes_mask(devinfo->dev)) - 1; ch->sid = HDAC_STREAM_ALLOC(device_get_parent(devinfo->dev), devinfo->dev, ch->dir == PCMDIR_PLAY ? 1 : 0, fmt, ch->stripectl, &ch->dmapos); if (ch->sid <= 0) Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Wed Dec 28 06:16:55 2016 (r310673) +++ head/sys/dev/sound/pci/hda/hdac.c Wed Dec 28 07:37:26 2016 (r310674) @@ -1767,6 +1767,9 @@ hdac_read_ivar(device_t dev, device_t ch case HDA_IVAR_DMA_NOCACHE: *result = (sc->flags & HDAC_F_DMA_NOCACHE) != 0; break; + case HDA_IVAR_STRIPES_MASK: + *result = (1 << (1 << sc->num_sdo)) - 1; + break; default: return (ENOENT); } Modified: head/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.h Wed Dec 28 06:16:55 2016 (r310673) +++ head/sys/dev/sound/pci/hda/hdac.h Wed Dec 28 07:37:26 2016 (r310674) @@ -707,6 +707,7 @@ enum hdac_device_ivars { HDA_IVAR_SUBSYSTEM_ID, HDA_IVAR_NODE_TYPE, HDA_IVAR_DMA_NOCACHE, + HDA_IVAR_STRIPES_MASK, }; #define HDA_ACCESSOR(var, ivar, type) \ @@ -723,6 +724,7 @@ HDA_ACCESSOR(subdevice_id, SUBDEVICE_ID, HDA_ACCESSOR(subsystem_id, SUBSYSTEM_ID, uint32_t); HDA_ACCESSOR(node_type, NODE_TYPE, uint8_t); HDA_ACCESSOR(dma_nocache, DMA_NOCACHE, uint8_t); +HDA_ACCESSOR(stripes_mask, STRIPES_MASK, uint8_t); #define PCIS_MULTIMEDIA_HDA 0x03 From owner-svn-src-head@freebsd.org Wed Dec 28 08:11:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F502C90F6B; Wed, 28 Dec 2016 08:11:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 567AE1D0B; Wed, 28 Dec 2016 08:11:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS8BfBp080250; Wed, 28 Dec 2016 08:11:41 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS8BfN9080249; Wed, 28 Dec 2016 08:11:41 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612280811.uBS8BfN9080249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 28 Dec 2016 08:11:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310675 - head/usr.sbin/bsnmpd/modules/snmp_hostres X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 08:11:42 -0000 Author: ngie Date: Wed Dec 28 08:11:41 2016 New Revision: 310675 URL: https://svnweb.freebsd.org/changeset/base/310675 Log: Fix the build by moving the initializers for len/nswapdev down below the declarations MFC after: 3 days Pointyhat to: ngie Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c Wed Dec 28 07:37:26 2016 (r310674) +++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c Wed Dec 28 08:11:41 2016 (r310675) @@ -376,8 +376,11 @@ storage_OS_get_swap(void) { struct storage_entry *entry; char swap_w_prefix[SE_DESC_MLEN]; - size_t len = sizeof(nswapdev); - int nswapdev = 0; + size_t len; + int nswapdev; + + len = sizeof(nswapdev); + nswapdev = 0; if (sysctlbyname("vm.nswapdev", &nswapdev, &len, NULL,0 ) < 0) { syslog(LOG_ERR, From owner-svn-src-head@freebsd.org Wed Dec 28 09:32:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85898C94D1E; Wed, 28 Dec 2016 09:32:03 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6018017C2; Wed, 28 Dec 2016 09:32:03 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS9W2ML015894; Wed, 28 Dec 2016 09:32:02 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS9W20h015892; Wed, 28 Dec 2016 09:32:02 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201612280932.uBS9W20h015892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Wed, 28 Dec 2016 09:32:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310676 - in head: share/man/man4 tools/build/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 09:32:03 -0000 Author: avos Date: Wed Dec 28 09:32:02 2016 New Revision: 310676 URL: https://svnweb.freebsd.org/changeset/base/310676 Log: rum.4, run.4, runfw.4, zyd.4: do not install when MK_USB == no. While here, add missing if_rtwn_usb.4.gz symlink into OptionalObsoleteFiles.inc Modified: head/share/man/man4/Makefile head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Wed Dec 28 08:11:41 2016 (r310675) +++ head/share/man/man4/Makefile Wed Dec 28 09:32:02 2016 (r310676) @@ -438,9 +438,6 @@ MAN= aac.4 \ rtwnfw.4 \ rtwn_pci.4 \ rue.4 \ - rum.4 \ - run.4 \ - runfw.4 \ sa.4 \ safe.4 \ sbp.4 \ @@ -574,8 +571,7 @@ MAN= aac.4 \ xl.4 \ ${_xnb.4} \ xpt.4 \ - zero.4 \ - zyd.4 + zero.4 MLINKS= ae.4 if_ae.4 MLINKS+=age.4 if_age.4 @@ -710,8 +706,6 @@ MLINKS+=rl.4 if_rl.4 MLINKS+=rtwn.4 if_rtwn.4 MLINKS+=rtwn_pci.4 if_rtwn_pci.4 MLINKS+=rue.4 if_rue.4 -MLINKS+=rum.4 if_rum.4 -MLINKS+=run.4 if_run.4 MLINKS+=scsi.4 CAM.4 \ scsi.4 cam.4 \ scsi.4 scbus.4 \ @@ -756,7 +750,6 @@ MLINKS+=wi.4 if_wi.4 MLINKS+=${_wpi.4} ${_if_wpi.4} MLINKS+=xe.4 if_xe.4 MLINKS+=xl.4 if_xl.4 -MLINKS+=zyd.4 if_zyd.4 .if ${MACHINE_CPUARCH} == "aarch64" _armv8crypto.4= armv8crypto.4 @@ -915,6 +908,9 @@ MAN+= \ rsu.4 \ rsufw.4 \ rtwn_usb.4 \ + rum.4 \ + run.4 \ + runfw.4 \ u3g.4 \ uark.4 \ uart.4 \ @@ -965,10 +961,13 @@ MAN+= \ utopia.4 \ uvisor.4 \ uvscom.4 \ + zyd.4 MLINKS+=otus.4 if_otus.4 MLINKS+=rsu.4 if_rsu.4 MLINKS+=rtwn_usb.4 if_rtwn_usb.4 +MLINKS+=rum.4 if_rum.4 +MLINKS+=run.4 if_run.4 MLINKS+=u3g.4 u3gstub.4 MLINKS+=uath.4 if_uath.4 MLINKS+=udav.4 if_udav.4 @@ -976,6 +975,7 @@ MLINKS+=upgt.4 if_upgt.4 MLINKS+=ural.4 if_ural.4 MLINKS+=urndis.4 if_urndis.4 MLINKS+=${_urtw.4} ${_if_urtw.4} +MLINKS+=zyd.4 if_zyd.4 .endif .include Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Wed Dec 28 08:11:41 2016 (r310675) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Wed Dec 28 09:32:02 2016 (r310676) @@ -8870,11 +8870,18 @@ OLD_FILES+=usr/share/man/man3/usb_strerr OLD_FILES+=usr/share/man/man3/usbhid.3.gz OLD_FILES+=usr/share/man/man4/if_otus.4.gz OLD_FILES+=usr/share/man/man4/if_rsu.4.gz +OLD_FILES+=usr/share/man/man4/if_rtwn_usb.4.gz +OLD_FILES+=usr/share/man/man4/if_rum.4.gz +OLD_FILES+=usr/share/man/man4/if_run.4.gz +OLD_FILES+=usr/share/man/man4/if_zyd.4.gz OLD_FILES+=usr/share/man/man4/otus.4.gz OLD_FILES+=usr/share/man/man4/otusfw.4.gz OLD_FILES+=usr/share/man/man4/rsu.4.gz OLD_FILES+=usr/share/man/man4/rsufw.4.gz OLD_FILES+=usr/share/man/man4/rtwn_usb.4.gz +OLD_FILES+=usr/share/man/man4/rum.4.gz +OLD_FILES+=usr/share/man/man4/run.4.gz +OLD_FILES+=usr/share/man/man4/runfw.4.gz OLD_FILES+=usr/share/man/man4/u3g.4.gz OLD_FILES+=usr/share/man/man4/u3gstub.4.gz OLD_FILES+=usr/share/man/man4/uark.4.gz @@ -8924,6 +8931,7 @@ OLD_FILES+=usr/share/man/man4/uslcom.4.g OLD_FILES+=usr/share/man/man4/utopia.4.gz OLD_FILES+=usr/share/man/man4/uvisor.4.gz OLD_FILES+=usr/share/man/man4/uvscom.4.gz +OLD_FILES+=usr/share/man/man4/zyd.4.gz OLD_FILES+=usr/share/man/man8/uathload.8.gz OLD_FILES+=usr/share/man/man8/usbconfig.8.gz OLD_FILES+=usr/share/man/man8/usbdump.8.gz From owner-svn-src-head@freebsd.org Wed Dec 28 10:39:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8156CC93EFD; Wed, 28 Dec 2016 10:39:12 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50F721038; Wed, 28 Dec 2016 10:39:12 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSAdBbA040464; Wed, 28 Dec 2016 10:39:11 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSAdB1T040463; Wed, 28 Dec 2016 10:39:11 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281039.uBSAdB1T040463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 10:39:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310677 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 10:39:12 -0000 Author: arybchik Date: Wed Dec 28 10:39:11 2016 New Revision: 310677 URL: https://svnweb.freebsd.org/changeset/base/310677 Log: sfxge(4): cleanup: fix typo in siena_mac_loopback_set() instrumentation Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/siena_mac.c Modified: head/sys/dev/sfxge/common/siena_mac.c ============================================================================== --- head/sys/dev/sfxge/common/siena_mac.c Wed Dec 28 09:32:02 2016 (r310676) +++ head/sys/dev/sfxge/common/siena_mac.c Wed Dec 28 10:39:11 2016 (r310677) @@ -223,7 +223,7 @@ siena_mac_loopback_set( return (0); fail1: - EFSYS_PROBE(fail2); + EFSYS_PROBE1(fail1, efx_rc_t, rc); epp->ep_loopback_type = old_loopback_type; epp->ep_loopback_link_mode = old_loopback_link_mode; From owner-svn-src-head@freebsd.org Wed Dec 28 10:40:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06852C940B3; Wed, 28 Dec 2016 10:40:23 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA0931337; Wed, 28 Dec 2016 10:40:22 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSAeLFS040567; Wed, 28 Dec 2016 10:40:22 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSAeLrL040566; Wed, 28 Dec 2016 10:40:21 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281040.uBSAeLrL040566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 10:40:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310678 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 10:40:23 -0000 Author: arybchik Date: Wed Dec 28 10:40:21 2016 New Revision: 310678 URL: https://svnweb.freebsd.org/changeset/base/310678 Log: sfxge(4): cleanup: remove trailing whitespace Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx_types.h Modified: head/sys/dev/sfxge/common/efx_types.h ============================================================================== --- head/sys/dev/sfxge/common/efx_types.h Wed Dec 28 10:39:11 2016 (r310677) +++ head/sys/dev/sfxge/common/efx_types.h Wed Dec 28 10:40:21 2016 (r310678) @@ -1310,7 +1310,7 @@ extern int fix_lint; /* * Set or clear a numbered bit within an octword. */ - + #define EFX_SHIFT64(_bit, _base) \ (((_bit) >= (_base) && (_bit) < (_base) + 64) ? \ ((uint64_t)1 << ((_bit) - (_base))) : \ From owner-svn-src-head@freebsd.org Wed Dec 28 10:43:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3E19C94251; Wed, 28 Dec 2016 10:43:05 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3655179D; Wed, 28 Dec 2016 10:43:05 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSAh4n1044487; Wed, 28 Dec 2016 10:43:04 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSAh4vC044486; Wed, 28 Dec 2016 10:43:04 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281043.uBSAh4vC044486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 10:43:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310679 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 10:43:06 -0000 Author: arybchik Date: Wed Dec 28 10:43:04 2016 New Revision: 310679 URL: https://svnweb.freebsd.org/changeset/base/310679 Log: sfxge(4): cleanup: fix wrong indent Found by DPDK checkpatch.sh Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx_tx.c Modified: head/sys/dev/sfxge/common/efx_tx.c ============================================================================== --- head/sys/dev/sfxge/common/efx_tx.c Wed Dec 28 10:40:21 2016 (r310678) +++ head/sys/dev/sfxge/common/efx_tx.c Wed Dec 28 10:43:04 2016 (r310679) @@ -329,7 +329,7 @@ efx_tx_qcreate( if ((rc = etxop->etxo_qcreate(enp, index, label, esmp, n, id, flags, eep, etp, addedp)) != 0) - goto fail2; + goto fail2; enp->en_tx_qcount++; *etpp = etp; From owner-svn-src-head@freebsd.org Wed Dec 28 10:44:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3602C942D5; Wed, 28 Dec 2016 10:44:04 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2C8F1945; Wed, 28 Dec 2016 10:44:04 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSAi39g044582; Wed, 28 Dec 2016 10:44:03 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSAi3ki044581; Wed, 28 Dec 2016 10:44:03 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281044.uBSAi3ki044581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 10:44:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310680 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 10:44:05 -0000 Author: arybchik Date: Wed Dec 28 10:44:03 2016 New Revision: 310680 URL: https://svnweb.freebsd.org/changeset/base/310680 Log: sfxge(4): cleanup: use spaces around binary arithmetic operations Found by DPDK checkpatch.sh Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx_lic.c Modified: head/sys/dev/sfxge/common/efx_lic.c ============================================================================== --- head/sys/dev/sfxge/common/efx_lic.c Wed Dec 28 10:43:04 2016 (r310679) +++ head/sys/dev/sfxge/common/efx_lic.c Wed Dec 28 10:44:03 2016 (r310680) @@ -456,7 +456,7 @@ fail1: * Value (V): L bytes - payload */ #define EFX_LICENSE_V1V2_PAYLOAD_LENGTH_MAX (256) -#define EFX_LICENSE_V1V2_HEADER_LENGTH (2*sizeof(uint16_t)) +#define EFX_LICENSE_V1V2_HEADER_LENGTH (2 * sizeof(uint16_t)) __checkReturn efx_rc_t efx_lic_v1v2_find_start( @@ -1082,9 +1082,10 @@ efx_mcdi_licensing_v3_get_id( } else { /* Shift ID down to start of buffer */ memmove(bufferp, - bufferp+MC_CMD_LICENSING_GET_ID_V3_OUT_LICENSE_ID_OFST, - *lengthp); - memset(bufferp+(*lengthp), 0, MC_CMD_LICENSING_GET_ID_V3_OUT_LICENSE_ID_OFST); + bufferp + MC_CMD_LICENSING_GET_ID_V3_OUT_LICENSE_ID_OFST, + *lengthp); + memset(bufferp + (*lengthp), 0, + MC_CMD_LICENSING_GET_ID_V3_OUT_LICENSE_ID_OFST); } return (0); From owner-svn-src-head@freebsd.org Wed Dec 28 10:45:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13C0DC9435B; Wed, 28 Dec 2016 10:45:16 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D75C01AD5; Wed, 28 Dec 2016 10:45:15 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSAjFYU044673; Wed, 28 Dec 2016 10:45:15 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSAjEi3044671; Wed, 28 Dec 2016 10:45:14 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281045.uBSAjEi3044671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 10:45:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310681 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 10:45:16 -0000 Author: arybchik Date: Wed Dec 28 10:45:14 2016 New Revision: 310681 URL: https://svnweb.freebsd.org/changeset/base/310681 Log: sfxge(4): cleanup: remove unnecessary spaces Found by DPDK checkpatch.sh Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx_impl.h head/sys/dev/sfxge/common/efx_lic.c Modified: head/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- head/sys/dev/sfxge/common/efx_impl.h Wed Dec 28 10:44:03 2016 (r310680) +++ head/sys/dev/sfxge/common/efx_impl.h Wed Dec 28 10:45:14 2016 (r310681) @@ -564,7 +564,7 @@ typedef struct efx_lic_ops_s { efx_rc_t (*elo_find_start) (efx_nic_t *, caddr_t, size_t, uint32_t *); efx_rc_t (*elo_find_end)(efx_nic_t *, caddr_t, size_t, - uint32_t , uint32_t *); + uint32_t, uint32_t *); boolean_t (*elo_find_key)(efx_nic_t *, caddr_t, size_t, uint32_t, uint32_t *, uint32_t *); boolean_t (*elo_validate_key)(efx_nic_t *, Modified: head/sys/dev/sfxge/common/efx_lic.c ============================================================================== --- head/sys/dev/sfxge/common/efx_lic.c Wed Dec 28 10:44:03 2016 (r310680) +++ head/sys/dev/sfxge/common/efx_lic.c Wed Dec 28 10:45:14 2016 (r310681) @@ -627,7 +627,7 @@ efx_lic_v1v2_write_key( // Ensure space for terminator remains if ((offset + length) > - (buffer_size - EFX_LICENSE_V1V2_HEADER_LENGTH) ) { + (buffer_size - EFX_LICENSE_V1V2_HEADER_LENGTH)) { rc = ENOSPC; goto fail1; } From owner-svn-src-head@freebsd.org Wed Dec 28 10:47:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EEF01C943E7; Wed, 28 Dec 2016 10:47:05 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8EB81C89; Wed, 28 Dec 2016 10:47:05 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSAl4BK044777; Wed, 28 Dec 2016 10:47:04 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSAl48D044774; Wed, 28 Dec 2016 10:47:04 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281047.uBSAl48D044774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 10:47:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310682 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 10:47:06 -0000 Author: arybchik Date: Wed Dec 28 10:47:04 2016 New Revision: 310682 URL: https://svnweb.freebsd.org/changeset/base/310682 Log: sfxge(4): cleanup: avoid C99 // comments Found by DPDK checkpatch.sh Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/ef10_ev.c head/sys/dev/sfxge/common/ef10_nvram.c head/sys/dev/sfxge/common/efx_lic.c Modified: head/sys/dev/sfxge/common/ef10_ev.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_ev.c Wed Dec 28 10:45:14 2016 (r310681) +++ head/sys/dev/sfxge/common/ef10_ev.c Wed Dec 28 10:47:04 2016 (r310682) @@ -800,7 +800,7 @@ ef10_ev_rx( * or headers that are too long for the parser. * Headers and checksums must be validated by the host. */ - // TODO: EFX_EV_QSTAT_INCR(eep, EV_RX_PARSE_INCOMPLETE); + /* TODO: EFX_EV_QSTAT_INCR(eep, EV_RX_PARSE_INCOMPLETE); */ goto deliver; } Modified: head/sys/dev/sfxge/common/ef10_nvram.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_nvram.c Wed Dec 28 10:45:14 2016 (r310681) +++ head/sys/dev/sfxge/common/ef10_nvram.c Wed Dec 28 10:47:04 2016 (r310682) @@ -852,7 +852,7 @@ ef10_nvram_buffer_find_item_start( __in size_t buffer_size, __out uint32_t *startp) { - // Read past partition header to find start address of the first key + /* Read past partition header to find start address of the first key */ tlv_cursor_t cursor; efx_rc_t rc; @@ -898,7 +898,7 @@ ef10_nvram_buffer_find_end( __in uint32_t offset, __out uint32_t *endp) { - // Read to end of partition + /* Read to end of partition */ tlv_cursor_t cursor; efx_rc_t rc; uint32_t *segment_used; @@ -956,7 +956,7 @@ ef10_nvram_buffer_find_item( __out uint32_t *startp, __out uint32_t *lengthp) { - // Find TLV at offset and return key start and length + /* Find TLV at offset and return key start and length */ tlv_cursor_t cursor; uint8_t *key; uint32_t tag; Modified: head/sys/dev/sfxge/common/efx_lic.c ============================================================================== --- head/sys/dev/sfxge/common/efx_lic.c Wed Dec 28 10:45:14 2016 (r310681) +++ head/sys/dev/sfxge/common/efx_lic.c Wed Dec 28 10:47:04 2016 (r310682) @@ -625,7 +625,7 @@ efx_lic_v1v2_write_key( EFSYS_ASSERT(length <= (EFX_LICENSE_V1V2_PAYLOAD_LENGTH_MAX + EFX_LICENSE_V1V2_HEADER_LENGTH)); - // Ensure space for terminator remains + /* Ensure space for terminator remains */ if ((offset + length) > (buffer_size - EFX_LICENSE_V1V2_HEADER_LENGTH)) { rc = ENOSPC; @@ -662,7 +662,7 @@ efx_lic_v1v2_delete_key( _NOTE(ARGUNUSED(enp)) EFSYS_ASSERT(end <= buffer_size); - // Shift everything after the key down + /* Shift everything after the key down */ memmove(bufferp + offset, bufferp + move_start, move_length); *deltap = length; @@ -681,7 +681,7 @@ efx_lic_v1v2_create_partition( _NOTE(ARGUNUSED(enp)) EFSYS_ASSERT(EFX_LICENSE_V1V2_HEADER_LENGTH <= buffer_size); - // Write terminator + /* Write terminator */ memset(bufferp, '\0', EFX_LICENSE_V1V2_HEADER_LENGTH); return (0); } @@ -1155,7 +1155,7 @@ efx_lic_v3_validate_key( __in uint32_t length ) { - // Check key is a valid V3 key + /* Check key is a valid V3 key */ uint8_t key_type; uint8_t key_length; @@ -1272,7 +1272,7 @@ efx_lic_v3_create_partition( { efx_rc_t rc; - // Construct empty partition + /* Construct empty partition */ if ((rc = ef10_nvram_buffer_create(enp, NVRAM_PARTITION_TYPE_LICENSE, bufferp, buffer_size)) != 0) { @@ -1303,7 +1303,7 @@ efx_lic_v3_finish_partition( goto fail1; } - // Validate completed partition + /* Validate completed partition */ if ((rc = ef10_nvram_buffer_validate(enp, NVRAM_PARTITION_TYPE_LICENSE, bufferp, buffer_size)) != 0) { goto fail2; From owner-svn-src-head@freebsd.org Wed Dec 28 10:48:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9819BC94458; Wed, 28 Dec 2016 10:48:16 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 679941DF9; Wed, 28 Dec 2016 10:48:16 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSAmFbP044859; Wed, 28 Dec 2016 10:48:15 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSAmFfv044858; Wed, 28 Dec 2016 10:48:15 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281048.uBSAmFfv044858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 10:48:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310683 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 10:48:16 -0000 Author: arybchik Date: Wed Dec 28 10:48:15 2016 New Revision: 310683 URL: https://svnweb.freebsd.org/changeset/base/310683 Log: sfxge(4): cleanup: pointer symbol should go together with struct member name Found by DPDK checkpatch.sh Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/ef10_impl.h Modified: head/sys/dev/sfxge/common/ef10_impl.h ============================================================================== --- head/sys/dev/sfxge/common/ef10_impl.h Wed Dec 28 10:47:04 2016 (r310682) +++ head/sys/dev/sfxge/common/ef10_impl.h Wed Dec 28 10:48:15 2016 (r310683) @@ -950,7 +950,7 @@ typedef struct ef10_filter_entry_s { typedef struct ef10_filter_table_s { ef10_filter_entry_t eft_entry[EFX_EF10_FILTER_TBL_ROWS]; - efx_rxq_t * eft_default_rxq; + efx_rxq_t *eft_default_rxq; boolean_t eft_using_rss; uint32_t eft_unicst_filter_indexes[ EFX_EF10_FILTER_UNICAST_FILTERS_MAX]; From owner-svn-src-head@freebsd.org Wed Dec 28 10:49:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DD5EC94511; Wed, 28 Dec 2016 10:49:42 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D5F41FF8; Wed, 28 Dec 2016 10:49:42 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSAnfDY044951; Wed, 28 Dec 2016 10:49:41 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSAnf9o044950; Wed, 28 Dec 2016 10:49:41 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281049.uBSAnf9o044950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 10:49:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310684 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 10:49:42 -0000 Author: arybchik Date: Wed Dec 28 10:49:41 2016 New Revision: 310684 URL: https://svnweb.freebsd.org/changeset/base/310684 Log: sfxge(4): cleanup: remove trailing whitespaces Found by DPDK checkpatch.sh Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx_types.h Modified: head/sys/dev/sfxge/common/efx_types.h ============================================================================== --- head/sys/dev/sfxge/common/efx_types.h Wed Dec 28 10:48:15 2016 (r310683) +++ head/sys/dev/sfxge/common/efx_types.h Wed Dec 28 10:49:41 2016 (r310684) @@ -238,7 +238,7 @@ typedef union efx_oword_u { #endif #if EFSYS_HAS_UINT64 uint64_t eo_u64[2]; -#endif +#endif uint32_t eo_u32[4]; uint16_t eo_u16[8]; uint8_t eo_u8[16]; From owner-svn-src-head@freebsd.org Wed Dec 28 10:52:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52899C94742; Wed, 28 Dec 2016 10:52:06 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 21C1614E1; Wed, 28 Dec 2016 10:52:06 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSAq53V047498; Wed, 28 Dec 2016 10:52:05 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSAq5Ua047255; Wed, 28 Dec 2016 10:52:05 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281052.uBSAq5Ua047255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 10:52:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310685 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 10:52:06 -0000 Author: arybchik Date: Wed Dec 28 10:52:04 2016 New Revision: 310685 URL: https://svnweb.freebsd.org/changeset/base/310685 Log: sfxge(4): cleanup: open brace should be on a type name line Found by DPDK checkpatch.sh Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_mcdi.c Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Wed Dec 28 10:49:41 2016 (r310684) +++ head/sys/dev/sfxge/common/efx.h Wed Dec 28 10:52:04 2016 (r310685) @@ -212,8 +212,7 @@ typedef enum efx_mcdi_exception_e { } efx_mcdi_exception_t; #if EFSYS_OPT_MCDI_LOGGING -typedef enum efx_log_msg_e -{ +typedef enum efx_log_msg_e { EFX_LOG_INVALID, EFX_LOG_MCDI_REQUEST, EFX_LOG_MCDI_RESPONSE, @@ -1172,8 +1171,7 @@ efx_nic_cfg_get( __in efx_nic_t *enp); /* Driver resource limits (minimum required/maximum usable). */ -typedef struct efx_drv_limits_s -{ +typedef struct efx_drv_limits_s { uint32_t edl_min_evq_count; uint32_t edl_max_evq_count; Modified: head/sys/dev/sfxge/common/efx_mcdi.c ============================================================================== --- head/sys/dev/sfxge/common/efx_mcdi.c Wed Dec 28 10:49:41 2016 (r310684) +++ head/sys/dev/sfxge/common/efx_mcdi.c Wed Dec 28 10:52:04 2016 (r310685) @@ -1728,8 +1728,7 @@ fail1: #if EFSYS_OPT_MAC_STATS -typedef enum efx_stats_action_e -{ +typedef enum efx_stats_action_e { EFX_STATS_CLEAR, EFX_STATS_UPLOAD, EFX_STATS_ENABLE_NOEVENTS, From owner-svn-src-head@freebsd.org Wed Dec 28 10:53:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11421C948C0; Wed, 28 Dec 2016 10:53:55 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BAF0016C4; Wed, 28 Dec 2016 10:53:54 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSArrmx048857; Wed, 28 Dec 2016 10:53:53 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSArrb9048855; Wed, 28 Dec 2016 10:53:53 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281053.uBSArrb9048855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 10:53:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310686 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 10:53:55 -0000 Author: arybchik Date: Wed Dec 28 10:53:53 2016 New Revision: 310686 URL: https://svnweb.freebsd.org/changeset/base/310686 Log: sfxge(4): cleanup: add missing space between type and pointer symbol Found by DPDK checkpatch.sh Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_lic.c Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Wed Dec 28 10:52:04 2016 (r310685) +++ head/sys/dev/sfxge/common/efx.h Wed Dec 28 10:53:53 2016 (r310686) @@ -435,7 +435,7 @@ typedef enum efx_link_mode_e { #define EFX_MAC_ADDR_LEN 6 -#define EFX_MAC_ADDR_IS_MULTICAST(_address) (((uint8_t*)_address)[0] & 0x01) +#define EFX_MAC_ADDR_IS_MULTICAST(_address) (((uint8_t *)_address)[0] & 0x01) #define EFX_MAC_MULTICAST_LIST_MAX 256 Modified: head/sys/dev/sfxge/common/efx_lic.c ============================================================================== --- head/sys/dev/sfxge/common/efx_lic.c Wed Dec 28 10:52:04 2016 (r310685) +++ head/sys/dev/sfxge/common/efx_lic.c Wed Dec 28 10:53:53 2016 (r310686) @@ -509,8 +509,8 @@ efx_lic_v1v2_find_key( if ((size_t)buffer_size - offset < EFX_LICENSE_V1V2_HEADER_LENGTH) goto fail1; - tlv_type = __LE_TO_CPU_16(((uint16_t*)&bufferp[offset])[0]); - tlv_length = __LE_TO_CPU_16(((uint16_t*)&bufferp[offset])[1]); + tlv_type = __LE_TO_CPU_16(((uint16_t *)&bufferp[offset])[0]); + tlv_length = __LE_TO_CPU_16(((uint16_t *)&bufferp[offset])[1]); if ((tlv_length > EFX_LICENSE_V1V2_PAYLOAD_LENGTH_MAX) || (tlv_type == 0 && tlv_length == 0)) { found = B_FALSE; @@ -543,8 +543,8 @@ efx_lic_v1v2_validate_key( goto fail1; } - tlv_type = __LE_TO_CPU_16(((uint16_t*)keyp)[0]); - tlv_length = __LE_TO_CPU_16(((uint16_t*)keyp)[1]); + tlv_type = __LE_TO_CPU_16(((uint16_t *)keyp)[0]); + tlv_length = __LE_TO_CPU_16(((uint16_t *)keyp)[1]); if (tlv_length > EFX_LICENSE_V1V2_PAYLOAD_LENGTH_MAX) { goto fail2; @@ -1169,8 +1169,8 @@ efx_lic_v3_validate_key( goto fail2; } - key_type = ((uint8_t*)keyp)[0]; - key_length = ((uint8_t*)keyp)[1]; + key_type = ((uint8_t *)keyp)[0]; + key_length = ((uint8_t *)keyp)[1]; if (key_type < 3) { goto fail3; From owner-svn-src-head@freebsd.org Wed Dec 28 11:01:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E0E3C94AEB; Wed, 28 Dec 2016 11:01:03 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F09D19B1; Wed, 28 Dec 2016 11:01:02 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSB12Yx050598; Wed, 28 Dec 2016 11:01:02 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSB11o9050590; Wed, 28 Dec 2016 11:01:01 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281101.uBSB11o9050590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 11:01:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310687 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 11:01:03 -0000 Author: arybchik Date: Wed Dec 28 11:01:01 2016 New Revision: 310687 URL: https://svnweb.freebsd.org/changeset/base/310687 Log: sfxge(4): cleanup: use TAB to indent Found by DPDK checkpatch.sh Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_impl.h head/sys/dev/sfxge/common/efx_phy.c head/sys/dev/sfxge/common/hunt_nic.c head/sys/dev/sfxge/common/mcdi_mon.c head/sys/dev/sfxge/common/medford_nic.c head/sys/dev/sfxge/common/siena_flash.h head/sys/dev/sfxge/common/siena_impl.h Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Wed Dec 28 10:53:53 2016 (r310686) +++ head/sys/dev/sfxge/common/efx.h Wed Dec 28 11:01:01 2016 (r310687) @@ -847,7 +847,7 @@ typedef enum efx_phy_cap_type_e { extern void efx_phy_adv_cap_get( __in efx_nic_t *enp, - __in uint32_t flag, + __in uint32_t flag, __out uint32_t *maskp); extern __checkReturn efx_rc_t @@ -1132,20 +1132,20 @@ typedef struct efx_nic_cfg_s { boolean_t enc_rx_batching_enabled; /* Maximum number of descriptors completed in an rx event. */ uint32_t enc_rx_batch_max; - /* Number of rx descriptors the hardware requires for a push. */ - uint32_t enc_rx_push_align; + /* Number of rx descriptors the hardware requires for a push. */ + uint32_t enc_rx_push_align; /* * Maximum number of bytes into the packet the TCP header can start for * the hardware to apply TSO packet edits. */ - uint32_t enc_tx_tso_tcp_header_offset_limit; - boolean_t enc_fw_assisted_tso_enabled; - boolean_t enc_fw_assisted_tso_v2_enabled; - boolean_t enc_hw_tx_insert_vlan_enabled; + uint32_t enc_tx_tso_tcp_header_offset_limit; + boolean_t enc_fw_assisted_tso_enabled; + boolean_t enc_fw_assisted_tso_v2_enabled; + boolean_t enc_hw_tx_insert_vlan_enabled; /* Datapath firmware vadapter/vport/vswitch support */ boolean_t enc_datapath_cap_evb; - boolean_t enc_rx_disable_scatter_supported; - boolean_t enc_allow_set_mac_with_installed_filters; + boolean_t enc_rx_disable_scatter_supported; + boolean_t enc_allow_set_mac_with_installed_filters; boolean_t enc_enhanced_set_mac_supported; boolean_t enc_init_evq_v2_supported; /* External port identifier */ @@ -1846,8 +1846,8 @@ typedef enum efx_rx_hash_support_e { } efx_rx_hash_support_t; #define EFX_RSS_TBL_SIZE 128 /* Rows in RX indirection table */ -#define EFX_MAXRSS 64 /* RX indirection entry range */ -#define EFX_MAXRSS_LEGACY 16 /* See bug16611 and bug17213 */ +#define EFX_MAXRSS 64 /* RX indirection entry range */ +#define EFX_MAXRSS_LEGACY 16 /* See bug16611 and bug17213 */ typedef enum efx_rx_scale_support_e { EFX_RX_SCALE_UNAVAILABLE = 0, /* Not supported */ @@ -2059,7 +2059,7 @@ efx_tx_qpio_write( __in efx_txq_t *etp, __in_ecount(buf_length) uint8_t *buffer, __in size_t buf_length, - __in size_t pio_buf_offset); + __in size_t pio_buf_offset); extern __checkReturn efx_rc_t efx_tx_qpio_post( Modified: head/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- head/sys/dev/sfxge/common/efx_impl.h Wed Dec 28 10:53:53 2016 (r310686) +++ head/sys/dev/sfxge/common/efx_impl.h Wed Dec 28 11:01:01 2016 (r310687) @@ -252,7 +252,7 @@ efx_filter_reconfigure( typedef struct efx_port_s { efx_mac_type_t ep_mac_type; - uint32_t ep_phy_type; + uint32_t ep_phy_type; uint8_t ep_port; uint32_t ep_mac_pdu; uint8_t ep_mac_addr[6]; @@ -600,7 +600,7 @@ struct efx_nic_s { uint32_t en_features; efsys_identifier_t *en_esip; efsys_lock_t *en_eslp; - efsys_bar_t *en_esbp; + efsys_bar_t *en_esbp; unsigned int en_mod_flags; unsigned int en_reset_flags; efx_nic_cfg_t en_nic_cfg; Modified: head/sys/dev/sfxge/common/efx_phy.c ============================================================================== --- head/sys/dev/sfxge/common/efx_phy.c Wed Dec 28 10:53:53 2016 (r310686) +++ head/sys/dev/sfxge/common/efx_phy.c Wed Dec 28 11:01:01 2016 (r310687) @@ -47,7 +47,7 @@ static const efx_phy_ops_t __efx_phy_sie #endif /* EFSYS_OPT_PHY_STATS */ #if EFSYS_OPT_BIST NULL, /* epo_bist_enable_offline */ - siena_phy_bist_start, /* epo_bist_start */ + siena_phy_bist_start, /* epo_bist_start */ siena_phy_bist_poll, /* epo_bist_poll */ siena_phy_bist_stop, /* epo_bist_stop */ #endif /* EFSYS_OPT_BIST */ Modified: head/sys/dev/sfxge/common/hunt_nic.c ============================================================================== --- head/sys/dev/sfxge/common/hunt_nic.c Wed Dec 28 10:53:53 2016 (r310686) +++ head/sys/dev/sfxge/common/hunt_nic.c Wed Dec 28 11:01:01 2016 (r310687) @@ -83,7 +83,7 @@ hunt_nic_get_required_pcie_bandwidth( if ((rc = ef10_nic_get_port_mode_bandwidth(max_port_mode, &bandwidth)) != 0) - goto fail2; + goto fail2; } out: @@ -295,7 +295,7 @@ hunt_board_cfg( /* Check capabilities of running datapath firmware */ if ((rc = ef10_get_datapath_caps(enp)) != 0) - goto fail12; + goto fail12; /* Alignment for receive packet DMA buffers */ encp->enc_rx_buf_align_start = 1; Modified: head/sys/dev/sfxge/common/mcdi_mon.c ============================================================================== --- head/sys/dev/sfxge/common/mcdi_mon.c Wed Dec 28 10:53:53 2016 (r310686) +++ head/sys/dev/sfxge/common/mcdi_mon.c Wed Dec 28 11:01:01 2016 (r310687) @@ -155,8 +155,8 @@ static const struct mcdi_sensor_map_s { STAT(Px, PHY0_VCC), /* 0x4c PHY0_VCC */ STAT(Px, PHY1_VCC), /* 0x4d PHY1_VCC */ STAT(Px, CONTROLLER_TDIODE_TEMP), /* 0x4e CONTROLLER_TDIODE_TEMP */ - STAT(Px, BOARD_FRONT_TEMP), /* 0x4f BOARD_FRONT_TEMP */ - STAT(Px, BOARD_BACK_TEMP), /* 0x50 BOARD_BACK_TEMP */ + STAT(Px, BOARD_FRONT_TEMP), /* 0x4f BOARD_FRONT_TEMP */ + STAT(Px, BOARD_BACK_TEMP), /* 0x50 BOARD_BACK_TEMP */ }; #define MCDI_STATIC_SENSOR_ASSERT(_field) \ Modified: head/sys/dev/sfxge/common/medford_nic.c ============================================================================== --- head/sys/dev/sfxge/common/medford_nic.c Wed Dec 28 10:53:53 2016 (r310686) +++ head/sys/dev/sfxge/common/medford_nic.c Wed Dec 28 11:01:01 2016 (r310687) @@ -283,7 +283,7 @@ medford_board_cfg( /* Check capabilities of running datapath firmware */ if ((rc = ef10_get_datapath_caps(enp)) != 0) - goto fail10; + goto fail10; /* Alignment for receive packet DMA buffers */ encp->enc_rx_buf_align_start = 1; Modified: head/sys/dev/sfxge/common/siena_flash.h ============================================================================== --- head/sys/dev/sfxge/common/siena_flash.h Wed Dec 28 10:53:53 2016 (r310686) +++ head/sys/dev/sfxge/common/siena_flash.h Wed Dec 28 11:01:01 2016 (r310687) @@ -127,7 +127,7 @@ typedef struct siena_mc_boot_hdr_s { /* } siena_mc_boot_hdr_t; #define SIENA_MC_BOOT_HDR_PADDING \ - (SIENA_MC_BOOT_HDR_LEN - sizeof(siena_mc_boot_hdr_t)) + (SIENA_MC_BOOT_HDR_LEN - sizeof(siena_mc_boot_hdr_t)) #define SIENA_MC_STATIC_CONFIG_MAGIC (0xBDCF5555) #define SIENA_MC_STATIC_CONFIG_VERSION (0) Modified: head/sys/dev/sfxge/common/siena_impl.h ============================================================================== --- head/sys/dev/sfxge/common/siena_impl.h Wed Dec 28 10:53:53 2016 (r310686) +++ head/sys/dev/sfxge/common/siena_impl.h Wed Dec 28 11:01:01 2016 (r310687) @@ -294,7 +294,7 @@ siena_vpd_fini( typedef struct siena_link_state_s { uint32_t sls_adv_cap_mask; uint32_t sls_lp_cap_mask; - unsigned int sls_fcntl; + unsigned int sls_fcntl; efx_link_mode_t sls_link_mode; #if EFSYS_OPT_LOOPBACK efx_loopback_type_t sls_loopback; @@ -362,7 +362,7 @@ siena_phy_bist_poll( __in efx_bist_type_t type, __out efx_bist_result_t *resultp, __out_opt __drv_when(count > 0, __notnull) - uint32_t *value_maskp, + uint32_t *value_maskp, __out_ecount_opt(count) __drv_when(count > 0, __notnull) unsigned long *valuesp, __in size_t count); From owner-svn-src-head@freebsd.org Wed Dec 28 11:03:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1421DC94B77; Wed, 28 Dec 2016 11:03:08 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D73D31D66; Wed, 28 Dec 2016 11:03:07 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSB37x6052782; Wed, 28 Dec 2016 11:03:07 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSB37Ik052781; Wed, 28 Dec 2016 11:03:07 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281103.uBSB37Ik052781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 11:03:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310688 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 11:03:08 -0000 Author: arybchik Date: Wed Dec 28 11:03:06 2016 New Revision: 310688 URL: https://svnweb.freebsd.org/changeset/base/310688 Log: sfxge(4): cleanup: avoid space just before TAB in efx_types.h Found by DPDK checkpatch.sh Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx_types.h Modified: head/sys/dev/sfxge/common/efx_types.h ============================================================================== --- head/sys/dev/sfxge/common/efx_types.h Wed Dec 28 11:01:01 2016 (r310687) +++ head/sys/dev/sfxge/common/efx_types.h Wed Dec 28 11:03:06 2016 (r310688) @@ -688,21 +688,21 @@ extern int fix_lint; _field7, _value7, _field8, _value8, _field9, _value9, \ _field10, _value10) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_oword).eo_u64[0] = EFX_INSERT_FIELDS64(0, 63, \ _field1, _value1, _field2, _value2, \ _field3, _value3, _field4, _value4, \ _field5, _value5, _field6, _value6, \ _field7, _value7, _field8, _value8, \ _field9, _value9, _field10, _value10); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_oword).eo_u64[1] = EFX_INSERT_FIELDS64(64, 127, \ _field1, _value1, _field2, _value2, \ _field3, _value3, _field4, _value4, \ _field5, _value5, _field6, _value6, \ _field7, _value7, _field8, _value8, \ _field9, _value9, _field10, _value10); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_POPULATE_OWORD32(_oword, \ @@ -711,35 +711,35 @@ extern int fix_lint; _field7, _value7, _field8, _value8, _field9, _value9, \ _field10, _value10) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_oword).eo_u32[0] = EFX_INSERT_FIELDS32(0, 31, \ _field1, _value1, _field2, _value2, \ _field3, _value3, _field4, _value4, \ _field5, _value5, _field6, _value6, \ _field7, _value7, _field8, _value8, \ _field9, _value9, _field10, _value10); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_oword).eo_u32[1] = EFX_INSERT_FIELDS32(32, 63, \ _field1, _value1, _field2, _value2, \ _field3, _value3, _field4, _value4, \ _field5, _value5, _field6, _value6, \ _field7, _value7, _field8, _value8, \ _field9, _value9, _field10, _value10); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_oword).eo_u32[2] = EFX_INSERT_FIELDS32(64, 95, \ _field1, _value1, _field2, _value2, \ _field3, _value3, _field4, _value4, \ _field5, _value5, _field6, _value6, \ _field7, _value7, _field8, _value8, \ _field9, _value9, _field10, _value10); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_oword).eo_u32[3] = EFX_INSERT_FIELDS32(96, 127, \ _field1, _value1, _field2, _value2, \ _field3, _value3, _field4, _value4, \ _field5, _value5, _field6, _value6, \ _field7, _value7, _field8, _value8, \ _field9, _value9, _field10, _value10); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_POPULATE_QWORD64(_qword, \ @@ -748,14 +748,14 @@ extern int fix_lint; _field7, _value7, _field8, _value8, _field9, _value9, \ _field10, _value10) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_qword).eq_u64[0] = EFX_INSERT_FIELDS64(0, 63, \ _field1, _value1, _field2, _value2, \ _field3, _value3, _field4, _value4, \ _field5, _value5, _field6, _value6, \ _field7, _value7, _field8, _value8, \ _field9, _value9, _field10, _value10); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_POPULATE_QWORD32(_qword, \ @@ -764,21 +764,21 @@ extern int fix_lint; _field7, _value7, _field8, _value8, _field9, _value9, \ _field10, _value10) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_qword).eq_u32[0] = EFX_INSERT_FIELDS32(0, 31, \ _field1, _value1, _field2, _value2, \ _field3, _value3, _field4, _value4, \ _field5, _value5, _field6, _value6, \ _field7, _value7, _field8, _value8, \ _field9, _value9, _field10, _value10); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_qword).eq_u32[1] = EFX_INSERT_FIELDS32(32, 63, \ _field1, _value1, _field2, _value2, \ _field3, _value3, _field4, _value4, \ _field5, _value5, _field6, _value6, \ _field7, _value7, _field8, _value8, \ _field9, _value9, _field10, _value10); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_POPULATE_DWORD(_dword, \ @@ -787,7 +787,7 @@ extern int fix_lint; _field7, _value7, _field8, _value8, _field9, _value9, \ _field10, _value10) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_dword).ed_u32[0] = EFX_INSERT_FIELDS32(0, 31, \ _field1, _value1, _field2, _value2, \ _field3, _value3, _field4, _value4, \ @@ -803,7 +803,7 @@ extern int fix_lint; _field7, _value7, _field8, _value8, _field9, _value9, \ _field10, _value10) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_word).ew_u16[0] = EFX_INSERT_FIELDS16(0, 15, \ _field1, _value1, _field2, _value2, \ _field3, _value3, _field4, _value4, \ @@ -819,7 +819,7 @@ extern int fix_lint; _field7, _value7, _field8, _value8, _field9, _value9, \ _field10, _value10) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_byte).eb_u8[0] = EFX_INSERT_FIELDS8(0, 7, \ _field1, _value1, _field2, _value2, \ _field3, _value3, _field4, _value4, \ @@ -1226,85 +1226,85 @@ extern int fix_lint; #define EFX_SET_OWORD_FIELD64(_oword, _field, _value) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_oword).eo_u64[0] = (((_oword).eo_u64[0] & \ ~EFX_INPLACE_MASK64(0, 63, _field)) | \ EFX_INSERT_FIELD64(0, 63, _field, _value)); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_oword).eo_u64[1] = (((_oword).eo_u64[1] & \ ~EFX_INPLACE_MASK64(64, 127, _field)) | \ EFX_INSERT_FIELD64(64, 127, _field, _value)); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_SET_OWORD_FIELD32(_oword, _field, _value) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_oword).eo_u32[0] = (((_oword).eo_u32[0] & \ ~EFX_INPLACE_MASK32(0, 31, _field)) | \ EFX_INSERT_FIELD32(0, 31, _field, _value)); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_oword).eo_u32[1] = (((_oword).eo_u32[1] & \ ~EFX_INPLACE_MASK32(32, 63, _field)) | \ EFX_INSERT_FIELD32(32, 63, _field, _value)); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_oword).eo_u32[2] = (((_oword).eo_u32[2] & \ ~EFX_INPLACE_MASK32(64, 95, _field)) | \ EFX_INSERT_FIELD32(64, 95, _field, _value)); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_oword).eo_u32[3] = (((_oword).eo_u32[3] & \ ~EFX_INPLACE_MASK32(96, 127, _field)) | \ EFX_INSERT_FIELD32(96, 127, _field, _value)); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_SET_QWORD_FIELD64(_qword, _field, _value) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_qword).eq_u64[0] = (((_qword).eq_u64[0] & \ ~EFX_INPLACE_MASK64(0, 63, _field)) | \ EFX_INSERT_FIELD64(0, 63, _field, _value)); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_SET_QWORD_FIELD32(_qword, _field, _value) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_qword).eq_u32[0] = (((_qword).eq_u32[0] & \ ~EFX_INPLACE_MASK32(0, 31, _field)) | \ EFX_INSERT_FIELD32(0, 31, _field, _value)); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_qword).eq_u32[1] = (((_qword).eq_u32[1] & \ ~EFX_INPLACE_MASK32(32, 63, _field)) | \ EFX_INSERT_FIELD32(32, 63, _field, _value)); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_SET_DWORD_FIELD(_dword, _field, _value) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_dword).ed_u32[0] = (((_dword).ed_u32[0] & \ ~EFX_INPLACE_MASK32(0, 31, _field)) | \ EFX_INSERT_FIELD32(0, 31, _field, _value)); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_SET_WORD_FIELD(_word, _field, _value) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_word).ew_u16[0] = (((_word).ew_u16[0] & \ ~EFX_INPLACE_MASK16(0, 15, _field)) | \ EFX_INSERT_FIELD16(0, 15, _field, _value)); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_SET_BYTE_FIELD(_byte, _field, _value) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_byte).eb_u8[0] = (((_byte).eb_u8[0] & \ ~EFX_INPLACE_MASK8(0, 7, _field)) | \ EFX_INSERT_FIELD8(0, 7, _field, _value)); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) /* @@ -1333,17 +1333,17 @@ extern int fix_lint; #define EFX_SET_OWORD_BIT64(_oword, _bit) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_oword).eo_u64[0] |= \ __CPU_TO_LE_64(EFX_SHIFT64(_bit, FIX_LINT(0))); \ (_oword).eo_u64[1] |= \ __CPU_TO_LE_64(EFX_SHIFT64(_bit, FIX_LINT(64))); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_SET_OWORD_BIT32(_oword, _bit) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_oword).eo_u32[0] |= \ __CPU_TO_LE_32(EFX_SHIFT32(_bit, FIX_LINT(0))); \ (_oword).eo_u32[1] |= \ @@ -1352,22 +1352,22 @@ extern int fix_lint; __CPU_TO_LE_32(EFX_SHIFT32(_bit, FIX_LINT(64))); \ (_oword).eo_u32[3] |= \ __CPU_TO_LE_32(EFX_SHIFT32(_bit, FIX_LINT(96))); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_CLEAR_OWORD_BIT64(_oword, _bit) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_oword).eo_u64[0] &= \ __CPU_TO_LE_64(~EFX_SHIFT64(_bit, FIX_LINT(0))); \ (_oword).eo_u64[1] &= \ __CPU_TO_LE_64(~EFX_SHIFT64(_bit, FIX_LINT(64))); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_CLEAR_OWORD_BIT32(_oword, _bit) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_oword).eo_u32[0] &= \ __CPU_TO_LE_32(~EFX_SHIFT32(_bit, FIX_LINT(0))); \ (_oword).eo_u32[1] &= \ @@ -1376,7 +1376,7 @@ extern int fix_lint; __CPU_TO_LE_32(~EFX_SHIFT32(_bit, FIX_LINT(64))); \ (_oword).eo_u32[3] &= \ __CPU_TO_LE_32(~EFX_SHIFT32(_bit, FIX_LINT(96))); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_TEST_OWORD_BIT64(_oword, _bit) \ @@ -1398,38 +1398,38 @@ extern int fix_lint; #define EFX_SET_QWORD_BIT64(_qword, _bit) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_qword).eq_u64[0] |= \ __CPU_TO_LE_64(EFX_SHIFT64(_bit, FIX_LINT(0))); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_SET_QWORD_BIT32(_qword, _bit) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_qword).eq_u32[0] |= \ __CPU_TO_LE_32(EFX_SHIFT32(_bit, FIX_LINT(0))); \ (_qword).eq_u32[1] |= \ __CPU_TO_LE_32(EFX_SHIFT32(_bit, FIX_LINT(32))); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_CLEAR_QWORD_BIT64(_qword, _bit) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_qword).eq_u64[0] &= \ __CPU_TO_LE_64(~EFX_SHIFT64(_bit, FIX_LINT(0))); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_CLEAR_QWORD_BIT32(_qword, _bit) \ do { \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ (_qword).eq_u32[0] &= \ __CPU_TO_LE_32(~EFX_SHIFT32(_bit, FIX_LINT(0))); \ (_qword).eq_u32[1] &= \ __CPU_TO_LE_32(~EFX_SHIFT32(_bit, FIX_LINT(32))); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_TEST_QWORD_BIT64(_qword, _bit) \ @@ -1447,14 +1447,14 @@ extern int fix_lint; do { \ (_dword).ed_u32[0] |= \ __CPU_TO_LE_32(EFX_SHIFT32(_bit, FIX_LINT(0))); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_CLEAR_DWORD_BIT(_dword, _bit) \ do { \ (_dword).ed_u32[0] &= \ __CPU_TO_LE_32(~EFX_SHIFT32(_bit, FIX_LINT(0))); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_TEST_DWORD_BIT(_dword, _bit) \ @@ -1466,14 +1466,14 @@ extern int fix_lint; do { \ (_word).ew_u16[0] |= \ __CPU_TO_LE_16(EFX_SHIFT16(_bit, FIX_LINT(0))); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_CLEAR_WORD_BIT(_word, _bit) \ do { \ (_word).ew_u32[0] &= \ __CPU_TO_LE_16(~EFX_SHIFT16(_bit, FIX_LINT(0))); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_TEST_WORD_BIT(_word, _bit) \ @@ -1485,14 +1485,14 @@ extern int fix_lint; do { \ (_byte).eb_u8[0] |= \ __NATIVE_8(EFX_SHIFT8(_bit, FIX_LINT(0))); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_CLEAR_BYTE_BIT(_byte, _bit) \ do { \ (_byte).eb_u8[0] &= \ __NATIVE_8(~EFX_SHIFT8(_bit, FIX_LINT(0))); \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_TEST_BYTE_BIT(_byte, _bit) \ @@ -1504,7 +1504,7 @@ extern int fix_lint; do { \ (_oword1).eo_u64[0] |= (_oword2).eo_u64[0]; \ (_oword1).eo_u64[1] |= (_oword2).eo_u64[1]; \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_OR_OWORD32(_oword1, _oword2) \ @@ -1513,14 +1513,14 @@ extern int fix_lint; (_oword1).eo_u32[1] |= (_oword2).eo_u32[1]; \ (_oword1).eo_u32[2] |= (_oword2).eo_u32[2]; \ (_oword1).eo_u32[3] |= (_oword2).eo_u32[3]; \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_AND_OWORD64(_oword1, _oword2) \ do { \ (_oword1).eo_u64[0] &= (_oword2).eo_u64[0]; \ (_oword1).eo_u64[1] &= (_oword2).eo_u64[1]; \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_AND_OWORD32(_oword1, _oword2) \ @@ -1529,69 +1529,69 @@ extern int fix_lint; (_oword1).eo_u32[1] &= (_oword2).eo_u32[1]; \ (_oword1).eo_u32[2] &= (_oword2).eo_u32[2]; \ (_oword1).eo_u32[3] &= (_oword2).eo_u32[3]; \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_OR_QWORD64(_qword1, _qword2) \ do { \ (_qword1).eq_u64[0] |= (_qword2).eq_u64[0]; \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_OR_QWORD32(_qword1, _qword2) \ do { \ (_qword1).eq_u32[0] |= (_qword2).eq_u32[0]; \ (_qword1).eq_u32[1] |= (_qword2).eq_u32[1]; \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_AND_QWORD64(_qword1, _qword2) \ do { \ (_qword1).eq_u64[0] &= (_qword2).eq_u64[0]; \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_AND_QWORD32(_qword1, _qword2) \ do { \ (_qword1).eq_u32[0] &= (_qword2).eq_u32[0]; \ (_qword1).eq_u32[1] &= (_qword2).eq_u32[1]; \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_OR_DWORD(_dword1, _dword2) \ do { \ (_dword1).ed_u32[0] |= (_dword2).ed_u32[0]; \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_AND_DWORD(_dword1, _dword2) \ do { \ (_dword1).ed_u32[0] &= (_dword2).ed_u32[0]; \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_OR_WORD(_word1, _word2) \ do { \ (_word1).ew_u16[0] |= (_word2).ew_u16[0]; \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_AND_WORD(_word1, _word2) \ do { \ (_word1).ew_u16[0] &= (_word2).ew_u16[0]; \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_OR_BYTE(_byte1, _byte2) \ do { \ (_byte1).eb_u8[0] |= (_byte2).eb_u8[0]; \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #define EFX_AND_BYTE(_byte1, _byte2) \ do { \ (_byte1).eb_u8[0] &= (_byte2).eb_u8[0]; \ - _NOTE(CONSTANTCONDITION) \ + _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) #if EFSYS_USE_UINT64 From owner-svn-src-head@freebsd.org Wed Dec 28 11:04:38 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15D58C94BED; Wed, 28 Dec 2016 11:04:38 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CABC91EEA; Wed, 28 Dec 2016 11:04:37 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSB4b9K052872; Wed, 28 Dec 2016 11:04:37 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSB4aik052868; Wed, 28 Dec 2016 11:04:36 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281104.uBSB4aik052868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 11:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310689 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 11:04:38 -0000 Author: arybchik Date: Wed Dec 28 11:04:36 2016 New Revision: 310689 URL: https://svnweb.freebsd.org/changeset/base/310689 Log: sfxge(4): cleanup: avoid spaces before TAB Found by DPDK checkpatch.sh Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_impl.h head/sys/dev/sfxge/common/efx_types.h head/sys/dev/sfxge/common/siena_phy.c Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Wed Dec 28 11:03:06 2016 (r310688) +++ head/sys/dev/sfxge/common/efx.h Wed Dec 28 11:04:36 2016 (r310689) @@ -169,7 +169,7 @@ extern void efx_nic_unprobe( __in efx_nic_t *enp); -extern void +extern void efx_nic_destroy( __in efx_nic_t *enp); @@ -286,21 +286,21 @@ efx_intr_init( __in efx_intr_type_t type, __in efsys_mem_t *esmp); -extern void +extern void efx_intr_enable( __in efx_nic_t *enp); -extern void +extern void efx_intr_disable( __in efx_nic_t *enp); -extern void +extern void efx_intr_disable_unlocked( __in efx_nic_t *enp); #define EFX_INTR_NEVQS 32 -extern __checkReturn efx_rc_t +extern __checkReturn efx_rc_t efx_intr_trigger( __in efx_nic_t *enp, __in unsigned int level); @@ -819,7 +819,7 @@ efx_port_poll( __in efx_nic_t *enp, __out_opt efx_link_mode_t *link_modep); -extern void +extern void efx_port_fini( __in efx_nic_t *enp); @@ -1253,7 +1253,7 @@ efx_vpd_verify( __in_bcount(size) caddr_t data, __in size_t size); -extern __checkReturn efx_rc_t +extern __checkReturn efx_rc_t efx_vpd_reinit( __in efx_nic_t *enp, __in_bcount(size) caddr_t data, @@ -1281,7 +1281,7 @@ efx_vpd_next( __out efx_vpd_value_t *evvp, __inout unsigned int *contp); -extern __checkReturn efx_rc_t +extern __checkReturn efx_rc_t efx_vpd_write( __in efx_nic_t *enp, __in_bcount(size) caddr_t data, @@ -1499,7 +1499,7 @@ typedef enum efx_pattern_type_t { EFX_PATTERN_NTYPES } efx_pattern_type_t; -typedef void +typedef void (*efx_sram_pattern_fn_t)( __in size_t row, __in boolean_t negate, Modified: head/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- head/sys/dev/sfxge/common/efx_impl.h Wed Dec 28 11:03:06 2016 (r310688) +++ head/sys/dev/sfxge/common/efx_impl.h Wed Dec 28 11:04:36 2016 (r310689) @@ -913,7 +913,7 @@ struct efx_txq_s { uint32_t, (_edp)->ed_u32[0]); \ EFSYS_BAR_WRITED((_enp)->en_esbp, \ (_reg ## _OFST + \ - (2 * sizeof (efx_dword_t)) + \ + (2 * sizeof (efx_dword_t)) + \ ((_index) * _reg ## _STEP)), \ (_edp), (_lock)); \ _NOTE(CONSTANTCONDITION) \ @@ -928,7 +928,7 @@ struct efx_txq_s { uint32_t, (_edp)->ed_u32[0]); \ EFSYS_BAR_WRITED((_enp)->en_esbp, \ (_reg ## _OFST + \ - (3 * sizeof (efx_dword_t)) + \ + (3 * sizeof (efx_dword_t)) + \ ((_index) * _reg ## _STEP)), \ (_edp), (_lock)); \ _NOTE(CONSTANTCONDITION) \ Modified: head/sys/dev/sfxge/common/efx_types.h ============================================================================== --- head/sys/dev/sfxge/common/efx_types.h Wed Dec 28 11:03:06 2016 (r310688) +++ head/sys/dev/sfxge/common/efx_types.h Wed Dec 28 11:04:36 2016 (r310689) @@ -246,7 +246,7 @@ typedef union efx_oword_u { #pragma pack() -#define __SWAP16(_x) \ +#define __SWAP16(_x) \ ((((_x) & 0xff) << 8) | \ (((_x) >> 8) & 0xff)) @@ -1212,16 +1212,16 @@ extern int fix_lint; #define EFX_INSERT_FIELD8(_min, _max, _field, _value) \ __NATIVE_8(EFX_INSERT_FIELD_NATIVE8(_min, _max, _field, _value)) -#define EFX_INPLACE_MASK64(_min, _max, _field) \ +#define EFX_INPLACE_MASK64(_min, _max, _field) \ EFX_INSERT_FIELD64(_min, _max, _field, EFX_MASK64(_field)) -#define EFX_INPLACE_MASK32(_min, _max, _field) \ +#define EFX_INPLACE_MASK32(_min, _max, _field) \ EFX_INSERT_FIELD32(_min, _max, _field, EFX_MASK32(_field)) -#define EFX_INPLACE_MASK16(_min, _max, _field) \ +#define EFX_INPLACE_MASK16(_min, _max, _field) \ EFX_INSERT_FIELD16(_min, _max, _field, EFX_MASK16(_field)) -#define EFX_INPLACE_MASK8(_min, _max, _field) \ +#define EFX_INPLACE_MASK8(_min, _max, _field) \ EFX_INSERT_FIELD8(_min, _max, _field, EFX_MASK8(_field)) #define EFX_SET_OWORD_FIELD64(_oword, _field, _value) \ Modified: head/sys/dev/sfxge/common/siena_phy.c ============================================================================== --- head/sys/dev/sfxge/common/siena_phy.c Wed Dec 28 11:03:06 2016 (r310688) +++ head/sys/dev/sfxge/common/siena_phy.c Wed Dec 28 11:04:36 2016 (r310689) @@ -455,7 +455,7 @@ siena_phy_oui_get( } #define SIENA_SIMPLE_STAT_SET2(_vmask, _esmp, _smask, _stat, _record) \ - SIENA_SIMPLE_STAT_SET(_vmask, _esmp, _smask, _stat, \ + SIENA_SIMPLE_STAT_SET(_vmask, _esmp, _smask, _stat, \ MC_CMD_ ## _record, \ EFX_PHY_STAT_ ## _record) From owner-svn-src-head@freebsd.org Wed Dec 28 11:07:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A04DC94C66; Wed, 28 Dec 2016 11:07:36 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14C221099; Wed, 28 Dec 2016 11:07:36 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSB7Zb5053112; Wed, 28 Dec 2016 11:07:35 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSB7Yab053021; Wed, 28 Dec 2016 11:07:34 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281107.uBSB7Yab053021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 11:07:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310690 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 11:07:36 -0000 Author: arybchik Date: Wed Dec 28 11:07:34 2016 New Revision: 310690 URL: https://svnweb.freebsd.org/changeset/base/310690 Log: sfxge(4): cleanup: add const qualifier to const array pointer Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx_ev.c head/sys/dev/sfxge/common/efx_mac.c head/sys/dev/sfxge/common/efx_mon.c head/sys/dev/sfxge/common/efx_phy.c head/sys/dev/sfxge/common/efx_tx.c Modified: head/sys/dev/sfxge/common/efx_ev.c ============================================================================== --- head/sys/dev/sfxge/common/efx_ev.c Wed Dec 28 11:04:36 2016 (r310689) +++ head/sys/dev/sfxge/common/efx_ev.c Wed Dec 28 11:07:34 2016 (r310690) @@ -1357,8 +1357,8 @@ fail1: #if EFSYS_OPT_QSTATS #if EFSYS_OPT_NAMES -/* START MKCONFIG GENERATED EfxEventQueueStatNamesBlock b693ddf85aee1bfd */ -static const char *__efx_ev_qstat_name[] = { +/* START MKCONFIG GENERATED EfxEventQueueStatNamesBlock c0f3bc5083b40532 */ +static const char * const __efx_ev_qstat_name[] = { "all", "rx", "rx_ok", Modified: head/sys/dev/sfxge/common/efx_mac.c ============================================================================== --- head/sys/dev/sfxge/common/efx_mac.c Wed Dec 28 11:04:36 2016 (r310689) +++ head/sys/dev/sfxge/common/efx_mac.c Wed Dec 28 11:07:34 2016 (r310690) @@ -515,8 +515,8 @@ efx_mac_filter_default_rxq_clear( #if EFSYS_OPT_NAMES -/* START MKCONFIG GENERATED EfxMacStatNamesBlock 054d43a31d2d7a45 */ -static const char *__efx_mac_stat_name[] = { +/* START MKCONFIG GENERATED EfxMacStatNamesBlock c11b91b42f922516 */ +static const char * const __efx_mac_stat_name[] = { "rx_octets", "rx_pkts", "rx_unicst_pkts", Modified: head/sys/dev/sfxge/common/efx_mon.c ============================================================================== --- head/sys/dev/sfxge/common/efx_mon.c Wed Dec 28 11:04:36 2016 (r310689) +++ head/sys/dev/sfxge/common/efx_mon.c Wed Dec 28 11:07:34 2016 (r310690) @@ -126,8 +126,8 @@ fail1: #if EFSYS_OPT_NAMES -/* START MKCONFIG GENERATED MonitorStatNamesBlock 31f437eafb0b0437 */ -static const char *__mon_stat_name[] = { +/* START MKCONFIG GENERATED MonitorStatNamesBlock 5daa2a5725ba734b */ +static const char * const __mon_stat_name[] = { "value_2_5v", "value_vccp1", "value_vcc", Modified: head/sys/dev/sfxge/common/efx_phy.c ============================================================================== --- head/sys/dev/sfxge/common/efx_phy.c Wed Dec 28 11:04:36 2016 (r310689) +++ head/sys/dev/sfxge/common/efx_phy.c Wed Dec 28 11:07:34 2016 (r310690) @@ -336,8 +336,8 @@ fail1: #if EFSYS_OPT_NAMES -/* START MKCONFIG GENERATED PhyStatNamesBlock d5f79b4bc2c050fe */ -static const char *__efx_phy_stat_name[] = { +/* START MKCONFIG GENERATED PhyStatNamesBlock af9ffa24da3bc100 */ +static const char * const __efx_phy_stat_name[] = { "oui", "pma_pmd_link_up", "pma_pmd_rx_fault", Modified: head/sys/dev/sfxge/common/efx_tx.c ============================================================================== --- head/sys/dev/sfxge/common/efx_tx.c Wed Dec 28 11:04:36 2016 (r310689) +++ head/sys/dev/sfxge/common/efx_tx.c Wed Dec 28 11:07:34 2016 (r310690) @@ -1029,8 +1029,8 @@ siena_tx_qdesc_dma_create( #if EFSYS_OPT_QSTATS #if EFSYS_OPT_NAMES -/* START MKCONFIG GENERATED EfxTransmitQueueStatNamesBlock 9d8d26a0a5e2c453 */ -static const char *__efx_tx_qstat_name[] = { +/* START MKCONFIG GENERATED EfxTransmitQueueStatNamesBlock 2866874ecd7a363b */ +static const char * const __efx_tx_qstat_name[] = { "post", "post_pio", }; From owner-svn-src-head@freebsd.org Wed Dec 28 11:09:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23A6AC94D9E; Wed, 28 Dec 2016 11:09:47 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E63221359; Wed, 28 Dec 2016 11:09:46 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSB9kqO053326; Wed, 28 Dec 2016 11:09:46 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSB9kYU053324; Wed, 28 Dec 2016 11:09:46 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281109.uBSB9kYU053324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 11:09:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310691 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 11:09:47 -0000 Author: arybchik Date: Wed Dec 28 11:09:45 2016 New Revision: 310691 URL: https://svnweb.freebsd.org/changeset/base/310691 Log: sfxge(4): make strings array pointer itself immutable Found by DPDK checkpatches.sh Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx_mon.c head/sys/dev/sfxge/common/efx_port.c Modified: head/sys/dev/sfxge/common/efx_mon.c ============================================================================== --- head/sys/dev/sfxge/common/efx_mon.c Wed Dec 28 11:07:34 2016 (r310690) +++ head/sys/dev/sfxge/common/efx_mon.c Wed Dec 28 11:09:45 2016 (r310691) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); #if EFSYS_OPT_NAMES -static const char *__efx_mon_name[] = { +static const char * const __efx_mon_name[] = { "", "sfx90x0", "sfx91x0", Modified: head/sys/dev/sfxge/common/efx_port.c ============================================================================== --- head/sys/dev/sfxge/common/efx_port.c Wed Dec 28 11:07:34 2016 (r310690) +++ head/sys/dev/sfxge/common/efx_port.c Wed Dec 28 11:09:45 2016 (r310691) @@ -172,7 +172,7 @@ fail1: #if EFSYS_OPT_NAMES -static const char *__efx_loopback_type_name[] = { +static const char * const __efx_loopback_type_name[] = { "OFF", "DATA", "GMAC", From owner-svn-src-head@freebsd.org Wed Dec 28 11:11:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEE68C94F09; Wed, 28 Dec 2016 11:11:16 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B95081815; Wed, 28 Dec 2016 11:11:16 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSBBFYM054442; Wed, 28 Dec 2016 11:11:15 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSBBFD4054439; Wed, 28 Dec 2016 11:11:15 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281111.uBSBBFD4054439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 11:11:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310692 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 11:11:17 -0000 Author: arybchik Date: Wed Dec 28 11:11:15 2016 New Revision: 310692 URL: https://svnweb.freebsd.org/changeset/base/310692 Log: sfxge(4): enclose macro complex value in parenthesis Found by DPDK checkpatches.sh Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx_bootcfg.c head/sys/dev/sfxge/common/efx_types.h head/sys/dev/sfxge/common/mcdi_mon.c Modified: head/sys/dev/sfxge/common/efx_bootcfg.c ============================================================================== --- head/sys/dev/sfxge/common/efx_bootcfg.c Wed Dec 28 11:09:45 2016 (r310691) +++ head/sys/dev/sfxge/common/efx_bootcfg.c Wed Dec 28 11:11:15 2016 (r310692) @@ -43,8 +43,8 @@ __FBSDID("$FreeBSD$"); */ #define BOOTCFG_MAX_SIZE 0x1000 -#define DHCP_END (uint8_t)0xff -#define DHCP_PAD (uint8_t)0 +#define DHCP_END ((uint8_t)0xff) +#define DHCP_PAD ((uint8_t)0) static __checkReturn uint8_t efx_bootcfg_csum( Modified: head/sys/dev/sfxge/common/efx_types.h ============================================================================== --- head/sys/dev/sfxge/common/efx_types.h Wed Dec 28 11:09:45 2016 (r310691) +++ head/sys/dev/sfxge/common/efx_types.h Wed Dec 28 11:11:15 2016 (r310692) @@ -264,37 +264,37 @@ typedef union efx_oword_u { #if EFSYS_IS_BIG_ENDIAN -#define __CPU_TO_LE_16(_x) (uint16_t)__SWAP16(_x) -#define __LE_TO_CPU_16(_x) (uint16_t)__SWAP16(_x) -#define __CPU_TO_BE_16(_x) (uint16_t)__NOSWAP16(_x) -#define __BE_TO_CPU_16(_x) (uint16_t)__NOSWAP16(_x) - -#define __CPU_TO_LE_32(_x) (uint32_t)__SWAP32(_x) -#define __LE_TO_CPU_32(_x) (uint32_t)__SWAP32(_x) -#define __CPU_TO_BE_32(_x) (uint32_t)__NOSWAP32(_x) -#define __BE_TO_CPU_32(_x) (uint32_t)__NOSWAP32(_x) - -#define __CPU_TO_LE_64(_x) (uint64_t)__SWAP64(_x) -#define __LE_TO_CPU_64(_x) (uint64_t)__SWAP64(_x) -#define __CPU_TO_BE_64(_x) (uint64_t)__NOSWAP64(_x) -#define __BE_TO_CPU_64(_x) (uint64_t)__NOSWAP64(_x) +#define __CPU_TO_LE_16(_x) ((uint16_t)__SWAP16(_x)) +#define __LE_TO_CPU_16(_x) ((uint16_t)__SWAP16(_x)) +#define __CPU_TO_BE_16(_x) ((uint16_t)__NOSWAP16(_x)) +#define __BE_TO_CPU_16(_x) ((uint16_t)__NOSWAP16(_x)) + +#define __CPU_TO_LE_32(_x) ((uint32_t)__SWAP32(_x)) +#define __LE_TO_CPU_32(_x) ((uint32_t)__SWAP32(_x)) +#define __CPU_TO_BE_32(_x) ((uint32_t)__NOSWAP32(_x)) +#define __BE_TO_CPU_32(_x) ((uint32_t)__NOSWAP32(_x)) + +#define __CPU_TO_LE_64(_x) ((uint64_t)__SWAP64(_x)) +#define __LE_TO_CPU_64(_x) ((uint64_t)__SWAP64(_x)) +#define __CPU_TO_BE_64(_x) ((uint64_t)__NOSWAP64(_x)) +#define __BE_TO_CPU_64(_x) ((uint64_t)__NOSWAP64(_x)) #elif EFSYS_IS_LITTLE_ENDIAN -#define __CPU_TO_LE_16(_x) (uint16_t)__NOSWAP16(_x) -#define __LE_TO_CPU_16(_x) (uint16_t)__NOSWAP16(_x) -#define __CPU_TO_BE_16(_x) (uint16_t)__SWAP16(_x) -#define __BE_TO_CPU_16(_x) (uint16_t)__SWAP16(_x) - -#define __CPU_TO_LE_32(_x) (uint32_t)__NOSWAP32(_x) -#define __LE_TO_CPU_32(_x) (uint32_t)__NOSWAP32(_x) -#define __CPU_TO_BE_32(_x) (uint32_t)__SWAP32(_x) -#define __BE_TO_CPU_32(_x) (uint32_t)__SWAP32(_x) - -#define __CPU_TO_LE_64(_x) (uint64_t)__NOSWAP64(_x) -#define __LE_TO_CPU_64(_x) (uint64_t)__NOSWAP64(_x) -#define __CPU_TO_BE_64(_x) (uint64_t)__SWAP64(_x) -#define __BE_TO_CPU_64(_x) (uint64_t)__SWAP64(_x) +#define __CPU_TO_LE_16(_x) ((uint16_t)__NOSWAP16(_x)) +#define __LE_TO_CPU_16(_x) ((uint16_t)__NOSWAP16(_x)) +#define __CPU_TO_BE_16(_x) ((uint16_t)__SWAP16(_x)) +#define __BE_TO_CPU_16(_x) ((uint16_t)__SWAP16(_x)) + +#define __CPU_TO_LE_32(_x) ((uint32_t)__NOSWAP32(_x)) +#define __LE_TO_CPU_32(_x) ((uint32_t)__NOSWAP32(_x)) +#define __CPU_TO_BE_32(_x) ((uint32_t)__SWAP32(_x)) +#define __BE_TO_CPU_32(_x) ((uint32_t)__SWAP32(_x)) + +#define __CPU_TO_LE_64(_x) ((uint64_t)__NOSWAP64(_x)) +#define __LE_TO_CPU_64(_x) ((uint64_t)__NOSWAP64(_x)) +#define __CPU_TO_BE_64(_x) ((uint64_t)__SWAP64(_x)) +#define __BE_TO_CPU_64(_x) ((uint64_t)__SWAP64(_x)) #else Modified: head/sys/dev/sfxge/common/mcdi_mon.c ============================================================================== --- head/sys/dev/sfxge/common/mcdi_mon.c Wed Dec 28 11:09:45 2016 (r310691) +++ head/sys/dev/sfxge/common/mcdi_mon.c Wed Dec 28 11:11:15 2016 (r310692) @@ -38,8 +38,8 @@ __FBSDID("$FreeBSD$"); #if EFSYS_OPT_MON_STATS -#define MCDI_MON_NEXT_PAGE (uint16_t)0xfffe -#define MCDI_MON_INVALID_SENSOR (uint16_t)0xfffd +#define MCDI_MON_NEXT_PAGE ((uint16_t)0xfffe) +#define MCDI_MON_INVALID_SENSOR ((uint16_t)0xfffd) #define MCDI_MON_PAGE_SIZE 0x20 /* Bitmasks of valid port(s) for each sensor */ From owner-svn-src-head@freebsd.org Wed Dec 28 11:19:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26A03C94161; Wed, 28 Dec 2016 11:19:56 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA3CF1AE6; Wed, 28 Dec 2016 11:19:55 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSBJtlE057552; Wed, 28 Dec 2016 11:19:55 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSBJsDp057546; Wed, 28 Dec 2016 11:19:54 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281119.uBSBJsDp057546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 11:19:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310693 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 11:19:56 -0000 Author: arybchik Date: Wed Dec 28 11:19:54 2016 New Revision: 310693 URL: https://svnweb.freebsd.org/changeset/base/310693 Log: sfxge(4): cleanup: avoid unspecified unsigned Found by DPDK checkpatch.sh Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/ef10_ev.c head/sys/dev/sfxge/common/ef10_filter.c head/sys/dev/sfxge/common/ef10_nvram.c head/sys/dev/sfxge/common/efx_ev.c head/sys/dev/sfxge/common/efx_filter.c head/sys/dev/sfxge/common/siena_vpd.c Modified: head/sys/dev/sfxge/common/ef10_ev.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_ev.c Wed Dec 28 11:11:15 2016 (r310692) +++ head/sys/dev/sfxge/common/ef10_ev.c Wed Dec 28 11:19:54 2016 (r310693) @@ -990,7 +990,7 @@ ef10_ev_mcdi( __in_opt void *arg) { efx_nic_t *enp = eep->ee_enp; - unsigned code; + unsigned int code; boolean_t should_abort = B_FALSE; EFX_EV_QSTAT_INCR(eep, EV_MCDI_RESPONSE); Modified: head/sys/dev/sfxge/common/ef10_filter.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_filter.c Wed Dec 28 11:11:15 2016 (r310692) +++ head/sys/dev/sfxge/common/ef10_filter.c Wed Dec 28 11:19:54 2016 (r310693) @@ -1246,7 +1246,7 @@ ef10_filter_reconfigure( efx_nic_cfg_t *encp = &enp->en_nic_cfg; ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; efx_filter_flag_t filter_flags; - unsigned i; + unsigned int i; efx_rc_t all_unicst_rc = 0; efx_rc_t all_mulcst_rc = 0; efx_rc_t rc; Modified: head/sys/dev/sfxge/common/ef10_nvram.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_nvram.c Wed Dec 28 11:11:15 2016 (r310692) +++ head/sys/dev/sfxge/common/ef10_nvram.c Wed Dec 28 11:19:54 2016 (r310693) @@ -772,7 +772,7 @@ ef10_nvram_buffer_create( struct tlv_partition_header header; struct tlv_partition_trailer trailer; - unsigned min_buf_size = sizeof (struct tlv_partition_header) + + unsigned int min_buf_size = sizeof (struct tlv_partition_header) + sizeof (struct tlv_partition_trailer); if (partn_size < min_buf_size) { rc = EINVAL; Modified: head/sys/dev/sfxge/common/efx_ev.c ============================================================================== --- head/sys/dev/sfxge/common/efx_ev.c Wed Dec 28 11:11:15 2016 (r310692) +++ head/sys/dev/sfxge/common/efx_ev.c Wed Dec 28 11:19:54 2016 (r310693) @@ -953,7 +953,7 @@ siena_ev_mcdi( __in_opt void *arg) { efx_nic_t *enp = eep->ee_enp; - unsigned code; + unsigned int code; boolean_t should_abort = B_FALSE; EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_SIENA); Modified: head/sys/dev/sfxge/common/efx_filter.c ============================================================================== --- head/sys/dev/sfxge/common/efx_filter.c Wed Dec 28 11:11:15 2016 (r310692) +++ head/sys/dev/sfxge/common/efx_filter.c Wed Dec 28 11:19:54 2016 (r310693) @@ -970,7 +970,7 @@ siena_filter_search( __out int *filter_index, __out unsigned int *depth_required) { - unsigned hash, incr, filter_idx, depth; + unsigned int hash, incr, filter_idx, depth; hash = siena_filter_tbl_hash(key); incr = siena_filter_tbl_increment(key); Modified: head/sys/dev/sfxge/common/siena_vpd.c ============================================================================== --- head/sys/dev/sfxge/common/siena_vpd.c Wed Dec 28 11:11:15 2016 (r310692) +++ head/sys/dev/sfxge/common/siena_vpd.c Wed Dec 28 11:19:54 2016 (r310693) @@ -160,7 +160,7 @@ siena_vpd_init( { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); caddr_t svpd = NULL; - unsigned partn; + unsigned int partn; size_t size = 0; efx_rc_t rc; From owner-svn-src-head@freebsd.org Wed Dec 28 11:25:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36FAAC94398; Wed, 28 Dec 2016 11:25:19 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E238D101F; Wed, 28 Dec 2016 11:25:18 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSBPIC4061553; Wed, 28 Dec 2016 11:25:18 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSBPHYt061550; Wed, 28 Dec 2016 11:25:17 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281125.uBSBPHYt061550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 11:25:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310694 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 11:25:19 -0000 Author: arybchik Date: Wed Dec 28 11:25:17 2016 New Revision: 310694 URL: https://svnweb.freebsd.org/changeset/base/310694 Log: sfxge(4): cleanup: add missing spaces Found by DPDK checkpatch.sh Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx_impl.h head/sys/dev/sfxge/common/efx_mcdi.c head/sys/dev/sfxge/common/medford_nic.c Modified: head/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- head/sys/dev/sfxge/common/efx_impl.h Wed Dec 28 11:19:54 2016 (r310693) +++ head/sys/dev/sfxge/common/efx_impl.h Wed Dec 28 11:25:17 2016 (r310694) @@ -124,7 +124,7 @@ typedef struct efx_tx_ops_s { void (*etxo_qenable)(efx_txq_t *); efx_rc_t (*etxo_qpio_enable)(efx_txq_t *); void (*etxo_qpio_disable)(efx_txq_t *); - efx_rc_t (*etxo_qpio_write)(efx_txq_t *,uint8_t *, size_t, + efx_rc_t (*etxo_qpio_write)(efx_txq_t *, uint8_t *, size_t, size_t); efx_rc_t (*etxo_qpio_post)(efx_txq_t *, size_t, unsigned int, unsigned int *); @@ -801,7 +801,7 @@ struct efx_txq_s { #else #define EFX_CHECK_REG(_enp, _reg) do { \ _NOTE(CONSTANTCONDITION) \ - } while(B_FALSE) + } while (B_FALSE) #endif #define EFX_BAR_READD(_enp, _reg, _edp, _lock) \ Modified: head/sys/dev/sfxge/common/efx_mcdi.c ============================================================================== --- head/sys/dev/sfxge/common/efx_mcdi.c Wed Dec 28 11:19:54 2016 (r310693) +++ head/sys/dev/sfxge/common/efx_mcdi.c Wed Dec 28 11:25:17 2016 (r310694) @@ -1765,7 +1765,7 @@ efx_mcdi_mac_stats( MAC_STATS_IN_PERIODIC_CHANGE, enable | events | disable, MAC_STATS_IN_PERIODIC_ENABLE, enable | events, MAC_STATS_IN_PERIODIC_NOEVENT, !events, - MAC_STATS_IN_PERIOD_MS, (enable | events) ? 1000: 0); + MAC_STATS_IN_PERIOD_MS, (enable | events) ? 1000 : 0); if (esmp != NULL) { int bytes = MC_CMD_MAC_NSTATS * sizeof (uint64_t); Modified: head/sys/dev/sfxge/common/medford_nic.c ============================================================================== --- head/sys/dev/sfxge/common/medford_nic.c Wed Dec 28 11:19:54 2016 (r310693) +++ head/sys/dev/sfxge/common/medford_nic.c Wed Dec 28 11:25:17 2016 (r310694) @@ -66,7 +66,7 @@ efx_mcdi_get_rxdp_config( /* RX DMA end padding is disabled */ end_padding = 0; } else { - switch(MCDI_OUT_DWORD_FIELD(req, GET_RXDP_CONFIG_OUT_DATA, + switch (MCDI_OUT_DWORD_FIELD(req, GET_RXDP_CONFIG_OUT_DATA, GET_RXDP_CONFIG_OUT_PAD_HOST_LEN)) { case MC_CMD_SET_RXDP_CONFIG_IN_PAD_HOST_64: end_padding = 64; From owner-svn-src-head@freebsd.org Wed Dec 28 11:28:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02DBBC94461; Wed, 28 Dec 2016 11:28:18 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C690911E7; Wed, 28 Dec 2016 11:28:17 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSBSGAj061685; Wed, 28 Dec 2016 11:28:16 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSBSG2o061684; Wed, 28 Dec 2016 11:28:16 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281128.uBSBSG2o061684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 11:28:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310695 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 11:28:18 -0000 Author: arybchik Date: Wed Dec 28 11:28:16 2016 New Revision: 310695 URL: https://svnweb.freebsd.org/changeset/base/310695 Log: sfxge(4): fix defined-but-not-used warning if neither VPD nor NVRAM opt enabled Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/siena_nic.c Modified: head/sys/dev/sfxge/common/siena_nic.c ============================================================================== --- head/sys/dev/sfxge/common/siena_nic.c Wed Dec 28 11:25:17 2016 (r310694) +++ head/sys/dev/sfxge/common/siena_nic.c Wed Dec 28 11:28:16 2016 (r310695) @@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$"); #if EFSYS_OPT_SIENA +#if EFSYS_OPT_VPD || EFSYS_OPT_NVRAM + static __checkReturn efx_rc_t siena_nic_get_partn_mask( __in efx_nic_t *enp, @@ -78,6 +80,8 @@ fail1: return (rc); } +#endif /* EFSYS_OPT_VPD || EFSYS_OPT_NVRAM */ + static __checkReturn efx_rc_t siena_board_cfg( __in efx_nic_t *enp) From owner-svn-src-head@freebsd.org Wed Dec 28 11:43:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1E09C948FF; Wed, 28 Dec 2016 11:43:12 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 823121B49; Wed, 28 Dec 2016 11:43:12 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSBhBrW069638; Wed, 28 Dec 2016 11:43:11 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSBhBPo069634; Wed, 28 Dec 2016 11:43:11 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281143.uBSBhBPo069634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 11:43:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310696 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 11:43:12 -0000 Author: arybchik Date: Wed Dec 28 11:43:11 2016 New Revision: 310696 URL: https://svnweb.freebsd.org/changeset/base/310696 Log: sfxge(4): cleanup: improve prefast annotations Submitted by: Andy Moreton Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/ef10_impl.h head/sys/dev/sfxge/common/ef10_mcdi.c head/sys/dev/sfxge/common/siena_impl.h head/sys/dev/sfxge/common/siena_mcdi.c Modified: head/sys/dev/sfxge/common/ef10_impl.h ============================================================================== --- head/sys/dev/sfxge/common/ef10_impl.h Wed Dec 28 11:28:16 2016 (r310695) +++ head/sys/dev/sfxge/common/ef10_impl.h Wed Dec 28 11:43:11 2016 (r310696) @@ -296,11 +296,11 @@ ef10_mcdi_fini( extern void ef10_mcdi_send_request( - __in efx_nic_t *enp, - __in void *hdrp, - __in size_t hdr_len, - __in void *sdup, - __in size_t sdu_len); + __in efx_nic_t *enp, + __in_bcount(hdr_len) void *hdrp, + __in size_t hdr_len, + __in_bcount(sdu_len) void *sdup, + __in size_t sdu_len); extern __checkReturn boolean_t ef10_mcdi_poll_response( Modified: head/sys/dev/sfxge/common/ef10_mcdi.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_mcdi.c Wed Dec 28 11:28:16 2016 (r310695) +++ head/sys/dev/sfxge/common/ef10_mcdi.c Wed Dec 28 11:43:11 2016 (r310696) @@ -110,11 +110,11 @@ ef10_mcdi_fini( void ef10_mcdi_send_request( - __in efx_nic_t *enp, - __in void *hdrp, - __in size_t hdr_len, - __in void *sdup, - __in size_t sdu_len) + __in efx_nic_t *enp, + __in_bcount(hdr_len) void *hdrp, + __in size_t hdr_len, + __in_bcount(sdu_len) void *sdup, + __in size_t sdu_len) { const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp; efsys_mem_t *esmp = emtp->emt_dma_mem; Modified: head/sys/dev/sfxge/common/siena_impl.h ============================================================================== --- head/sys/dev/sfxge/common/siena_impl.h Wed Dec 28 11:28:16 2016 (r310695) +++ head/sys/dev/sfxge/common/siena_impl.h Wed Dec 28 11:43:11 2016 (r310696) @@ -96,11 +96,11 @@ siena_mcdi_init( extern void siena_mcdi_send_request( - __in efx_nic_t *enp, - __in void *hdrp, - __in size_t hdr_len, - __in void *sdup, - __in size_t sdu_len); + __in efx_nic_t *enp, + __in_bcount(hdr_len) void *hdrp, + __in size_t hdr_len, + __in_bcount(sdu_len) void *sdup, + __in size_t sdu_len); extern __checkReturn boolean_t siena_mcdi_poll_response( Modified: head/sys/dev/sfxge/common/siena_mcdi.c ============================================================================== --- head/sys/dev/sfxge/common/siena_mcdi.c Wed Dec 28 11:28:16 2016 (r310695) +++ head/sys/dev/sfxge/common/siena_mcdi.c Wed Dec 28 11:43:11 2016 (r310696) @@ -54,11 +54,11 @@ __FBSDID("$FreeBSD$"); void siena_mcdi_send_request( - __in efx_nic_t *enp, - __in void *hdrp, - __in size_t hdr_len, - __in void *sdup, - __in size_t sdu_len) + __in efx_nic_t *enp, + __in_bcount(hdr_len) void *hdrp, + __in size_t hdr_len, + __in_bcount(sdu_len) void *sdup, + __in size_t sdu_len) { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); efx_dword_t dword; From owner-svn-src-head@freebsd.org Wed Dec 28 13:11:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3E20C947E2; Wed, 28 Dec 2016 13:11:23 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D5BD123E; Wed, 28 Dec 2016 13:11:23 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSDBMnH003557; Wed, 28 Dec 2016 13:11:22 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSDBMIa003556; Wed, 28 Dec 2016 13:11:22 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201612281311.uBSDBMIa003556@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Wed, 28 Dec 2016 13:11:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310698 - head/usr.bin/netstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 13:11:23 -0000 Author: araujo Date: Wed Dec 28 13:11:22 2016 New Revision: 310698 URL: https://svnweb.freebsd.org/changeset/base/310698 Log: Print hostcache usage counts with TCP statistics. PR: 196252 Submitted by: Anton Yuzhaninov MFC after: 3 weeks. Modified: head/usr.bin/netstat/inet.c Modified: head/usr.bin/netstat/inet.c ============================================================================== --- head/usr.bin/netstat/inet.c Wed Dec 28 12:23:16 2016 (r310697) +++ head/usr.bin/netstat/inet.c Wed Dec 28 13:11:22 2016 (r310698) @@ -751,6 +751,12 @@ tcp_stats(u_long off, const char *name, "{N:/ignored RSTs in the window%s}\n"); p(tcps_connects, "\t{:connections-established/%ju} " "{N:/connection%s established (including accepts)}\n"); + p(tcps_usedrtt, "\t\t{:connections-hostcache-rtt/%ju} " + "{N:/time%s used RTT from hostcache}\n"); + p(tcps_usedrttvar, "\t\t{:connections-hostcache-rttvar/%ju} " + "{N:/time%s used RTT variance from hostcache}\n"); + p(tcps_usedssthresh, "\t\t{:connections-hostcache-ssthresh/%ju} " + "{N:/time%s used slow-start threshold from hostcache}\n"); p2(tcps_closed, tcps_drops, "\t{:connections-closed/%ju} " "{N:/connection%s closed (including} " "{:connection-drops/%ju} {N:/drop%s})\n"); From owner-svn-src-head@freebsd.org Wed Dec 28 13:28:45 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69DCCC94D43; Wed, 28 Dec 2016 13:28:45 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 449B41F0C; Wed, 28 Dec 2016 13:28:45 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSDSivl011645; Wed, 28 Dec 2016 13:28:44 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSDSiZr011642; Wed, 28 Dec 2016 13:28:44 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281328.uBSDSiZr011642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 13:28:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310699 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 13:28:45 -0000 Author: arybchik Date: Wed Dec 28 13:28:44 2016 New Revision: 310699 URL: https://svnweb.freebsd.org/changeset/base/310699 Log: sfxge(4): rename hunt_bist_* methods to ef10_bist_* Submitted by: Mark Spender Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx_phy.c head/sys/dev/sfxge/common/hunt_impl.h head/sys/dev/sfxge/common/hunt_phy.c Modified: head/sys/dev/sfxge/common/efx_phy.c ============================================================================== --- head/sys/dev/sfxge/common/efx_phy.c Wed Dec 28 13:11:22 2016 (r310698) +++ head/sys/dev/sfxge/common/efx_phy.c Wed Dec 28 13:28:44 2016 (r310699) @@ -65,11 +65,10 @@ static const efx_phy_ops_t __efx_phy_ef1 ef10_phy_stats_update, /* epo_stats_update */ #endif /* EFSYS_OPT_PHY_STATS */ #if EFSYS_OPT_BIST - /* FIXME: Are these BIST methods appropriate for Medford? */ - hunt_bist_enable_offline, /* epo_bist_enable_offline */ - hunt_bist_start, /* epo_bist_start */ - hunt_bist_poll, /* epo_bist_poll */ - hunt_bist_stop, /* epo_bist_stop */ + ef10_bist_enable_offline, /* epo_bist_enable_offline */ + ef10_bist_start, /* epo_bist_start */ + ef10_bist_poll, /* epo_bist_poll */ + ef10_bist_stop, /* epo_bist_stop */ #endif /* EFSYS_OPT_BIST */ }; #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ Modified: head/sys/dev/sfxge/common/hunt_impl.h ============================================================================== --- head/sys/dev/sfxge/common/hunt_impl.h Wed Dec 28 13:11:22 2016 (r310698) +++ head/sys/dev/sfxge/common/hunt_impl.h Wed Dec 28 13:28:44 2016 (r310699) @@ -75,16 +75,16 @@ hunt_board_cfg( #if EFSYS_OPT_BIST extern __checkReturn efx_rc_t -hunt_bist_enable_offline( +ef10_bist_enable_offline( __in efx_nic_t *enp); extern __checkReturn efx_rc_t -hunt_bist_start( +ef10_bist_start( __in efx_nic_t *enp, __in efx_bist_type_t type); extern __checkReturn efx_rc_t -hunt_bist_poll( +ef10_bist_poll( __in efx_nic_t *enp, __in efx_bist_type_t type, __out efx_bist_result_t *resultp, @@ -95,7 +95,7 @@ hunt_bist_poll( __in size_t count); extern void -hunt_bist_stop( +ef10_bist_stop( __in efx_nic_t *enp, __in efx_bist_type_t type); Modified: head/sys/dev/sfxge/common/hunt_phy.c ============================================================================== --- head/sys/dev/sfxge/common/hunt_phy.c Wed Dec 28 13:11:22 2016 (r310698) +++ head/sys/dev/sfxge/common/hunt_phy.c Wed Dec 28 13:28:44 2016 (r310699) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #if EFSYS_OPT_BIST __checkReturn efx_rc_t -hunt_bist_enable_offline( +ef10_bist_enable_offline( __in efx_nic_t *enp) { efx_rc_t rc; @@ -56,7 +56,7 @@ fail1: } __checkReturn efx_rc_t -hunt_bist_start( +ef10_bist_start( __in efx_nic_t *enp, __in efx_bist_type_t type) { @@ -74,7 +74,7 @@ fail1: } __checkReturn efx_rc_t -hunt_bist_poll( +ef10_bist_poll( __in efx_nic_t *enp, __in efx_bist_type_t type, __out efx_bist_result_t *resultp, @@ -179,11 +179,11 @@ fail1: } void -hunt_bist_stop( +ef10_bist_stop( __in efx_nic_t *enp, __in efx_bist_type_t type) { - /* There is no way to stop BIST on Huntinton. */ + /* There is no way to stop BIST on EF10. */ _NOTE(ARGUNUSED(enp, type)) } From owner-svn-src-head@freebsd.org Wed Dec 28 13:47:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E646AC4F53D; Wed, 28 Dec 2016 13:47:03 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-qk0-x242.google.com (mail-qk0-x242.google.com [IPv6:2607:f8b0:400d:c09::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D8DA1D74; Wed, 28 Dec 2016 13:47:03 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: by mail-qk0-x242.google.com with SMTP id t184so32182583qkd.1; Wed, 28 Dec 2016 05:47:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version; bh=zQZDIPvTWblW6andBDHU5gLMBM8ZL1HkY5OdVOPUHOg=; b=ID2D8osL2JPLGnZ7U+tUck2BvS8PyWCBylQRe5innN2wiR0Ce4YXz+fOP57PW2vN47 atb/Zmep2l25cLUFMiDBxoCIISVe+Xz1ZfAmMLWtLny1UvnJBwqL3XpJef3BisG5E26D 2vUUm8Eh5edXGJldUtWGmg8YmBZGJHdstMY88wQPdxP3Wp8feo0UoS0JEk7r2n7+Yuno vX6tsDaKs8IIfcpHGfzZsJB2dqDGz7nbbhB2JDC9+DNLQXa0yF7HoQqGJmTVBEE8+J5b CcGT8vlPoYhTZaaIP6vu399wgqRbpjEzrQFKdND2DcsZE0UKZ/e+gScZe1hExNKxcABQ 3eLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version; bh=zQZDIPvTWblW6andBDHU5gLMBM8ZL1HkY5OdVOPUHOg=; b=dksosO451doLRz0bQ0nbNYqBN7492ErJTWCp/MM1RXewp0iPdkAAdbXWcctj/EWBxh Q7MQIX0Lpw3jj9Ydc1RGNixi7P2B88WiAiOpIXRFAGnc7J2hVfYAQGe87ht6sNfsXSxB Eeo4JqYoK3PBi9RuVrw6BNUNLxnt/cscBtScUklxHDQrM0xMOTJfk+ZFoe5p2sa1d6i7 THv6zkV6bvWa8bVcoPS7mHPb4QcA7FM4A/P27wsKwyAdblRtg/O9h6cbaAhciTqOiV1T jM9Bg24bRBSY48mBcN0jdxddU6U3zlTVFUl9OAECwlSrdt9GDR6Ti+RSvXVJY/e6ZvsC UhnQ== X-Gm-Message-State: AIkVDXIEzjjSrrYyB4tHYYiEFhXtdL5N++MzGfu3mX1Sl5Rpgptb/dcQGcW/726TA4RYaQ== X-Received: by 10.55.95.1 with SMTP id t1mr34991611qkb.277.1482932822847; Wed, 28 Dec 2016 05:47:02 -0800 (PST) Received: from kan ([2601:18f:802:4680:226:18ff:fe00:232e]) by smtp.gmail.com with ESMTPSA id p19sm30820689qtp.4.2016.12.28.05.47.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Dec 2016 05:47:02 -0800 (PST) Date: Wed, 28 Dec 2016 08:46:53 -0500 From: Alexander Kabaev To: Adrian Chadd Cc: Alexander Kabaev , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r310650 - in head/sys/mips: include mips Message-ID: <20161228084653.0326caa4@kan> In-Reply-To: References: <201612280255.uBS2tQeR045512@repo.freebsd.org> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.29; amd64-portbld-freebsd12.0) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/y/NNRm+pci6OV9c.3sVTdHg"; protocol="application/pgp-signature" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 13:47:04 -0000 --Sig_/y/NNRm+pci6OV9c.3sVTdHg Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable On Tue, 27 Dec 2016 21:50:32 -0800 Adrian Chadd wrote: > hiya, >=20 > so I dug into the mips24k definition of this. It says this: >=20 > " > 3.4.3 Uncached accelerated writes > The 24K core permits memory regions to be marked as "uncached > accelerated". This type of region is useful to hard- > ware which is "write only" - perhaps video frame buffers, or some > other hardware stream. Sequential word stores in > such regions are gathered into cache-line-sized chunks, before being > written with a single burst cycle on the CPU > interface. > Such regions are uncached for read, and partial-word or > out-of-sequence writes have "unpredictable" effects - don't > do them. The burst write is normally performed when software writes to > the last location in the memory block or does > an uncached-accelerated write to some other block; but it can also be > triggered by a > sync instruction, a pref nudge, a matching load or any exception. If > the block is not completely written by the time it's pushed out, it > will be written using a series of doubleword or smaller write cycles > over the 24K core's 64-bit memory interface. > " >=20 > So, question is - is our write combining page attribute in the VM > suitable for this? Is it defined as "only do full sequential word > writes"? Or do we risk having some other platform use it in a less > "don't do this" way and then MIPS is the one at fault again? :) >=20 >=20 > -adrian >=20 >=20 FWIW, this is more or less standard verbiage for memory mapped devices and devices is where one would expect framebuffer to reside, so I would not read too much into it. I committed change that does not map UA to WC unconditionally and will let people who need write combining to enable it on a case by case basis. For now, only Ingenic XBursts are doing so as these are ones I have tested. --=20 Alexander Kabaev --Sig_/y/NNRm+pci6OV9c.3sVTdHg Content-Type: application/pgp-signature Content-Description: Цифровая подпись OpenPGP -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEExffZlZm2QeE8UVaRBxMimZJ5Ln4FAlhjwk1fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEM1 RjdEOTk1OTlCNjQxRTEzQzUxNTY5MTA3MTMyMjk5OTI3OTJFN0UACgkQBxMimZJ5 Ln4O9A/+Ll0BXYm9sUys0R9sxrnrMOTouq+vOB5VCkkx7ztmTuRVX9WaXe51q7T+ e0gRcvr61jViiF+aFJFWEjCWKjkO1jcnSKB3X1Mtz5gy/hiLRnxhdIRlh4DMsQAn Az+KtM1ozixIHaohU2ARQvL+rt/vHkaDng6wwtZ9xnbajNcMeXArXlRBCnzl6mCN igDQo3/i7v7ZcsoufYegsQo87lV/iLPOo4PpStBJxL2IDl9lSXJxY80twRGGRHFt V6rRVRdQbeHYYvg5eNBpXZL209CgChvatSOyqqU97sIsA39ozFV9j1AG4GVrD5+p CGBUvOYE76a8VL7xXAHpipOlNn9dS+bT9MmzB4czYgcUDtySOuYksOKSWilkjNSn ARYVY2AIJpId14mN94qjs3o08QpHzMb53tteRgLTRapgoCct5Je/gAeq0FPaFcBk TnjVAXzLQ5SxBQkLZklJ/VHV8h2NUGWms5jhDF0DHZojPpk/FmBHXRhY41GVNRas P99gZX0LOKH+i4y3njDzbw3FANL53lJUyZxCTvAYV5mq3HbLQDZYeL+OrPWSIO+H DE+gqawrLvJA4JLlwWV/Wx93jTM95I+qbMZaUk9Dn3BbAeeHP31W9fWRtW/qCKaj 5QIV4IzWZULG858cP/Aty7201kA53LJPPDzUCPpLB6y5Q6+VYeo= =PSbE -----END PGP SIGNATURE----- --Sig_/y/NNRm+pci6OV9c.3sVTdHg-- From owner-svn-src-head@freebsd.org Wed Dec 28 13:48:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 891D1C4F654; Wed, 28 Dec 2016 13:48:01 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 590451FBB; Wed, 28 Dec 2016 13:48:01 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSDm0Zf020263; Wed, 28 Dec 2016 13:48:00 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSDm0RL020262; Wed, 28 Dec 2016 13:48:00 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201612281348.uBSDm0RL020262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Wed, 28 Dec 2016 13:48:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310700 - head/sys/mips/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 13:48:01 -0000 Author: kan Date: Wed Dec 28 13:48:00 2016 New Revision: 310700 URL: https://svnweb.freebsd.org/changeset/base/310700 Log: Be more conservative when enabling write-combining on MIPS Some MIPS revisions do implement uncached-accelerate caching attribute, but place extra requirement on access, such as partial-word or out-of-sequence writes potentially having an “unpredictable” effects. Modified: head/sys/mips/include/cpuregs.h Modified: head/sys/mips/include/cpuregs.h ============================================================================== --- head/sys/mips/include/cpuregs.h Wed Dec 28 13:28:44 2016 (r310699) +++ head/sys/mips/include/cpuregs.h Wed Dec 28 13:48:00 2016 (r310700) @@ -173,6 +173,7 @@ #if defined(CPU_XBURST) #define MIPS_CCA_UA 0x01 +#define MIPS_CCA_WC MIPS_CCA_UA #endif #ifndef MIPS_CCA_UNCACHED @@ -192,16 +193,6 @@ #endif #endif -/* - * Use uncached-accelerated mode for write-combining maps, if one is defined, - * otherwise fall back to uncached - */ -#ifndef MIPS_CCA_WC -#ifdef MIPS_CCA_UA -#define MIPS_CCA_WC MIPS_CCA_UA -#endif -#endif - #define MIPS_PHYS_TO_XKPHYS(cca,x) \ ((0x2ULL << 62) | ((unsigned long long)(cca) << 59) | (x)) #define MIPS_PHYS_TO_XKPHYS_CACHED(x) \ From owner-svn-src-head@freebsd.org Wed Dec 28 14:10:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85E53C4FE84; Wed, 28 Dec 2016 14:10:34 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46AA910C6; Wed, 28 Dec 2016 14:10:34 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSEAXWX029373; Wed, 28 Dec 2016 14:10:33 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSEAXif029372; Wed, 28 Dec 2016 14:10:33 GMT (envelope-from br@FreeBSD.org) Message-Id: <201612281410.uBSEAXif029372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 28 Dec 2016 14:10:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310701 - head/sys/dev/altera/atse X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 14:10:34 -0000 Author: br Date: Wed Dec 28 14:10:33 2016 New Revision: 310701 URL: https://svnweb.freebsd.org/changeset/base/310701 Log: o Fix style. o Remove set but not used variable. Sponsored by: DARPA, AFRL Modified: head/sys/dev/altera/atse/if_atse.c Modified: head/sys/dev/altera/atse/if_atse.c ============================================================================== --- head/sys/dev/altera/atse/if_atse.c Wed Dec 28 13:48:00 2016 (r310700) +++ head/sys/dev/altera/atse/if_atse.c Wed Dec 28 14:10:33 2016 (r310701) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012,2013 Bjoern A. Zeeb + * Copyright (c) 2012, 2013 Bjoern A. Zeeb * Copyright (c) 2014 Robert N. M. Watson * All rights reserved. * @@ -135,6 +135,7 @@ a_onchip_fifo_mem_core_write(struct reso DPRINTF("[%s:%d] FIFOW %s 0x%08x = 0x%08x\n", f, l, desc, off, val4); bus_write_4(res, off, val4); } + static inline uint32_t a_onchip_fifo_mem_core_read(struct resource *res, uint32_t off, const char *desc, const char *f, const int l) @@ -143,6 +144,7 @@ a_onchip_fifo_mem_core_read(struct resou val4 = le32toh(bus_read_4(res, off)); DPRINTF("[%s:%d] FIFOR %s 0x%08x = 0x%08x\n", f, l, desc, off, val4); + return (val4); } @@ -285,6 +287,7 @@ csr_read_4(struct atse_softc *sc, uint32 val4 = le32toh(bus_read_4(sc->atse_mem_res, reg * 4)); DPRINTF("[%s:%d] CSR R %s 0x%08x (0x%08x) = 0x%08x\n", f, l, "atse_mem_res", reg, reg * 4, val4); + return (val4); } @@ -315,6 +318,7 @@ pxx_read_2(struct atse_softc *sc, bus_ad val = le32toh(val4) & 0x0000ffff; DPRINTF("[%s:%d] %s R %s 0x%08x (0x%08jx) = 0x%04x\n", f, l, s, "atse_mem_res", reg, (bmcr + reg) * 4, val); + return (val); } @@ -343,6 +347,7 @@ atse_tx_locked(struct atse_softc *sc, in { struct mbuf *m; uint32_t val4, fill_level; + int leftm; int c; ATSE_LOCK_ASSERT(sc); @@ -393,15 +398,13 @@ atse_tx_locked(struct atse_softc *sc, in /* Set EOP *before* writing the last symbol. */ if (sc->atse_tx_m_offset >= (sc->atse_tx_buf_len - 4) && fill_level < AVALON_FIFO_TX_BASIC_OPTS_DEPTH) { - int leftm; - uint32_t x; /* Set EndOfPacket. */ val4 = A_ONCHIP_FIFO_MEM_CORE_EOP; + /* Set EMPTY. */ leftm = sc->atse_tx_buf_len - sc->atse_tx_m_offset; val4 |= ((4 - leftm) << A_ONCHIP_FIFO_MEM_CORE_EMPTY_SHIFT); - x = val4; ATSE_TX_META_WRITE(sc, val4); /* Write last symbol. */ @@ -440,7 +443,7 @@ atse_start_locked(struct ifnet *ifp) return; #if 1 - /* + /* * Disable the watchdog while sending, we are batching packets. * Though we should never reach 5 seconds, and are holding the lock, * but who knows. @@ -485,8 +488,8 @@ atse_start(struct ifnet *ifp) static int atse_stop_locked(struct atse_softc *sc) { - struct ifnet *ifp; uint32_t mask, val4; + struct ifnet *ifp; int i; ATSE_LOCK_ASSERT(sc); @@ -527,8 +530,8 @@ atse_stop_locked(struct atse_softc *sc) static uint8_t atse_mchash(struct atse_softc *sc __unused, const uint8_t *addr) { - int i, j; uint8_t x, y; + int i, j; x = 0; for (i = 0; i < ETHER_ADDR_LEN; i++) { @@ -537,14 +540,15 @@ atse_mchash(struct atse_softc *sc __unus y ^= (addr[i] >> j) & 0x01; x |= (y << i); } + return (x); } static int atse_rxfilter_locked(struct atse_softc *sc) { - struct ifnet *ifp; struct ifmultiaddr *ifma; + struct ifnet *ifp; uint32_t val4; int i; @@ -567,7 +571,7 @@ atse_rxfilter_locked(struct atse_softc * for (i = 0; i <= MHASH_LEN; i++) CSR_WRITE_4(sc, MHASH_START + i, 0x1); } else { - /* + /* * Can hold MHASH_LEN entries. * XXX-BZ bitstring.h would be more general. */ @@ -634,8 +638,9 @@ atse_ethernet_option_bits_read(device_t error = atse_ethernet_option_bits_read_fdt(dev); if (error == 0) return (0); - + device_printf(dev, "Cannot read Ethernet addresses from flash.\n"); + return (error); } @@ -789,9 +794,9 @@ atse_set_eth_address(struct atse_softc * static int atse_reset(struct atse_softc *sc) { - int i; uint32_t val4, mask; uint16_t val; + int i; /* 1. External PHY Initialization using MDIO. */ /* @@ -820,6 +825,7 @@ atse_reset(struct atse_softc *sc) val = PCS_READ_2(sc, PCS_CONTROL); val |= PCS_CONTROL_RESET; PCS_WRITE_2(sc, PCS_CONTROL, val); + /* Wait for reset bit to clear; i=100 is excessive. */ for (i = 0; i < 100; i++) { val = PCS_READ_2(sc, PCS_CONTROL); @@ -827,6 +833,7 @@ atse_reset(struct atse_softc *sc) break; DELAY(10); } + if ((val & PCS_CONTROL_RESET) != 0) { device_printf(sc->atse_dev, "PCS reset timed out.\n"); return (ENXIO); @@ -877,7 +884,7 @@ atse_reset(struct atse_softc *sc) CSR_WRITE_4(sc, BASE_CFG_PAUSE_QUANT, 0xFFFF); val4 = CSR_READ_4(sc, BASE_CFG_COMMAND_CONFIG); - /* + /* * If 1000BASE-X/SGMII PCS is initialized, set the ETH_SPEED (bit 3) * and ENA_10 (bit 25) in command_config register to 0. If half duplex * is reported in the PHY/PCS status register, set the HD_ENA (bit 10) @@ -936,7 +943,7 @@ atse_reset(struct atse_softc *sc) device_printf(sc->atse_dev, "MAC reset timed out.\n"); return (ENXIO); } - + /* f. Enable MAC transmit and receive datapath. */ mask = BASE_CFG_COMMAND_CONFIG_TX_ENA|BASE_CFG_COMMAND_CONFIG_RX_ENA; val4 = CSR_READ_4(sc, BASE_CFG_COMMAND_CONFIG); @@ -992,7 +999,7 @@ atse_init_locked(struct atse_softc *sc) sc->atse_flags &= ATSE_FLAGS_LINK; /* Preserve. */ #ifdef DEVICE_POLLING - /* Only enable interrupts if we are not polling. */ + /* Only enable interrupts if we are not polling. */ if (ifp->if_capenable & IFCAP_POLLING) { ATSE_RX_INTR_DISABLE(sc); ATSE_TX_INTR_DISABLE(sc); @@ -1039,7 +1046,6 @@ atse_ioctl(struct ifnet *ifp, u_long com struct ifreq *ifr; int error, mask; - error = 0; sc = ifp->if_softc; ifr = (struct ifreq *)data; @@ -1056,7 +1062,7 @@ atse_ioctl(struct ifnet *ifp, u_long com atse_init_locked(sc); } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) atse_stop_locked(sc); - sc->atse_if_flags = ifp->if_flags; + sc->atse_if_flags = ifp->if_flags; ATSE_UNLOCK(sc); break; case SIOCSIFCAP: @@ -1193,7 +1199,7 @@ atse_tick(void *xsc) /* * Set media options. */ -static int +static int atse_ifmedia_upd(struct ifnet *ifp) { struct atse_softc *sc; @@ -1227,15 +1233,16 @@ atse_update_rx_err(struct atse_softc *sc static int atse_rx_locked(struct atse_softc *sc) { - struct ifnet *ifp; - struct mbuf *m; uint32_t fill, i, j; uint32_t data, meta; - int rx_npkts = 0; + struct ifnet *ifp; + struct mbuf *m; + int rx_npkts; ATSE_LOCK_ASSERT(sc); ifp = sc->atse_ifp; + rx_npkts = 0; j = 0; meta = 0; do { @@ -1294,7 +1301,7 @@ outer: /* XXX-BZ any better counter? */ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); } - + if ((sc->atse_flags & ATSE_FLAGS_SOP_SEEN) == 0) { sc->atse_flags |= ATSE_FLAGS_SOP_SEEN; @@ -1403,7 +1410,7 @@ atse_rx_intr(void *arg) if (ifp->if_capenable & IFCAP_POLLING) { ATSE_UNLOCK(sc); return; - } + } #endif atse_intr_debug(sc, "rx"); @@ -1460,7 +1467,7 @@ atse_tx_intr(void *arg) if (ifp->if_capenable & IFCAP_POLLING) { ATSE_UNLOCK(sc); return; - } + } #endif /* XXX-BZ build histogram. */ @@ -1508,7 +1515,7 @@ atse_poll(struct ifnet *ifp, enum poll_c ATSE_LOCK(sc); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { ATSE_UNLOCK(sc); - return (rx_npkts); + return (rx_npkts); } sc->atse_rx_cycles = count; @@ -1658,9 +1665,9 @@ static int sysctl_atse_mac_stats_proc(SYSCTL_HANDLER_ARGS) { struct atse_softc *sc; - int error, offset, s; + int error, offset, s; - sc = arg1; + sc = arg1; offset = arg2; s = CSR_READ_4(sc, offset); @@ -1668,7 +1675,7 @@ sysctl_atse_mac_stats_proc(SYSCTL_HANDLE if (error || !req->newptr) return (error); - return (0); + return (0); } static struct atse_rx_err_stats_regs { @@ -1676,12 +1683,12 @@ static struct atse_rx_err_stats_regs { const char *descr; } atse_rx_err_stats_regs[] = { -#define ATSE_RX_ERR_FIFO_THRES_EOP 0 /* FIFO threshold reached, on EOP. */ -#define ATSE_RX_ERR_ELEN 1 /* Frame/payload length not valid. */ -#define ATSE_RX_ERR_CRC32 2 /* CRC-32 error. */ -#define ATSE_RX_ERR_FIFO_THRES_TRUNC 3 /* FIFO thresh., truncated frame. */ -#define ATSE_RX_ERR_4 4 /* ? */ -#define ATSE_RX_ERR_5 5 /* / */ +#define ATSE_RX_ERR_FIFO_THRES_EOP 0 /* FIFO threshold reached, on EOP. */ +#define ATSE_RX_ERR_ELEN 1 /* Frame/payload length not valid. */ +#define ATSE_RX_ERR_CRC32 2 /* CRC-32 error. */ +#define ATSE_RX_ERR_FIFO_THRES_TRUNC 3 /* FIFO thresh., truncated frame. */ +#define ATSE_RX_ERR_4 4 /* ? */ +#define ATSE_RX_ERR_5 5 /* / */ { "rx_err_fifo_thres_eop", "FIFO threshold reached, reported on EOP." }, @@ -1701,9 +1708,9 @@ static int sysctl_atse_rx_err_stats_proc(SYSCTL_HANDLER_ARGS) { struct atse_softc *sc; - int error, offset, s; + int error, offset, s; - sc = arg1; + sc = arg1; offset = arg2; s = sc->atse_rx_err[offset]; @@ -1711,7 +1718,7 @@ sysctl_atse_rx_err_stats_proc(SYSCTL_HAN if (error || !req->newptr) return (error); - return (0); + return (0); } static void @@ -1723,8 +1730,8 @@ atse_sysctl_stats_attach(device_t dev) int i; sc = device_get_softc(dev); - sctx = device_get_sysctl_ctx(dev); - soid = device_get_sysctl_tree(dev); + sctx = device_get_sysctl_ctx(dev); + soid = device_get_sysctl_tree(dev); /* MAC statistics. */ for (i = 0; i < nitems(atse_mac_stats_regs); i++) { @@ -2034,11 +2041,11 @@ atse_miibus_statchg(device_t dev) sc = device_get_softc(dev); ATSE_LOCK_ASSERT(sc); - mii = device_get_softc(sc->atse_miibus); - ifp = sc->atse_ifp; - if (mii == NULL || ifp == NULL || - (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - return; + mii = device_get_softc(sc->atse_miibus); + ifp = sc->atse_ifp; + if (mii == NULL || ifp == NULL || + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; val4 = CSR_READ_4(sc, BASE_CFG_COMMAND_CONFIG); @@ -2069,14 +2076,14 @@ atse_miibus_statchg(device_t dev) } } - if ((sc->atse_flags & ATSE_FLAGS_LINK) == 0) { + if ((sc->atse_flags & ATSE_FLAGS_LINK) == 0) { /* XXX-BZ need to stop the MAC? */ - return; - } + return; + } if (IFM_OPTIONS(mii->mii_media_active & IFM_FDX) != 0) val4 &= ~BASE_CFG_COMMAND_CONFIG_HD_ENA; - else + else val4 |= BASE_CFG_COMMAND_CONFIG_HD_ENA; /* XXX-BZ flow control? */ From owner-svn-src-head@freebsd.org Wed Dec 28 14:25:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4003C94295; Wed, 28 Dec 2016 14:25:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 549191935; Wed, 28 Dec 2016 14:25:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSEP467037215; Wed, 28 Dec 2016 14:25:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSEP4qO037214; Wed, 28 Dec 2016 14:25:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612281425.uBSEP4qO037214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 28 Dec 2016 14:25:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310702 - head/sys/boot/i386/btx/btxldr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 14:25:05 -0000 Author: emaste Date: Wed Dec 28 14:25:04 2016 New Revision: 310702 URL: https://svnweb.freebsd.org/changeset/base/310702 Log: btxldr: process all PT_LOAD segments, not just the first two With default settings GNU ld generates two PT_LOADs for loader.sym while LLD generates three, because it creates a rodata segment. Previously btxldr terminated phdr processing after two PT_LOADs. Remove the early termination to process all PT_LOADs. Reviewed by: kib, tsoome MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8929 Modified: head/sys/boot/i386/btx/btxldr/btxldr.S Modified: head/sys/boot/i386/btx/btxldr/btxldr.S ============================================================================== --- head/sys/boot/i386/btx/btxldr/btxldr.S Wed Dec 28 14:10:33 2016 (r310701) +++ head/sys/boot/i386/btx/btxldr/btxldr.S Wed Dec 28 14:25:04 2016 (r310702) @@ -198,7 +198,6 @@ start.3: call putstr # message movl $m_segs,%esi # Format string #endif - movl $0x2,%edi # Segment count movl 0x1c(%ebx),%edx # Get e_phoff addl %ebx,%edx # To pointer movzwl 0x2c(%ebx),%ecx # Get e_phnum @@ -216,8 +215,7 @@ start.4: cmpl $0x1,(%edx) # Is p_type P call putstr # End message #endif pushl %esi # Save - pushl %edi # working - pushl %ecx # registers + pushl %ecx # working registers movl 0x4(%edx),%esi # Get p_offset addl %ebx,%esi # as pointer movl 0x8(%edx),%edi # Get p_vaddr @@ -232,13 +230,9 @@ start.4: cmpl $0x1,(%edx) # Is p_type P rep # zero stosb # them start.5: popl %ecx # Restore - popl %edi # working popl %esi # registers - decl %edi # Segments to do - je start.7 # If none start.6: addl $0x20,%edx # To next entry loop start.4 # Till done -start.7: #ifdef BTXLDR_VERBOSE movl $m_done,%esi # Display done call putstr # message From owner-svn-src-head@freebsd.org Wed Dec 28 14:50:40 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65791C94B39; Wed, 28 Dec 2016 14:50:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3551017DD; Wed, 28 Dec 2016 14:50:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSEod0c046492; Wed, 28 Dec 2016 14:50:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSEodYv046491; Wed, 28 Dec 2016 14:50:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612281450.uBSEodYv046491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 28 Dec 2016 14:50:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310703 - head/sys/dev/isci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 14:50:40 -0000 Author: mav Date: Wed Dec 28 14:50:39 2016 New Revision: 310703 URL: https://svnweb.freebsd.org/changeset/base/310703 Log: Pass proper arguments (handles, not directly structure pointers) to scif_cb_domain_device_removed(). This should fix NULL dereference on task management function timeout. Reviewed by: jimharris MFC after: 2 weeks Modified: head/sys/dev/isci/isci_task_request.c Modified: head/sys/dev/isci/isci_task_request.c ============================================================================== --- head/sys/dev/isci/isci_task_request.c Wed Dec 28 14:25:04 2016 (r310702) +++ head/sys/dev/isci/isci_task_request.c Wed Dec 28 14:50:39 2016 (r310703) @@ -210,8 +210,9 @@ isci_task_request_complete(SCI_CONTROLLE retry_task = FALSE; isci_log_message(0, "ISCI", "task timeout - not retrying\n"); - scif_cb_domain_device_removed(isci_controller, - isci_remote_device->domain, isci_remote_device); + scif_cb_domain_device_removed(scif_controller, + isci_remote_device->domain->sci_object, + remote_device); } else { retry_task = TRUE; isci_log_message(0, "ISCI", From owner-svn-src-head@freebsd.org Wed Dec 28 15:24:45 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA7D4C947A5; Wed, 28 Dec 2016 15:24:45 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9F2212C2; Wed, 28 Dec 2016 15:24:45 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSFOi05061868; Wed, 28 Dec 2016 15:24:44 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSFOi3K061867; Wed, 28 Dec 2016 15:24:44 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281524.uBSFOi3K061867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 15:24:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310704 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 15:24:46 -0000 Author: arybchik Date: Wed Dec 28 15:24:44 2016 New Revision: 310704 URL: https://svnweb.freebsd.org/changeset/base/310704 Log: sfxge(4): translate MC_CMD_ERR_ERANGE to host errno value This is needed because MCDI command MC_CMD_REKEY can return MC_CMD_ERR_ERANGE. Submitted by: Tom Millington Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx_mcdi.c Modified: head/sys/dev/sfxge/common/efx_mcdi.c ============================================================================== --- head/sys/dev/sfxge/common/efx_mcdi.c Wed Dec 28 14:50:39 2016 (r310703) +++ head/sys/dev/sfxge/common/efx_mcdi.c Wed Dec 28 15:24:44 2016 (r310704) @@ -646,6 +646,8 @@ efx_mcdi_request_errcode( case MC_CMD_ERR_ENOSPC: return (ENOSPC); #endif + case MC_CMD_ERR_ERANGE: + return (ERANGE); case MC_CMD_ERR_ALLOC_FAIL: return (ENOMEM); From owner-svn-src-head@freebsd.org Wed Dec 28 15:43:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94182C94CD1; Wed, 28 Dec 2016 15:43:19 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30C401F4F; Wed, 28 Dec 2016 15:43:19 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSFhIa7069996; Wed, 28 Dec 2016 15:43:18 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSFhHS0069984; Wed, 28 Dec 2016 15:43:17 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201612281543.uBSFhHS0069984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 28 Dec 2016 15:43:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310705 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 15:43:19 -0000 Author: pfg Date: Wed Dec 28 15:43:17 2016 New Revision: 310705 URL: https://svnweb.freebsd.org/changeset/base/310705 Log: style(9) cleanups. Just to reduce some of the issues found with indent(1). MFC after: 1 week Modified: head/sys/fs/ext2fs/ext2_alloc.c head/sys/fs/ext2fs/ext2_balloc.c head/sys/fs/ext2fs/ext2_bmap.c head/sys/fs/ext2fs/ext2_dir.h head/sys/fs/ext2fs/ext2_extents.c head/sys/fs/ext2fs/ext2_extents.h head/sys/fs/ext2fs/ext2_extern.h head/sys/fs/ext2fs/ext2_hash.c head/sys/fs/ext2fs/ext2_htree.c head/sys/fs/ext2fs/ext2_inode.c head/sys/fs/ext2fs/ext2_inode_cnv.c head/sys/fs/ext2fs/ext2_lookup.c head/sys/fs/ext2fs/ext2_mount.h head/sys/fs/ext2fs/ext2_subr.c head/sys/fs/ext2fs/ext2_vfsops.c head/sys/fs/ext2fs/ext2_vnops.c head/sys/fs/ext2fs/ext2fs.h head/sys/fs/ext2fs/fs.h head/sys/fs/ext2fs/htree.h head/sys/fs/ext2fs/inode.h Modified: head/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_alloc.c Wed Dec 28 15:24:44 2016 (r310704) +++ head/sys/fs/ext2fs/ext2_alloc.c Wed Dec 28 15:43:17 2016 (r310705) @@ -81,12 +81,13 @@ static daddr_t ext2_mapsearch(struct m_ */ int ext2_alloc(struct inode *ip, daddr_t lbn, e4fs_daddr_t bpref, int size, - struct ucred *cred, e4fs_daddr_t *bnp) + struct ucred *cred, e4fs_daddr_t *bnp) { struct m_ext2fs *fs; struct ext2mount *ump; int32_t bno; - int cg; + int cg; + *bnp = 0; fs = ip->i_e2fs; ump = ip->i_ump; @@ -99,11 +100,11 @@ ext2_alloc(struct inode *ip, daddr_t lbn } if (cred == NOCRED) panic("ext2_alloc: missing credential"); -#endif /* INVARIANTS */ +#endif /* INVARIANTS */ if (size == fs->e2fs_bsize && fs->e2fs->e2fs_fbcount == 0) goto nospace; - if (cred->cr_uid != 0 && - fs->e2fs->e2fs_fbcount < fs->e2fs->e2fs_rbcount) + if (cred->cr_uid != 0 && + fs->e2fs->e2fs_fbcount < fs->e2fs->e2fs_rbcount) goto nospace; if (bpref >= fs->e2fs->e2fs_bcount) bpref = 0; @@ -112,7 +113,7 @@ ext2_alloc(struct inode *ip, daddr_t lbn else cg = dtog(fs, bpref); bno = (daddr_t)ext2_hashalloc(ip, cg, bpref, fs->e2fs_bsize, - ext2_alloccg); + ext2_alloccg); if (bno > 0) { /* set next_alloc fields as done in block_getblk */ ip->i_next_alloc_block = lbn; @@ -148,10 +149,12 @@ nospace: static SYSCTL_NODE(_vfs, OID_AUTO, ext2fs, CTLFLAG_RW, 0, "EXT2FS filesystem"); static int doasyncfree = 1; + SYSCTL_INT(_vfs_ext2fs, OID_AUTO, doasyncfree, CTLFLAG_RW, &doasyncfree, 0, "Use asychronous writes to update block pointers when freeing blocks"); static int doreallocblks = 1; + SYSCTL_INT(_vfs_ext2fs, OID_AUTO, doreallocblks, CTLFLAG_RW, &doreallocblks, 0, ""); int @@ -171,7 +174,7 @@ ext2_reallocblks(struct vop_reallocblks_ int i, len, start_lvl, end_lvl, pref, ssize; if (doreallocblks == 0) - return (ENOSPC); + return (ENOSPC); vp = ap->a_vp; ip = VTOI(vp); @@ -236,7 +239,7 @@ ext2_reallocblks(struct vop_reallocblks_ ssize = len; } else { #ifdef INVARIANTS - if (start_ap[start_lvl-1].in_lbn == idp->in_lbn) + if (start_ap[start_lvl - 1].in_lbn == idp->in_lbn) panic("ext2_reallocblks: start == end"); #endif ssize = len - (idp->in_off + 1); @@ -253,10 +256,10 @@ ext2_reallocblks(struct vop_reallocblks_ * Search the block map looking for an allocation of the desired size. */ if ((newblk = (e2fs_daddr_t)ext2_hashalloc(ip, dtog(fs, pref), pref, - len, ext2_clusteralloc)) == 0){ + len, ext2_clusteralloc)) == 0) { EXT2_UNLOCK(ump); goto fail; - } + } /* * We have found a new contiguous block. * @@ -267,7 +270,7 @@ ext2_reallocblks(struct vop_reallocblks_ #ifdef DEBUG printf("realloc: ino %ju, lbns %jd-%jd\n\told:", (uintmax_t)ip->i_number, (intmax_t)start_lbn, (intmax_t)end_lbn); -#endif /* DEBUG */ +#endif /* DEBUG */ blkno = newblk; for (bap = &sbap[soff], i = 0; i < len; i++, blkno += fs->e2fs_fpb) { if (i == ssize) { @@ -279,15 +282,15 @@ ext2_reallocblks(struct vop_reallocblks_ panic("ext2_reallocblks: alloc mismatch"); #endif #ifdef DEBUG - printf(" %d,", *bap); -#endif /* DEBUG */ + printf(" %d,", *bap); +#endif /* DEBUG */ *bap++ = blkno; } /* * Next we must write out the modified inode and indirect blocks. * For strict correctness, the writes should be synchronous since * the old block values may have been written to disk. In practise - * they are almost never written, but if we are concerned about + * they are almost never written, but if we are concerned about * strict correctness, the `doasyncfree' flag should be set to zero. * * The test on `doasyncfree' should be changed to test a flag @@ -318,18 +321,18 @@ ext2_reallocblks(struct vop_reallocblks_ */ #ifdef DEBUG printf("\n\tnew:"); -#endif /* DEBUG */ +#endif /* DEBUG */ for (blkno = newblk, i = 0; i < len; i++, blkno += fs->e2fs_fpb) { ext2_blkfree(ip, dbtofsb(fs, buflist->bs_children[i]->b_blkno), fs->e2fs_bsize); buflist->bs_children[i]->b_blkno = fsbtodb(fs, blkno); #ifdef DEBUG printf(" %d,", blkno); -#endif /* DEBUG */ +#endif /* DEBUG */ } #ifdef DEBUG printf("\n"); -#endif /* DEBUG */ +#endif /* DEBUG */ return (0); fail: @@ -342,7 +345,7 @@ fail: /* * Allocate an inode in the filesystem. - * + * */ int ext2_valloc(struct vnode *pvp, int mode, struct ucred *cred, struct vnode **vpp) @@ -354,7 +357,7 @@ ext2_valloc(struct vnode *pvp, int mode, struct ext2mount *ump; ino_t ino, ipref; int i, error, cg; - + *vpp = NULL; pip = VTOI(pvp); fs = pip->i_e2fs; @@ -380,7 +383,7 @@ ext2_valloc(struct vnode *pvp, int mode, ipref = cg * fs->e2fs->e2fs_ipg + 1; ino = (ino_t)ext2_hashalloc(pip, cg, (long)ipref, mode, ext2_nodealloccg); - if (ino == 0) + if (ino == 0) goto noinodes; error = VFS_VGET(pvp->v_mount, ino, LK_EXCLUSIVE, vpp); if (error) { @@ -411,7 +414,7 @@ ext2_valloc(struct vnode *pvp, int mode, */ do { ip->i_gen = arc4random(); - } while ( ip->i_gen == 0); + } while (ip->i_gen == 0); vfs_timestamp(&ts); ip->i_birthtime = ts.tv_sec; @@ -457,7 +460,7 @@ ext2_dirpref(struct inode *pip) avgifree = fs->e2fs->e2fs_ficount / fs->e2fs_gcount; avgbfree = fs->e2fs->e2fs_fbcount / fs->e2fs_gcount; - avgndir = fs->e2fs_total_dir / fs->e2fs_gcount; + avgndir = fs->e2fs_total_dir / fs->e2fs_gcount; /* * Force allocation in another cg if creating a first level dir. @@ -481,10 +484,8 @@ ext2_dirpref(struct inode *pip) mincg = cg; minndir = fs->e2fs_gd[cg].ext2bgd_ndirs; } - return (mincg); } - /* * Count various limits which used for * optimal allocation of a directory inode. @@ -507,7 +508,7 @@ ext2_dirpref(struct inode *pip) maxcontigdirs = 1; /* - * Limit number of dirs in one cg and reserve space for + * Limit number of dirs in one cg and reserve space for * regular files, but only if we have no deficit in * inodes or space. */ @@ -539,7 +540,7 @@ ext2_dirpref(struct inode *pip) } /* - * Select the desired position for the next block in a file. + * Select the desired position for the next block in a file. * * we try to mimic what Remy does in inode_getblk/block_getblk * @@ -555,30 +556,34 @@ e4fs_daddr_t ext2_blkpref(struct inode *ip, e2fs_lbn_t lbn, int indx, e2fs_daddr_t *bap, e2fs_daddr_t blocknr) { - int tmp; + int tmp; + mtx_assert(EXT2_MTX(ip->i_ump), MA_OWNED); - /* if the next block is actually what we thought it is, - then set the goal to what we thought it should be - */ + /* + * If the next block is actually what we thought it is, then set the + * goal to what we thought it should be. + */ if (ip->i_next_alloc_block == lbn && ip->i_next_alloc_goal != 0) return ip->i_next_alloc_goal; - /* now check whether we were provided with an array that basically - tells us previous blocks to which we want to stay closeby - */ + /* + * Now check whether we were provided with an array that basically + * tells us previous blocks to which we want to stay close. + */ if (bap) - for (tmp = indx - 1; tmp >= 0; tmp--) - if (bap[tmp]) + for (tmp = indx - 1; tmp >= 0; tmp--) + if (bap[tmp]) return bap[tmp]; - /* else let's fall back to the blocknr, or, if there is none, - follow the rule that a block should be allocated near its inode - */ + /* + * Else lets fall back to the blocknr or, if there is none, follow + * the rule that a block should be allocated near its inode. + */ return blocknr ? blocknr : - (e2fs_daddr_t)(ip->i_block_group * - EXT2_BLOCKS_PER_GROUP(ip->i_e2fs)) + - ip->i_e2fs->e2fs->e2fs_first_dblock; + (e2fs_daddr_t)(ip->i_block_group * + EXT2_BLOCKS_PER_GROUP(ip->i_e2fs)) + + ip->i_e2fs->e2fs->e2fs_first_dblock; } /* @@ -591,7 +596,7 @@ ext2_blkpref(struct inode *ip, e2fs_lbn_ */ static u_long ext2_hashalloc(struct inode *ip, int cg, long pref, int size, - daddr_t (*allocator)(struct inode *, int, daddr_t, int)) + daddr_t (*allocator) (struct inode *, int, daddr_t, int)) { struct m_ext2fs *fs; ino_t result; @@ -655,8 +660,8 @@ ext2_alloccg(struct inode *ip, int cg, d return (0); EXT2_UNLOCK(ump); error = bread(ip->i_devvp, fsbtodb(fs, - fs->e2fs_gd[cg].ext2bgd_b_bitmap), - (int)fs->e2fs_bsize, NOCRED, &bp); + fs->e2fs_gd[cg].ext2bgd_b_bitmap), + (int)fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); EXT2_LOCK(ump); @@ -742,9 +747,8 @@ retry: start = 0; goto retry; } - bno = ext2_mapsearch(fs, bbp, bpref); - if (bno < 0){ + if (bno < 0) { brelse(bp); EXT2_LOCK(ump); return (0); @@ -753,7 +757,7 @@ gotit: #ifdef INVARIANTS if (isset(bbp, bno)) { printf("ext2fs_alloccgblk: cg=%d bno=%jd fs=%s\n", - cg, (intmax_t)bno, fs->e2fs_fsmnt); + cg, (intmax_t)bno, fs->e2fs_fsmnt); panic("ext2fs_alloccg: dup alloc"); } #endif @@ -813,9 +817,9 @@ ext2_clusteralloc(struct inode *ip, int * to find no cluster. */ lp = &fs->e2fs_clustersum[cg].cs_sum[len - 1]; - for (i = len - 1; i > 0; i--) - if (*lp-- > 0) - break; + for (i = len - 1; i > 0; i--) + if (*lp-- > 0) + break; fs->e2fs_maxcluster[cg] = i; goto fail; } @@ -890,17 +894,18 @@ ext2_nodealloccg(struct inode *ip, int c struct ext2mount *ump; int error, start, len; char *ibp, *loc; - ipref--; /* to avoid a lot of (ipref -1) */ + + ipref--; /* to avoid a lot of (ipref -1) */ if (ipref == -1) ipref = 0; fs = ip->i_e2fs; ump = ip->i_ump; if (fs->e2fs_gd[cg].ext2bgd_nifree == 0) return (0); - EXT2_UNLOCK(ump); + EXT2_UNLOCK(ump); error = bread(ip->i_devvp, fsbtodb(fs, - fs->e2fs_gd[cg].ext2bgd_i_bitmap), - (int)fs->e2fs_bsize, NOCRED, &bp); + fs->e2fs_gd[cg].ext2bgd_i_bitmap), + (int)fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); EXT2_LOCK(ump); @@ -930,7 +935,7 @@ ext2_nodealloccg(struct inode *ip, int c loc = memcchr(&ibp[start], 0xff, len); if (loc == NULL) { printf("cg = %d, ipref = %lld, fs = %s\n", - cg, (long long)ipref, fs->e2fs_fsmnt); + cg, (long long)ipref, fs->e2fs_fsmnt); panic("ext2fs_nodealloccg: map corrupted"); /* NOTREACHED */ } @@ -948,7 +953,7 @@ gotit: } EXT2_UNLOCK(ump); bdwrite(bp); - return (cg * fs->e2fs->e2fs_ipg + ipref +1); + return (cg * fs->e2fs->e2fs_ipg + ipref + 1); } /* @@ -974,8 +979,8 @@ ext2_blkfree(struct inode *ip, e4fs_dadd return; } error = bread(ip->i_devvp, - fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap), - (int)fs->e2fs_bsize, NOCRED, &bp); + fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap), + (int)fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); return; @@ -984,7 +989,7 @@ ext2_blkfree(struct inode *ip, e4fs_dadd bno = dtogd(fs, bno); if (isclr(bbp, bno)) { printf("block = %lld, fs = %s\n", - (long long)bno, fs->e2fs_fsmnt); + (long long)bno, fs->e2fs_fsmnt); panic("ext2_blkfree: freeing free block"); } clrbit(bbp, bno); @@ -1009,7 +1014,7 @@ ext2_vfree(struct vnode *pvp, ino_t ino, struct buf *bp; struct ext2mount *ump; int error, cg; - char * ibp; + char *ibp; pip = VTOI(pvp); fs = pip->i_e2fs; @@ -1020,8 +1025,8 @@ ext2_vfree(struct vnode *pvp, ino_t ino, cg = ino_to_cg(fs, ino); error = bread(pip->i_devvp, - fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_i_bitmap), - (int)fs->e2fs_bsize, NOCRED, &bp); + fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_i_bitmap), + (int)fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); return (0); @@ -1030,7 +1035,7 @@ ext2_vfree(struct vnode *pvp, ino_t ino, ino = (ino - 1) % fs->e2fs->e2fs_ipg; if (isclr(ibp, ino)) { printf("ino = %llu, fs = %s\n", - (unsigned long long)ino, fs->e2fs_fsmnt); + (unsigned long long)ino, fs->e2fs_fsmnt); if (fs->e2fs_ronly == 0) panic("ext2_vfree: freeing free inode"); } @@ -1076,7 +1081,7 @@ ext2_mapsearch(struct m_ext2fs *fs, char loc = memcchr(&bbp[start], 0xff, len); if (loc == NULL) { printf("start = %d, len = %d, fs = %s\n", - start, len, fs->e2fs_fsmnt); + start, len, fs->e2fs_fsmnt); panic("ext2_mapsearch: map corrupted"); /* NOTREACHED */ } @@ -1086,7 +1091,7 @@ ext2_mapsearch(struct m_ext2fs *fs, char /* * Fserr prints the name of a filesystem with an error diagnostic. - * + * * The form of the error message is: * fs: error message */ Modified: head/sys/fs/ext2fs/ext2_balloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_balloc.c Wed Dec 28 15:24:44 2016 (r310704) +++ head/sys/fs/ext2fs/ext2_balloc.c Wed Dec 28 15:43:17 2016 (r310705) @@ -76,22 +76,23 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t ump = ip->i_ump; /* - * check if this is a sequential block allocation. - * If so, increment next_alloc fields to allow ext2_blkpref + * check if this is a sequential block allocation. + * If so, increment next_alloc fields to allow ext2_blkpref * to make a good guess */ if (lbn == ip->i_next_alloc_block + 1) { ip->i_next_alloc_block++; ip->i_next_alloc_goal++; } - /* * The first NDADDR blocks are direct blocks */ if (lbn < NDADDR) { nb = ip->i_db[lbn]; - /* no new block is to be allocated, and no need to expand - the file */ + /* + * no new block is to be allocated, and no need to expand + * the file + */ if (nb != 0 && ip->i_size >= (lbn + 1) * fs->e2fs_bsize) { error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, &bp); if (error) { @@ -116,10 +117,13 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t } bp->b_blkno = fsbtodb(fs, nb); } else { - /* Godmar thinks: this shouldn't happen w/o fragments */ - printf("nsize %d(%d) > osize %d(%d) nb %d\n", - (int)nsize, (int)size, (int)osize, - (int)ip->i_size, (int)nb); + /* + * Godmar thinks: this shouldn't happen w/o + * fragments + */ + printf("nsize %d(%d) > osize %d(%d) nb %d\n", + (int)nsize, (int)size, (int)osize, + (int)ip->i_size, (int)nb); panic( "ext2_balloc: Something is terribly wrong"); /* @@ -156,7 +160,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t return (error); #ifdef INVARIANTS if (num < 1) - panic ("ext2_balloc: ext2_getlbns returned indirect block"); + panic("ext2_balloc: ext2_getlbns returned indirect block"); #endif /* * Fetch the first indirect block allocating if necessary. @@ -165,10 +169,10 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t nb = ip->i_ib[indirs[0].in_off]; if (nb == 0) { EXT2_LOCK(ump); - pref = ext2_blkpref(ip, lbn, indirs[0].in_off + - EXT2_NDIR_BLOCKS, &ip->i_db[0], 0); + pref = ext2_blkpref(ip, lbn, indirs[0].in_off + + EXT2_NDIR_BLOCKS, &ip->i_db[0], 0); if ((error = ext2_alloc(ip, lbn, pref, fs->e2fs_bsize, cred, - &newb))) + &newb))) return (error); nb = newb; bp = getblk(vp, indirs[1].in_lbn, fs->e2fs_bsize, 0, 0, 0); @@ -207,8 +211,8 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t EXT2_LOCK(ump); if (pref == 0) pref = ext2_blkpref(ip, lbn, indirs[i].in_off, bap, - bp->b_lblkno); - error = ext2_alloc(ip, lbn, pref, (int)fs->e2fs_bsize, cred, &newb); + bp->b_lblkno); + error = ext2_alloc(ip, lbn, pref, (int)fs->e2fs_bsize, cred, &newb); if (error) { brelse(bp); return (error); @@ -245,8 +249,8 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t */ if (nb == 0) { EXT2_LOCK(ump); - pref = ext2_blkpref(ip, lbn, indirs[i].in_off, &bap[0], - bp->b_lblkno); + pref = ext2_blkpref(ip, lbn, indirs[i].in_off, &bap[0], + bp->b_lblkno); if ((error = ext2_alloc(ip, lbn, pref, (int)fs->e2fs_bsize, cred, &newb)) != 0) { brelse(bp); @@ -265,7 +269,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t if (flags & IO_SYNC) { bwrite(bp); } else { - if (bp->b_bufsize == fs->e2fs_bsize) + if (bp->b_bufsize == fs->e2fs_bsize) bp->b_flags |= B_CLUSTEROK; bdwrite(bp); } @@ -275,6 +279,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t brelse(bp); if (flags & BA_CLRBUF) { int seqcount = (flags & BA_SEQMASK) >> BA_SEQSHIFT; + if (seqcount && (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) { error = cluster_read(vp, ip->i_size, lbn, (int)fs->e2fs_bsize, NOCRED, @@ -293,4 +298,3 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t *bpp = nbp; return (0); } - Modified: head/sys/fs/ext2fs/ext2_bmap.c ============================================================================== --- head/sys/fs/ext2fs/ext2_bmap.c Wed Dec 28 15:24:44 2016 (r310704) +++ head/sys/fs/ext2fs/ext2_bmap.c Wed Dec 28 15:43:17 2016 (r310705) @@ -95,7 +95,7 @@ ext4_bmapext(struct vnode *vp, int32_t b struct inode *ip; struct m_ext2fs *fs; struct ext4_extent *ep; - struct ext4_extent_path path = { .ep_bp = NULL }; + struct ext4_extent_path path = {.ep_bp = NULL}; daddr_t lbn; int error; @@ -163,7 +163,7 @@ ext2_bmaparray(struct vnode *vp, daddr_t struct buf *bp; struct ext2mount *ump; struct mount *mp; - struct indir a[NIADDR+1], *ap; + struct indir a[NIADDR + 1], *ap; daddr_t daddr; e2fs_lbn_t metalbn; int error, num, maxrun = 0, bsize; @@ -180,10 +180,8 @@ ext2_bmaparray(struct vnode *vp, daddr_t maxrun = mp->mnt_iosize_max / bsize - 1; *runp = 0; } - - if (runb) { + if (runb) *runb = 0; - } ap = a; @@ -199,6 +197,7 @@ ext2_bmaparray(struct vnode *vp, daddr_t *bnp = -1; } else if (runp) { daddr_t bnb = bn; + for (++bn; bn < NDADDR && *runp < maxrun && is_sequential(ump, ip->i_db[bn - 1], ip->i_db[bn]); ++bn, ++*runp); @@ -213,7 +212,6 @@ ext2_bmaparray(struct vnode *vp, daddr_t return (0); } - /* Get disk address out of indirect block array */ daddr = ip->i_ib[ap->in_off]; @@ -290,7 +288,7 @@ ext2_bmaparray(struct vnode *vp, daddr_t * return a request for a zeroed out buffer if attempts are made * to read a BLK_NOCOPY or BLK_SNAP block. */ - if ((ip->i_flags & SF_SNAPSHOT) && daddr > 0 && daddr < ump->um_seqinc){ + if ((ip->i_flags & SF_SNAPSHOT) && daddr > 0 && daddr < ump->um_seqinc) { *bnp = -1; return (0); } Modified: head/sys/fs/ext2fs/ext2_dir.h ============================================================================== --- head/sys/fs/ext2fs/ext2_dir.h Wed Dec 28 15:24:44 2016 (r310704) +++ head/sys/fs/ext2fs/ext2_dir.h Wed Dec 28 15:43:17 2016 (r310705) @@ -34,7 +34,7 @@ */ #define EXT2FS_MAXNAMLEN 255 -struct ext2fs_direct { +struct ext2fs_direct { uint32_t e2d_ino; /* inode number of entry */ uint16_t e2d_reclen; /* length of this record */ uint16_t e2d_namlen; /* length of string in e2d_name */ @@ -49,10 +49,10 @@ enum slotstatus { struct ext2fs_searchslot { enum slotstatus slotstatus; - doff_t slotoffset; /* offset of area with free space */ - int slotsize; /* size of area at slotoffset */ - int slotfreespace; /* amount of space free in slot */ - int slotneeded; /* sizeof the entry we are seeking */ + doff_t slotoffset; /* offset of area with free space */ + int slotsize; /* size of area at slotoffset */ + int slotfreespace; /* amount of space free in slot */ + int slotneeded; /* sizeof the entry we are seeking */ }; /* @@ -61,12 +61,13 @@ struct ext2fs_searchslot { * bigger than 255 chars, it's safe to reclaim the extra byte for the * file_type field. */ -struct ext2fs_direct_2 { +struct ext2fs_direct_2 { uint32_t e2d_ino; /* inode number of entry */ uint16_t e2d_reclen; /* length of this record */ - uint8_t e2d_namlen; /* length of string in e2d_name */ - uint8_t e2d_type; /* file type */ - char e2d_name[EXT2FS_MAXNAMLEN];/* name with length<=EXT2FS_MAXNAMLEN */ + uint8_t e2d_namlen; /* length of string in e2d_name */ + uint8_t e2d_type; /* file type */ + char e2d_name[EXT2FS_MAXNAMLEN]; /* name with + * length<=EXT2FS_MAXNAMLEN */ }; /* @@ -97,5 +98,4 @@ struct ext2fs_direct_2 { #define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1) #define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \ ~EXT2_DIR_ROUND) -#endif /* !_FS_EXT2FS_EXT2_DIR_H_ */ - +#endif /* !_FS_EXT2FS_EXT2_DIR_H_ */ Modified: head/sys/fs/ext2fs/ext2_extents.c ============================================================================== --- head/sys/fs/ext2fs/ext2_extents.c Wed Dec 28 15:24:44 2016 (r310704) +++ head/sys/fs/ext2fs/ext2_extents.c Wed Dec 28 15:43:17 2016 (r310705) @@ -45,8 +45,7 @@ static bool ext4_ext_binsearch_index(struct inode *ip, struct ext4_extent_path *path, - daddr_t lbn, daddr_t *first_lbn, daddr_t *last_lbn) -{ + daddr_t lbn, daddr_t *first_lbn, daddr_t *last_lbn){ struct ext4_extent_header *ehp = path->ep_header; struct ext4_extent_index *first, *last, *l, *r, *m; @@ -79,7 +78,7 @@ ext4_ext_binsearch_index(struct inode *i static void ext4_ext_binsearch(struct inode *ip, struct ext4_extent_path *path, daddr_t lbn, - daddr_t first_lbn, daddr_t last_lbn) + daddr_t first_lbn, daddr_t last_lbn) { struct ext4_extent_header *ehp = path->ep_header; struct ext4_extent *first, *l, *r, *m; @@ -167,7 +166,7 @@ ext4_ext_put_cache(struct inode *ip, str */ struct ext4_extent_path * ext4_ext_find_extent(struct m_ext2fs *fs, struct inode *ip, - daddr_t lbn, struct ext4_extent_path *path) + daddr_t lbn, struct ext4_extent_path *path) { struct ext4_extent_header *ehp; uint16_t i; @@ -200,7 +199,7 @@ ext4_ext_find_extent(struct m_ext2fs *fs path->ep_bp = NULL; } error = bread(ip->i_devvp, fsbtodb(fs, nblk), size, NOCRED, - &path->ep_bp); + &path->ep_bp); if (error) { brelse(path->ep_bp); path->ep_bp = NULL; Modified: head/sys/fs/ext2fs/ext2_extents.h ============================================================================== --- head/sys/fs/ext2fs/ext2_extents.h Wed Dec 28 15:24:44 2016 (r310704) +++ head/sys/fs/ext2fs/ext2_extents.h Wed Dec 28 15:43:17 2016 (r310705) @@ -40,10 +40,10 @@ * Ext4 file system extent on disk. */ struct ext4_extent { - uint32_t e_blk; /* first logical block */ - uint16_t e_len; /* number of blocks */ - uint16_t e_start_hi; /* high 16 bits of physical block */ - uint32_t e_start_lo; /* low 32 bits of physical block */ + uint32_t e_blk; /* first logical block */ + uint16_t e_len; /* number of blocks */ + uint16_t e_start_hi; /* high 16 bits of physical block */ + uint32_t e_start_lo; /* low 32 bits of physical block */ }; /* @@ -61,19 +61,19 @@ struct ext4_extent_index { * Extent tree header. */ struct ext4_extent_header { - uint16_t eh_magic; /* magic number: 0xf30a */ - uint16_t eh_ecount; /* number of valid entries */ - uint16_t eh_max; /* capacity of store in entries */ - uint16_t eh_depth; /* the depth of extent tree */ - uint32_t eh_gen; /* generation of extent tree */ + uint16_t eh_magic; /* magic number: 0xf30a */ + uint16_t eh_ecount; /* number of valid entries */ + uint16_t eh_max; /* capacity of store in entries */ + uint16_t eh_depth; /* the depth of extent tree */ + uint32_t eh_gen; /* generation of extent tree */ }; /* * Save cached extent. */ struct ext4_extent_cache { - daddr_t ec_start; /* extent start */ - uint32_t ec_blk; /* logical block */ + daddr_t ec_start; /* extent start */ + uint32_t ec_blk; /* logical block */ uint32_t ec_len; uint32_t ec_type; }; @@ -84,7 +84,7 @@ struct ext4_extent_cache { struct ext4_extent_path { uint16_t ep_depth; struct buf *ep_bp; - bool ep_is_sparse; + bool ep_is_sparse; union { struct ext4_extent ep_sparse_ext; struct ext4_extent *ep_ext; @@ -97,7 +97,8 @@ struct inode; struct m_ext2fs; int ext4_ext_in_cache(struct inode *, daddr_t, struct ext4_extent *); void ext4_ext_put_cache(struct inode *, struct ext4_extent *, int); -struct ext4_extent_path *ext4_ext_find_extent(struct m_ext2fs *fs, +struct ext4_extent_path * +ext4_ext_find_extent(struct m_ext2fs *fs, struct inode *, daddr_t, struct ext4_extent_path *); -#endif /* !_FS_EXT2FS_EXT2_EXTENTS_H_ */ +#endif /* !_FS_EXT2FS_EXT2_EXTENTS_H_ */ Modified: head/sys/fs/ext2fs/ext2_extern.h ============================================================================== --- head/sys/fs/ext2fs/ext2_extern.h Wed Dec 28 15:24:44 2016 (r310704) +++ head/sys/fs/ext2fs/ext2_extern.h Wed Dec 28 15:43:17 2016 (r310705) @@ -110,4 +110,4 @@ int ext2_search_dirblock(struct inode *, extern struct vop_vector ext2_vnodeops; extern struct vop_vector ext2_fifoops; -#endif /* !_FS_EXT2FS_EXT2_EXTERN_H_ */ +#endif /* !_FS_EXT2FS_EXT2_EXTERN_H_ */ Modified: head/sys/fs/ext2fs/ext2_hash.c ============================================================================== --- head/sys/fs/ext2fs/ext2_hash.c Wed Dec 28 15:24:44 2016 (r310704) +++ head/sys/fs/ext2fs/ext2_hash.c Wed Dec 28 15:43:17 2016 (r310705) @@ -192,7 +192,7 @@ ext2_legacy_hash(const char *name, int l static void ext2_prep_hashbuf(const char *src, int slen, uint32_t *dst, int dlen, - int unsigned_char) + int unsigned_char) { uint32_t padding = slen | (slen << 8) | (slen << 16) | (slen << 24); uint32_t buf_val; @@ -240,8 +240,8 @@ ext2_prep_hashbuf(const char *src, int s int ext2_htree_hash(const char *name, int len, - uint32_t *hash_seed, int hash_version, - uint32_t *hash_major, uint32_t *hash_minor) + uint32_t *hash_seed, int hash_version, + uint32_t *hash_major, uint32_t *hash_minor) { uint32_t hash[4]; uint32_t data[8]; Modified: head/sys/fs/ext2fs/ext2_htree.c ============================================================================== --- head/sys/fs/ext2fs/ext2_htree.c Wed Dec 28 15:24:44 2016 (r310704) +++ head/sys/fs/ext2fs/ext2_htree.c Wed Dec 28 15:43:17 2016 (r310705) @@ -98,7 +98,7 @@ ext2_htree_has_idx(struct inode *ip) static int ext2_htree_check_next(struct inode *ip, uint32_t hash, const char *name, - struct ext2fs_htree_lookup_info *info) + struct ext2fs_htree_lookup_info *info) { struct vnode *vp = ITOV(ip); struct ext2fs_htree_lookup_level *level; @@ -195,6 +195,7 @@ ext2_htree_release(struct ext2fs_htree_l for (i = 0; i < info->h_levels_num; i++) { struct buf *bp = info->h_levels[i].h_bp; + if (bp != NULL) brelse(bp); } @@ -224,8 +225,8 @@ ext2_htree_node_limit(struct inode *ip) static int ext2_htree_find_leaf(struct inode *ip, const char *name, int namelen, - uint32_t *hash, uint8_t *hash_ver, - struct ext2fs_htree_lookup_info *info) + uint32_t *hash, uint8_t *hash_ver, + struct ext2fs_htree_lookup_info *info) { struct vnode *vp; struct ext2fs *fs; @@ -317,9 +318,9 @@ error: */ int ext2_htree_lookup(struct inode *ip, const char *name, int namelen, - struct buf **bpp, int *entryoffp, doff_t *offp, - doff_t *prevoffp, doff_t *endusefulp, - struct ext2fs_searchslot *ss) + struct buf **bpp, int *entryoffp, doff_t *offp, + doff_t *prevoffp, doff_t *endusefulp, + struct ext2fs_searchslot *ss) { struct vnode *vp; struct ext2fs_htree_lookup_info info; @@ -386,7 +387,7 @@ ext2_htree_lookup(struct inode *ip, cons static int ext2_htree_append_block(struct vnode *vp, char *data, - struct componentname *cnp, uint32_t blksize) + struct componentname *cnp, uint32_t blksize) { struct iovec aiov; struct uio auio; @@ -419,6 +420,7 @@ ext2_htree_writebuf(struct ext2fs_htree_ for (i = 0; i < info->h_levels_num; i++) { struct buf *bp = info->h_levels[i].h_bp; + error = bwrite(bp); if (error) return (error); @@ -429,7 +431,7 @@ ext2_htree_writebuf(struct ext2fs_htree_ static void ext2_htree_insert_entry_to_level(struct ext2fs_htree_lookup_level *level, - uint32_t hash, uint32_t blk) + uint32_t hash, uint32_t blk) { struct ext2fs_htree_entry *target; int entries_num; @@ -449,7 +451,7 @@ ext2_htree_insert_entry_to_level(struct */ static void ext2_htree_insert_entry(struct ext2fs_htree_lookup_info *info, - uint32_t hash, uint32_t blk) + uint32_t hash, uint32_t blk) { struct ext2fs_htree_lookup_level *level; @@ -481,8 +483,8 @@ ext2_htree_cmp_sort_entry(const void *e1 */ static void ext2_append_entry(char *block, uint32_t blksize, - struct ext2fs_direct_2 *last_entry, - struct ext2fs_direct_2 *new_entry) + struct ext2fs_direct_2 *last_entry, + struct ext2fs_direct_2 *new_entry) { uint16_t entry_len; @@ -498,8 +500,8 @@ ext2_append_entry(char *block, uint32_t */ static int ext2_htree_split_dirblock(char *block1, char *block2, uint32_t blksize, - uint32_t *hash_seed, uint8_t hash_version, - uint32_t *split_hash, struct ext2fs_direct_2 *entry) + uint32_t *hash_seed, uint8_t hash_version, + uint32_t *split_hash, struct ext2fs_direct_2 *entry) { int entry_cnt = 0; int size = 0; @@ -585,7 +587,7 @@ ext2_htree_split_dirblock(char *block1, offset += ep->e2d_reclen; if (ep->e2d_ino) { last = (struct ext2fs_direct_2 *) - ((char *)last + entry_len); + ((char *)last + entry_len); entry_len = EXT2_DIR_REC_LEN(ep->e2d_namlen); memcpy((void *)last, (void *)ep, entry_len); last->e2d_reclen = entry_len; @@ -616,7 +618,7 @@ ext2_htree_split_dirblock(char *block1, */ int ext2_htree_create_index(struct vnode *vp, struct componentname *cnp, - struct ext2fs_direct_2 *new_entry) + struct ext2fs_direct_2 *new_entry) { struct buf *bp = NULL; struct inode *dp; @@ -721,7 +723,7 @@ out1: */ int ext2_htree_add_entry(struct vnode *dvp, struct ext2fs_direct_2 *entry, - struct componentname *cnp) + struct componentname *cnp) { struct ext2fs_htree_entry *entries, *leaf_node; struct ext2fs_htree_lookup_info info; @@ -747,7 +749,7 @@ ext2_htree_add_entry(struct vnode *dvp, fs = m_fs->e2fs; blksize = m_fs->e2fs_bsize; - if (ip->i_count != 0) + if (ip->i_count != 0) return ext2_add_entry(dvp, entry); /* Target directory block is full, split it */ @@ -807,6 +809,7 @@ ext2_htree_add_entry(struct vnode *dvp, if (info.h_levels[1].h_entry >= entries + src_ent_num) { struct buf *tmp = info.h_levels[1].h_bp; + info.h_levels[1].h_bp = dst_bp; dst_bp = tmp; Modified: head/sys/fs/ext2fs/ext2_inode.c ============================================================================== --- head/sys/fs/ext2fs/ext2_inode.c Wed Dec 28 15:24:44 2016 (r310704) +++ head/sys/fs/ext2fs/ext2_inode.c Wed Dec 28 15:43:17 2016 (r310705) @@ -81,11 +81,11 @@ ext2_update(struct vnode *vp, int waitfo return (0); ip->i_flag &= ~(IN_LAZYACCESS | IN_LAZYMOD | IN_MODIFIED); fs = ip->i_e2fs; - if(fs->e2fs_ronly) + if (fs->e2fs_ronly) return (0); if ((error = bread(ip->i_devvp, fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), - (int)fs->e2fs_bsize, NOCRED, &bp)) != 0) { + (int)fs->e2fs_bsize, NOCRED, &bp)) != 0) { brelse(bp); return (error); } @@ -130,10 +130,10 @@ ext2_truncate(struct vnode *vp, off_t le bo = &ovp->v_bufobj; #endif - ASSERT_VOP_LOCKED(vp, "ext2_truncate"); + ASSERT_VOP_LOCKED(vp, "ext2_truncate"); if (length < 0) - return (EINVAL); + return (EINVAL); if (ovp->v_type == VLNK && oip->i_size < ovp->v_mount->mnt_maxsymlinklen) { @@ -345,7 +345,7 @@ done: bo->bo_clean.bv_cnt != 0)) panic("itrunc3"); BO_UNLOCK(bo); -#endif /* INVARIANTS */ +#endif /* INVARIANTS */ /* * Put back the real size. */ @@ -418,12 +418,11 @@ ext2_indirtrunc(struct inode *ip, daddr_ *countp = 0; return (error); } - bap = (e2fs_daddr_t *)bp->b_data; copy = malloc(fs->e2fs_bsize, M_TEMP, M_WAITOK); bcopy((caddr_t)bap, (caddr_t)copy, (u_int)fs->e2fs_bsize); bzero((caddr_t)&bap[last + 1], - (NINDIR(fs) - (last + 1)) * sizeof(e2fs_daddr_t)); + (NINDIR(fs) - (last + 1)) * sizeof(e2fs_daddr_t)); if (last == -1) bp->b_flags |= B_INVAL; if (DOINGASYNC(vp)) { Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- head/sys/fs/ext2fs/ext2_inode_cnv.c Wed Dec 28 15:24:44 2016 (r310704) +++ head/sys/fs/ext2fs/ext2_inode_cnv.c Wed Dec 28 15:43:17 2016 (r310705) @@ -49,17 +49,17 @@ ext2_print_inode(struct inode *in) struct ext4_extent_header *ehp; struct ext4_extent *ep; - printf( "Inode: %5ju", (uintmax_t)in->i_number); - printf( /* "Inode: %5d" */ - " Type: %10s Mode: 0x%o Flags: 0x%x Version: %d\n", - "n/a", in->i_mode, in->i_flags, in->i_gen); + printf("Inode: %5ju", (uintmax_t)in->i_number); + printf( /* "Inode: %5d" */ + " Type: %10s Mode: 0x%o Flags: 0x%x Version: %d\n", + "n/a", in->i_mode, in->i_flags, in->i_gen); printf("User: %5u Group: %5u Size: %ju\n", in->i_uid, in->i_gid, (uintmax_t)in->i_size); printf("Links: %3d Blockcount: %ju\n", in->i_nlink, (uintmax_t)in->i_blocks); - printf( "ctime: 0x%x", in->i_ctime); - printf( "atime: 0x%x", in->i_atime); - printf( "mtime: 0x%x", in->i_mtime); + printf("ctime: 0x%x", in->i_ctime); + printf("atime: 0x%x", in->i_atime); + printf("mtime: 0x%x", in->i_mtime); if (E2DI_HAS_XTIME(in)) printf("crtime %#x ", in->i_birthtime); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Dec 28 15:57:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C7B2C942D8; Wed, 28 Dec 2016 15:57:44 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 99FEF1B60; Wed, 28 Dec 2016 15:57:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id uBSFvcr2008544 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 28 Dec 2016 17:57:38 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua uBSFvcr2008544 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id uBSFvc5j008543; Wed, 28 Dec 2016 17:57:38 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 28 Dec 2016 17:57:38 +0200 From: Konstantin Belousov To: "Pedro F. Giffuni" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310705 - head/sys/fs/ext2fs Message-ID: <20161228155738.GB1923@kib.kiev.ua> References: <201612281543.uBSFhHS0069984@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201612281543.uBSFhHS0069984@repo.freebsd.org> User-Agent: Mutt/1.7.2 (2016-11-26) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 15:57:44 -0000 On Wed, Dec 28, 2016 at 03:43:17PM +0000, Pedro F. Giffuni wrote: > Author: pfg > Date: Wed Dec 28 15:43:17 2016 > New Revision: 310705 > URL: https://svnweb.freebsd.org/changeset/base/310705 > > Log: > style(9) cleanups. > > Just to reduce some of the issues found with indent(1). > > @@ -81,12 +81,13 @@ static daddr_t ext2_mapsearch(struct m_ > */ > int > ext2_alloc(struct inode *ip, daddr_t lbn, e4fs_daddr_t bpref, int size, > - struct ucred *cred, e4fs_daddr_t *bnp) > + struct ucred *cred, e4fs_daddr_t *bnp) This is wrong. Indent of the continuation line should be 4 spaces. > { > struct m_ext2fs *fs; From owner-svn-src-head@freebsd.org Wed Dec 28 16:03:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 066F9C946DE for ; Wed, 28 Dec 2016 16:03:51 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm29-vm4.bullet.mail.ne1.yahoo.com (nm29-vm4.bullet.mail.ne1.yahoo.com [98.138.91.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6CAB1263 for ; Wed, 28 Dec 2016 16:03:50 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1482941024; bh=bnz72vtWal7RSZeEhD0s7K/gFjjpXYXmraLJP+PuhW0=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=AxFVbstzQzDqGMW2xoLGVb9OQ1v7NeLeDTroU5bkI2VISvCynEppHhmxAiHDMToyLA8hAifWJrsaVvfy406sFLh5GYa/70GIEicEfi4DFxjM9kywrxoQ7riugitg2efyXjpQn8XHNwhNgqk3JaZMGFMrSs/mZnrUIUt/X3EmSbYxwMtaHrYLNbLXft/GSAaDwcVM7Ui3JdKRdHiWSoy1fzAmQLmHfDtntheA+iVkD0fr2m/fjzViPi03D+itp8Tv72zeHK8YK/TWUsPe4UBqQ7ozU3K/NhR9fRhHLvrZKRE0zySf8kn6nAIbfq8WwHjdgAlDmysau85HUtCiqfFNgA== Received: from [98.138.100.114] by nm29.bullet.mail.ne1.yahoo.com with NNFMP; 28 Dec 2016 16:03:44 -0000 Received: from [98.138.84.44] by tm105.bullet.mail.ne1.yahoo.com with NNFMP; 28 Dec 2016 16:03:44 -0000 Received: from [127.0.0.1] by smtp112.mail.ne1.yahoo.com with NNFMP; 28 Dec 2016 16:03:29 -0000 X-Yahoo-Newman-Id: 941556.47865.bm@smtp112.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 6CRUzT8VM1luNzE7PhAAhkNVtC4bTGJuciHOvhBhDzTqM2Q 8wAzFbbcgNI4dKzr1kRXVWO2PthjzTpc8JJIic8.Ai4JvILU98CIcvdfQ43w f0K0Ou9xkIEPcr2nMx4h3VspQiOHjWVcPoNJNHK89sSMg2L_4Mr6br7xQWqC 9ix5J5pzxkzOrDcJMhYhoFIzZntcoWKHk4XcT0FkTkyszvIIDI9TJMgoCAnp GeZ3bTkiC3tOC1Xl33Ls_nRAFqBqkJNSMJGxqDJiQq4XcxDEJDq64e0kohM_ 4e7tHOfvjuwwaLVCvgAW3Lpb_fS2ZtX5IblDNohFd7Zwno12_RZ3xvFSJslz UaUR52_4vHzJZ.VEJ1PgZNtaq5fHE4lxqDiXRoI.KfzxUOMjLQ8G5LQth2ok 2DFVcPb4ditOp.FrDbswAsFhObggjpNmTjIXQkuOg47SAKdjjXfpyQBNIIG8 bEz1czqaIKAxd37I23PHzKFtyEaUDt11.jFovXobF4mFHQhqYkJZ30omAOlt Q6aWsh_nUT36bJyvko..OFUAiTsto4isGW9j8JsXRtLvnsPA- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r310705 - head/sys/fs/ext2fs To: Konstantin Belousov References: <201612281543.uBSFhHS0069984@repo.freebsd.org> <20161228155738.GB1923@kib.kiev.ua> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Pedro Giffuni Message-ID: <7e837097-c3f5-fd6c-5059-c982b6e3f533@FreeBSD.org> Date: Wed, 28 Dec 2016 11:05:01 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161228155738.GB1923@kib.kiev.ua> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 16:03:51 -0000 On 12/28/16 10:57, Konstantin Belousov wrote: > On Wed, Dec 28, 2016 at 03:43:17PM +0000, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Wed Dec 28 15:43:17 2016 >> New Revision: 310705 >> URL: https://svnweb.freebsd.org/changeset/base/310705 >> >> Log: >> style(9) cleanups. >> >> Just to reduce some of the issues found with indent(1). >> >> @@ -81,12 +81,13 @@ static daddr_t ext2_mapsearch(struct m_ >> */ >> int >> ext2_alloc(struct inode *ip, daddr_t lbn, e4fs_daddr_t bpref, int size, >> - struct ucred *cred, e4fs_daddr_t *bnp) >> + struct ucred *cred, e4fs_daddr_t *bnp) > This is wrong. Indent of the continuation line should be 4 spaces. > >> { >> struct m_ext2fs *fs; > Thanks, it's easy to miss such cases :(. Pedro. From owner-svn-src-head@freebsd.org Wed Dec 28 16:16:38 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 105EFC94B91; Wed, 28 Dec 2016 16:16:38 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D432A1C41; Wed, 28 Dec 2016 16:16:37 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSGGbu0083281; Wed, 28 Dec 2016 16:16:37 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSGGbSR083280; Wed, 28 Dec 2016 16:16:37 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201612281616.uBSGGbSR083280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 28 Dec 2016 16:16:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310706 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 16:16:38 -0000 Author: pfg Date: Wed Dec 28 16:16:36 2016 New Revision: 310706 URL: https://svnweb.freebsd.org/changeset/base/310706 Log: Undo small wrong style change. Reported by: kib Modified: head/sys/fs/ext2fs/ext2_alloc.c Modified: head/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_alloc.c Wed Dec 28 15:43:17 2016 (r310705) +++ head/sys/fs/ext2fs/ext2_alloc.c Wed Dec 28 16:16:36 2016 (r310706) @@ -81,7 +81,7 @@ static daddr_t ext2_mapsearch(struct m_ */ int ext2_alloc(struct inode *ip, daddr_t lbn, e4fs_daddr_t bpref, int size, - struct ucred *cred, e4fs_daddr_t *bnp) + struct ucred *cred, e4fs_daddr_t *bnp) { struct m_ext2fs *fs; struct ext2mount *ump; From owner-svn-src-head@freebsd.org Wed Dec 28 16:16:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E991CC94BC9; Wed, 28 Dec 2016 16:16:49 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4B2C1CFF; Wed, 28 Dec 2016 16:16:49 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSGGm7U083329; Wed, 28 Dec 2016 16:16:48 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSGGmpZ083328; Wed, 28 Dec 2016 16:16:48 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201612281616.uBSGGmpZ083328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Wed, 28 Dec 2016 16:16:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310707 - head/sbin/pfctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 16:16:50 -0000 Author: loos Date: Wed Dec 28 16:16:48 2016 New Revision: 310707 URL: https://svnweb.freebsd.org/changeset/base/310707 Log: Fix the parsing of NPt binat rules. In this specific case the src address can be set to any, which was not accepted prior to this commit. pfSense bug report: https://redmine.pfsense.org/issues/6985 Reviewed by: kp Obtained from: pfSense MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sbin/pfctl/parse.y Modified: head/sbin/pfctl/parse.y ============================================================================== --- head/sbin/pfctl/parse.y Wed Dec 28 16:16:36 2016 (r310706) +++ head/sbin/pfctl/parse.y Wed Dec 28 16:16:48 2016 (r310707) @@ -4195,7 +4195,7 @@ natrule : nataction interface af proto } ; -binatrule : no BINAT natpasslog interface af proto FROM host toipspec tag +binatrule : no BINAT natpasslog interface af proto FROM ipspec toipspec tag tagged rtable redirection { struct pf_rule binat; From owner-svn-src-head@freebsd.org Wed Dec 28 16:21:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70BBEC94F12; Wed, 28 Dec 2016 16:21:47 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 403AC1191; Wed, 28 Dec 2016 16:21:47 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSGLkdi085615; Wed, 28 Dec 2016 16:21:46 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSGLkmh085614; Wed, 28 Dec 2016 16:21:46 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281621.uBSGLkmh085614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 16:21:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310708 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 16:21:47 -0000 Author: arybchik Date: Wed Dec 28 16:21:46 2016 New Revision: 310708 URL: https://svnweb.freebsd.org/changeset/base/310708 Log: sfxge(4): do not initialize enumerated type variable to another type Fix build warning generated by ICC. Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx_nic.c Modified: head/sys/dev/sfxge/common/efx_nic.c ============================================================================== --- head/sys/dev/sfxge/common/efx_nic.c Wed Dec 28 16:16:48 2016 (r310707) +++ head/sys/dev/sfxge/common/efx_nic.c Wed Dec 28 16:21:46 2016 (r310708) @@ -556,7 +556,7 @@ efx_nic_destroy( EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, ==, 0); - enp->en_family = 0; + enp->en_family = EFX_FAMILY_INVALID; enp->en_esip = NULL; enp->en_esbp = NULL; enp->en_eslp = NULL; From owner-svn-src-head@freebsd.org Wed Dec 28 16:28:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB264C94FEF; Wed, 28 Dec 2016 16:28:10 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A7DC1574; Wed, 28 Dec 2016 16:28:10 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSGS9M6087270; Wed, 28 Dec 2016 16:28:09 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSGS9Yw087269; Wed, 28 Dec 2016 16:28:09 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281628.uBSGS9Yw087269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 16:28:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310709 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 16:28:10 -0000 Author: arybchik Date: Wed Dec 28 16:28:09 2016 New Revision: 310709 URL: https://svnweb.freebsd.org/changeset/base/310709 Log: sfxge(4): fix invalid type of eft_unicst_filter_count Found by clang when boolean_t is defined as bool for DPDK PMD. Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/ef10_impl.h Modified: head/sys/dev/sfxge/common/ef10_impl.h ============================================================================== --- head/sys/dev/sfxge/common/ef10_impl.h Wed Dec 28 16:21:46 2016 (r310708) +++ head/sys/dev/sfxge/common/ef10_impl.h Wed Dec 28 16:28:09 2016 (r310709) @@ -954,7 +954,7 @@ typedef struct ef10_filter_table_s { boolean_t eft_using_rss; uint32_t eft_unicst_filter_indexes[ EFX_EF10_FILTER_UNICAST_FILTERS_MAX]; - boolean_t eft_unicst_filter_count; + uint32_t eft_unicst_filter_count; uint32_t eft_mulcst_filter_indexes[ EFX_EF10_FILTER_MULTICAST_FILTERS_MAX]; uint32_t eft_mulcst_filter_count; From owner-svn-src-head@freebsd.org Wed Dec 28 16:34:50 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AABCC94391; Wed, 28 Dec 2016 16:34:50 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A3791D46; Wed, 28 Dec 2016 16:34:50 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSGYnsQ091299; Wed, 28 Dec 2016 16:34:49 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSGYnGb091298; Wed, 28 Dec 2016 16:34:49 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612281634.uBSGYnGb091298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 28 Dec 2016 16:34:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310711 - head/usr.sbin/bsnmpd/bsnmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 16:34:50 -0000 Author: ngie Date: Wed Dec 28 16:34:49 2016 New Revision: 310711 URL: https://svnweb.freebsd.org/changeset/base/310711 Log: Don't explicitly build tcp wrappers support into bsnmpd; make it conditional on MK_TCP_WRAPPERS != "no" This likely fixes an issue seen where some of the USE_TCPWRAPPERS code didn't work as advertised MFC after: 1 week Modified: head/usr.sbin/bsnmpd/bsnmpd/Makefile Modified: head/usr.sbin/bsnmpd/bsnmpd/Makefile ============================================================================== --- head/usr.sbin/bsnmpd/bsnmpd/Makefile Wed Dec 28 16:30:08 2016 (r310710) +++ head/usr.sbin/bsnmpd/bsnmpd/Makefile Wed Dec 28 16:34:49 2016 (r310711) @@ -125,9 +125,8 @@ DEFSDIR= ${SHAREDIR}/snmp/defs CFLAGS+= -DSNMPTREE_TYPES CFLAGS+= -I${CONTRIB}/lib -I${CONTRIB}/snmpd -I. -DUSE_LIBBEGEMOT -CFLAGS+= -DUSE_TCPWRAPPERS CFLAGS+= -DHAVE_STDINT_H -DHAVE_INTTYPES_H -DHAVE_ERR_H -DHAVE_STRLCPY -LIBADD= begemot bsnmp wrap +LIBADD= begemot bsnmp LDFLAGS= -Wl,-export-dynamic @@ -135,6 +134,11 @@ LDFLAGS= -Wl,-export-dynamic CFLAGS+= -DHAVE_LIBCRYPTO .endif +.if ${MK_TCP_WRAPPERS} != "no" +CFLAGS+= -DUSE_TCPWRAPPERS +LIBADD+= wrap +.endif + oid.h: tree.def Makefile gensnmptree -e ${XSYM} < ${.ALLSRC:M*.def} > ${.TARGET} From owner-svn-src-head@freebsd.org Wed Dec 28 17:13:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 449BFC94793; Wed, 28 Dec 2016 17:13:05 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F2C61D3E; Wed, 28 Dec 2016 17:13:05 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSHD4It008292; Wed, 28 Dec 2016 17:13:04 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSHD4uJ008289; Wed, 28 Dec 2016 17:13:04 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201612281713.uBSHD4uJ008289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 28 Dec 2016 17:13:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310712 - head/usr.bin/sort X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 17:13:05 -0000 Author: marius Date: Wed Dec 28 17:13:03 2016 New Revision: 310712 URL: https://svnweb.freebsd.org/changeset/base/310712 Log: - Use correct offsets into the keys set array. As the elements of this zero-length array are dynamically sized at run-time based on the use of hints, compilers can't be expected to figure out these offsets on their own. [1] - Fix incorrect comparison in cmp_nans(). [2] PR: 204571 [1], 202301 [2] Submitted by: David Binderman [2] MFC after: 3 days Modified: head/usr.bin/sort/coll.c head/usr.bin/sort/coll.h head/usr.bin/sort/radixsort.c Modified: head/usr.bin/sort/coll.c ============================================================================== --- head/usr.bin/sort/coll.c Wed Dec 28 16:34:49 2016 (r310711) +++ head/usr.bin/sort/coll.c Wed Dec 28 17:13:03 2016 (r310712) @@ -105,14 +105,29 @@ clean_keys_array(const struct bwstring * { if (ka) { - for (size_t i = 0; i < keys_num; ++i) - if (ka->key[i].k && ka->key[i].k != s) - bwsfree(ka->key[i].k); + for (size_t i = 0; i < keys_num; ++i) { + const struct key_value *kv; + + kv = get_key_from_keys_array(ka, i); + if (kv->k && kv->k != s) + bwsfree(kv->k); + } memset(ka, 0, keys_array_size()); } } /* + * Get pointer to a key value in the keys set + */ +struct key_value * +get_key_from_keys_array(struct keys_array *ka, size_t ind) +{ + + return ((struct key_value *)((caddr_t)ka->key + + ind * (sizeof(struct key_value) + key_hint_size()))); +} + +/* * Set value of a key in the keys set */ void @@ -122,7 +137,7 @@ set_key_on_keys_array(struct keys_array if (ka && keys_num > ind) { struct key_value *kv; - kv = &(ka->key[ind]); + kv = get_key_from_keys_array(ka, ind); if (kv->k && kv->k != s) bwsfree(kv->k); @@ -156,9 +171,9 @@ sort_list_item_size(struct sort_list_ite if (si->str) ret += bws_memsize(si->str); for (size_t i = 0; i < keys_num; ++i) { - struct key_value *kv; + const struct key_value *kv; - kv = &(si->ka.key[i]); + kv = get_key_from_keys_array(&si->ka, i); if (kv->k != si->str) ret += bws_memsize(kv->k); @@ -475,16 +490,19 @@ get_sort_func(struct sort_mods *sm) int key_coll(struct keys_array *ps1, struct keys_array *ps2, size_t offset) { + struct key_value *kv1, *kv2; struct sort_mods *sm; int res = 0; for (size_t i = 0; i < keys_num; ++i) { + kv1 = get_key_from_keys_array(ps1, i); + kv2 = get_key_from_keys_array(ps2, i); sm = &(keys[i].sm); if (sm->rflag) - res = sm->func(&(ps2->key[i]), &(ps1->key[i]), offset); + res = sm->func(kv2, kv1, offset); else - res = sm->func(&(ps1->key[i]), &(ps2->key[i]), offset); + res = sm->func(kv1, kv2, offset); if (res) break; @@ -1087,7 +1105,7 @@ cmp_nans(double d1, double d2) if (d1 < d2) return (-1); - if (d2 > d2) + if (d1 > d2) return (+1); return (0); } Modified: head/usr.bin/sort/coll.h ============================================================================== --- head/usr.bin/sort/coll.h Wed Dec 28 16:34:49 2016 (r310711) +++ head/usr.bin/sort/coll.h Wed Dec 28 17:13:03 2016 (r310712) @@ -91,7 +91,7 @@ struct key_value { struct bwstring *k; /* key string */ struct key_hint hint[0]; /* key sort hint */ -}; +} __packed; /* * Set of keys container object. @@ -146,6 +146,7 @@ cmpcoll_t get_sort_func(struct sort_mods struct keys_array *keys_array_alloc(void); size_t keys_array_size(void); +struct key_value *get_key_from_keys_array(struct keys_array *ka, size_t ind); void set_key_on_keys_array(struct keys_array *ka, struct bwstring *s, size_t ind); void clean_keys_array(const struct bwstring *s, struct keys_array *ka); Modified: head/usr.bin/sort/radixsort.c ============================================================================== --- head/usr.bin/sort/radixsort.c Wed Dec 28 16:34:49 2016 (r310711) +++ head/usr.bin/sort/radixsort.c Wed Dec 28 17:13:03 2016 (r310712) @@ -243,9 +243,11 @@ add_leaf(struct sort_level *sl, struct s static inline int get_wc_index(struct sort_list_item *sli, size_t level) { + const struct key_value *kv; const struct bwstring *bws; - bws = sli->ka.key[0].k; + kv = get_key_from_keys_array(&sli->ka, 0); + bws = kv->k; if ((BWSLEN(bws) > level)) return (unsigned char) BWS_GET(bws,level); From owner-svn-src-head@freebsd.org Wed Dec 28 17:37:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20C0DC94D33; Wed, 28 Dec 2016 17:37:47 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1A581904; Wed, 28 Dec 2016 17:37:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 0177410A74C; Wed, 28 Dec 2016 12:37:46 -0500 (EST) From: John Baldwin To: Adrian Chadd Cc: Alexander Kabaev , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r310650 - in head/sys/mips: include mips Date: Wed, 28 Dec 2016 09:30:17 -0800 Message-ID: <8608352.T4YV5SIEDd@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: References: <201612280255.uBS2tQeR045512@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 28 Dec 2016 12:37:46 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 17:37:47 -0000 On Tuesday, December 27, 2016 09:50:32 PM Adrian Chadd wrote: > hiya, >=20 > so I dug into the mips24k definition of this. It says this: >=20 > " > 3.4.3 Uncached accelerated writes > The 24K core permits memory regions to be marked as =E2=80=9Cuncached= > accelerated=E2=80=9D. This type of region is useful to hard- > ware which is =E2=80=9Cwrite only=E2=80=9D - perhaps video frame buff= ers, or some > other hardware stream. Sequential word stores in > such regions are gathered into cache-line-sized chunks, before being > written with a single burst cycle on the CPU > interface. > Such regions are uncached for read, and partial-word or > out-of-sequence writes have =E2=80=9Cunpredictable=E2=80=9D effects -= don=E2=80=99t > do them. The burst write is normally performed when software writes t= o > the last location in the memory block or does > an uncached-accelerated write to some other block; but it can also be= > triggered by a > sync instruction, a pref nudge, a matching load or any exception. If > the block is not completely written by the time it=E2=80=99s pushed o= ut, it > will be written using a series of doubleword or smaller write cycles > over the 24K core=E2=80=99s 64-bit memory interface. > " >=20 > So, question is - is our write combining page attribute in the VM > suitable for this? Is it defined as "only do full sequential word > writes"? Or do we risk having some other platform use it in a less > "don't do this" way and then MIPS is the one at fault again? :) The description of WC in the Intel SDM appears to be more forgiving. If you do out-of-sequence writes it won't "lose" the data, but there isn't a strong ordering of when the different regions of a cache line are finally written. Also, different WC store buffers may be written out-of-order (e.g. if you partially fill one line, then fully fill a second line, the second line may be written out, but the first one will= be held for a bit to see if it will be fully filled). However, you never lose the data, and the last thing written will eventually end up being written to the bus. --=20 John Baldwin From owner-svn-src-head@freebsd.org Wed Dec 28 17:45:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 365AAC9502D; Wed, 28 Dec 2016 17:45:54 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E59151DED; Wed, 28 Dec 2016 17:45:53 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSHjrZY020475; Wed, 28 Dec 2016 17:45:53 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSHjquP020469; Wed, 28 Dec 2016 17:45:52 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281745.uBSHjquP020469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 17:45:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310713 - in head/sys/dev/sfxge: . common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 17:45:54 -0000 Author: arybchik Date: Wed Dec 28 17:45:52 2016 New Revision: 310713 URL: https://svnweb.freebsd.org/changeset/base/310713 Log: sfxge(4): add possibility to control event queue performance profile It is ignored on SFN5xxx/6xxx (aka Siena). Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8931 Modified: head/sys/dev/sfxge/common/ef10_ev.c head/sys/dev/sfxge/common/ef10_impl.h head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_ev.c head/sys/dev/sfxge/common/efx_impl.h head/sys/dev/sfxge/sfxge_ev.c Modified: head/sys/dev/sfxge/common/ef10_ev.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_ev.c Wed Dec 28 17:13:03 2016 (r310712) +++ head/sys/dev/sfxge/common/ef10_ev.c Wed Dec 28 17:45:52 2016 (r310713) @@ -140,6 +140,7 @@ efx_mcdi_init_evq( __in size_t nevs, __in uint32_t irq, __in uint32_t us, + __in uint32_t flags, __in boolean_t low_latency) { efx_mcdi_req_t req; @@ -178,7 +179,20 @@ efx_mcdi_init_evq( * So always enable RX and TX event batching, and enable event cut * through if we want low latency operation. */ - ev_cut_through = low_latency ? 1 : 0; + switch (flags & EFX_EVQ_FLAGS_TYPE_MASK) { + case EFX_EVQ_FLAGS_TYPE_AUTO: + ev_cut_through = low_latency ? 1 : 0; + break; + case EFX_EVQ_FLAGS_TYPE_THROUGHPUT: + ev_cut_through = 0; + break; + case EFX_EVQ_FLAGS_TYPE_LOW_LATENCY: + ev_cut_through = 1; + break; + default: + rc = EINVAL; + goto fail2; + } MCDI_IN_POPULATE_DWORD_6(req, INIT_EVQ_IN_FLAGS, INIT_EVQ_IN_FLAG_INTERRUPTING, 1, INIT_EVQ_IN_FLAG_RPTR_DOS, 0, @@ -197,7 +211,7 @@ efx_mcdi_init_evq( unsigned int ticks; if ((rc = efx_ev_usecs_to_ticks(enp, us, &ticks)) != 0) - goto fail2; + goto fail3; MCDI_IN_SET_DWORD(req, INIT_EVQ_IN_TMR_MODE, MC_CMD_INIT_EVQ_IN_TMR_INT_HLDOFF); @@ -225,18 +239,20 @@ efx_mcdi_init_evq( if (req.emr_rc != 0) { rc = req.emr_rc; - goto fail3; + goto fail4; } if (req.emr_out_length_used < MC_CMD_INIT_EVQ_OUT_LEN) { rc = EMSGSIZE; - goto fail4; + goto fail5; } /* NOTE: ignore the returned IRQ param as firmware does not set it. */ return (0); +fail5: + EFSYS_PROBE(fail5); fail4: EFSYS_PROBE(fail4); fail3: @@ -257,12 +273,14 @@ efx_mcdi_init_evq_v2( __in efsys_mem_t *esmp, __in size_t nevs, __in uint32_t irq, - __in uint32_t us) + __in uint32_t us, + __in uint32_t flags) { efx_mcdi_req_t req; uint8_t payload[ MAX(MC_CMD_INIT_EVQ_V2_IN_LEN(EFX_EVQ_NBUFS(EFX_EVQ_MAXNEVS)), MC_CMD_INIT_EVQ_V2_OUT_LEN)]; + unsigned int evq_type; efx_qword_t *dma_addr; uint64_t addr; int npages; @@ -286,11 +304,25 @@ efx_mcdi_init_evq_v2( MCDI_IN_SET_DWORD(req, INIT_EVQ_V2_IN_INSTANCE, instance); MCDI_IN_SET_DWORD(req, INIT_EVQ_V2_IN_IRQ_NUM, irq); + switch (flags & EFX_EVQ_FLAGS_TYPE_MASK) { + case EFX_EVQ_FLAGS_TYPE_AUTO: + evq_type = MC_CMD_INIT_EVQ_V2_IN_FLAG_TYPE_AUTO; + break; + case EFX_EVQ_FLAGS_TYPE_THROUGHPUT: + evq_type = MC_CMD_INIT_EVQ_V2_IN_FLAG_TYPE_THROUGHPUT; + break; + case EFX_EVQ_FLAGS_TYPE_LOW_LATENCY: + evq_type = MC_CMD_INIT_EVQ_V2_IN_FLAG_TYPE_LOW_LATENCY; + break; + default: + rc = EINVAL; + goto fail2; + } MCDI_IN_POPULATE_DWORD_4(req, INIT_EVQ_V2_IN_FLAGS, INIT_EVQ_V2_IN_FLAG_INTERRUPTING, 1, INIT_EVQ_V2_IN_FLAG_RPTR_DOS, 0, INIT_EVQ_V2_IN_FLAG_INT_ARMD, 0, - INIT_EVQ_V2_IN_FLAG_TYPE, MC_CMD_INIT_EVQ_V2_IN_FLAG_TYPE_AUTO); + INIT_EVQ_V2_IN_FLAG_TYPE, evq_type); /* If the value is zero then disable the timer */ if (us == 0) { @@ -302,7 +334,7 @@ efx_mcdi_init_evq_v2( unsigned int ticks; if ((rc = efx_ev_usecs_to_ticks(enp, us, &ticks)) != 0) - goto fail2; + goto fail3; MCDI_IN_SET_DWORD(req, INIT_EVQ_V2_IN_TMR_MODE, MC_CMD_INIT_EVQ_V2_IN_TMR_INT_HLDOFF); @@ -330,12 +362,12 @@ efx_mcdi_init_evq_v2( if (req.emr_rc != 0) { rc = req.emr_rc; - goto fail3; + goto fail4; } if (req.emr_out_length_used < MC_CMD_INIT_EVQ_V2_OUT_LEN) { rc = EMSGSIZE; - goto fail4; + goto fail5; } /* NOTE: ignore the returned IRQ param as firmware does not set it. */ @@ -345,6 +377,8 @@ efx_mcdi_init_evq_v2( return (0); +fail5: + EFSYS_PROBE(fail5); fail4: EFSYS_PROBE(fail4); fail3: @@ -416,6 +450,7 @@ ef10_ev_qcreate( __in size_t n, __in uint32_t id, __in uint32_t us, + __in uint32_t flags, __in efx_evq_t *eep) { efx_nic_cfg_t *encp = &(enp->en_nic_cfg); @@ -459,29 +494,30 @@ ef10_ev_qcreate( if (encp->enc_init_evq_v2_supported) { /* * On Medford the low latency license is required to enable RX - * and event cut through and to disable RX batching. We let the - * firmware decide the settings to use. If the adapter has a low - * latency license, it will choose the best settings for low - * latency, otherwise it choose the best settings for - * throughput. + * and event cut through and to disable RX batching. If event + * queue type in flags is auto, we let the firmware decide the + * settings to use. If the adapter has a low latency license, + * it will choose the best settings for low latency, otherwise + * it will choose the best settings for throughput. */ - rc = efx_mcdi_init_evq_v2(enp, index, esmp, n, irq, us); + rc = efx_mcdi_init_evq_v2(enp, index, esmp, n, irq, us, flags); if (rc != 0) goto fail4; } else { /* - * On Huntington we need to specify the settings to use. We - * favour latency if the adapter is running low-latency firmware - * and throughput otherwise, and assume not support RX batching - * implies the adapter is running low-latency firmware. (This - * is how it's been done since Huntington GA. It doesn't make - * much sense with hindsight as the 'low-latency' firmware - * variant is also best for throughput, and does now support RX - * batching). + * On Huntington we need to specify the settings to use. + * If event queue type in flags is auto, we favour throughput + * if the adapter is running virtualization supporting firmware + * (i.e. the full featured firmware variant) + * and latency otherwise. The Ethernet Virtual Bridging + * capability is used to make this decision. (Note though that + * the low latency firmware variant is also best for + * throughput and corresponding type should be specified + * to choose it.) */ - boolean_t low_latency = encp->enc_rx_batching_enabled ? 0 : 1; - rc = efx_mcdi_init_evq(enp, index, esmp, n, irq, us, - low_latency); + boolean_t low_latency = encp->enc_datapath_cap_evb ? 0 : 1; + rc = efx_mcdi_init_evq(enp, index, esmp, n, irq, us, flags, + low_latency); if (rc != 0) goto fail5; } Modified: head/sys/dev/sfxge/common/ef10_impl.h ============================================================================== --- head/sys/dev/sfxge/common/ef10_impl.h Wed Dec 28 17:13:03 2016 (r310712) +++ head/sys/dev/sfxge/common/ef10_impl.h Wed Dec 28 17:45:52 2016 (r310713) @@ -85,6 +85,7 @@ ef10_ev_qcreate( __in size_t n, __in uint32_t id, __in uint32_t us, + __in uint32_t flags, __in efx_evq_t *eep); void Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Wed Dec 28 17:13:03 2016 (r310712) +++ head/sys/dev/sfxge/common/efx.h Wed Dec 28 17:45:52 2016 (r310713) @@ -1595,6 +1595,11 @@ efx_ev_fini( #define EFX_EVQ_SIZE(_nevs) ((_nevs) * sizeof (efx_qword_t)) #define EFX_EVQ_NBUFS(_nevs) (EFX_EVQ_SIZE(_nevs) / EFX_BUF_SIZE) +#define EFX_EVQ_FLAGS_TYPE_MASK (0x3) +#define EFX_EVQ_FLAGS_TYPE_AUTO (0x0) +#define EFX_EVQ_FLAGS_TYPE_THROUGHPUT (0x1) +#define EFX_EVQ_FLAGS_TYPE_LOW_LATENCY (0x2) + extern __checkReturn efx_rc_t efx_ev_qcreate( __in efx_nic_t *enp, @@ -1603,6 +1608,7 @@ efx_ev_qcreate( __in size_t n, __in uint32_t id, __in uint32_t us, + __in uint32_t flags, __deref_out efx_evq_t **eepp); extern void Modified: head/sys/dev/sfxge/common/efx_ev.c ============================================================================== --- head/sys/dev/sfxge/common/efx_ev.c Wed Dec 28 17:13:03 2016 (r310712) +++ head/sys/dev/sfxge/common/efx_ev.c Wed Dec 28 17:45:52 2016 (r310713) @@ -71,6 +71,7 @@ siena_ev_qcreate( __in size_t n, __in uint32_t id, __in uint32_t us, + __in uint32_t flags, __in efx_evq_t *eep); static void @@ -228,6 +229,7 @@ efx_ev_qcreate( __in size_t n, __in uint32_t id, __in uint32_t us, + __in uint32_t flags, __deref_out efx_evq_t **eepp) { const efx_ev_ops_t *eevop = enp->en_eevop; @@ -264,7 +266,8 @@ efx_ev_qcreate( enp->en_ev_qcount++; *eepp = eep; - if ((rc = eevop->eevo_qcreate(enp, index, esmp, n, id, us, eep)) != 0) + if ((rc = eevop->eevo_qcreate(enp, index, esmp, n, id, us, flags, + eep)) != 0) goto fail2; return (0); @@ -1279,6 +1282,7 @@ siena_ev_qcreate( __in size_t n, __in uint32_t id, __in uint32_t us, + __in uint32_t flags, __in efx_evq_t *eep) { efx_nic_cfg_t *encp = &(enp->en_nic_cfg); Modified: head/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- head/sys/dev/sfxge/common/efx_impl.h Wed Dec 28 17:13:03 2016 (r310712) +++ head/sys/dev/sfxge/common/efx_impl.h Wed Dec 28 17:45:52 2016 (r310713) @@ -95,7 +95,7 @@ typedef struct efx_ev_ops_s { void (*eevo_fini)(efx_nic_t *); efx_rc_t (*eevo_qcreate)(efx_nic_t *, unsigned int, efsys_mem_t *, size_t, uint32_t, - uint32_t, efx_evq_t *); + uint32_t, uint32_t, efx_evq_t *); void (*eevo_qdestroy)(efx_evq_t *); efx_rc_t (*eevo_qprime)(efx_evq_t *, unsigned int); void (*eevo_qpost)(efx_evq_t *, uint16_t); Modified: head/sys/dev/sfxge/sfxge_ev.c ============================================================================== --- head/sys/dev/sfxge/sfxge_ev.c Wed Dec 28 17:13:03 2016 (r310712) +++ head/sys/dev/sfxge/sfxge_ev.c Wed Dec 28 17:45:52 2016 (r310713) @@ -703,7 +703,8 @@ sfxge_ev_qstart(struct sfxge_softc *sc, /* Create the common code event queue. */ if ((rc = efx_ev_qcreate(sc->enp, index, esmp, evq->entries, - evq->buf_base_id, sc->ev_moderation, &evq->common)) != 0) + evq->buf_base_id, sc->ev_moderation, EFX_EVQ_FLAGS_TYPE_AUTO, + &evq->common)) != 0) goto fail; SFXGE_EVQ_LOCK(evq); From owner-svn-src-head@freebsd.org Wed Dec 28 17:49:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A766C9517C; Wed, 28 Dec 2016 17:49:35 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D92B31FFF; Wed, 28 Dec 2016 17:49:34 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSHnYnr020626; Wed, 28 Dec 2016 17:49:34 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSHnY4m020625; Wed, 28 Dec 2016 17:49:34 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281749.uBSHnY4m020625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 17:49:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310714 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 17:49:35 -0000 Author: arybchik Date: Wed Dec 28 17:49:33 2016 New Revision: 310714 URL: https://svnweb.freebsd.org/changeset/base/310714 Log: sfxge(4): support Medford bootcfg partition layout in common code For Siena and Huntington, the per-port bootcfg (aka expcfg) is stored in a dedicated 4Kbyte partition for each port. For Medford, the per-PF bootcfg is stored in a 2Kbyte sector within a single shared partition. Update the common code to support the new bootcfg layout. Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8932 Modified: head/sys/dev/sfxge/common/efx_bootcfg.c Modified: head/sys/dev/sfxge/common/efx_bootcfg.c ============================================================================== --- head/sys/dev/sfxge/common/efx_bootcfg.c Wed Dec 28 17:45:52 2016 (r310713) +++ head/sys/dev/sfxge/common/efx_bootcfg.c Wed Dec 28 17:49:33 2016 (r310714) @@ -38,14 +38,69 @@ __FBSDID("$FreeBSD$"); /* * Maximum size of BOOTCFG block across all nics as understood by SFCgPXE. - * A multiple of 0x100 so trailing 0xff characters don't contrinbute to the - * checksum. + * NOTE: This is larger than the Medford per-PF bootcfg sector. */ #define BOOTCFG_MAX_SIZE 0x1000 #define DHCP_END ((uint8_t)0xff) #define DHCP_PAD ((uint8_t)0) + +/* Report size and offset of bootcfg sector in NVRAM partition. */ +static __checkReturn efx_rc_t +efx_bootcfg_sector( + __in efx_nic_t *enp, + __out size_t *offsetp, + __out size_t *max_sizep) +{ + size_t max_size; + size_t offset; + int rc; + + switch (enp->en_family) { +#if EFSYS_OPT_SIENA + case EFX_FAMILY_SIENA: + max_size = BOOTCFG_MAX_SIZE; + offset = 0; + break; +#endif /* EFSYS_OPT_SIENA */ + +#if EFSYS_OPT_HUNTINGTON + case EFX_FAMILY_HUNTINGTON: + max_size = BOOTCFG_MAX_SIZE; + offset = 0; + break; +#endif /* EFSYS_OPT_HUNTINGTON */ + +#if EFSYS_OPT_MEDFORD + case EFX_FAMILY_MEDFORD: { + efx_nic_cfg_t *encp = &(enp->en_nic_cfg); + + /* Shared partition (array indexed by PF) */ + max_size = 0x0800; + offset = max_size * encp->enc_pf; + break; + } +#endif /* EFSYS_OPT_MEDFORD */ + + default: + EFSYS_ASSERT(0); + rc = ENOTSUP; + goto fail1; + } + EFSYS_ASSERT3U(max_size, <=, BOOTCFG_MAX_SIZE); + + *offsetp = offset; + *max_sizep = max_size; + + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); +} + + static __checkReturn uint8_t efx_bootcfg_csum( __in efx_nic_t *enp, @@ -136,40 +191,54 @@ efx_bootcfg_read( { uint8_t *payload = NULL; size_t used_bytes; + size_t partn_length; size_t sector_length; + size_t sector_offset; efx_rc_t rc; - rc = efx_nvram_size(enp, EFX_NVRAM_BOOTROM_CFG, §or_length); + rc = efx_nvram_size(enp, EFX_NVRAM_BOOTROM_CFG, &partn_length); if (rc != 0) goto fail1; + /* The bootcfg sector may be stored in a (larger) shared partition */ + rc = efx_bootcfg_sector(enp, §or_offset, §or_length); + if (rc != 0) + goto fail2; + + if (sector_length > BOOTCFG_MAX_SIZE) + sector_length = BOOTCFG_MAX_SIZE; + + if (sector_offset + sector_length > partn_length) { + /* Partition is too small */ + rc = EFBIG; + goto fail3; + } + /* - * We need to read the entire BOOTCFG area to ensure we read all the + * We need to read the entire BOOTCFG sector to ensure we read all the * tags, because legacy bootcfg sectors are not guaranteed to end with * a DHCP_END character. If the user hasn't supplied a sufficiently * large buffer then use our own buffer. */ - if (sector_length > BOOTCFG_MAX_SIZE) - sector_length = BOOTCFG_MAX_SIZE; if (sector_length > size) { EFSYS_KMEM_ALLOC(enp->en_esip, sector_length, payload); if (payload == NULL) { rc = ENOMEM; - goto fail2; + goto fail4; } } else payload = (uint8_t *)data; if ((rc = efx_nvram_rw_start(enp, EFX_NVRAM_BOOTROM_CFG, NULL)) != 0) - goto fail3; + goto fail5; - rc = efx_nvram_read_chunk(enp, EFX_NVRAM_BOOTROM_CFG, 0, + rc = efx_nvram_read_chunk(enp, EFX_NVRAM_BOOTROM_CFG, sector_offset, (caddr_t)payload, sector_length); efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG); if (rc != 0) - goto fail4; + goto fail6; /* Verify that the area is correctly formatted and checksummed */ rc = efx_bootcfg_verify(enp, (caddr_t)payload, sector_length, @@ -205,7 +274,7 @@ efx_bootcfg_read( */ if (used_bytes > size) { rc = ENOSPC; - goto fail5; + goto fail7; } if (sector_length > size) { memcpy(data, payload, used_bytes); @@ -224,15 +293,18 @@ efx_bootcfg_read( return (0); +fail7: + EFSYS_PROBE(fail7); +fail6: + EFSYS_PROBE(fail6); fail5: EFSYS_PROBE(fail5); + if (sector_length > size) + EFSYS_KMEM_FREE(enp->en_esip, sector_length, payload); fail4: EFSYS_PROBE(fail4); fail3: EFSYS_PROBE(fail3); - - if (sector_length > size) - EFSYS_KMEM_FREE(enp->en_esip, sector_length, payload); fail2: EFSYS_PROBE(fail2); fail1: @@ -247,90 +319,109 @@ efx_bootcfg_write( __in_bcount(size) caddr_t data, __in size_t size) { - uint8_t *chunk; + uint8_t *partn_data; uint8_t checksum; + size_t partn_length; size_t sector_length; - size_t chunk_length; + size_t sector_offset; size_t used_bytes; - size_t offset; - size_t remaining; efx_rc_t rc; - rc = efx_nvram_size(enp, EFX_NVRAM_BOOTROM_CFG, §or_length); + rc = efx_nvram_size(enp, EFX_NVRAM_BOOTROM_CFG, &partn_length); if (rc != 0) goto fail1; + /* The bootcfg sector may be stored in a (larger) shared partition */ + rc = efx_bootcfg_sector(enp, §or_offset, §or_length); + if (rc != 0) + goto fail2; + if (sector_length > BOOTCFG_MAX_SIZE) sector_length = BOOTCFG_MAX_SIZE; + if (sector_offset + sector_length > partn_length) { + /* Partition is too small */ + rc = EFBIG; + goto fail3; + } + if ((rc = efx_bootcfg_verify(enp, data, size, &used_bytes)) != 0) - goto fail2; + goto fail4; /* The caller *must* terminate their block with a DHCP_END character */ - EFSYS_ASSERT(used_bytes >= 2); /* checksum and DHCP_END */ - if ((uint8_t)data[used_bytes - 1] != DHCP_END) { + if ((used_bytes < 2) || ((uint8_t)data[used_bytes - 1] != DHCP_END)) { + /* Block too short or DHCP_END missing */ rc = ENOENT; - goto fail3; + goto fail5; } /* Check that the hardware has support for this much data */ if (used_bytes > MIN(sector_length, BOOTCFG_MAX_SIZE)) { rc = ENOSPC; - goto fail4; + goto fail6; } - rc = efx_nvram_rw_start(enp, EFX_NVRAM_BOOTROM_CFG, &chunk_length); - if (rc != 0) - goto fail5; - - EFSYS_KMEM_ALLOC(enp->en_esip, chunk_length, chunk); - if (chunk == NULL) { + /* + * If the BOOTCFG sector is stored in a shared partition, then we must + * read the whole partition and insert the updated bootcfg sector at the + * correct offset. + */ + EFSYS_KMEM_ALLOC(enp->en_esip, partn_length, partn_data); + if (partn_data == NULL) { rc = ENOMEM; - goto fail6; + goto fail7; } - if ((rc = efx_nvram_erase(enp, EFX_NVRAM_BOOTROM_CFG)) != 0) - goto fail7; + rc = efx_nvram_rw_start(enp, EFX_NVRAM_BOOTROM_CFG, NULL); + if (rc != 0) + goto fail8; + + /* Read the entire partition */ + rc = efx_nvram_read_chunk(enp, EFX_NVRAM_BOOTROM_CFG, 0, + (caddr_t)partn_data, partn_length); + if (rc != 0) + goto fail9; /* - * Write the entire sector_length bytes of data in chunks. Zero out - * all data following the DHCP_END, and adjust the checksum + * Insert the BOOTCFG sector into the partition, Zero out all data after + * the DHCP_END tag, and adjust the checksum. */ + (void) memset(partn_data + sector_offset, 0x0, sector_length); + (void) memcpy(partn_data + sector_offset, data, used_bytes); + checksum = efx_bootcfg_csum(enp, data, used_bytes); - for (offset = 0; offset < sector_length; offset += remaining) { - remaining = MIN(chunk_length, sector_length - offset); + partn_data[sector_offset] -= checksum; - /* Fill chunk */ - (void) memset(chunk, 0x0, chunk_length); - if (offset < used_bytes) - memcpy(chunk, data + offset, - MIN(remaining, used_bytes - offset)); - - /* Adjust checksum */ - if (offset == 0) - chunk[0] -= checksum; - - if ((rc = efx_nvram_write_chunk(enp, EFX_NVRAM_BOOTROM_CFG, - offset, (caddr_t)chunk, remaining)) != 0) - goto fail8; + if ((rc = efx_nvram_erase(enp, EFX_NVRAM_BOOTROM_CFG)) != 0) + goto fail10; + + if ((rc = efx_nvram_write_chunk(enp, EFX_NVRAM_BOOTROM_CFG, + 0, partn_data, partn_length)) != 0) { + goto fail11; } efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG); - EFSYS_KMEM_FREE(enp->en_esip, chunk_length, chunk); + EFSYS_KMEM_FREE(enp->en_esip, partn_length, partn_data); return (0); +fail11: + EFSYS_PROBE(fail11); +fail10: + EFSYS_PROBE(fail10); +fail9: + EFSYS_PROBE(fail9); + + efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG); fail8: EFSYS_PROBE(fail8); + + EFSYS_KMEM_FREE(enp->en_esip, partn_length, partn_data); fail7: EFSYS_PROBE(fail7); - - EFSYS_KMEM_FREE(enp->en_esip, chunk_length, chunk); fail6: EFSYS_PROBE(fail6); - - efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG); fail5: EFSYS_PROBE(fail5); fail4: From owner-svn-src-head@freebsd.org Wed Dec 28 17:50:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37CD3C9522A; Wed, 28 Dec 2016 17:50:49 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0736813A3; Wed, 28 Dec 2016 17:50:48 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSHomgj020835; Wed, 28 Dec 2016 17:50:48 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSHomXd020834; Wed, 28 Dec 2016 17:50:48 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281750.uBSHomXd020834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 17:50:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310715 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 17:50:49 -0000 Author: arybchik Date: Wed Dec 28 17:50:48 2016 New Revision: 310715 URL: https://svnweb.freebsd.org/changeset/base/310715 Log: sfxge(4): fix GET_RXDP_CONFIG usage for multi-PF on Medford On Medford, using MC_CMD_GET_RXDP_CONFIG to query the RX end padding setting is in the ADMIN group, and so fails for unprivileged functions. In that case, assume the largest size supported by Medford hardware (256bytes) to prevent overrun. Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8933 Modified: head/sys/dev/sfxge/common/medford_nic.c Modified: head/sys/dev/sfxge/common/medford_nic.c ============================================================================== --- head/sys/dev/sfxge/common/medford_nic.c Wed Dec 28 17:49:33 2016 (r310714) +++ head/sys/dev/sfxge/common/medford_nic.c Wed Dec 28 17:50:48 2016 (r310715) @@ -289,8 +289,13 @@ medford_board_cfg( encp->enc_rx_buf_align_start = 1; /* Get the RX DMA end padding alignment configuration */ - if ((rc = efx_mcdi_get_rxdp_config(enp, &end_padding)) != 0) - goto fail11; + if ((rc = efx_mcdi_get_rxdp_config(enp, &end_padding)) != 0) { + if (rc != EACCES) + goto fail11; + + /* Assume largest tail padding size supported by hardware */ + end_padding = 256; + } encp->enc_rx_buf_align_end = end_padding; /* Alignment for WPTR updates */ From owner-svn-src-head@freebsd.org Wed Dec 28 17:52:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C4DBC953B0; Wed, 28 Dec 2016 17:52:26 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DFC2B17BD; Wed, 28 Dec 2016 17:52:25 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSHqPbB024142; Wed, 28 Dec 2016 17:52:25 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSHqORE024140; Wed, 28 Dec 2016 17:52:24 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281752.uBSHqORE024140@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 17:52:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310716 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 17:52:26 -0000 Author: arybchik Date: Wed Dec 28 17:52:24 2016 New Revision: 310716 URL: https://svnweb.freebsd.org/changeset/base/310716 Log: sfxge(4): add UEFI ROM support to the common code Submitted by: Andrew Lee Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8934 Modified: head/sys/dev/sfxge/common/ef10_nvram.c head/sys/dev/sfxge/common/efx.h Modified: head/sys/dev/sfxge/common/ef10_nvram.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_nvram.c Wed Dec 28 17:50:48 2016 (r310715) +++ head/sys/dev/sfxge/common/ef10_nvram.c Wed Dec 28 17:52:24 2016 (r310716) @@ -2175,7 +2175,11 @@ static ef10_parttbl_entry_t medford_part {NVRAM_PARTITION_TYPE_LICENSE, 1, EFX_NVRAM_LICENSE}, {NVRAM_PARTITION_TYPE_LICENSE, 2, EFX_NVRAM_LICENSE}, {NVRAM_PARTITION_TYPE_LICENSE, 3, EFX_NVRAM_LICENSE}, - {NVRAM_PARTITION_TYPE_LICENSE, 4, EFX_NVRAM_LICENSE} + {NVRAM_PARTITION_TYPE_LICENSE, 4, EFX_NVRAM_LICENSE}, + {NVRAM_PARTITION_TYPE_EXPANSION_UEFI, 1, EFX_NVRAM_UEFIROM}, + {NVRAM_PARTITION_TYPE_EXPANSION_UEFI, 2, EFX_NVRAM_UEFIROM}, + {NVRAM_PARTITION_TYPE_EXPANSION_UEFI, 3, EFX_NVRAM_UEFIROM}, + {NVRAM_PARTITION_TYPE_EXPANSION_UEFI, 4, EFX_NVRAM_UEFIROM} }; static __checkReturn efx_rc_t Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Wed Dec 28 17:50:48 2016 (r310715) +++ head/sys/dev/sfxge/common/efx.h Wed Dec 28 17:52:24 2016 (r310716) @@ -1311,6 +1311,7 @@ typedef enum efx_nvram_type_e { EFX_NVRAM_FPGA_BACKUP, EFX_NVRAM_DYNAMIC_CFG, EFX_NVRAM_LICENSE, + EFX_NVRAM_UEFIROM, EFX_NVRAM_NTYPES, } efx_nvram_type_t; From owner-svn-src-head@freebsd.org Wed Dec 28 17:56:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBEBFC9551D; Wed, 28 Dec 2016 17:56:04 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D46E1C14; Wed, 28 Dec 2016 17:56:04 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSHu32F025484; Wed, 28 Dec 2016 17:56:03 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSHu3kG025480; Wed, 28 Dec 2016 17:56:03 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281756.uBSHu3kG025480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 17:56:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310717 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 17:56:04 -0000 Author: arybchik Date: Wed Dec 28 17:56:03 2016 New Revision: 310717 URL: https://svnweb.freebsd.org/changeset/base/310717 Log: sfxge(4): move BIST methods from hunt_phy.c to ef10_phy.c Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8935 Modified: head/sys/dev/sfxge/common/ef10_impl.h head/sys/dev/sfxge/common/ef10_phy.c head/sys/dev/sfxge/common/hunt_impl.h head/sys/dev/sfxge/common/hunt_phy.c Modified: head/sys/dev/sfxge/common/ef10_impl.h ============================================================================== --- head/sys/dev/sfxge/common/ef10_impl.h Wed Dec 28 17:52:24 2016 (r310716) +++ head/sys/dev/sfxge/common/ef10_impl.h Wed Dec 28 17:56:03 2016 (r310717) @@ -602,6 +602,34 @@ ef10_phy_stats_update( #endif /* EFSYS_OPT_PHY_STATS */ +#if EFSYS_OPT_BIST + +extern __checkReturn efx_rc_t +ef10_bist_enable_offline( + __in efx_nic_t *enp); + +extern __checkReturn efx_rc_t +ef10_bist_start( + __in efx_nic_t *enp, + __in efx_bist_type_t type); + +extern __checkReturn efx_rc_t +ef10_bist_poll( + __in efx_nic_t *enp, + __in efx_bist_type_t type, + __out efx_bist_result_t *resultp, + __out_opt __drv_when(count > 0, __notnull) + uint32_t *value_maskp, + __out_ecount_opt(count) __drv_when(count > 0, __notnull) + unsigned long *valuesp, + __in size_t count); + +extern void +ef10_bist_stop( + __in efx_nic_t *enp, + __in efx_bist_type_t type); + +#endif /* EFSYS_OPT_BIST */ /* TX */ Modified: head/sys/dev/sfxge/common/ef10_phy.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_phy.c Wed Dec 28 17:52:24 2016 (r310716) +++ head/sys/dev/sfxge/common/ef10_phy.c Wed Dec 28 17:56:03 2016 (r310717) @@ -474,4 +474,157 @@ ef10_phy_stats_update( #endif /* EFSYS_OPT_PHY_STATS */ +#if EFSYS_OPT_BIST + + __checkReturn efx_rc_t +ef10_bist_enable_offline( + __in efx_nic_t *enp) +{ + efx_rc_t rc; + + if ((rc = efx_mcdi_bist_enable_offline(enp)) != 0) + goto fail1; + + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); +} + + __checkReturn efx_rc_t +ef10_bist_start( + __in efx_nic_t *enp, + __in efx_bist_type_t type) +{ + efx_rc_t rc; + + if ((rc = efx_mcdi_bist_start(enp, type)) != 0) + goto fail1; + + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); +} + + __checkReturn efx_rc_t +ef10_bist_poll( + __in efx_nic_t *enp, + __in efx_bist_type_t type, + __out efx_bist_result_t *resultp, + __out_opt __drv_when(count > 0, __notnull) + uint32_t *value_maskp, + __out_ecount_opt(count) __drv_when(count > 0, __notnull) + unsigned long *valuesp, + __in size_t count) +{ + efx_nic_cfg_t *encp = &(enp->en_nic_cfg); + efx_mcdi_req_t req; + uint8_t payload[MAX(MC_CMD_POLL_BIST_IN_LEN, + MCDI_CTL_SDU_LEN_MAX)]; + uint32_t value_mask = 0; + uint32_t result; + efx_rc_t rc; + + _NOTE(ARGUNUSED(type)) + + (void) memset(payload, 0, sizeof (payload)); + req.emr_cmd = MC_CMD_POLL_BIST; + req.emr_in_buf = payload; + req.emr_in_length = MC_CMD_POLL_BIST_IN_LEN; + req.emr_out_buf = payload; + req.emr_out_length = MCDI_CTL_SDU_LEN_MAX; + + efx_mcdi_execute(enp, &req); + + if (req.emr_rc != 0) { + rc = req.emr_rc; + goto fail1; + } + + if (req.emr_out_length_used < MC_CMD_POLL_BIST_OUT_RESULT_OFST + 4) { + rc = EMSGSIZE; + goto fail2; + } + + if (count > 0) + (void) memset(valuesp, '\0', count * sizeof (unsigned long)); + + result = MCDI_OUT_DWORD(req, POLL_BIST_OUT_RESULT); + + if (result == MC_CMD_POLL_BIST_FAILED && + req.emr_out_length >= MC_CMD_POLL_BIST_OUT_MEM_LEN && + count > EFX_BIST_MEM_ECC_FATAL) { + if (valuesp != NULL) { + valuesp[EFX_BIST_MEM_TEST] = + MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_TEST); + valuesp[EFX_BIST_MEM_ADDR] = + MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ADDR); + valuesp[EFX_BIST_MEM_BUS] = + MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_BUS); + valuesp[EFX_BIST_MEM_EXPECT] = + MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_EXPECT); + valuesp[EFX_BIST_MEM_ACTUAL] = + MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ACTUAL); + valuesp[EFX_BIST_MEM_ECC] = + MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC); + valuesp[EFX_BIST_MEM_ECC_PARITY] = + MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC_PARITY); + valuesp[EFX_BIST_MEM_ECC_FATAL] = + MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC_FATAL); + } + value_mask |= (1 << EFX_BIST_MEM_TEST) | + (1 << EFX_BIST_MEM_ADDR) | + (1 << EFX_BIST_MEM_BUS) | + (1 << EFX_BIST_MEM_EXPECT) | + (1 << EFX_BIST_MEM_ACTUAL) | + (1 << EFX_BIST_MEM_ECC) | + (1 << EFX_BIST_MEM_ECC_PARITY) | + (1 << EFX_BIST_MEM_ECC_FATAL); + } else if (result == MC_CMD_POLL_BIST_FAILED && + encp->enc_phy_type == EFX_PHY_XFI_FARMI && + req.emr_out_length >= MC_CMD_POLL_BIST_OUT_MRSFP_LEN && + count > EFX_BIST_FAULT_CODE) { + if (valuesp != NULL) + valuesp[EFX_BIST_FAULT_CODE] = + MCDI_OUT_DWORD(req, POLL_BIST_OUT_MRSFP_TEST); + value_mask |= 1 << EFX_BIST_FAULT_CODE; + } + + if (value_maskp != NULL) + *value_maskp = value_mask; + + EFSYS_ASSERT(resultp != NULL); + if (result == MC_CMD_POLL_BIST_RUNNING) + *resultp = EFX_BIST_RESULT_RUNNING; + else if (result == MC_CMD_POLL_BIST_PASSED) + *resultp = EFX_BIST_RESULT_PASSED; + else + *resultp = EFX_BIST_RESULT_FAILED; + + return (0); + +fail2: + EFSYS_PROBE(fail2); +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); +} + + void +ef10_bist_stop( + __in efx_nic_t *enp, + __in efx_bist_type_t type) +{ + /* There is no way to stop BIST on EF10. */ + _NOTE(ARGUNUSED(enp, type)) +} + +#endif /* EFSYS_OPT_BIST */ + #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ Modified: head/sys/dev/sfxge/common/hunt_impl.h ============================================================================== --- head/sys/dev/sfxge/common/hunt_impl.h Wed Dec 28 17:52:24 2016 (r310716) +++ head/sys/dev/sfxge/common/hunt_impl.h Wed Dec 28 17:56:03 2016 (r310717) @@ -69,39 +69,6 @@ extern __checkReturn efx_rc_t hunt_board_cfg( __in efx_nic_t *enp); - -/* PHY */ - -#if EFSYS_OPT_BIST - -extern __checkReturn efx_rc_t -ef10_bist_enable_offline( - __in efx_nic_t *enp); - -extern __checkReturn efx_rc_t -ef10_bist_start( - __in efx_nic_t *enp, - __in efx_bist_type_t type); - -extern __checkReturn efx_rc_t -ef10_bist_poll( - __in efx_nic_t *enp, - __in efx_bist_type_t type, - __out efx_bist_result_t *resultp, - __out_opt __drv_when(count > 0, __notnull) - uint32_t *value_maskp, - __out_ecount_opt(count) __drv_when(count > 0, __notnull) - unsigned long *valuesp, - __in size_t count); - -extern void -ef10_bist_stop( - __in efx_nic_t *enp, - __in efx_bist_type_t type); - -#endif /* EFSYS_OPT_BIST */ - - #ifdef __cplusplus } #endif Modified: head/sys/dev/sfxge/common/hunt_phy.c ============================================================================== --- head/sys/dev/sfxge/common/hunt_phy.c Wed Dec 28 17:52:24 2016 (r310716) +++ head/sys/dev/sfxge/common/hunt_phy.c Wed Dec 28 17:56:03 2016 (r310717) @@ -36,157 +36,4 @@ __FBSDID("$FreeBSD$"); #if EFSYS_OPT_HUNTINGTON -#if EFSYS_OPT_BIST - - __checkReturn efx_rc_t -ef10_bist_enable_offline( - __in efx_nic_t *enp) -{ - efx_rc_t rc; - - if ((rc = efx_mcdi_bist_enable_offline(enp)) != 0) - goto fail1; - - return (0); - -fail1: - EFSYS_PROBE1(fail1, efx_rc_t, rc); - - return (rc); -} - - __checkReturn efx_rc_t -ef10_bist_start( - __in efx_nic_t *enp, - __in efx_bist_type_t type) -{ - efx_rc_t rc; - - if ((rc = efx_mcdi_bist_start(enp, type)) != 0) - goto fail1; - - return (0); - -fail1: - EFSYS_PROBE1(fail1, efx_rc_t, rc); - - return (rc); -} - - __checkReturn efx_rc_t -ef10_bist_poll( - __in efx_nic_t *enp, - __in efx_bist_type_t type, - __out efx_bist_result_t *resultp, - __out_opt __drv_when(count > 0, __notnull) - uint32_t *value_maskp, - __out_ecount_opt(count) __drv_when(count > 0, __notnull) - unsigned long *valuesp, - __in size_t count) -{ - efx_nic_cfg_t *encp = &(enp->en_nic_cfg); - efx_mcdi_req_t req; - uint8_t payload[MAX(MC_CMD_POLL_BIST_IN_LEN, - MCDI_CTL_SDU_LEN_MAX)]; - uint32_t value_mask = 0; - uint32_t result; - efx_rc_t rc; - - _NOTE(ARGUNUSED(type)) - - (void) memset(payload, 0, sizeof (payload)); - req.emr_cmd = MC_CMD_POLL_BIST; - req.emr_in_buf = payload; - req.emr_in_length = MC_CMD_POLL_BIST_IN_LEN; - req.emr_out_buf = payload; - req.emr_out_length = MCDI_CTL_SDU_LEN_MAX; - - efx_mcdi_execute(enp, &req); - - if (req.emr_rc != 0) { - rc = req.emr_rc; - goto fail1; - } - - if (req.emr_out_length_used < MC_CMD_POLL_BIST_OUT_RESULT_OFST + 4) { - rc = EMSGSIZE; - goto fail2; - } - - if (count > 0) - (void) memset(valuesp, '\0', count * sizeof (unsigned long)); - - result = MCDI_OUT_DWORD(req, POLL_BIST_OUT_RESULT); - - if (result == MC_CMD_POLL_BIST_FAILED && - req.emr_out_length >= MC_CMD_POLL_BIST_OUT_MEM_LEN && - count > EFX_BIST_MEM_ECC_FATAL) { - if (valuesp != NULL) { - valuesp[EFX_BIST_MEM_TEST] = - MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_TEST); - valuesp[EFX_BIST_MEM_ADDR] = - MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ADDR); - valuesp[EFX_BIST_MEM_BUS] = - MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_BUS); - valuesp[EFX_BIST_MEM_EXPECT] = - MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_EXPECT); - valuesp[EFX_BIST_MEM_ACTUAL] = - MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ACTUAL); - valuesp[EFX_BIST_MEM_ECC] = - MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC); - valuesp[EFX_BIST_MEM_ECC_PARITY] = - MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC_PARITY); - valuesp[EFX_BIST_MEM_ECC_FATAL] = - MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC_FATAL); - } - value_mask |= (1 << EFX_BIST_MEM_TEST) | - (1 << EFX_BIST_MEM_ADDR) | - (1 << EFX_BIST_MEM_BUS) | - (1 << EFX_BIST_MEM_EXPECT) | - (1 << EFX_BIST_MEM_ACTUAL) | - (1 << EFX_BIST_MEM_ECC) | - (1 << EFX_BIST_MEM_ECC_PARITY) | - (1 << EFX_BIST_MEM_ECC_FATAL); - } else if (result == MC_CMD_POLL_BIST_FAILED && - encp->enc_phy_type == EFX_PHY_XFI_FARMI && - req.emr_out_length >= MC_CMD_POLL_BIST_OUT_MRSFP_LEN && - count > EFX_BIST_FAULT_CODE) { - if (valuesp != NULL) - valuesp[EFX_BIST_FAULT_CODE] = - MCDI_OUT_DWORD(req, POLL_BIST_OUT_MRSFP_TEST); - value_mask |= 1 << EFX_BIST_FAULT_CODE; - } - - if (value_maskp != NULL) - *value_maskp = value_mask; - - EFSYS_ASSERT(resultp != NULL); - if (result == MC_CMD_POLL_BIST_RUNNING) - *resultp = EFX_BIST_RESULT_RUNNING; - else if (result == MC_CMD_POLL_BIST_PASSED) - *resultp = EFX_BIST_RESULT_PASSED; - else - *resultp = EFX_BIST_RESULT_FAILED; - - return (0); - -fail2: - EFSYS_PROBE(fail2); -fail1: - EFSYS_PROBE1(fail1, efx_rc_t, rc); - - return (rc); -} - - void -ef10_bist_stop( - __in efx_nic_t *enp, - __in efx_bist_type_t type) -{ - /* There is no way to stop BIST on EF10. */ - _NOTE(ARGUNUSED(enp, type)) -} - -#endif /* EFSYS_OPT_BIST */ - #endif /* EFSYS_OPT_HUNTINGTON */ From owner-svn-src-head@freebsd.org Wed Dec 28 18:04:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3CEFC9590E; Wed, 28 Dec 2016 18:04:19 +0000 (UTC) (envelope-from amdmi3@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B1F6143A; Wed, 28 Dec 2016 18:04:19 +0000 (UTC) (envelope-from amdmi3@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSI4Ib4029398; Wed, 28 Dec 2016 18:04:18 GMT (envelope-from amdmi3@FreeBSD.org) Received: (from amdmi3@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSI4IDF029397; Wed, 28 Dec 2016 18:04:18 GMT (envelope-from amdmi3@FreeBSD.org) Message-Id: <201612281804.uBSI4IDF029397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: amdmi3 set sender to amdmi3@FreeBSD.org using -f From: Dmitry Marakasov Date: Wed, 28 Dec 2016 18:04:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310718 - head/contrib/bzip2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 18:04:19 -0000 Author: amdmi3 (ports committer) Date: Wed Dec 28 18:04:18 2016 New Revision: 310718 URL: https://svnweb.freebsd.org/changeset/base/310718 Log: bzip2 does not exit after showing license as requested with --version or --license as most apps would do, instead it waits for data to compress on stdin. Because of that, if `bzip2 --version' is called, bogus `bzip2: I won't write compressed data to a terminal' error message will be displayed, and checking for bzip2 version in scripts as in bzip2 --version 2>&1 | grep -o "Version [^,]*" will hand as bzip2 would wait for data to compress on stdin. Fix this by exiting right after showing version/license text. I've tried to push this upstream for more than a year, but author is unresponsive, so upstream may be considered dead. Ubuntu applies similar fix, for the note. PR: 199443 Approved by: dim, bapt MFC after: 2 weeks Differential Revision: D8924 Modified: head/contrib/bzip2/bzip2.c Modified: head/contrib/bzip2/bzip2.c ============================================================================== --- head/contrib/bzip2/bzip2.c Wed Dec 28 17:56:03 2016 (r310717) +++ head/contrib/bzip2/bzip2.c Wed Dec 28 18:04:18 2016 (r310718) @@ -1890,7 +1890,9 @@ IntNative main ( IntNative argc, Char *a case '8': blockSize100k = 8; break; case '9': blockSize100k = 9; break; case 'V': - case 'L': license(); break; + case 'L': license(); + exit ( 0 ); + break; case 'v': verbosity++; break; case 'h': usage ( progName ); exit ( 0 ); @@ -1916,8 +1918,8 @@ IntNative main ( IntNative argc, Char *a if (ISFLAG("--keep")) keepInputFiles = True; else if (ISFLAG("--small")) smallMode = True; else if (ISFLAG("--quiet")) noisy = False; else - if (ISFLAG("--version")) license(); else - if (ISFLAG("--license")) license(); else + if (ISFLAG("--version")) { license(); exit ( 0 ); } else + if (ISFLAG("--license")) { license(); exit ( 0 ); } else if (ISFLAG("--exponential")) workFactor = 1; else if (ISFLAG("--repetitive-best")) redundant(aa->name); else if (ISFLAG("--repetitive-fast")) redundant(aa->name); else From owner-svn-src-head@freebsd.org Wed Dec 28 18:07:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76715C95AD2; Wed, 28 Dec 2016 18:07:18 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45E8518B8; Wed, 28 Dec 2016 18:07:18 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSI7H0I029551; Wed, 28 Dec 2016 18:07:17 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSI7HEO029550; Wed, 28 Dec 2016 18:07:17 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612281807.uBSI7HEO029550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 28 Dec 2016 18:07:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310719 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 18:07:18 -0000 Author: arybchik Date: Wed Dec 28 18:07:17 2016 New Revision: 310719 URL: https://svnweb.freebsd.org/changeset/base/310719 Log: sfxge(4): cleanup: remove last use of deprecated function flags with privilege check The function flags were changed to mirror the privileges, but the privileges are preferred. Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8936 Modified: head/sys/dev/sfxge/common/ef10_phy.c Modified: head/sys/dev/sfxge/common/ef10_phy.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_phy.c Wed Dec 28 18:04:18 2016 (r310718) +++ head/sys/dev/sfxge/common/ef10_phy.c Wed Dec 28 18:07:17 2016 (r310719) @@ -278,7 +278,6 @@ fail1: ef10_phy_reconfigure( __in efx_nic_t *enp) { - efx_nic_cfg_t *encp = &(enp->en_nic_cfg); efx_port_t *epp = &(enp->en_port); efx_mcdi_req_t req; uint8_t payload[MAX(MC_CMD_SET_LINK_IN_LEN, @@ -286,9 +285,12 @@ ef10_phy_reconfigure( uint32_t cap_mask; unsigned int led_mode; unsigned int speed; + boolean_t supported; efx_rc_t rc; - if (~encp->enc_func_flags & EFX_NIC_FUNC_LINKCTRL) + if ((rc = efx_mcdi_link_control_supported(enp, &supported)) != 0) + goto fail1; + if (supported == B_FALSE) goto out; (void) memset(payload, 0, sizeof (payload)); @@ -349,7 +351,7 @@ ef10_phy_reconfigure( if (req.emr_rc != 0) { rc = req.emr_rc; - goto fail1; + goto fail2; } /* And set the blink mode */ @@ -385,11 +387,13 @@ ef10_phy_reconfigure( if (req.emr_rc != 0) { rc = req.emr_rc; - goto fail2; + goto fail3; } out: return (0); +fail3: + EFSYS_PROBE(fail3); fail2: EFSYS_PROBE(fail2); fail1: From owner-svn-src-head@freebsd.org Wed Dec 28 18:32:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09E1BC946C1; Wed, 28 Dec 2016 18:32:15 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D89FC1C56; Wed, 28 Dec 2016 18:32:14 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSIWEsZ041096; Wed, 28 Dec 2016 18:32:14 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSIWDIb041093; Wed, 28 Dec 2016 18:32:13 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201612281832.uBSIWDIb041093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Wed, 28 Dec 2016 18:32:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310720 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 18:32:15 -0000 Author: alc Date: Wed Dec 28 18:32:13 2016 New Revision: 310720 URL: https://svnweb.freebsd.org/changeset/base/310720 Log: Relax the object type restrictions on vm_page_alloc_contig(). Specifically, add support for object types that were previously prohibited because they could contain PG_CACHED pages. Roughly halve the number of radix trie operations performed by vm_page_alloc_contig() using the same approach that is employed by vm_page_alloc(). Also, eliminate the radix trie lookup performed with the free page queues lock held. Tidy up the handling of radix trie insert failures in vm_page_alloc() and vm_page_alloc_contig(). Reviewed by: kib, markj Tested by: pho Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8878 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_reserv.c head/sys/vm/vm_reserv.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Dec 28 18:07:17 2016 (r310719) +++ head/sys/vm/vm_page.c Wed Dec 28 18:32:13 2016 (r310720) @@ -1486,13 +1486,12 @@ vm_page_alloc(vm_object_t object, vm_pin vm_page_t m, mpred; int flags, req_class; - mpred = 0; /* XXX: pacify gcc */ + mpred = NULL; /* XXX: pacify gcc */ KASSERT((object != NULL) == ((req & VM_ALLOC_NOOBJ) == 0) && (object != NULL || (req & VM_ALLOC_SBUSY) == 0) && ((req & (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)) != (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)), - ("vm_page_alloc: inconsistent object(%p)/req(%x)", (void *)object, - req)); + ("vm_page_alloc: inconsistent object(%p)/req(%x)", object, req)); if (object != NULL) VM_OBJECT_ASSERT_WLOCKED(object); @@ -1596,10 +1595,11 @@ vm_page_alloc(vm_object_t object, vm_pin atomic_subtract_int(&vm_cnt.v_wire_count, 1); m->wire_count = 0; } - m->object = NULL; + KASSERT(m->object == NULL, ("page %p has object", m)); m->oflags = VPO_UNMANAGED; m->busy_lock = VPB_UNBUSIED; - vm_page_free(m); + /* Don't change PG_ZERO. */ + vm_page_free_toq(m); return (NULL); } @@ -1641,6 +1641,8 @@ vm_page_alloc(vm_object_t object, vm_pin * memory attribute setting for the physical pages cannot be configured * to VM_MEMATTR_DEFAULT. * + * The specified object may not contain fictitious pages. + * * The caller must always specify an allocation class. * * allocation classes: @@ -1664,20 +1666,21 @@ vm_page_alloc_contig(vm_object_t object, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, vm_memattr_t memattr) { - vm_page_t m, m_tmp, m_ret; - u_int flags; + vm_page_t m, m_ret, mpred; + u_int busy_lock, flags, oflags; int req_class; + mpred = NULL; /* XXX: pacify gcc */ KASSERT((object != NULL) == ((req & VM_ALLOC_NOOBJ) == 0) && (object != NULL || (req & VM_ALLOC_SBUSY) == 0) && ((req & (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)) != (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)), - ("vm_page_alloc: inconsistent object(%p)/req(%x)", (void *)object, + ("vm_page_alloc_contig: inconsistent object(%p)/req(%x)", object, req)); if (object != NULL) { VM_OBJECT_ASSERT_WLOCKED(object); - KASSERT(object->type == OBJT_PHYS, - ("vm_page_alloc_contig: object %p isn't OBJT_PHYS", + KASSERT((object->flags & OBJ_FICTITIOUS) == 0, + ("vm_page_alloc_contig: object %p has fictitious pages", object)); } KASSERT(npages > 0, ("vm_page_alloc_contig: npages is zero")); @@ -1689,18 +1692,34 @@ vm_page_alloc_contig(vm_object_t object, if (curproc == pageproc && req_class != VM_ALLOC_INTERRUPT) req_class = VM_ALLOC_SYSTEM; + if (object != NULL) { + mpred = vm_radix_lookup_le(&object->rtree, pindex); + KASSERT(mpred == NULL || mpred->pindex != pindex, + ("vm_page_alloc_contig: pindex already allocated")); + } + + /* + * Can we allocate the pages without the number of free pages falling + * below the lower bound for the allocation class? + */ mtx_lock(&vm_page_queue_free_mtx); if (vm_cnt.v_free_count >= npages + vm_cnt.v_free_reserved || (req_class == VM_ALLOC_SYSTEM && vm_cnt.v_free_count >= npages + vm_cnt.v_interrupt_free_min) || (req_class == VM_ALLOC_INTERRUPT && vm_cnt.v_free_count >= npages)) { + /* + * Can we allocate the pages from a reservation? + */ #if VM_NRESERVLEVEL > 0 retry: if (object == NULL || (object->flags & OBJ_COLORED) == 0 || (m_ret = vm_reserv_alloc_contig(object, pindex, npages, - low, high, alignment, boundary)) == NULL) + low, high, alignment, boundary, mpred)) == NULL) #endif + /* + * If not, allocate them from the free page queues. + */ m_ret = vm_phys_alloc_contig(npages, low, high, alignment, boundary); } else { @@ -1732,6 +1751,13 @@ retry: flags = PG_ZERO; if ((req & VM_ALLOC_NODUMP) != 0) flags |= PG_NODUMP; + oflags = object == NULL || (object->flags & OBJ_UNMANAGED) != 0 ? + VPO_UNMANAGED : 0; + busy_lock = VPB_UNBUSIED; + if ((req & (VM_ALLOC_NOBUSY | VM_ALLOC_NOOBJ | VM_ALLOC_SBUSY)) == 0) + busy_lock = VPB_SINGLE_EXCLUSIVER; + if ((req & VM_ALLOC_SBUSY) != 0) + busy_lock = VPB_SHARERS_WORD(1); if ((req & VM_ALLOC_WIRED) != 0) atomic_add_int(&vm_cnt.v_wire_count, npages); if (object != NULL) { @@ -1742,37 +1768,32 @@ retry: for (m = m_ret; m < &m_ret[npages]; m++) { m->aflags = 0; m->flags = (m->flags | PG_NODUMP) & flags; - m->busy_lock = VPB_UNBUSIED; - if (object != NULL) { - if ((req & (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)) == 0) - m->busy_lock = VPB_SINGLE_EXCLUSIVER; - if ((req & VM_ALLOC_SBUSY) != 0) - m->busy_lock = VPB_SHARERS_WORD(1); - } + m->busy_lock = busy_lock; if ((req & VM_ALLOC_WIRED) != 0) m->wire_count = 1; - /* Unmanaged pages don't use "act_count". */ - m->oflags = VPO_UNMANAGED; + m->act_count = 0; + m->oflags = oflags; if (object != NULL) { - if (vm_page_insert(m, object, pindex)) { - if (vm_paging_needed()) - pagedaemon_wakeup(); + if (vm_page_insert_after(m, object, pindex, mpred)) { + pagedaemon_wakeup(); if ((req & VM_ALLOC_WIRED) != 0) - atomic_subtract_int(&vm_cnt.v_wire_count, - npages); - for (m_tmp = m, m = m_ret; - m < &m_ret[npages]; m++) { - if ((req & VM_ALLOC_WIRED) != 0) + atomic_subtract_int( + &vm_cnt.v_wire_count, npages); + KASSERT(m->object == NULL, + ("page %p has object", m)); + mpred = m; + for (m = m_ret; m < &m_ret[npages]; m++) { + if (m <= mpred && + (req & VM_ALLOC_WIRED) != 0) m->wire_count = 0; - if (m >= m_tmp) { - m->object = NULL; - m->oflags |= VPO_UNMANAGED; - } + m->oflags = VPO_UNMANAGED; m->busy_lock = VPB_UNBUSIED; - vm_page_free(m); + /* Don't change PG_ZERO. */ + vm_page_free_toq(m); } return (NULL); } + mpred = m; } else m->pindex = pindex; if (memattr != VM_MEMATTR_DEFAULT) @@ -1791,6 +1812,7 @@ static void vm_page_alloc_check(vm_page_t m) { + KASSERT(m->object == NULL, ("page %p has object", m)); KASSERT(m->queue == PQ_NONE, ("page %p has unexpected queue %d", m, m->queue)); KASSERT(m->wire_count == 0, ("page %p is wired", m)); Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Wed Dec 28 18:07:17 2016 (r310719) +++ head/sys/vm/vm_reserv.c Wed Dec 28 18:32:13 2016 (r310720) @@ -404,14 +404,18 @@ vm_reserv_populate(vm_reserv_t rv, int i * physical address boundary that is a multiple of that value. Both * "alignment" and "boundary" must be a power of two. * + * The page "mpred" must immediately precede the offset "pindex" within the + * specified object. + * * The object and free page queue must be locked. */ vm_page_t vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t pindex, u_long npages, - vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary) + vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, + vm_page_t mpred) { vm_paddr_t pa, size; - vm_page_t m, m_ret, mpred, msucc; + vm_page_t m, m_ret, msucc; vm_pindex_t first, leftcap, rightcap; vm_reserv_t rv; u_long allocpages, maxpages, minpages; @@ -448,10 +452,11 @@ vm_reserv_alloc_contig(vm_object_t objec /* * Look for an existing reservation. */ - mpred = vm_radix_lookup_le(&object->rtree, pindex); if (mpred != NULL) { + KASSERT(mpred->object == object, + ("vm_reserv_alloc_contig: object doesn't contain mpred")); KASSERT(mpred->pindex < pindex, - ("vm_reserv_alloc_contig: pindex already allocated")); + ("vm_reserv_alloc_contig: mpred doesn't precede pindex")); rv = vm_reserv_from_page(mpred); if (rv->object == object && vm_reserv_has_pindex(rv, pindex)) goto found; @@ -460,7 +465,7 @@ vm_reserv_alloc_contig(vm_object_t objec msucc = TAILQ_FIRST(&object->memq); if (msucc != NULL) { KASSERT(msucc->pindex > pindex, - ("vm_reserv_alloc_contig: pindex already allocated")); + ("vm_reserv_alloc_contig: msucc doesn't succeed pindex")); rv = vm_reserv_from_page(msucc); if (rv->object == object && vm_reserv_has_pindex(rv, pindex)) goto found; Modified: head/sys/vm/vm_reserv.h ============================================================================== --- head/sys/vm/vm_reserv.h Wed Dec 28 18:07:17 2016 (r310719) +++ head/sys/vm/vm_reserv.h Wed Dec 28 18:32:13 2016 (r310720) @@ -47,7 +47,7 @@ */ vm_page_t vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t pindex, u_long npages, vm_paddr_t low, vm_paddr_t high, - u_long alignment, vm_paddr_t boundary); + u_long alignment, vm_paddr_t boundary, vm_page_t mpred); vm_page_t vm_reserv_alloc_page(vm_object_t object, vm_pindex_t pindex, vm_page_t mpred); void vm_reserv_break_all(vm_object_t object); From owner-svn-src-head@freebsd.org Wed Dec 28 18:42:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B12D2C94A65; Wed, 28 Dec 2016 18:42:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80E5E12CC; Wed, 28 Dec 2016 18:42:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSIgh8i045936; Wed, 28 Dec 2016 18:42:43 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSIghfC045935; Wed, 28 Dec 2016 18:42:43 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612281842.uBSIghfC045935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 28 Dec 2016 18:42:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310721 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 18:42:44 -0000 Author: jhb Date: Wed Dec 28 18:42:43 2016 New Revision: 310721 URL: https://svnweb.freebsd.org/changeset/base/310721 Log: Mention T6 and 100GbE in description of cxgbe. MFC after: 3 days Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Wed Dec 28 18:32:13 2016 (r310720) +++ head/sys/conf/NOTES Wed Dec 28 18:42:43 2016 (r310721) @@ -1956,8 +1956,9 @@ device xmphy # XaQti XMAC II # cm: Arcnet SMC COM90c26 / SMC COM90c56 # (and SMC COM90c66 in '56 compatibility mode) adapters. # cxgb: Chelsio T3 based 1GbE/10GbE PCIe Ethernet adapters. -# cxgbe:Chelsio T4 and T5 based 1GbE/10GbE/40GbE PCIe Ethernet adapters. -# cxgbev: Chelsio T4 and T5 based PCIe Virtual Functions. +# cxgbe:Chelsio T4, T5, and T6-based 1GbE/10GbE/40GbE/100GbE PCIe Ethernet +# adapters. +# cxgbev: Chelsio T4, T5, and T6-based PCIe Virtual Functions. # dc: Support for PCI fast ethernet adapters based on the DEC/Intel 21143 # and various workalikes including: # the ADMtek AL981 Comet and AN985 Centaur, the ASIX Electronics @@ -2140,8 +2141,8 @@ device xl # 3Com 3c90x (``Boomerang'', # PCI Ethernet NICs. device cxgb # Chelsio T3 10 Gigabit Ethernet device cxgb_t3fw # Chelsio T3 10 Gigabit Ethernet firmware -device cxgbe # Chelsio T4 and T5 1GbE/10GbE/40GbE -device cxgbev # Chelsio T4 and T5 1GbE/10GbE/40GbE VF +device cxgbe # Chelsio T4, T5, and T6 1GbE/10GbE/40GbE/100GbE +device cxgbev # Chelsio T4, T5, and T6 VF device de # DEC/Intel DC21x4x (``Tulip'') device em # Intel Pro/1000 Gigabit Ethernet device igb # Intel Pro/1000 PCIE Gigabit Ethernet From owner-svn-src-head@freebsd.org Wed Dec 28 19:41:00 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8507C9599A; Wed, 28 Dec 2016 19:41:00 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 775D51E98; Wed, 28 Dec 2016 19:41:00 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSJexkQ066492; Wed, 28 Dec 2016 19:40:59 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSJexhN066491; Wed, 28 Dec 2016 19:40:59 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201612281940.uBSJexhN066491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Wed, 28 Dec 2016 19:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310722 - head/sys/mips/ingenic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 19:41:00 -0000 Author: kan Date: Wed Dec 28 19:40:59 2016 New Revision: 310722 URL: https://svnweb.freebsd.org/changeset/base/310722 Log: Do not use read-modify-write on MSC control register. The register is write-only, so just write only bits we want. Submitted by: jmcneill Modified: head/sys/mips/ingenic/jz4780_mmc.c Modified: head/sys/mips/ingenic/jz4780_mmc.c ============================================================================== --- head/sys/mips/ingenic/jz4780_mmc.c Wed Dec 28 18:42:43 2016 (r310721) +++ head/sys/mips/ingenic/jz4780_mmc.c Wed Dec 28 19:40:59 2016 (r310722) @@ -412,13 +412,9 @@ static int jz4780_mmc_reset(struct jz4780_mmc_softc *sc) { int timeout; - int reg; /* Stop the clock */ - reg = JZ_MMC_READ_4(sc, JZ_MSC_CTRL); - reg &= ~(JZ_CLOCK_CTRL_M); - reg |= JZ_CLOCK_STOP; - JZ_MMC_WRITE_4(sc, JZ_MSC_CTRL, reg); + JZ_MMC_WRITE_4(sc, JZ_MSC_CTRL, JZ_CLOCK_STOP); timeout = 1000; while (--timeout > 0) { @@ -432,9 +428,7 @@ jz4780_mmc_reset(struct jz4780_mmc_softc } /* Reset */ - reg = JZ_MMC_READ_4(sc, JZ_MSC_CTRL); - reg |= JZ_RESET; - JZ_MMC_WRITE_4(sc, JZ_MSC_CTRL, reg); + JZ_MMC_WRITE_4(sc, JZ_MSC_CTRL, JZ_RESET); timeout = 10; while (--timeout > 0) { @@ -647,7 +641,7 @@ jz4780_mmc_request(device_t bus, device_ { struct jz4780_mmc_softc *sc; struct mmc_command *cmd; - uint32_t cmdat, ctrl, iwait; + uint32_t cmdat, iwait; int blksz; sc = device_get_softc(bus); @@ -731,9 +725,7 @@ jz4780_mmc_request(device_t bus, device_ JZ_MMC_WRITE_4(sc, JZ_MSC_CMD, cmd->opcode); JZ_MMC_WRITE_4(sc, JZ_MSC_CMDAT, cmdat); - ctrl = JZ_MMC_READ_4(sc, JZ_MSC_CTRL); - ctrl |= JZ_START_OP | JZ_CLOCK_START; - JZ_MMC_WRITE_4(sc, JZ_MSC_CTRL, ctrl); + JZ_MMC_WRITE_4(sc, JZ_MSC_CTRL, JZ_START_OP | JZ_CLOCK_START); callout_reset(&sc->sc_timeoutc, sc->sc_timeout * hz, jz4780_mmc_timeout, sc); @@ -853,8 +845,7 @@ jz4780_mmc_disable_clock(struct jz4780_m { int timeout; - JZ_MMC_WRITE_4(sc, JZ_MSC_CTRL, - JZ_MMC_READ_4(sc, JZ_MSC_CTRL) | JZ_CLOCK_STOP); + JZ_MMC_WRITE_4(sc, JZ_MSC_CTRL, JZ_CLOCK_STOP); for (timeout = 1000; timeout > 0; timeout--) if ((JZ_MMC_READ_4(sc, JZ_MSC_STAT) & JZ_CLK_EN) == 0) From owner-svn-src-head@freebsd.org Wed Dec 28 21:54:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 434FFC9503E; Wed, 28 Dec 2016 21:54:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DD0B129B; Wed, 28 Dec 2016 21:54:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSLsYWN023464; Wed, 28 Dec 2016 21:54:34 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSLsYBl023462; Wed, 28 Dec 2016 21:54:34 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201612282154.uBSLsYBl023462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 28 Dec 2016 21:54:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310724 - head/contrib/elftoolchain/libdwarf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 21:54:35 -0000 Author: markj Date: Wed Dec 28 21:54:33 2016 New Revision: 310724 URL: https://svnweb.freebsd.org/changeset/base/310724 Log: Follow DW_AT_specification when looking up DW_AT_type attributes. dwarf_attrval_*() will search the parent DIE referenced by a DW_AT_abstract_origin attribute for the value of the DW_AT_type attribute. Do the same thing for the DW_AT_specification attributes in variable definitions emitted by GCC 6.2, and ensure that we return an error rather than crashing if neither DW_AT_abstract_origin or DW_AT_specification is found when looking for the value of the DW_AT_type attribute. PR: 215350, 215395 Reviewed by: emaste MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D8920 Modified: head/contrib/elftoolchain/libdwarf/dwarf_attrval.c head/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 Modified: head/contrib/elftoolchain/libdwarf/dwarf_attrval.c ============================================================================== --- head/contrib/elftoolchain/libdwarf/dwarf_attrval.c Wed Dec 28 21:45:41 2016 (r310723) +++ head/contrib/elftoolchain/libdwarf/dwarf_attrval.c Wed Dec 28 21:54:33 2016 (r310724) @@ -145,6 +145,7 @@ dwarf_attrval_unsigned(Dwarf_Die die, Dw Dwarf_Die die1; Dwarf_Unsigned val; Dwarf_Debug dbg; + int first; dbg = die != NULL ? die->die_dbg : NULL; @@ -155,14 +156,16 @@ dwarf_attrval_unsigned(Dwarf_Die die, Dw *valp = 0; - if ((at = _dwarf_attr_find(die, attr)) == NULL && attr != DW_AT_type) { - DWARF_SET_ERROR(dbg, err, DW_DLE_NO_ENTRY); - return (DW_DLV_NO_ENTRY); - } - die1 = NULL; - if (at == NULL && - (at = _dwarf_attr_find(die, DW_AT_abstract_origin)) != NULL) { + for (;;) { + if ((at = _dwarf_attr_find(die, attr)) != NULL || + attr != DW_AT_type) + break; + if ((at = _dwarf_attr_find(die, DW_AT_abstract_origin)) == + NULL && + (at = _dwarf_attr_find(die, DW_AT_specification)) == NULL) + break; + switch (at->at_form) { case DW_FORM_ref1: case DW_FORM_ref2: @@ -170,13 +173,15 @@ dwarf_attrval_unsigned(Dwarf_Die die, Dw case DW_FORM_ref8: case DW_FORM_ref_udata: val = at->u[0].u64; - if ((die1 = _dwarf_die_find(die, val)) == NULL || - (at = _dwarf_attr_find(die1, attr)) == NULL) { - if (die1 != NULL) - dwarf_dealloc(dbg, die1, DW_DLA_DIE); + first = (die1 == NULL); + die1 = _dwarf_die_find(die, val); + if (!first) + dwarf_dealloc(dbg, die, DW_DLA_DIE); + if (die1 == NULL) { DWARF_SET_ERROR(dbg, err, DW_DLE_NO_ENTRY); return (DW_DLV_NO_ENTRY); } + die = die1; break; default: DWARF_SET_ERROR(dbg, err, DW_DLE_ATTR_FORM_BAD); @@ -184,6 +189,11 @@ dwarf_attrval_unsigned(Dwarf_Die die, Dw } } + if (at == NULL) { + DWARF_SET_ERROR(dbg, err, DW_DLE_NO_ENTRY); + return (DW_DLV_NO_ENTRY); + } + switch (at->at_form) { case DW_FORM_addr: case DW_FORM_data1: Modified: head/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 ============================================================================== --- head/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 Wed Dec 28 21:45:41 2016 (r310723) +++ head/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 Wed Dec 28 21:54:33 2016 (r310724) @@ -24,7 +24,7 @@ .\" .\" $Id: dwarf_attrval_signed.3 2980 2014-01-21 20:15:54Z kaiwang27 $ .\" -.Dd January 18, 2014 +.Dd December 26, 2016 .Os .Dt DWARF_ATTRVAL_SIGNED 3 .Sh NAME @@ -168,17 +168,22 @@ or .Pp If the attribute named by argument .Ar attr -is not present in the debugging information entry referenced by -argument +is +.Dv DW_AT_type +and is not present in the debugging information entry referenced by argument .Ar die , and if a .Dv DW_AT_abstract_origin +or +.Dv DW_AT_specification attribute is present in the debugging information entry, function .Fn dwarf_attrval_unsigned will search for the named attribute in the debugging information entry referenced by the .Dv DW_AT_abstract_origin +or +.Dv DW_AT_specification attribute. .Sh RETURN VALUES On success, these functions returns From owner-svn-src-head@freebsd.org Wed Dec 28 23:02:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39AF7C95D79; Wed, 28 Dec 2016 23:02:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09353136D; Wed, 28 Dec 2016 23:02:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSN21Fs051592; Wed, 28 Dec 2016 23:02:01 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSN21hx051591; Wed, 28 Dec 2016 23:02:01 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612282302.uBSN21hx051591@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 28 Dec 2016 23:02:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310726 - head/sys/boot/i386/cdboot X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 23:02:02 -0000 Author: emaste Date: Wed Dec 28 23:02:01 2016 New Revision: 310726 URL: https://svnweb.freebsd.org/changeset/base/310726 Log: cdboot: add explict suffix to ambiguous or instruction Clang disallows ambiguous instructions (GNU as has a default based on chosen .code setting). We only need 'orb' here because KARGS_FLAGS_PXE fits in a byte; this is the same as done in bxeboot. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8959 Modified: head/sys/boot/i386/cdboot/cdboot.S Modified: head/sys/boot/i386/cdboot/cdboot.S ============================================================================== --- head/sys/boot/i386/cdboot/cdboot.S Wed Dec 28 21:58:20 2016 (r310725) +++ head/sys/boot/i386/cdboot/cdboot.S Wed Dec 28 23:02:01 2016 (r310726) @@ -127,7 +127,7 @@ start: cld # string ops inc stosl # to zero mov drive,%dl # Store BIOS boot device mov %dl,0x4(%bx) # in kargs->bootdev - or $KARGS_FLAGS_CD,0x8(%bx) # kargs->bootflags |= + orb $KARGS_FLAGS_CD,0x8(%bx) # kargs->bootflags |= # KARGS_FLAGS_CD # # Load Volume Descriptor From owner-svn-src-head@freebsd.org Wed Dec 28 23:34:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2824C95522; Wed, 28 Dec 2016 23:34:29 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8A391539; Wed, 28 Dec 2016 23:34:29 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSNYSu5065414; Wed, 28 Dec 2016 23:34:28 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSNYS3n065412; Wed, 28 Dec 2016 23:34:28 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201612282334.uBSNYS3n065412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 28 Dec 2016 23:34:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310727 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 23:34:30 -0000 Author: marius Date: Wed Dec 28 23:34:28 2016 New Revision: 310727 URL: https://svnweb.freebsd.org/changeset/base/310727 Log: Fix a bug in r272840; given that the optlen parameter of setsockopt(2) is a 32-bit socklen_t, do_get3() passes the kernel to access the wrong 32-bit half on big-endian LP64 machines when simply casting the 64-bit size_t optlen to a socklen_t pointer. While at it and given that the intention of do_get3() apparently is to hide/wrap the fact that socket options are used for communication with ipfw(4), change the optlen parameter of do_set3() to be of type size_t and as such more appropriate than uintptr_t, too. MFC after: 3 days Modified: head/sbin/ipfw/ipfw2.c head/sbin/ipfw/ipfw2.h Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Wed Dec 28 23:02:01 2016 (r310726) +++ head/sbin/ipfw/ipfw2.c Wed Dec 28 23:34:28 2016 (r310727) @@ -591,7 +591,7 @@ do_cmd(int optname, void *optval, uintpt * Returns 0 on success or errno otherwise. */ int -do_set3(int optname, ip_fw3_opheader *op3, uintptr_t optlen) +do_set3(int optname, ip_fw3_opheader *op3, size_t optlen) { if (co.test_only) @@ -621,6 +621,7 @@ int do_get3(int optname, ip_fw3_opheader *op3, size_t *optlen) { int error; + socklen_t len; if (co.test_only) return (0); @@ -632,8 +633,9 @@ do_get3(int optname, ip_fw3_opheader *op op3->opcode = optname; - error = getsockopt(ipfw_socket, IPPROTO_IP, IP_FW3, op3, - (socklen_t *)optlen); + len = *optlen; + error = getsockopt(ipfw_socket, IPPROTO_IP, IP_FW3, op3, &len); + *optlen = len; return (error); } Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Wed Dec 28 23:02:01 2016 (r310726) +++ head/sbin/ipfw/ipfw2.h Wed Dec 28 23:34:28 2016 (r310727) @@ -329,7 +329,7 @@ void print_flags_buffer(char *buf, size_ struct _ip_fw3_opheader; int do_cmd(int optname, void *optval, uintptr_t optlen); -int do_set3(int optname, struct _ip_fw3_opheader *op3, uintptr_t optlen); +int do_set3(int optname, struct _ip_fw3_opheader *op3, size_t optlen); int do_get3(int optname, struct _ip_fw3_opheader *op3, size_t *optlen); struct in6_addr; From owner-svn-src-head@freebsd.org Wed Dec 28 23:55:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71262C95932; Wed, 28 Dec 2016 23:55:19 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E1DC1EB8; Wed, 28 Dec 2016 23:55:19 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBSNtIYm073719; Wed, 28 Dec 2016 23:55:18 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBSNtIXQ073717; Wed, 28 Dec 2016 23:55:18 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612282355.uBSNtIXQ073717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 28 Dec 2016 23:55:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310728 - in head: lib/libbsnmp/libbsnmp tools/build/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 23:55:19 -0000 Author: ngie Date: Wed Dec 28 23:55:18 2016 New Revision: 310728 URL: https://svnweb.freebsd.org/changeset/base/310728 Log: Install {asn1,bsnmpagent,bsnmpclient,bsnmplib}.3 as all of the APIs they document Also, alphabetically sort MAN MFC after: 3 days Modified: head/lib/libbsnmp/libbsnmp/Makefile head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/lib/libbsnmp/libbsnmp/Makefile ============================================================================== --- head/lib/libbsnmp/libbsnmp/Makefile Wed Dec 28 23:34:28 2016 (r310727) +++ head/lib/libbsnmp/libbsnmp/Makefile Wed Dec 28 23:55:18 2016 (r310728) @@ -20,7 +20,97 @@ LIBADD= crypto .endif SRCS= asn1.c snmp.c snmpagent.c snmpclient.c snmpcrypto.c support.c -INCS= asn1.h snmp.h snmpagent.h snmpclient.h -MAN= asn1.3 bsnmplib.3 bsnmpclient.3 bsnmpagent.3 +INCS= asn1.h snmp.h snmpagent.h snmpclient.h +MAN= asn1.3 bsnmpagent.3 bsnmpclient.3 bsnmplib.3 + +MLINKS+= asn1.3 asn_append_oid.3 +MLINKS+= asn1.3 asn_commit_header.3 +MLINKS+= asn1.3 asn_compare_oid.3 +MLINKS+= asn1.3 asn_get_counter64_raw.3 +MLINKS+= asn1.3 asn_get_header.3 +MLINKS+= asn1.3 asn_get_integer.3 +MLINKS+= asn1.3 asn_get_integer_raw.3 +MLINKS+= asn1.3 asn_get_ipaddress.3 +MLINKS+= asn1.3 asn_get_ipaddress_raw.3 +MLINKS+= asn1.3 asn_get_null.3 +MLINKS+= asn1.3 asn_get_null_raw.3 +MLINKS+= asn1.3 asn_get_objid.3 +MLINKS+= asn1.3 asn_get_objid_raw.3 +MLINKS+= asn1.3 asn_get_octetstring.3 +MLINKS+= asn1.3 asn_get_octetstring_raw.3 +MLINKS+= asn1.3 asn_get_sequence.3 +MLINKS+= asn1.3 asn_get_timeticks.3 +MLINKS+= asn1.3 asn_get_uint32_raw.3 +MLINKS+= asn1.3 asn_is_suboid.3 +MLINKS+= asn1.3 asn_oid2str.3 +MLINKS+= asn1.3 asn_oid2str_r.3 +MLINKS+= asn1.3 asn_put_counter64.3 +MLINKS+= asn1.3 asn_put_exception.3 +MLINKS+= asn1.3 asn_put_header.3 +MLINKS+= asn1.3 asn_put_integer.3 +MLINKS+= asn1.3 asn_put_ipaddress.3 +MLINKS+= asn1.3 asn_put_null.3 +MLINKS+= asn1.3 asn_put_objid.3 +MLINKS+= asn1.3 asn_put_octetstring.3 +MLINKS+= asn1.3 asn_put_temp_header.3 +MLINKS+= asn1.3 asn_put_timeticks.3 +MLINKS+= asn1.3 asn_put_uint32.3 +MLINKS+= asn1.3 asn_skip.3 +MLINKS+= asn1.3 asn_slice_oid.3 + +MLINKS+= bsnmpagent.3 snmp_debug.3 +MLINKS+= bsnmpagent.3 snmp_dep_commit.3 +MLINKS+= bsnmpagent.3 snmp_dep_finish.3 +MLINKS+= bsnmpagent.3 snmp_dep_lookup.3 +MLINKS+= bsnmpagent.3 snmp_dep_rollback.3 +MLINKS+= bsnmpagent.3 snmp_depop_t.3 +MLINKS+= bsnmpagent.3 snmp_get.3 +MLINKS+= bsnmpagent.3 snmp_getbulk.3 +MLINKS+= bsnmpagent.3 snmp_getnext.3 +MLINKS+= bsnmpagent.3 snmp_init_context.3 +MLINKS+= bsnmpagent.3 snmp_make_errresp.3 +MLINKS+= bsnmpagent.3 snmp_op_t.3 +MLINKS+= bsnmpagent.3 snmp_set.3 +MLINKS+= bsnmpagent.3 snmp_trace.3 +MLINKS+= bsnmpagent.3 tree.3 +MLINKS+= bsnmpagent.3 tree_size.3 + +MLINKS+= bsnmpclient.3 snmp_add_binding.3 +MLINKS+= bsnmpclient.3 snmp_client.3 +MLINKS+= bsnmpclient.3 snmp_close.3 +MLINKS+= bsnmpclient.3 snmp_dialog.3 +MLINKS+= bsnmpclient.3 snmp_discover_engine.3 +MLINKS+= bsnmpclient.3 snmp_oid_append.3 +MLINKS+= bsnmpclient.3 snmp_open.3 +MLINKS+= bsnmpclient.3 snmp_parse_server.3 +MLINKS+= bsnmpclient.3 snmp_pdu_check.3 +MLINKS+= bsnmpclient.3 snmp_pdu_create.3 +MLINKS+= bsnmpclient.3 snmp_pdu_send.3 +MLINKS+= bsnmpclient.3 snmp_receive.3 +MLINKS+= bsnmpclient.3 snmp_send_cb_f.3 +MLINKS+= bsnmpclient.3 snmp_table_cb_f.3 +MLINKS+= bsnmpclient.3 snmp_table_fetch.3 +MLINKS+= bsnmpclient.3 snmp_table_fetch_async.3 +MLINKS+= bsnmpclient.3 snmp_timeout_cb_f.3 +MLINKS+= bsnmpclient.3 snmp_timeout_start_f.3 +MLINKS+= bsnmpclient.3 snmp_timeout_stop_f.3 + +MLINKS+= bsnmplib.3 TRUTH_GET.3 +MLINKS+= bsnmplib.3 TRUTH_MK.3 +MLINKS+= bsnmplib.3 TRUTH_OK.3 +MLINKS+= bsnmplib.3 snmp_calc_keychange.3 +MLINKS+= bsnmplib.3 snmp_get_local_keys.3 +MLINKS+= bsnmplib.3 snmp_passwd_to_keys.3 +MLINKS+= bsnmplib.3 snmp_pdu_decode.3 +MLINKS+= bsnmplib.3 snmp_pdu_decode_header.3 +MLINKS+= bsnmplib.3 snmp_pdu_decode_scoped.3 +MLINKS+= bsnmplib.3 snmp_pdu_decode_secmode.3 +MLINKS+= bsnmplib.3 snmp_pdu_dump.3 +MLINKS+= bsnmplib.3 snmp_pdu_encode.3 +MLINKS+= bsnmplib.3 snmp_pdu_free.3 +MLINKS+= bsnmplib.3 snmp_pdu_init_secparams.3 +MLINKS+= bsnmplib.3 snmp_value_copy.3 +MLINKS+= bsnmplib.3 snmp_value_free.3 +MLINKS+= bsnmplib.3 snmp_value_parse.3 .include Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Wed Dec 28 23:34:28 2016 (r310727) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Wed Dec 28 23:55:18 2016 (r310728) @@ -782,6 +782,95 @@ OLD_FILES+=usr/share/man/man1/bsnmpget.1 OLD_FILES+=usr/share/man/man1/bsnmpset.1.gz OLD_FILES+=usr/share/man/man1/bsnmpwalk.1.gz OLD_FILES+=usr/share/man/man1/gensnmptree.1.gz +# lib/libbsnmp/libbsnmp +OLD_FILES+=usr/share/man/man3/TRUTH_GET.3.gz +OLD_FILES+=usr/share/man/man3/TRUTH_MK.3.gz +OLD_FILES+=usr/share/man/man3/TRUTH_OK.3.gz +OLD_FILES+=usr/share/man/man3/asn1.3.gz +OLD_FILES+=usr/share/man/man3/asn_append_oid.3.gz +OLD_FILES+=usr/share/man/man3/asn_commit_header.3.gz +OLD_FILES+=usr/share/man/man3/asn_compare_oid.3.gz +OLD_FILES+=usr/share/man/man3/asn_get_counter64_raw.3.gz +OLD_FILES+=usr/share/man/man3/asn_get_header.3.gz +OLD_FILES+=usr/share/man/man3/asn_get_integer.3.gz +OLD_FILES+=usr/share/man/man3/asn_get_integer_raw.3.gz +OLD_FILES+=usr/share/man/man3/asn_get_ipaddress.3.gz +OLD_FILES+=usr/share/man/man3/asn_get_ipaddress_raw.3.gz +OLD_FILES+=usr/share/man/man3/asn_get_null.3.gz +OLD_FILES+=usr/share/man/man3/asn_get_null_raw.3.gz +OLD_FILES+=usr/share/man/man3/asn_get_objid.3.gz +OLD_FILES+=usr/share/man/man3/asn_get_objid_raw.3.gz +OLD_FILES+=usr/share/man/man3/asn_get_octetstring.3.gz +OLD_FILES+=usr/share/man/man3/asn_get_octetstring_raw.3.gz +OLD_FILES+=usr/share/man/man3/asn_get_sequence.3.gz +OLD_FILES+=usr/share/man/man3/asn_get_timeticks.3.gz +OLD_FILES+=usr/share/man/man3/asn_get_uint32_raw.3.gz +OLD_FILES+=usr/share/man/man3/asn_is_suboid.3.gz +OLD_FILES+=usr/share/man/man3/asn_oid2str.3.gz +OLD_FILES+=usr/share/man/man3/asn_oid2str_r.3.gz +OLD_FILES+=usr/share/man/man3/asn_put_counter64.3.gz +OLD_FILES+=usr/share/man/man3/asn_put_exception.3.gz +OLD_FILES+=usr/share/man/man3/asn_put_header.3.gz +OLD_FILES+=usr/share/man/man3/asn_put_integer.3.gz +OLD_FILES+=usr/share/man/man3/asn_put_ipaddress.3.gz +OLD_FILES+=usr/share/man/man3/asn_put_null.3.gz +OLD_FILES+=usr/share/man/man3/asn_put_objid.3.gz +OLD_FILES+=usr/share/man/man3/asn_put_octetstring.3.gz +OLD_FILES+=usr/share/man/man3/asn_put_temp_header.3.gz +OLD_FILES+=usr/share/man/man3/asn_put_timeticks.3.gz +OLD_FILES+=usr/share/man/man3/asn_put_uint32.3.gz +OLD_FILES+=usr/share/man/man3/asn_skip.3.gz +OLD_FILES+=usr/share/man/man3/asn_slice_oid.3.gz +OLD_FILES+=usr/share/man/man3/snmp_add_binding.3.gz +OLD_FILES+=usr/share/man/man3/snmp_calc_keychange.3.gz +OLD_FILES+=usr/share/man/man3/snmp_client.3.gz +OLD_FILES+=usr/share/man/man3/snmp_close.3.gz +OLD_FILES+=usr/share/man/man3/snmp_debug.3.gz +OLD_FILES+=usr/share/man/man3/snmp_dep_commit.3.gz +OLD_FILES+=usr/share/man/man3/snmp_dep_finish.3.gz +OLD_FILES+=usr/share/man/man3/snmp_dep_lookup.3.gz +OLD_FILES+=usr/share/man/man3/snmp_dep_rollback.3.gz +OLD_FILES+=usr/share/man/man3/snmp_depop_t.3.gz +OLD_FILES+=usr/share/man/man3/snmp_dialog.3.gz +OLD_FILES+=usr/share/man/man3/snmp_discover_engine.3.gz +OLD_FILES+=usr/share/man/man3/snmp_get.3.gz +OLD_FILES+=usr/share/man/man3/snmp_get_local_keys.3.gz +OLD_FILES+=usr/share/man/man3/snmp_getbulk.3.gz +OLD_FILES+=usr/share/man/man3/snmp_getnext.3.gz +OLD_FILES+=usr/share/man/man3/snmp_init_context.3.gz +OLD_FILES+=usr/share/man/man3/snmp_make_errresp.3.gz +OLD_FILES+=usr/share/man/man3/snmp_oid_append.3.gz +OLD_FILES+=usr/share/man/man3/snmp_op_t.3.gz +OLD_FILES+=usr/share/man/man3/snmp_open.3.gz +OLD_FILES+=usr/share/man/man3/snmp_parse_server.3.gz +OLD_FILES+=usr/share/man/man3/snmp_passwd_to_keys.3.gz +OLD_FILES+=usr/share/man/man3/snmp_pdu_check.3.gz +OLD_FILES+=usr/share/man/man3/snmp_pdu_create.3.gz +OLD_FILES+=usr/share/man/man3/snmp_pdu_decode.3.gz +OLD_FILES+=usr/share/man/man3/snmp_pdu_decode_header.3.gz +OLD_FILES+=usr/share/man/man3/snmp_pdu_decode_scoped.3.gz +OLD_FILES+=usr/share/man/man3/snmp_pdu_decode_secmode.3.gz +OLD_FILES+=usr/share/man/man3/snmp_pdu_dump.3.gz +OLD_FILES+=usr/share/man/man3/snmp_pdu_encode.3.gz +OLD_FILES+=usr/share/man/man3/snmp_pdu_free.3.gz +OLD_FILES+=usr/share/man/man3/snmp_pdu_init_secparams.3.gz +OLD_FILES+=usr/share/man/man3/snmp_pdu_send.3.gz +OLD_FILES+=usr/share/man/man3/snmp_receive.3.gz +OLD_FILES+=usr/share/man/man3/snmp_send_cb_f.3.gz +OLD_FILES+=usr/share/man/man3/snmp_set.3.gz +OLD_FILES+=usr/share/man/man3/snmp_table_cb_f.3.gz +OLD_FILES+=usr/share/man/man3/snmp_table_fetch.3.gz +OLD_FILES+=usr/share/man/man3/snmp_table_fetch_async.3.gz +OLD_FILES+=usr/share/man/man3/snmp_timeout_cb_f.3.gz +OLD_FILES+=usr/share/man/man3/snmp_timeout_start_f.3.gz +OLD_FILES+=usr/share/man/man3/snmp_timeout_stop_f.3.gz +OLD_FILES+=usr/share/man/man3/snmp_trace.3.gz +OLD_FILES+=usr/share/man/man3/snmp_value_copy.3.gz +OLD_FILES+=usr/share/man/man3/snmp_value_free.3.gz +OLD_FILES+=usr/share/man/man3/snmp_value_parse.3.gz +OLD_FILES+=usr/share/man/man3/tree.3.gz +OLD_FILES+=usr/share/man/man3/tree_size.3.gz +# usr.sbin/bsnmpd/bsnmpd OLD_FILES+=usr/share/man/man3/FIND_OBJECT_INT.3.gz OLD_FILES+=usr/share/man/man3/FIND_OBJECT_INT_LINK.3.gz OLD_FILES+=usr/share/man/man3/FIND_OBJECT_INT_LINK_INDEX.3.gz From owner-svn-src-head@freebsd.org Thu Dec 29 00:20:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 844EDC940F2; Thu, 29 Dec 2016 00:20:04 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53DB01973; Thu, 29 Dec 2016 00:20:04 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT0K3nO082222; Thu, 29 Dec 2016 00:20:03 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT0K31s082221; Thu, 29 Dec 2016 00:20:03 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612290020.uBT0K31s082221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Thu, 29 Dec 2016 00:20:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310729 - head/contrib/bsnmp/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 00:20:04 -0000 Author: ngie Date: Thu Dec 29 00:20:03 2016 New Revision: 310729 URL: https://svnweb.freebsd.org/changeset/base/310729 Log: Prevent improper memory accesses after calling snmp_pdu_free and snmp_value_free snmp_pdu_free: set pdu->nbindings to 0 to limit the damage that could happen if a pdu was reused after calling the function, and as both stack and heap allocation types are used in contrib/bsnmp and usr.sbin/bsnmpd. snmp_value_free: NULL out value->v.octetstring.octets after calling free on it to prevent a double-free from occurring. MFC after: 2 weeks Modified: head/contrib/bsnmp/lib/snmp.c Modified: head/contrib/bsnmp/lib/snmp.c ============================================================================== --- head/contrib/bsnmp/lib/snmp.c Wed Dec 28 23:55:18 2016 (r310728) +++ head/contrib/bsnmp/lib/snmp.c Thu Dec 29 00:20:03 2016 (r310729) @@ -1154,8 +1154,11 @@ snmp_pdu_dump(const struct snmp_pdu *pdu void snmp_value_free(struct snmp_value *value) { - if (value->syntax == SNMP_SYNTAX_OCTETSTRING) + + if (value->syntax == SNMP_SYNTAX_OCTETSTRING) { free(value->v.octetstring.octets); + value->v.octetstring.octets = NULL; + } value->syntax = SNMP_SYNTAX_NULL; } @@ -1216,6 +1219,7 @@ snmp_pdu_free(struct snmp_pdu *pdu) for (i = 0; i < pdu->nbindings; i++) snmp_value_free(&pdu->bindings[i]); + pdu->nbindings = 0; } /* From owner-svn-src-head@freebsd.org Thu Dec 29 01:11:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF9EDC9429A; Thu, 29 Dec 2016 01:11:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9EA531ABF; Thu, 29 Dec 2016 01:11:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT1BvB3004174; Thu, 29 Dec 2016 01:11:57 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT1Bv5A004173; Thu, 29 Dec 2016 01:11:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612290111.uBT1Bv5A004173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 29 Dec 2016 01:11:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310734 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 01:11:58 -0000 Author: jhb Date: Thu Dec 29 01:11:57 2016 New Revision: 310734 URL: https://svnweb.freebsd.org/changeset/base/310734 Log: Note that the Chelsio T6 also supports 25Gbps. To avoid overflowing 80 columns, condense the cxgbe description a bit. Reviewed by: np Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Thu Dec 29 00:26:27 2016 (r310733) +++ head/sys/conf/NOTES Thu Dec 29 01:11:57 2016 (r310734) @@ -1956,7 +1956,7 @@ device xmphy # XaQti XMAC II # cm: Arcnet SMC COM90c26 / SMC COM90c56 # (and SMC COM90c66 in '56 compatibility mode) adapters. # cxgb: Chelsio T3 based 1GbE/10GbE PCIe Ethernet adapters. -# cxgbe:Chelsio T4, T5, and T6-based 1GbE/10GbE/40GbE/100GbE PCIe Ethernet +# cxgbe:Chelsio T4, T5, and T6-based 1/10/25/40/100GbE PCIe Ethernet # adapters. # cxgbev: Chelsio T4, T5, and T6-based PCIe Virtual Functions. # dc: Support for PCI fast ethernet adapters based on the DEC/Intel 21143 @@ -2141,8 +2141,8 @@ device xl # 3Com 3c90x (``Boomerang'', # PCI Ethernet NICs. device cxgb # Chelsio T3 10 Gigabit Ethernet device cxgb_t3fw # Chelsio T3 10 Gigabit Ethernet firmware -device cxgbe # Chelsio T4, T5, and T6 1GbE/10GbE/40GbE/100GbE -device cxgbev # Chelsio T4, T5, and T6 VF +device cxgbe # Chelsio T4-T6 1/10/25/40/100 Gigabit Ethernet +device cxgbev # Chelsio T4-T6 Virtual Functions device de # DEC/Intel DC21x4x (``Tulip'') device em # Intel Pro/1000 Gigabit Ethernet device igb # Intel Pro/1000 PCIE Gigabit Ethernet From owner-svn-src-head@freebsd.org Thu Dec 29 03:03:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92B50C95D22; Thu, 29 Dec 2016 03:03:55 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2A5CD19B4; Thu, 29 Dec 2016 03:03:55 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wm0-x243.google.com with SMTP id u144so64499037wmu.0; Wed, 28 Dec 2016 19:03:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=nL2KhsHkudqs6EyniD5I2TXaec8PZoclf2/I711zZRU=; b=j9wwgD27yB3cCK0xfOjrqwVEg9Yml75RaIYF1j6OmNP+Og/g8eJ1/vRPO0Lyc137FV LQcxR9KkEpRL7AgIb/7dThXQD2038p7mvFhTRKXAPVKDUtZdmTAfonv51Ml+CX0QOtO6 wOlWNduMax4ny+B9AJk2082PrlfC15vFj3JCUEJOBCI7dRxwcuZ3VS4iVeHqYCUUEfZv dyRz8JrV7E2rNO9xfzpQHZjmp3SyJjjdra6Fcq8nGsCqIiQOaAN3Mreb/jy+HBfS3AZO tsCqJuJnTxHMHY3R3pju30d/VmOb+XU5Bs4S5vsN8lfkooHzvEPC5WtMGdS10CJNFRAN 3RVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=nL2KhsHkudqs6EyniD5I2TXaec8PZoclf2/I711zZRU=; b=IX4qCml6AeZJWXdTejw5pJJw62WkjUqRoWOTL6S/W56NLRSYh1yDNb1D6beuRamEU8 9ggOXKq2FQx/EUugwpSlBpfJl8a79r3U3kGhApV/cdb7Lc/7yiUpaedE1KS7SAYwlP3L YmnlOqv7xz0hWDOFAK+HL6GXs/glQ5IedO7c6lVcTBsnMjIEPLEBrWeMl5VKiTTSwkZX k9gcLgeKrbvn+zCtss4BzySr+TGindXHmG8R6kOk5UqRsZMl6fJQy/nvb2tdub0Uan8o jQZ/Kj5AWCD2V6TF5uXJfwmh5EaKsYu/8Wr0L8qT9FzN8vL5d03/psaT5R/D4ec4Bl5k bXRQ== X-Gm-Message-State: AIkVDXJbaTMH9FIZR7KgrZU8vpOV96ZiYrUjnJrfdN9vf84gUM0ouqoP09gDEZdIVmPvIRInyXNFERUbZrYe8g== X-Received: by 10.28.185.78 with SMTP id j75mr35625190wmf.14.1482980632929; Wed, 28 Dec 2016 19:03:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.44.1 with HTTP; Wed, 28 Dec 2016 19:03:52 -0800 (PST) In-Reply-To: <201612182056.uBIKuElT070792@repo.freebsd.org> References: <201612182056.uBIKuElT070792@repo.freebsd.org> From: Adrian Chadd Date: Wed, 28 Dec 2016 19:03:52 -0800 Message-ID: Subject: Re: svn commit: r310234 - head/sys/vm To: Konstantin Belousov Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 03:03:55 -0000 hi, I've bisected a boot failure on mips24k (carambola2) to this commit. Nothing useful is printed - it hangs at startup time. Any ideas? -adrian On 18 December 2016 at 12:56, Konstantin Belousov wrote: > Author: kib > Date: Sun Dec 18 20:56:14 2016 > New Revision: 310234 > URL: https://svnweb.freebsd.org/changeset/base/310234 > > Log: > Improve vm_object_scan_all_shadowed() to also check swap backing objects. > > As noted in the removed comment, it is possible and not prohibitively > costly to look up the swap blocks for the given page index. Implement > a swap_pager_find_least() function to do that, and use it to iterate > simultaneously over both backing object page queue and swap > allocations when looking for shadowed pages. > > Testing shows that number of new succesful scans, enabled by this > addition, is small but non-zero. When worked out, the change both > further reduces the depth of the shadow object chain, and frees unused > but allocated swap and memory. > > Suggested and reviewed by: alc > Tested by: pho (previous version) > Sponsored by: The FreeBSD Foundation > MFC after: 2 weeks > > Modified: > head/sys/vm/swap_pager.c > head/sys/vm/swap_pager.h > head/sys/vm/vm_object.c > > Modified: head/sys/vm/swap_pager.c > ============================================================================== > --- head/sys/vm/swap_pager.c Sun Dec 18 20:40:22 2016 (r310233) > +++ head/sys/vm/swap_pager.c Sun Dec 18 20:56:14 2016 (r310234) > @@ -2013,6 +2013,44 @@ swp_pager_meta_ctl(vm_object_t object, v > } > > /* > + * Returns the least page index which is greater than or equal to the > + * parameter pindex and for which there is a swap block allocated. > + * Returns object's size if the object's type is not swap or if there > + * are no allocated swap blocks for the object after the requested > + * pindex. > + */ > +vm_pindex_t > +swap_pager_find_least(vm_object_t object, vm_pindex_t pindex) > +{ > + struct swblock **pswap, *swap; > + vm_pindex_t i, j, lim; > + int idx; > + > + VM_OBJECT_ASSERT_LOCKED(object); > + if (object->type != OBJT_SWAP || object->un_pager.swp.swp_bcount == 0) > + return (object->size); > + > + mtx_lock(&swhash_mtx); > + for (j = pindex; j < object->size; j = lim) { > + pswap = swp_pager_hash(object, j); > + lim = rounddown2(j + SWAP_META_PAGES, SWAP_META_PAGES); > + if (lim > object->size) > + lim = object->size; > + if ((swap = *pswap) != NULL) { > + for (idx = j & SWAP_META_MASK, i = j; i < lim; > + i++, idx++) { > + if (swap->swb_pages[idx] != SWAPBLK_NONE) > + goto found; > + } > + } > + } > + i = object->size; > +found: > + mtx_unlock(&swhash_mtx); > + return (i); > +} > + > +/* > * System call swapon(name) enables swapping on device name, > * which must be in the swdevsw. Return EBUSY > * if already swapping on this device. > > Modified: head/sys/vm/swap_pager.h > ============================================================================== > --- head/sys/vm/swap_pager.h Sun Dec 18 20:40:22 2016 (r310233) > +++ head/sys/vm/swap_pager.h Sun Dec 18 20:56:14 2016 (r310234) > @@ -79,6 +79,7 @@ extern int swap_pager_avail; > struct xswdev; > int swap_dev_info(int name, struct xswdev *xs, char *devname, size_t len); > void swap_pager_copy(vm_object_t, vm_object_t, vm_pindex_t, int); > +vm_pindex_t swap_pager_find_least(vm_object_t object, vm_pindex_t pindex); > void swap_pager_freespace(vm_object_t, vm_pindex_t, vm_size_t); > void swap_pager_swap_init(void); > int swap_pager_isswapped(vm_object_t, struct swdevt *); > > Modified: head/sys/vm/vm_object.c > ============================================================================== > --- head/sys/vm/vm_object.c Sun Dec 18 20:40:22 2016 (r310233) > +++ head/sys/vm/vm_object.c Sun Dec 18 20:56:14 2016 (r310234) > @@ -1436,36 +1436,40 @@ vm_object_scan_all_shadowed(vm_object_t > { > vm_object_t backing_object; > vm_page_t p, pp; > - vm_pindex_t backing_offset_index, new_pindex; > + vm_pindex_t backing_offset_index, new_pindex, pi, ps; > > VM_OBJECT_ASSERT_WLOCKED(object); > VM_OBJECT_ASSERT_WLOCKED(object->backing_object); > > backing_object = object->backing_object; > > - /* > - * Initial conditions: > - * > - * We do not want to have to test for the existence of swap > - * pages in the backing object. XXX but with the new swapper this > - * would be pretty easy to do. > - */ > - if (backing_object->type != OBJT_DEFAULT) > + if (backing_object->type != OBJT_DEFAULT && > + backing_object->type != OBJT_SWAP) > return (false); > > - backing_offset_index = OFF_TO_IDX(object->backing_object_offset); > + pi = backing_offset_index = OFF_TO_IDX(object->backing_object_offset); > + p = vm_page_find_least(backing_object, pi); > + ps = swap_pager_find_least(backing_object, pi); > > - for (p = TAILQ_FIRST(&backing_object->memq); p != NULL; > - p = TAILQ_NEXT(p, listq)) { > - new_pindex = p->pindex - backing_offset_index; > + /* > + * Only check pages inside the parent object's range and > + * inside the parent object's mapping of the backing object. > + */ > + for (;; pi++) { > + if (p != NULL && p->pindex < pi) > + p = TAILQ_NEXT(p, listq); > + if (ps < pi) > + ps = swap_pager_find_least(backing_object, pi); > + if (p == NULL && ps >= backing_object->size) > + break; > + else if (p == NULL) > + pi = ps; > + else > + pi = MIN(p->pindex, ps); > > - /* > - * Ignore pages outside the parent object's range and outside > - * the parent object's mapping of the backing object. > - */ > - if (p->pindex < backing_offset_index || > - new_pindex >= object->size) > - continue; > + new_pindex = pi - backing_offset_index; > + if (new_pindex >= object->size) > + break; > > /* > * See if the parent has the page or if the parent's object > From owner-svn-src-head@freebsd.org Thu Dec 29 06:46:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 244F8C9550E; Thu, 29 Dec 2016 06:46:22 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E7D8D1079; Thu, 29 Dec 2016 06:46:21 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT6kLnT045830; Thu, 29 Dec 2016 06:46:21 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT6kLfk045829; Thu, 29 Dec 2016 06:46:21 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290646.uBT6kLfk045829@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 06:46:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310741 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 06:46:22 -0000 Author: arybchik Date: Thu Dec 29 06:46:20 2016 New Revision: 310741 URL: https://svnweb.freebsd.org/changeset/base/310741 Log: sfxge(4): fix misuse of siena_build_filter in common code Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8937 Modified: head/sys/dev/sfxge/common/efx_filter.c Modified: head/sys/dev/sfxge/common/efx_filter.c ============================================================================== --- head/sys/dev/sfxge/common/efx_filter.c Thu Dec 29 06:45:36 2016 (r310740) +++ head/sys/dev/sfxge/common/efx_filter.c Thu Dec 29 06:46:20 2016 (r310741) @@ -1179,6 +1179,7 @@ siena_filter_restore( efx_oword_t filter; int filter_idx; int state; + uint32_t key; efx_rc_t rc; EFSYS_LOCK(enp->en_eslp, state); @@ -1192,8 +1193,10 @@ siena_filter_restore( continue; spec = &sftp->sft_spec[filter_idx]; - if ((rc = siena_filter_build(&filter, spec)) != 0) + if ((key = siena_filter_build(&filter, spec)) == 0) { + rc = EINVAL; goto fail1; + } if ((rc = siena_filter_push_entry(enp, spec->sfs_type, filter_idx, &filter)) != 0) goto fail2; From owner-svn-src-head@freebsd.org Thu Dec 29 06:47:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59F9FC95594; Thu, 29 Dec 2016 06:47:54 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 296F51211; Thu, 29 Dec 2016 06:47:54 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT6lrRX045948; Thu, 29 Dec 2016 06:47:53 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT6lrUt045947; Thu, 29 Dec 2016 06:47:53 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290647.uBT6lrUt045947@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 06:47:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310742 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 06:47:54 -0000 Author: arybchik Date: Thu Dec 29 06:47:53 2016 New Revision: 310742 URL: https://svnweb.freebsd.org/changeset/base/310742 Log: sfxge(4): fix common code for non-Siena builds Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8938 Modified: head/sys/dev/sfxge/common/efx.h Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Thu Dec 29 06:46:20 2016 (r310741) +++ head/sys/dev/sfxge/common/efx.h Thu Dec 29 06:47:53 2016 (r310742) @@ -1105,18 +1105,16 @@ typedef struct efx_nic_cfg_s { #if EFSYS_OPT_PHY_STATS uint64_t enc_phy_stat_mask; #endif /* EFSYS_OPT_PHY_STATS */ -#if EFSYS_OPT_SIENA +#if EFSYS_OPT_MCDI uint8_t enc_mcdi_mdio_channel; #if EFSYS_OPT_PHY_STATS uint32_t enc_mcdi_phy_stat_mask; #endif /* EFSYS_OPT_PHY_STATS */ -#endif /* EFSYS_OPT_SIENA */ -#if (EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) #if EFSYS_OPT_MON_STATS uint32_t *enc_mcdi_sensor_maskp; uint32_t enc_mcdi_sensor_mask_size; #endif /* EFSYS_OPT_MON_STATS */ -#endif /* (EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */ +#endif /* EFSYS_OPT_MCDI */ #if EFSYS_OPT_BIST uint32_t enc_bist_mask; #endif /* EFSYS_OPT_BIST */ From owner-svn-src-head@freebsd.org Thu Dec 29 06:49:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C996C956C6; Thu, 29 Dec 2016 06:49:33 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 764B215A8; Thu, 29 Dec 2016 06:49:33 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT6nWlx046112; Thu, 29 Dec 2016 06:49:32 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT6nW2k046111; Thu, 29 Dec 2016 06:49:32 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290649.uBT6nW2k046111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 06:49:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310744 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 06:49:33 -0000 Author: arybchik Date: Thu Dec 29 06:49:32 2016 New Revision: 310744 URL: https://svnweb.freebsd.org/changeset/base/310744 Log: sfxge(4): fix efx_ev_qpoll for non-Siena builds Both Siena and EF10 use the siena_ev_qpoll() implementation, but this function is not defined in builds without EFSYS_OPT_SIENA. Remove siena_ev_qpoll and inline it into efx_ev_qpoll to allow it to be used in non-Siena builds. Also remove outdated FIXME comment, as EF10 event batching/merging has been implemented long ago without needing to modify this code. Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8939 Modified: head/sys/dev/sfxge/common/efx_ev.c Modified: head/sys/dev/sfxge/common/efx_ev.c ============================================================================== --- head/sys/dev/sfxge/common/efx_ev.c Thu Dec 29 06:48:10 2016 (r310743) +++ head/sys/dev/sfxge/common/efx_ev.c Thu Dec 29 06:49:32 2016 (r310744) @@ -84,13 +84,6 @@ siena_ev_qprime( __in unsigned int count); static void -siena_ev_qpoll( - __in efx_evq_t *eep, - __inout unsigned int *countp, - __in const efx_ev_callbacks_t *eecp, - __in_opt void *arg); - -static void siena_ev_qpost( __in efx_evq_t *eep, __in uint16_t data); @@ -362,6 +355,8 @@ efx_ev_qprefetch( #endif /* EFSYS_OPT_EV_PREFETCH */ +#define EFX_EV_BATCH 8 + void efx_ev_qpoll( __in efx_evq_t *eep, @@ -369,14 +364,14 @@ efx_ev_qpoll( __in const efx_ev_callbacks_t *eecp, __in_opt void *arg) { - EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC); + efx_qword_t ev[EFX_EV_BATCH]; + unsigned int batch; + unsigned int total; + unsigned int count; + unsigned int index; + size_t offset; - /* - * FIXME: Huntington will require support for hardware event batching - * and merging, which will need a different ev_qpoll implementation. - * - * Without those features the Falcon/Siena code can be used unchanged. - */ + /* Ensure events codes match for EF10 (Huntington/Medford) and Siena */ EFX_STATIC_ASSERT(ESF_DZ_EV_CODE_LBN == FSF_AZ_EV_CODE_LBN); EFX_STATIC_ASSERT(ESF_DZ_EV_CODE_WIDTH == FSF_AZ_EV_CODE_WIDTH); @@ -389,7 +384,125 @@ efx_ev_qpoll( EFX_STATIC_ASSERT(ESE_DZ_EV_CODE_MCDI_EV == FSE_AZ_EV_CODE_MCDI_EVRESPONSE); #endif - siena_ev_qpoll(eep, countp, eecp, arg); + + EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC); + EFSYS_ASSERT(countp != NULL); + EFSYS_ASSERT(eecp != NULL); + + count = *countp; + do { + /* Read up until the end of the batch period */ + batch = EFX_EV_BATCH - (count & (EFX_EV_BATCH - 1)); + offset = (count & eep->ee_mask) * sizeof (efx_qword_t); + for (total = 0; total < batch; ++total) { + EFSYS_MEM_READQ(eep->ee_esmp, offset, &(ev[total])); + + if (!EFX_EV_PRESENT(ev[total])) + break; + + EFSYS_PROBE3(event, unsigned int, eep->ee_index, + uint32_t, EFX_QWORD_FIELD(ev[total], EFX_DWORD_1), + uint32_t, EFX_QWORD_FIELD(ev[total], EFX_DWORD_0)); + + offset += sizeof (efx_qword_t); + } + +#if EFSYS_OPT_EV_PREFETCH && (EFSYS_OPT_EV_PREFETCH_PERIOD > 1) + /* + * Prefetch the next batch when we get within PREFETCH_PERIOD + * of a completed batch. If the batch is smaller, then prefetch + * immediately. + */ + if (total == batch && total < EFSYS_OPT_EV_PREFETCH_PERIOD) + EFSYS_MEM_PREFETCH(eep->ee_esmp, offset); +#endif /* EFSYS_OPT_EV_PREFETCH */ + + /* Process the batch of events */ + for (index = 0; index < total; ++index) { + boolean_t should_abort; + uint32_t code; + +#if EFSYS_OPT_EV_PREFETCH + /* Prefetch if we've now reached the batch period */ + if (total == batch && + index + EFSYS_OPT_EV_PREFETCH_PERIOD == total) { + offset = (count + batch) & eep->ee_mask; + offset *= sizeof (efx_qword_t); + + EFSYS_MEM_PREFETCH(eep->ee_esmp, offset); + } +#endif /* EFSYS_OPT_EV_PREFETCH */ + + EFX_EV_QSTAT_INCR(eep, EV_ALL); + + code = EFX_QWORD_FIELD(ev[index], FSF_AZ_EV_CODE); + switch (code) { + case FSE_AZ_EV_CODE_RX_EV: + should_abort = eep->ee_rx(eep, + &(ev[index]), eecp, arg); + break; + case FSE_AZ_EV_CODE_TX_EV: + should_abort = eep->ee_tx(eep, + &(ev[index]), eecp, arg); + break; + case FSE_AZ_EV_CODE_DRIVER_EV: + should_abort = eep->ee_driver(eep, + &(ev[index]), eecp, arg); + break; + case FSE_AZ_EV_CODE_DRV_GEN_EV: + should_abort = eep->ee_drv_gen(eep, + &(ev[index]), eecp, arg); + break; +#if EFSYS_OPT_MCDI + case FSE_AZ_EV_CODE_MCDI_EVRESPONSE: + should_abort = eep->ee_mcdi(eep, + &(ev[index]), eecp, arg); + break; +#endif + case FSE_AZ_EV_CODE_GLOBAL_EV: + if (eep->ee_global) { + should_abort = eep->ee_global(eep, + &(ev[index]), eecp, arg); + break; + } + /* else fallthrough */ + default: + EFSYS_PROBE3(bad_event, + unsigned int, eep->ee_index, + uint32_t, + EFX_QWORD_FIELD(ev[index], EFX_DWORD_1), + uint32_t, + EFX_QWORD_FIELD(ev[index], EFX_DWORD_0)); + + EFSYS_ASSERT(eecp->eec_exception != NULL); + (void) eecp->eec_exception(arg, + EFX_EXCEPTION_EV_ERROR, code); + should_abort = B_TRUE; + } + if (should_abort) { + /* Ignore subsequent events */ + total = index + 1; + break; + } + } + + /* + * Now that the hardware has most likely moved onto dma'ing + * into the next cache line, clear the processed events. Take + * care to only clear out events that we've processed + */ + EFX_SET_QWORD(ev[0]); + offset = (count & eep->ee_mask) * sizeof (efx_qword_t); + for (index = 0; index < total; ++index) { + EFSYS_MEM_WRITEQ(eep->ee_esmp, offset, &(ev[0])); + offset += sizeof (efx_qword_t); + } + + count += total; + + } while (total == batch); + + *countp = count; } void @@ -1072,141 +1185,6 @@ siena_ev_qprime( return (0); } -#define EFX_EV_BATCH 8 - -static void -siena_ev_qpoll( - __in efx_evq_t *eep, - __inout unsigned int *countp, - __in const efx_ev_callbacks_t *eecp, - __in_opt void *arg) -{ - efx_qword_t ev[EFX_EV_BATCH]; - unsigned int batch; - unsigned int total; - unsigned int count; - unsigned int index; - size_t offset; - - EFSYS_ASSERT(countp != NULL); - EFSYS_ASSERT(eecp != NULL); - - count = *countp; - do { - /* Read up until the end of the batch period */ - batch = EFX_EV_BATCH - (count & (EFX_EV_BATCH - 1)); - offset = (count & eep->ee_mask) * sizeof (efx_qword_t); - for (total = 0; total < batch; ++total) { - EFSYS_MEM_READQ(eep->ee_esmp, offset, &(ev[total])); - - if (!EFX_EV_PRESENT(ev[total])) - break; - - EFSYS_PROBE3(event, unsigned int, eep->ee_index, - uint32_t, EFX_QWORD_FIELD(ev[total], EFX_DWORD_1), - uint32_t, EFX_QWORD_FIELD(ev[total], EFX_DWORD_0)); - - offset += sizeof (efx_qword_t); - } - -#if EFSYS_OPT_EV_PREFETCH && (EFSYS_OPT_EV_PREFETCH_PERIOD > 1) - /* - * Prefetch the next batch when we get within PREFETCH_PERIOD - * of a completed batch. If the batch is smaller, then prefetch - * immediately. - */ - if (total == batch && total < EFSYS_OPT_EV_PREFETCH_PERIOD) - EFSYS_MEM_PREFETCH(eep->ee_esmp, offset); -#endif /* EFSYS_OPT_EV_PREFETCH */ - - /* Process the batch of events */ - for (index = 0; index < total; ++index) { - boolean_t should_abort; - uint32_t code; - -#if EFSYS_OPT_EV_PREFETCH - /* Prefetch if we've now reached the batch period */ - if (total == batch && - index + EFSYS_OPT_EV_PREFETCH_PERIOD == total) { - offset = (count + batch) & eep->ee_mask; - offset *= sizeof (efx_qword_t); - - EFSYS_MEM_PREFETCH(eep->ee_esmp, offset); - } -#endif /* EFSYS_OPT_EV_PREFETCH */ - - EFX_EV_QSTAT_INCR(eep, EV_ALL); - - code = EFX_QWORD_FIELD(ev[index], FSF_AZ_EV_CODE); - switch (code) { - case FSE_AZ_EV_CODE_RX_EV: - should_abort = eep->ee_rx(eep, - &(ev[index]), eecp, arg); - break; - case FSE_AZ_EV_CODE_TX_EV: - should_abort = eep->ee_tx(eep, - &(ev[index]), eecp, arg); - break; - case FSE_AZ_EV_CODE_DRIVER_EV: - should_abort = eep->ee_driver(eep, - &(ev[index]), eecp, arg); - break; - case FSE_AZ_EV_CODE_DRV_GEN_EV: - should_abort = eep->ee_drv_gen(eep, - &(ev[index]), eecp, arg); - break; -#if EFSYS_OPT_MCDI - case FSE_AZ_EV_CODE_MCDI_EVRESPONSE: - should_abort = eep->ee_mcdi(eep, - &(ev[index]), eecp, arg); - break; -#endif - case FSE_AZ_EV_CODE_GLOBAL_EV: - if (eep->ee_global) { - should_abort = eep->ee_global(eep, - &(ev[index]), eecp, arg); - break; - } - /* else fallthrough */ - default: - EFSYS_PROBE3(bad_event, - unsigned int, eep->ee_index, - uint32_t, - EFX_QWORD_FIELD(ev[index], EFX_DWORD_1), - uint32_t, - EFX_QWORD_FIELD(ev[index], EFX_DWORD_0)); - - EFSYS_ASSERT(eecp->eec_exception != NULL); - (void) eecp->eec_exception(arg, - EFX_EXCEPTION_EV_ERROR, code); - should_abort = B_TRUE; - } - if (should_abort) { - /* Ignore subsequent events */ - total = index + 1; - break; - } - } - - /* - * Now that the hardware has most likely moved onto dma'ing - * into the next cache line, clear the processed events. Take - * care to only clear out events that we've processed - */ - EFX_SET_QWORD(ev[0]); - offset = (count & eep->ee_mask) * sizeof (efx_qword_t); - for (index = 0; index < total; ++index) { - EFSYS_MEM_WRITEQ(eep->ee_esmp, offset, &(ev[0])); - offset += sizeof (efx_qword_t); - } - - count += total; - - } while (total == batch); - - *countp = count; -} - static void siena_ev_qpost( __in efx_evq_t *eep, From owner-svn-src-head@freebsd.org Thu Dec 29 06:51:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2361CC958A6; Thu, 29 Dec 2016 06:51:08 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F261A18C8; Thu, 29 Dec 2016 06:51:07 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT6p7fJ046245; Thu, 29 Dec 2016 06:51:07 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT6p6Q3046242; Thu, 29 Dec 2016 06:51:06 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290651.uBT6p6Q3046242@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 06:51:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310745 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 06:51:08 -0000 Author: arybchik Date: Thu Dec 29 06:51:06 2016 New Revision: 310745 URL: https://svnweb.freebsd.org/changeset/base/310745 Log: sfxge(4): make the common code retrieve the number of FATSOv2 contexts Submitted by: Ivan Malov Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8940 Modified: head/sys/dev/sfxge/common/ef10_nic.c head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/siena_nic.c Modified: head/sys/dev/sfxge/common/ef10_nic.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_nic.c Thu Dec 29 06:49:32 2016 (r310744) +++ head/sys/dev/sfxge/common/ef10_nic.c Thu Dec 29 06:51:06 2016 (r310745) @@ -497,7 +497,8 @@ static __checkReturn efx_rc_t efx_mcdi_get_capabilities( __in efx_nic_t *enp, __out uint32_t *flagsp, - __out uint32_t *flags2p) + __out uint32_t *flags2p, + __out uint32_t *tso2ncp) { efx_mcdi_req_t req; uint8_t payload[MAX(MC_CMD_GET_CAPABILITIES_IN_LEN, @@ -525,10 +526,14 @@ efx_mcdi_get_capabilities( *flagsp = MCDI_OUT_DWORD(req, GET_CAPABILITIES_OUT_FLAGS1); - if (req.emr_out_length_used < MC_CMD_GET_CAPABILITIES_V2_OUT_LEN) + if (req.emr_out_length_used < MC_CMD_GET_CAPABILITIES_V2_OUT_LEN) { *flags2p = 0; - else + *tso2ncp = 0; + } else { *flags2p = MCDI_OUT_DWORD(req, GET_CAPABILITIES_V2_OUT_FLAGS2); + *tso2ncp = MCDI_OUT_WORD(req, + GET_CAPABILITIES_V2_OUT_TX_TSO_V2_N_CONTEXTS); + } return (0); @@ -963,9 +968,11 @@ ef10_get_datapath_caps( efx_nic_cfg_t *encp = &(enp->en_nic_cfg); uint32_t flags; uint32_t flags2; + uint32_t tso2nc; efx_rc_t rc; - if ((rc = efx_mcdi_get_capabilities(enp, &flags, &flags2)) != 0) + if ((rc = efx_mcdi_get_capabilities(enp, &flags, &flags2, + &tso2nc)) != 0) goto fail1; #define CAP_FLAG(flags1, field) \ @@ -992,6 +999,10 @@ ef10_get_datapath_caps( encp->enc_fw_assisted_tso_v2_enabled = CAP_FLAG2(flags2, TX_TSO_V2) ? B_TRUE : B_FALSE; + /* Get the number of TSO contexts (FATSOv2) */ + encp->enc_fw_assisted_tso_v2_n_contexts = + CAP_FLAG2(flags2, TX_TSO_V2) ? tso2nc : 0; + /* Check if the firmware has vadapter/vport/vswitch support */ encp->enc_datapath_cap_evb = CAP_FLAG(flags, EVB) ? B_TRUE : B_FALSE; Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Thu Dec 29 06:49:32 2016 (r310744) +++ head/sys/dev/sfxge/common/efx.h Thu Dec 29 06:51:06 2016 (r310745) @@ -1139,6 +1139,8 @@ typedef struct efx_nic_cfg_s { uint32_t enc_tx_tso_tcp_header_offset_limit; boolean_t enc_fw_assisted_tso_enabled; boolean_t enc_fw_assisted_tso_v2_enabled; + /* Number of TSO contexts on the NIC (FATSOv2) */ + uint32_t enc_fw_assisted_tso_v2_n_contexts; boolean_t enc_hw_tx_insert_vlan_enabled; /* Datapath firmware vadapter/vport/vswitch support */ boolean_t enc_datapath_cap_evb; Modified: head/sys/dev/sfxge/common/siena_nic.c ============================================================================== --- head/sys/dev/sfxge/common/siena_nic.c Thu Dec 29 06:49:32 2016 (r310744) +++ head/sys/dev/sfxge/common/siena_nic.c Thu Dec 29 06:51:06 2016 (r310745) @@ -152,6 +152,7 @@ siena_board_cfg( encp->enc_hw_tx_insert_vlan_enabled = B_FALSE; encp->enc_fw_assisted_tso_enabled = B_FALSE; encp->enc_fw_assisted_tso_v2_enabled = B_FALSE; + encp->enc_fw_assisted_tso_v2_n_contexts = 0; encp->enc_allow_set_mac_with_installed_filters = B_TRUE; /* Siena supports two 10G ports, and 8 lanes of PCIe Gen2 */ From owner-svn-src-head@freebsd.org Thu Dec 29 06:52:43 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9754CC95942; Thu, 29 Dec 2016 06:52:43 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71ECE1B6A; Thu, 29 Dec 2016 06:52:43 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT6qgL8049944; Thu, 29 Dec 2016 06:52:42 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT6qgau049941; Thu, 29 Dec 2016 06:52:42 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290652.uBT6qgau049941@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 06:52:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310746 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 06:52:43 -0000 Author: arybchik Date: Thu Dec 29 06:52:42 2016 New Revision: 310746 URL: https://svnweb.freebsd.org/changeset/base/310746 Log: sfxge(4): make the common code determine the number of PFs Submitted by: Ivan Malov Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8941 Modified: head/sys/dev/sfxge/common/ef10_nic.c head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/siena_nic.c Modified: head/sys/dev/sfxge/common/ef10_nic.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_nic.c Thu Dec 29 06:51:06 2016 (r310745) +++ head/sys/dev/sfxge/common/ef10_nic.c Thu Dec 29 06:52:42 2016 (r310746) @@ -961,6 +961,50 @@ ef10_nic_pio_unlink( return (efx_mcdi_unlink_piobuf(enp, vi_index)); } +static __checkReturn efx_rc_t +ef10_mcdi_get_pf_count( + __in efx_nic_t *enp, + __out uint32_t *pf_countp) +{ + efx_mcdi_req_t req; + uint8_t payload[MAX(MC_CMD_GET_PF_COUNT_IN_LEN, + MC_CMD_GET_PF_COUNT_OUT_LEN)]; + efx_rc_t rc; + + (void) memset(payload, 0, sizeof (payload)); + req.emr_cmd = MC_CMD_GET_PF_COUNT; + req.emr_in_buf = payload; + req.emr_in_length = MC_CMD_GET_PF_COUNT_IN_LEN; + req.emr_out_buf = payload; + req.emr_out_length = MC_CMD_GET_PF_COUNT_OUT_LEN; + + efx_mcdi_execute(enp, &req); + + if (req.emr_rc != 0) { + rc = req.emr_rc; + goto fail1; + } + + if (req.emr_out_length_used < MC_CMD_GET_PF_COUNT_OUT_LEN) { + rc = EMSGSIZE; + goto fail2; + } + + *pf_countp = *MCDI_OUT(req, uint8_t, + MC_CMD_GET_PF_COUNT_OUT_PF_COUNT_OFST); + + EFSYS_ASSERT(*pf_countp != 0); + + return (0); + +fail2: + EFSYS_PROBE(fail2); +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); +} + __checkReturn efx_rc_t ef10_get_datapath_caps( __in efx_nic_t *enp) @@ -975,6 +1019,9 @@ ef10_get_datapath_caps( &tso2nc)) != 0) goto fail1; + if ((rc = ef10_mcdi_get_pf_count(enp, &encp->enc_hw_pf_count)) != 0) + goto fail1; + #define CAP_FLAG(flags1, field) \ ((flags1) & (1 << (MC_CMD_GET_CAPABILITIES_V2_OUT_ ## field ## _LBN))) Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Thu Dec 29 06:51:06 2016 (r310745) +++ head/sys/dev/sfxge/common/efx.h Thu Dec 29 06:52:42 2016 (r310746) @@ -1142,6 +1142,8 @@ typedef struct efx_nic_cfg_s { /* Number of TSO contexts on the NIC (FATSOv2) */ uint32_t enc_fw_assisted_tso_v2_n_contexts; boolean_t enc_hw_tx_insert_vlan_enabled; + /* Number of PFs on the NIC */ + uint32_t enc_hw_pf_count; /* Datapath firmware vadapter/vport/vswitch support */ boolean_t enc_datapath_cap_evb; boolean_t enc_rx_disable_scatter_supported; Modified: head/sys/dev/sfxge/common/siena_nic.c ============================================================================== --- head/sys/dev/sfxge/common/siena_nic.c Thu Dec 29 06:51:06 2016 (r310745) +++ head/sys/dev/sfxge/common/siena_nic.c Thu Dec 29 06:52:42 2016 (r310746) @@ -105,6 +105,13 @@ siena_board_cfg( encp->enc_board_type = board_type; + /* + * There is no possibility to determine the number of PFs on Siena + * by issuing MCDI request, and it is not an easy task to find the + * value based on the board type, so 'enc_hw_pf_count' is set to 1 + */ + encp->enc_hw_pf_count = 1; + /* Additional capabilities */ encp->enc_clk_mult = 1; if (EFX_DWORD_FIELD(capabilities, MC_CMD_CAPABILITIES_TURBO)) { From owner-svn-src-head@freebsd.org Thu Dec 29 06:54:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2269C95A8E; Thu, 29 Dec 2016 06:54:42 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 712901D2C; Thu, 29 Dec 2016 06:54:42 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT6sfAk050095; Thu, 29 Dec 2016 06:54:41 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT6serO050087; Thu, 29 Dec 2016 06:54:40 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290654.uBT6serO050087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 06:54:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310747 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 06:54:42 -0000 Author: arybchik Date: Thu Dec 29 06:54:40 2016 New Revision: 310747 URL: https://svnweb.freebsd.org/changeset/base/310747 Log: sfxge(4): provide a way to find out which MAC stats are supported Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8944 Modified: head/sys/dev/sfxge/common/ef10_impl.h head/sys/dev/sfxge/common/ef10_mac.c head/sys/dev/sfxge/common/ef10_nic.c head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_impl.h head/sys/dev/sfxge/common/efx_mac.c head/sys/dev/sfxge/common/siena_impl.h head/sys/dev/sfxge/common/siena_mac.c Modified: head/sys/dev/sfxge/common/ef10_impl.h ============================================================================== --- head/sys/dev/sfxge/common/ef10_impl.h Thu Dec 29 06:52:42 2016 (r310746) +++ head/sys/dev/sfxge/common/ef10_impl.h Thu Dec 29 06:54:40 2016 (r310747) @@ -273,6 +273,12 @@ ef10_mac_loopback_set( #if EFSYS_OPT_MAC_STATS extern __checkReturn efx_rc_t +ef10_mac_stats_get_mask( + __in efx_nic_t *enp, + __inout_bcount(mask_size) uint32_t *maskp, + __in size_t mask_size); + +extern __checkReturn efx_rc_t ef10_mac_stats_update( __in efx_nic_t *enp, __in efsys_mem_t *esmp, Modified: head/sys/dev/sfxge/common/ef10_mac.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_mac.c Thu Dec 29 06:52:42 2016 (r310746) +++ head/sys/dev/sfxge/common/ef10_mac.c Thu Dec 29 06:54:40 2016 (r310747) @@ -484,6 +484,89 @@ fail1: #if EFSYS_OPT_MAC_STATS + __checkReturn efx_rc_t +ef10_mac_stats_get_mask( + __in efx_nic_t *enp, + __inout_bcount(mask_size) uint32_t *maskp, + __in size_t mask_size) +{ + const struct efx_mac_stats_range ef10_common[] = { + { EFX_MAC_RX_OCTETS, EFX_MAC_RX_GE_15XX_PKTS }, + { EFX_MAC_RX_FCS_ERRORS, EFX_MAC_RX_DROP_EVENTS }, + { EFX_MAC_RX_JABBER_PKTS, EFX_MAC_RX_JABBER_PKTS }, + { EFX_MAC_RX_NODESC_DROP_CNT, EFX_MAC_TX_PAUSE_PKTS }, + }; + const struct efx_mac_stats_range ef10_tx_size_bins[] = { + { EFX_MAC_TX_LE_64_PKTS, EFX_MAC_TX_GE_15XX_PKTS }, + }; + efx_nic_cfg_t *encp = &(enp->en_nic_cfg); + efx_port_t *epp = &(enp->en_port); + efx_rc_t rc; + + if ((rc = efx_mac_stats_mask_add_ranges(maskp, mask_size, + ef10_common, EFX_ARRAY_SIZE(ef10_common))) != 0) + goto fail1; + + if (epp->ep_phy_cap_mask & (1 << MC_CMD_PHY_CAP_40000FDX_LBN)) { + const struct efx_mac_stats_range ef10_40g_extra[] = { + { EFX_MAC_RX_ALIGN_ERRORS, EFX_MAC_RX_ALIGN_ERRORS }, + }; + + if ((rc = efx_mac_stats_mask_add_ranges(maskp, mask_size, + ef10_40g_extra, EFX_ARRAY_SIZE(ef10_40g_extra))) != 0) + goto fail2; + + if (encp->enc_mac_stats_40g_tx_size_bins) { + if ((rc = efx_mac_stats_mask_add_ranges(maskp, + mask_size, ef10_tx_size_bins, + EFX_ARRAY_SIZE(ef10_tx_size_bins))) != 0) + goto fail3; + } + } else { + if ((rc = efx_mac_stats_mask_add_ranges(maskp, mask_size, + ef10_tx_size_bins, EFX_ARRAY_SIZE(ef10_tx_size_bins))) != 0) + goto fail4; + } + + if (encp->enc_pm_and_rxdp_counters) { + const struct efx_mac_stats_range ef10_pm_and_rxdp[] = { + { EFX_MAC_PM_TRUNC_BB_OVERFLOW, EFX_MAC_RXDP_HLB_WAIT }, + }; + + if ((rc = efx_mac_stats_mask_add_ranges(maskp, mask_size, + ef10_pm_and_rxdp, EFX_ARRAY_SIZE(ef10_pm_and_rxdp))) != 0) + goto fail5; + } + + if (encp->enc_datapath_cap_evb) { + const struct efx_mac_stats_range ef10_vadaptor[] = { + { EFX_MAC_VADAPTER_RX_UNICAST_PACKETS, + EFX_MAC_VADAPTER_TX_OVERFLOW }, + }; + + if ((rc = efx_mac_stats_mask_add_ranges(maskp, mask_size, + ef10_vadaptor, EFX_ARRAY_SIZE(ef10_vadaptor))) != 0) + goto fail6; + } + + return (0); + +fail6: + EFSYS_PROBE(fail6); +fail5: + EFSYS_PROBE(fail5); +fail4: + EFSYS_PROBE(fail4); +fail3: + EFSYS_PROBE(fail3); +fail2: + EFSYS_PROBE(fail2); +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); +} + #define EF10_MAC_STAT_READ(_esmp, _field, _eqp) \ EFSYS_MEM_READQ((_esmp), (_field) * sizeof (efx_qword_t), _eqp) Modified: head/sys/dev/sfxge/common/ef10_nic.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_nic.c Thu Dec 29 06:52:42 2016 (r310746) +++ head/sys/dev/sfxge/common/ef10_nic.c Thu Dec 29 06:54:40 2016 (r310747) @@ -1091,6 +1091,20 @@ ef10_get_datapath_caps( encp->enc_init_evq_v2_supported = CAP_FLAG2(flags2, INIT_EVQ_V2) ? B_TRUE : B_FALSE; + /* + * Check if firmware provides packet memory and Rx datapath + * counters. + */ + encp->enc_pm_and_rxdp_counters = + CAP_FLAG(flags, PM_AND_RXDP_COUNTERS) ? B_TRUE : B_FALSE; + + /* + * Check if the 40G MAC hardware is capable of reporting + * statistics for Tx size bins. + */ + encp->enc_mac_stats_40g_tx_size_bins = + CAP_FLAG2(flags2, MAC_STATS_40G_TX_SIZE_BINS) ? B_TRUE : B_FALSE; + #undef CAP_FLAG #undef CAP_FLAG2 Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Thu Dec 29 06:52:42 2016 (r310746) +++ head/sys/dev/sfxge/common/efx.h Thu Dec 29 06:54:40 2016 (r310747) @@ -535,6 +535,29 @@ efx_mac_stat_name( #endif /* EFSYS_OPT_NAMES */ +#define EFX_MAC_STATS_MASK_BITS_PER_PAGE (8 * sizeof (uint32_t)) + +#define EFX_MAC_STATS_MASK_NPAGES \ + (P2ROUNDUP(EFX_MAC_NSTATS, EFX_MAC_STATS_MASK_BITS_PER_PAGE) / \ + EFX_MAC_STATS_MASK_BITS_PER_PAGE) + +/* + * Get mask of MAC statistics supported by the hardware. + * + * If mask_size is insufficient to return the mask, EINVAL error is + * returned. EFX_MAC_STATS_MASK_NPAGES multiplied by size of the page + * (which is sizeof (uint32_t)) is sufficient. + */ +extern __checkReturn efx_rc_t +efx_mac_stats_get_mask( + __in efx_nic_t *enp, + __out_bcount(mask_size) uint32_t *maskp, + __in size_t mask_size); + +#define EFX_MAC_STAT_SUPPORTED(_mask, _stat) \ + ((_mask)[(_stat) / EFX_MAC_STATS_MASK_BITS_PER_PAGE] & \ + (1ULL << ((_stat) & (EFX_MAC_STATS_MASK_BITS_PER_PAGE - 1)))) + #define EFX_MAC_STATS_SIZE 0x400 /* @@ -1150,6 +1173,8 @@ typedef struct efx_nic_cfg_s { boolean_t enc_allow_set_mac_with_installed_filters; boolean_t enc_enhanced_set_mac_supported; boolean_t enc_init_evq_v2_supported; + boolean_t enc_pm_and_rxdp_counters; + boolean_t enc_mac_stats_40g_tx_size_bins; /* External port identifier */ uint8_t enc_external_port; uint32_t enc_mcdi_max_payload_length; Modified: head/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- head/sys/dev/sfxge/common/efx_impl.h Thu Dec 29 06:52:42 2016 (r310746) +++ head/sys/dev/sfxge/common/efx_impl.h Thu Dec 29 06:54:40 2016 (r310747) @@ -194,6 +194,7 @@ typedef struct efx_mac_ops_s { efx_loopback_type_t); #endif /* EFSYS_OPT_LOOPBACK */ #if EFSYS_OPT_MAC_STATS + efx_rc_t (*emo_stats_get_mask)(efx_nic_t *, uint32_t *, size_t); efx_rc_t (*emo_stats_upload)(efx_nic_t *, efsys_mem_t *); efx_rc_t (*emo_stats_periodic)(efx_nic_t *, efsys_mem_t *, uint16_t, boolean_t); @@ -1155,6 +1156,27 @@ efx_mcdi_get_workarounds( #endif /* EFSYS_OPT_MCDI */ +#if EFSYS_OPT_MAC_STATS + +/* + * Closed range of stats (i.e. the first and the last are included). + * The last must be greater or equal (if the range is one item only) to + * the first. + */ +struct efx_mac_stats_range { + efx_mac_stat_t first; + efx_mac_stat_t last; +}; + +extern efx_rc_t +efx_mac_stats_mask_add_ranges( + __inout_bcount(mask_size) uint32_t *maskp, + __in size_t mask_size, + __in_ecount(rng_count) const struct efx_mac_stats_range *rngp, + __in unsigned int rng_count); + +#endif /* EFSYS_OPT_MAC_STATS */ + #ifdef __cplusplus } #endif Modified: head/sys/dev/sfxge/common/efx_mac.c ============================================================================== --- head/sys/dev/sfxge/common/efx_mac.c Thu Dec 29 06:52:42 2016 (r310746) +++ head/sys/dev/sfxge/common/efx_mac.c Thu Dec 29 06:54:40 2016 (r310747) @@ -57,6 +57,7 @@ static const efx_mac_ops_t __efx_siena_m siena_mac_loopback_set, /* emo_loopback_set */ #endif /* EFSYS_OPT_LOOPBACK */ #if EFSYS_OPT_MAC_STATS + siena_mac_stats_get_mask, /* emo_stats_get_mask */ efx_mcdi_mac_stats_upload, /* emo_stats_upload */ efx_mcdi_mac_stats_periodic, /* emo_stats_periodic */ siena_mac_stats_update /* emo_stats_update */ @@ -80,6 +81,7 @@ static const efx_mac_ops_t __efx_ef10_ma ef10_mac_loopback_set, /* emo_loopback_set */ #endif /* EFSYS_OPT_LOOPBACK */ #if EFSYS_OPT_MAC_STATS + ef10_mac_stats_get_mask, /* emo_stats_get_mask */ efx_mcdi_mac_stats_upload, /* emo_stats_upload */ efx_mcdi_mac_stats_periodic, /* emo_stats_periodic */ ef10_mac_stats_update /* emo_stats_update */ @@ -615,6 +617,105 @@ efx_mac_stat_name( #endif /* EFSYS_OPT_NAMES */ +static efx_rc_t +efx_mac_stats_mask_add_range( + __inout_bcount(mask_size) uint32_t *maskp, + __in size_t mask_size, + __in const struct efx_mac_stats_range *rngp) +{ + unsigned int mask_npages = mask_size / sizeof (*maskp); + unsigned int el; + unsigned int el_min; + unsigned int el_max; + unsigned int low; + unsigned int high; + unsigned int width; + efx_rc_t rc; + + if ((mask_npages * EFX_MAC_STATS_MASK_BITS_PER_PAGE) <= + (unsigned int)rngp->last) { + rc = EINVAL; + goto fail1; + } + + EFSYS_ASSERT3U(rngp->first, <=, rngp->last); + EFSYS_ASSERT3U(rngp->last, <, EFX_MAC_NSTATS); + + for (el = 0; el < mask_npages; ++el) { + el_min = el * EFX_MAC_STATS_MASK_BITS_PER_PAGE; + el_max = + el_min + (EFX_MAC_STATS_MASK_BITS_PER_PAGE - 1); + if ((unsigned int)rngp->first > el_max || + (unsigned int)rngp->last < el_min) + continue; + low = MAX((unsigned int)rngp->first, el_min); + high = MIN((unsigned int)rngp->last, el_max); + width = high - low + 1; + maskp[el] |= + (width == EFX_MAC_STATS_MASK_BITS_PER_PAGE) ? + (~0ULL) : (((1ULL << width) - 1) << (low - el_min)); + } + + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); +} + + efx_rc_t +efx_mac_stats_mask_add_ranges( + __inout_bcount(mask_size) uint32_t *maskp, + __in size_t mask_size, + __in_ecount(rng_count) const struct efx_mac_stats_range *rngp, + __in unsigned int rng_count) +{ + unsigned int i; + efx_rc_t rc; + + for (i = 0; i < rng_count; ++i) { + if ((rc = efx_mac_stats_mask_add_range(maskp, mask_size, + &rngp[i])) != 0) + goto fail1; + } + + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); +} + + __checkReturn efx_rc_t +efx_mac_stats_get_mask( + __in efx_nic_t *enp, + __out_bcount(mask_size) uint32_t *maskp, + __in size_t mask_size) +{ + efx_port_t *epp = &(enp->en_port); + const efx_mac_ops_t *emop = epp->ep_emop; + efx_rc_t rc; + + EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); + EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE); + EFSYS_ASSERT(maskp != NULL); + EFSYS_ASSERT(mask_size % sizeof (maskp[0]) == 0); + + (void) memset(maskp, 0, mask_size); + + if ((rc = emop->emo_stats_get_mask(enp, maskp, mask_size)) != 0) + goto fail1; + + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); +} + __checkReturn efx_rc_t efx_mac_stats_upload( __in efx_nic_t *enp, Modified: head/sys/dev/sfxge/common/siena_impl.h ============================================================================== --- head/sys/dev/sfxge/common/siena_impl.h Thu Dec 29 06:52:42 2016 (r310746) +++ head/sys/dev/sfxge/common/siena_impl.h Thu Dec 29 06:54:40 2016 (r310747) @@ -406,6 +406,12 @@ siena_mac_loopback_set( #if EFSYS_OPT_MAC_STATS extern __checkReturn efx_rc_t +siena_mac_stats_get_mask( + __in efx_nic_t *enp, + __inout_bcount(mask_size) uint32_t *maskp, + __in size_t mask_size); + +extern __checkReturn efx_rc_t siena_mac_stats_update( __in efx_nic_t *enp, __in efsys_mem_t *esmp, Modified: head/sys/dev/sfxge/common/siena_mac.c ============================================================================== --- head/sys/dev/sfxge/common/siena_mac.c Thu Dec 29 06:52:42 2016 (r310746) +++ head/sys/dev/sfxge/common/siena_mac.c Thu Dec 29 06:54:40 2016 (r310747) @@ -235,6 +235,33 @@ fail1: #if EFSYS_OPT_MAC_STATS + __checkReturn efx_rc_t +siena_mac_stats_get_mask( + __in efx_nic_t *enp, + __inout_bcount(mask_size) uint32_t *maskp, + __in size_t mask_size) +{ + const struct efx_mac_stats_range siena_stats[] = { + { EFX_MAC_RX_OCTETS, EFX_MAC_RX_GE_15XX_PKTS }, + /* EFX_MAC_RX_ERRORS is not supported */ + { EFX_MAC_RX_FCS_ERRORS, EFX_MAC_TX_EX_DEF_PKTS }, + }; + efx_rc_t rc; + + _NOTE(ARGUNUSED(enp)) + + if ((rc = efx_mac_stats_mask_add_ranges(maskp, mask_size, + siena_stats, EFX_ARRAY_SIZE(siena_stats))) != 0) + goto fail1; + + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); +} + #define SIENA_MAC_STAT_READ(_esmp, _field, _eqp) \ EFSYS_MEM_READQ((_esmp), (_field) * sizeof (efx_qword_t), _eqp) From owner-svn-src-head@freebsd.org Thu Dec 29 06:56:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3132AC95B65; Thu, 29 Dec 2016 06:56:20 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 009341EC5; Thu, 29 Dec 2016 06:56:19 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT6uJHA050248; Thu, 29 Dec 2016 06:56:19 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT6uJFk050247; Thu, 29 Dec 2016 06:56:19 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290656.uBT6uJFk050247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 06:56:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310748 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 06:56:20 -0000 Author: arybchik Date: Thu Dec 29 06:56:18 2016 New Revision: 310748 URL: https://svnweb.freebsd.org/changeset/base/310748 Log: sfxge(4): cleanup: simplify disable scatter logic in ef10_rx_qcreate Reviewed by: gnn Submitted by: Andy Moreton Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8945 Modified: head/sys/dev/sfxge/common/ef10_rx.c Modified: head/sys/dev/sfxge/common/ef10_rx.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_rx.c Thu Dec 29 06:54:40 2016 (r310747) +++ head/sys/dev/sfxge/common/ef10_rx.c Thu Dec 29 06:56:18 2016 (r310748) @@ -769,12 +769,10 @@ ef10_rx_qcreate( } /* Scatter can only be disabled if the firmware supports doing so */ - if ((type != EFX_RXQ_TYPE_SCATTER) && - enp->en_nic_cfg.enc_rx_disable_scatter_supported) { - disable_scatter = B_TRUE; - } else { + if (type == EFX_RXQ_TYPE_SCATTER) disable_scatter = B_FALSE; - } + else + disable_scatter = encp->enc_rx_disable_scatter_supported; if ((rc = efx_mcdi_init_rxq(enp, n, eep->ee_index, label, index, esmp, disable_scatter)) != 0) From owner-svn-src-head@freebsd.org Thu Dec 29 06:57:38 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1905AC95BF0; Thu, 29 Dec 2016 06:57:38 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2C161065; Thu, 29 Dec 2016 06:57:37 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT6vaAP050365; Thu, 29 Dec 2016 06:57:36 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT6vapt050364; Thu, 29 Dec 2016 06:57:36 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290657.uBT6vapt050364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 06:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310749 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 06:57:38 -0000 Author: arybchik Date: Thu Dec 29 06:57:36 2016 New Revision: 310749 URL: https://svnweb.freebsd.org/changeset/base/310749 Log: sfxge(4): use correct port number in sensor decoding The port mask used for per-port sensors in mcdi_sensor_map assumes zero-based port numbering. The port mask used in the code is based on the one-based MCDI port number. Fix this to lookup the correct per-port sensors, and to allow reporting of sensor events from higher port numbers. Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8947 Modified: head/sys/dev/sfxge/common/mcdi_mon.c Modified: head/sys/dev/sfxge/common/mcdi_mon.c ============================================================================== --- head/sys/dev/sfxge/common/mcdi_mon.c Thu Dec 29 06:56:18 2016 (r310748) +++ head/sys/dev/sfxge/common/mcdi_mon.c Thu Dec 29 06:57:36 2016 (r310749) @@ -50,6 +50,9 @@ __FBSDID("$FreeBSD$"); #define MCDI_MON_PORT_P4 (0x08) #define MCDI_MON_PORT_Px (0xFFFF) +/* Get port mask from one-based MCDI port number */ +#define MCDI_MON_PORT_MASK(_emip) (1U << ((_emip)->emi_port - 1)) + /* Entry for MCDI sensor in sensor map */ #define STAT(portmask, stat) \ { (MCDI_MON_PORT_##portmask), (EFX_MON_STAT_##stat) } @@ -166,10 +169,10 @@ static const struct mcdi_sensor_map_s { static void mcdi_mon_decode_stats( __in efx_nic_t *enp, - __in_ecount(sensor_mask_size) uint32_t *sensor_mask, + __in_bcount(sensor_mask_size) uint32_t *sensor_mask, __in size_t sensor_mask_size, __in_opt efsys_mem_t *esmp, - __out_ecount_opt(sensor_mask_size) uint32_t *stat_maskp, + __out_bcount_opt(sensor_mask_size) uint32_t *stat_maskp, __inout_ecount_opt(EFX_MON_NSTATS) efx_mon_stat_value_t *stat) { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); @@ -192,7 +195,8 @@ mcdi_mon_decode_stats( sensor_max = MIN((8 * sensor_mask_size), EFX_ARRAY_SIZE(mcdi_sensor_map)); - port_mask = 1U << emip->emi_port; + EFSYS_ASSERT(emip->emi_port > 0); /* MCDI port number is one-based */ + port_mask = MCDI_MON_PORT_MASK(emip); memset(stat_mask, 0, sizeof (stat_mask)); @@ -269,9 +273,8 @@ mcdi_mon_ev( efx_mon_stat_t id; efx_rc_t rc; - port_mask = (emip->emi_port == 1) - ? MCDI_MON_PORT_P1 - : MCDI_MON_PORT_P2; + EFSYS_ASSERT(emip->emi_port > 0); /* MCDI port number is one-based */ + port_mask = MCDI_MON_PORT_MASK(emip); sensor = (uint16_t)MCDI_EV_FIELD(eqp, SENSOREVT_MONITOR); state = (uint16_t)MCDI_EV_FIELD(eqp, SENSOREVT_STATE); From owner-svn-src-head@freebsd.org Thu Dec 29 06:58:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A179C95C7F; Thu, 29 Dec 2016 06:58:52 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0965B120D; Thu, 29 Dec 2016 06:58:51 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT6wpvZ050482; Thu, 29 Dec 2016 06:58:51 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT6wp8n050481; Thu, 29 Dec 2016 06:58:51 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290658.uBT6wp8n050481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 06:58:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310750 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 06:58:52 -0000 Author: arybchik Date: Thu Dec 29 06:58:51 2016 New Revision: 310750 URL: https://svnweb.freebsd.org/changeset/base/310750 Log: sfxge(4): add missing barrier in common code MCDI response handling The semantics of the MCDI interfacve require reading the first dword of the header before any other data in the buffer. Add a barrier to the common code MCDI handler to enforce this. Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8949 Modified: head/sys/dev/sfxge/common/ef10_mcdi.c Modified: head/sys/dev/sfxge/common/ef10_mcdi.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_mcdi.c Thu Dec 29 06:57:36 2016 (r310749) +++ head/sys/dev/sfxge/common/ef10_mcdi.c Thu Dec 29 06:58:51 2016 (r310750) @@ -159,6 +159,8 @@ ef10_mcdi_poll_response( efx_dword_t hdr; EFSYS_MEM_READD(esmp, 0, &hdr); + EFSYS_MEM_READ_BARRIER(); + return (EFX_DWORD_FIELD(hdr, MCDI_HEADER_RESPONSE) ? B_TRUE : B_FALSE); } From owner-svn-src-head@freebsd.org Thu Dec 29 07:00:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6885BC95DC6; Thu, 29 Dec 2016 07:00:28 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 297C61580; Thu, 29 Dec 2016 07:00:28 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT70Rti050696; Thu, 29 Dec 2016 07:00:27 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT70RKa050694; Thu, 29 Dec 2016 07:00:27 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290700.uBT70RKa050694@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 07:00:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310752 - in head/sys/dev/sfxge: . common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 07:00:28 -0000 Author: arybchik Date: Thu Dec 29 07:00:26 2016 New Revision: 310752 URL: https://svnweb.freebsd.org/changeset/base/310752 Log: sfxge(4): allow to have no NIC handle on Rx datapath in DPDK PMD It is required to minimize RxQ context in the driver or avoid chaising for the NIC handle in adapter (global per-interface) structure. Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8950 Modified: head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_rx.c head/sys/dev/sfxge/sfxge_rx.c Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Thu Dec 29 06:59:24 2016 (r310751) +++ head/sys/dev/sfxge/common/efx.h Thu Dec 29 07:00:26 2016 (r310752) @@ -1921,7 +1921,7 @@ efx_rx_scale_key_set( extern __checkReturn uint32_t efx_psuedo_hdr_hash_get( - __in efx_nic_t *enp, + __in efx_rxq_t *erp, __in efx_rx_hash_alg_t func, __in uint8_t *buffer); @@ -1929,7 +1929,7 @@ efx_psuedo_hdr_hash_get( extern __checkReturn efx_rc_t efx_psuedo_hdr_pkt_length_get( - __in efx_nic_t *enp, + __in efx_rxq_t *erp, __in uint8_t *buffer, __out uint16_t *pkt_lengthp); Modified: head/sys/dev/sfxge/common/efx_rx.c ============================================================================== --- head/sys/dev/sfxge/common/efx_rx.c Thu Dec 29 06:59:24 2016 (r310751) +++ head/sys/dev/sfxge/common/efx_rx.c Thu Dec 29 07:00:26 2016 (r310752) @@ -541,24 +541,30 @@ efx_rx_qdestroy( __checkReturn efx_rc_t efx_psuedo_hdr_pkt_length_get( - __in efx_nic_t *enp, + __in efx_rxq_t *erp, __in uint8_t *buffer, __out uint16_t *lengthp) { + efx_nic_t *enp = erp->er_enp; const efx_rx_ops_t *erxop = enp->en_erxop; + EFSYS_ASSERT3U(erp->er_magic, ==, EFX_RXQ_MAGIC); + return (erxop->erxo_prefix_pktlen(enp, buffer, lengthp)); } #if EFSYS_OPT_RX_SCALE __checkReturn uint32_t efx_psuedo_hdr_hash_get( - __in efx_nic_t *enp, + __in efx_rxq_t *erp, __in efx_rx_hash_alg_t func, __in uint8_t *buffer) { + efx_nic_t *enp = erp->er_enp; const efx_rx_ops_t *erxop = enp->en_erxop; + EFSYS_ASSERT3U(erp->er_magic, ==, EFX_RXQ_MAGIC); + EFSYS_ASSERT3U(enp->en_hash_support, ==, EFX_RX_HASH_AVAILABLE); return (erxop->erxo_prefix_hash(enp, func, buffer)); } Modified: head/sys/dev/sfxge/sfxge_rx.c ============================================================================== --- head/sys/dev/sfxge/sfxge_rx.c Thu Dec 29 06:59:24 2016 (r310751) +++ head/sys/dev/sfxge/sfxge_rx.c Thu Dec 29 07:00:26 2016 (r310752) @@ -330,8 +330,9 @@ static void __sfxge_rx_deliver(struct sf } static void -sfxge_rx_deliver(struct sfxge_softc *sc, struct sfxge_rx_sw_desc *rx_desc) +sfxge_rx_deliver(struct sfxge_rxq *rxq, struct sfxge_rx_sw_desc *rx_desc) { + struct sfxge_softc *sc = rxq->sc; struct mbuf *m = rx_desc->mbuf; int flags = rx_desc->flags; int csum_flags; @@ -344,7 +345,7 @@ sfxge_rx_deliver(struct sfxge_softc *sc, if (flags & (EFX_PKT_IPV4 | EFX_PKT_IPV6)) { m->m_pkthdr.flowid = - efx_psuedo_hdr_hash_get(sc->enp, + efx_psuedo_hdr_hash_get(rxq->common, EFX_RX_HASHALG_TOEPLITZ, mtod(m, uint8_t *)); /* The hash covers a 4-tuple for TCP only */ @@ -423,7 +424,7 @@ static void sfxge_lro_drop(struct sfxge_ KASSERT(!c->mbuf, ("found orphaned mbuf")); if (c->next_buf.mbuf != NULL) { - sfxge_rx_deliver(rxq->sc, &c->next_buf); + sfxge_rx_deliver(rxq, &c->next_buf); LIST_REMOVE(c, active_link); } @@ -618,7 +619,7 @@ sfxge_lro_try_merge(struct sfxge_rxq *rx return (1); deliver_buf_out: - sfxge_rx_deliver(rxq->sc, rx_buf); + sfxge_rx_deliver(rxq, rx_buf); return (1); } @@ -679,7 +680,7 @@ sfxge_lro(struct sfxge_rxq *rxq, struct unsigned bucket; /* Get the hardware hash */ - conn_hash = efx_psuedo_hdr_hash_get(sc->enp, + conn_hash = efx_psuedo_hdr_hash_get(rxq->common, EFX_RX_HASHALG_TOEPLITZ, mtod(m, uint8_t *)); @@ -765,7 +766,7 @@ sfxge_lro(struct sfxge_rxq *rxq, struct sfxge_lro_new_conn(&rxq->lro, conn_hash, l2_id, nh, th); deliver_now: - sfxge_rx_deliver(sc, rx_buf); + sfxge_rx_deliver(rxq, rx_buf); } static void sfxge_lro_end_of_burst(struct sfxge_rxq *rxq) @@ -842,7 +843,7 @@ sfxge_rx_qcomplete(struct sfxge_rxq *rxq if (rx_desc->flags & EFX_PKT_PREFIX_LEN) { uint16_t tmp_size; int rc; - rc = efx_psuedo_hdr_pkt_length_get(sc->enp, + rc = efx_psuedo_hdr_pkt_length_get(rxq->common, mtod(m, uint8_t *), &tmp_size); KASSERT(rc == 0, ("cannot get packet length: %d", rc)); @@ -891,7 +892,7 @@ sfxge_rx_qcomplete(struct sfxge_rxq *rxq (EFX_PKT_TCP | EFX_CKSUM_TCPUDP))) sfxge_lro(rxq, prev); else - sfxge_rx_deliver(sc, prev); + sfxge_rx_deliver(rxq, prev); } prev = rx_desc; continue; @@ -912,7 +913,7 @@ discard: (EFX_PKT_TCP | EFX_CKSUM_TCPUDP))) sfxge_lro(rxq, prev); else - sfxge_rx_deliver(sc, prev); + sfxge_rx_deliver(rxq, prev); } /* From owner-svn-src-head@freebsd.org Thu Dec 29 07:02:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2B2FC95F66; Thu, 29 Dec 2016 07:02:33 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D77219C9; Thu, 29 Dec 2016 07:02:33 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT72WW1054488; Thu, 29 Dec 2016 07:02:32 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT72WhM054485; Thu, 29 Dec 2016 07:02:32 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290702.uBT72WhM054485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 07:02:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310753 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 07:02:33 -0000 Author: arybchik Date: Thu Dec 29 07:02:32 2016 New Revision: 310753 URL: https://svnweb.freebsd.org/changeset/base/310753 Log: sfxge(4): split EFX_FILTER_MATCH_LOC_MAC_IG back into separate flags The flag EFX_FILTER_MATCH_LOC_MAC_IG to represent filtering on the individual/group bit of the MAC address (with the two cases being distingusished by the MAC address in the filter specification) was introduced to mirror the Linux driver filtering code, but the implementations are different enough anyway that it isn't of much value. Having separate flags for unknown unicast and multicast simplifies the code and allows the set of flags to match those used by MCDI. It will also makes it easier to report whether these filters are supported. In the MCDI definitions, the unknown multicast and unicast flags have the values 0x40000000 and 0x80000000 respectively, and so using the same values for simplicity requires 32 bits in the filter specification to store the flags. This means the structure is now a little bigger than 64 bytes, but filters are not often used on critical paths so this shouldn't have much impact - on Linux they are also bigger than they used to be. Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8951 Modified: head/sys/dev/sfxge/common/ef10_filter.c head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_filter.c Modified: head/sys/dev/sfxge/common/ef10_filter.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_filter.c Thu Dec 29 07:00:26 2016 (r310752) +++ head/sys/dev/sfxge/common/ef10_filter.c Thu Dec 29 07:02:32 2016 (r310753) @@ -145,6 +145,10 @@ ef10_filter_init( MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_OUTER_VLAN)); EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IP_PROTO == MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_IP_PROTO)); + EFX_STATIC_ASSERT(EFX_FILTER_MATCH_UNKNOWN_MCAST_DST == + MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_MCAST_DST)); + EFX_STATIC_ASSERT((uint32_t)EFX_FILTER_MATCH_UNKNOWN_UCAST_DST == + MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_UCAST_DST)); #undef MATCH_MASK EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (ef10_filter_table_t), eftp); @@ -187,7 +191,6 @@ efx_mcdi_filter_op_add( efx_mcdi_req_t req; uint8_t payload[MAX(MC_CMD_FILTER_OP_IN_LEN, MC_CMD_FILTER_OP_OUT_LEN)]; - uint32_t match_fields = 0; efx_rc_t rc; memset(payload, 0, sizeof (payload)); @@ -214,26 +217,10 @@ efx_mcdi_filter_op_add( goto fail1; } - if (spec->efs_match_flags & EFX_FILTER_MATCH_LOC_MAC_IG) { - /* - * The LOC_MAC_IG match flag can represent unknown unicast - * or multicast filters - use the MAC address to distinguish - * them. - */ - if (EFX_MAC_ADDR_IS_MULTICAST(spec->efs_loc_mac)) - match_fields |= 1U << - MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_MCAST_DST_LBN; - else - match_fields |= 1U << - MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_UCAST_DST_LBN; - } - - match_fields |= spec->efs_match_flags & (~EFX_FILTER_MATCH_LOC_MAC_IG); - MCDI_IN_SET_DWORD(req, FILTER_OP_IN_PORT_ID, EVB_PORT_ID_ASSIGNED); MCDI_IN_SET_DWORD(req, FILTER_OP_IN_MATCH_FIELDS, - match_fields); + spec->efs_match_flags); MCDI_IN_SET_DWORD(req, FILTER_OP_IN_RX_DEST, MC_CMD_FILTER_OP_IN_RX_DEST_HOST); MCDI_IN_SET_DWORD(req, FILTER_OP_IN_RX_QUEUE, @@ -892,9 +879,6 @@ efx_mcdi_get_parser_disp_info( uint8_t payload[MAX(MC_CMD_GET_PARSER_DISP_INFO_IN_LEN, MC_CMD_GET_PARSER_DISP_INFO_OUT_LENMAX)]; efx_rc_t rc; - uint32_t i; - boolean_t support_unknown_ucast = B_FALSE; - boolean_t support_unknown_mcast = B_FALSE; (void) memset(payload, 0, sizeof (payload)); req.emr_cmd = MC_CMD_GET_PARSER_DISP_INFO; @@ -930,28 +914,6 @@ efx_mcdi_get_parser_disp_info( EFX_STATIC_ASSERT(sizeof (uint32_t) == MC_CMD_GET_PARSER_DISP_INFO_OUT_SUPPORTED_MATCHES_LEN); - /* - * Remove UNKNOWN UCAST and MCAST flags, and if both are present, change - * the lower priority one to LOC_MAC_IG. - */ - for (i = 0; i < *length; i++) { - if (list[i] & MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_UCAST_DST_LBN) { - list[i] &= - (~MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_UCAST_DST_LBN); - support_unknown_ucast = B_TRUE; - } - if (list[i] & MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_MCAST_DST_LBN) { - list[i] &= - (~MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_MCAST_DST_LBN); - support_unknown_mcast = B_TRUE; - } - - if (support_unknown_ucast && support_unknown_mcast) { - list[i] &= EFX_FILTER_MATCH_LOC_MAC_IG; - break; - } - } - return (0); fail2: Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Thu Dec 29 07:00:26 2016 (r310752) +++ head/sys/dev/sfxge/common/efx.h Thu Dec 29 07:02:32 2016 (r310753) @@ -2209,10 +2209,10 @@ typedef enum efx_filter_match_flags_e { EFX_FILTER_MATCH_OUTER_VID = 0x0100, /* Match by outer VLAN ID */ EFX_FILTER_MATCH_IP_PROTO = 0x0200, /* Match by IP transport * protocol */ - EFX_FILTER_MATCH_LOC_MAC_IG = 0x0400, /* Match by local MAC address - * I/G bit. Used for RX default - * unicast and multicast/ - * broadcast filters. */ + /* Match otherwise-unmatched multicast and broadcast packets */ + EFX_FILTER_MATCH_UNKNOWN_MCAST_DST = 0x40000000, + /* Match otherwise-unmatched unicast packets */ + EFX_FILTER_MATCH_UNKNOWN_UCAST_DST = 0x80000000, } efx_filter_match_flags_t; typedef enum efx_filter_priority_s { @@ -2234,7 +2234,7 @@ typedef enum efx_filter_priority_s { */ typedef struct efx_filter_spec_s { - uint32_t efs_match_flags:12; + uint32_t efs_match_flags; uint32_t efs_priority:2; uint32_t efs_flags:6; uint32_t efs_dmaq_id:12; Modified: head/sys/dev/sfxge/common/efx_filter.c ============================================================================== --- head/sys/dev/sfxge/common/efx_filter.c Thu Dec 29 07:00:26 2016 (r310752) +++ head/sys/dev/sfxge/common/efx_filter.c Thu Dec 29 07:02:32 2016 (r310753) @@ -152,9 +152,6 @@ efx_filter_init( const efx_filter_ops_t *efop; efx_rc_t rc; - /* Check that efx_filter_spec_t is 64 bytes. */ - EFX_STATIC_ASSERT(sizeof (efx_filter_spec_t) == 64); - EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE); EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_FILTER)); @@ -390,7 +387,7 @@ efx_filter_spec_set_uc_def( { EFSYS_ASSERT3P(spec, !=, NULL); - spec->efs_match_flags |= EFX_FILTER_MATCH_LOC_MAC_IG; + spec->efs_match_flags |= EFX_FILTER_MATCH_UNKNOWN_UCAST_DST; return (0); } @@ -403,8 +400,7 @@ efx_filter_spec_set_mc_def( { EFSYS_ASSERT3P(spec, !=, NULL); - spec->efs_match_flags |= EFX_FILTER_MATCH_LOC_MAC_IG; - spec->efs_loc_mac[0] = 1; + spec->efs_match_flags |= EFX_FILTER_MATCH_UNKNOWN_MCAST_DST; return (0); } From owner-svn-src-head@freebsd.org Thu Dec 29 07:04:27 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50A42C9406E; Thu, 29 Dec 2016 07:04:27 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B6DC1C81; Thu, 29 Dec 2016 07:04:27 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT74QWa054852; Thu, 29 Dec 2016 07:04:26 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT74Qlp054851; Thu, 29 Dec 2016 07:04:26 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290704.uBT74Qlp054851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 07:04:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310754 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 07:04:27 -0000 Author: arybchik Date: Thu Dec 29 07:04:26 2016 New Revision: 310754 URL: https://svnweb.freebsd.org/changeset/base/310754 Log: sfxge(4): don't use Tx descriptor push with TSO option descriptors It is not safe to push TSO option descriptors if pacer bypass is enabled, so to make sure that doesn't happen never push TSO option descriptors. Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8952 Modified: head/sys/dev/sfxge/common/ef10_tx.c Modified: head/sys/dev/sfxge/common/ef10_tx.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_tx.c Thu Dec 29 07:02:32 2016 (r310753) +++ head/sys/dev/sfxge/common/ef10_tx.c Thu Dec 29 07:04:26 2016 (r310754) @@ -470,9 +470,9 @@ fail1: } /* - * This improves performance by pushing a TX descriptor at the same time as the - * doorbell. The descriptor must be added to the TXQ, so that can be used if the - * hardware decides not to use the pushed descriptor. + * This improves performance by, when possible, pushing a TX descriptor at the + * same time as the doorbell. The descriptor must be added to the TXQ, so that + * can be used if the hardware decides not to use the pushed descriptor. */ void ef10_tx_qpush( @@ -492,16 +492,46 @@ ef10_tx_qpush( offset = id * sizeof (efx_qword_t); EFSYS_MEM_READQ(etp->et_esmp, offset, &desc); - EFX_POPULATE_OWORD_3(oword, - ERF_DZ_TX_DESC_WPTR, wptr, - ERF_DZ_TX_DESC_HWORD, EFX_QWORD_FIELD(desc, EFX_DWORD_1), - ERF_DZ_TX_DESC_LWORD, EFX_QWORD_FIELD(desc, EFX_DWORD_0)); - - /* Guarantee ordering of memory (descriptors) and PIO (doorbell) */ - EFX_DMA_SYNC_QUEUE_FOR_DEVICE(etp->et_esmp, etp->et_mask + 1, wptr, id); - EFSYS_PIO_WRITE_BARRIER(); - EFX_BAR_TBL_DOORBELL_WRITEO(enp, ER_DZ_TX_DESC_UPD_REG, etp->et_index, - &oword); + + /* + * SF Bug 65776: TSO option descriptors cannot be pushed if pacer bypass + * is enabled on the event queue this transmit queue is attached to. + * + * To ensure the code is safe, it is easiest to simply test the type of + * the descriptor to push, and only push it is if it not a TSO option + * descriptor. + */ + if ((EFX_QWORD_FIELD(desc, ESF_DZ_TX_DESC_IS_OPT) != 1) || + (EFX_QWORD_FIELD(desc, ESF_DZ_TX_OPTION_TYPE) != + ESE_DZ_TX_OPTION_DESC_TSO)) { + /* Push the descriptor and update the wptr. */ + EFX_POPULATE_OWORD_3(oword, ERF_DZ_TX_DESC_WPTR, wptr, + ERF_DZ_TX_DESC_HWORD, EFX_QWORD_FIELD(desc, EFX_DWORD_1), + ERF_DZ_TX_DESC_LWORD, EFX_QWORD_FIELD(desc, EFX_DWORD_0)); + + /* Ensure ordering of memory (descriptors) and PIO (doorbell) */ + EFX_DMA_SYNC_QUEUE_FOR_DEVICE(etp->et_esmp, etp->et_mask + 1, + wptr, id); + EFSYS_PIO_WRITE_BARRIER(); + EFX_BAR_TBL_DOORBELL_WRITEO(enp, ER_DZ_TX_DESC_UPD_REG, + etp->et_index, &oword); + } else { + efx_dword_t dword; + + /* + * Only update the wptr. This is signalled to the hardware by + * only writing one DWORD of the doorbell register. + */ + EFX_POPULATE_OWORD_1(oword, ERF_DZ_TX_DESC_WPTR, wptr); + dword = oword.eo_dword[2]; + + /* Ensure ordering of memory (descriptors) and PIO (doorbell) */ + EFX_DMA_SYNC_QUEUE_FOR_DEVICE(etp->et_esmp, etp->et_mask + 1, + wptr, id); + EFSYS_PIO_WRITE_BARRIER(); + EFX_BAR_TBL_WRITED2(enp, ER_DZ_TX_DESC_UPD_REG, + etp->et_index, &dword, B_FALSE); + } } __checkReturn efx_rc_t From owner-svn-src-head@freebsd.org Thu Dec 29 07:05:48 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B53B2C94126; Thu, 29 Dec 2016 07:05:48 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 762E01ED9; Thu, 29 Dec 2016 07:05:48 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT75lEa054961; Thu, 29 Dec 2016 07:05:47 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT75le3054958; Thu, 29 Dec 2016 07:05:47 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290705.uBT75le3054958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 07:05:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310755 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 07:05:48 -0000 Author: arybchik Date: Thu Dec 29 07:05:47 2016 New Revision: 310755 URL: https://svnweb.freebsd.org/changeset/base/310755 Log: sfxge(4): do not use enum for filter flags It is not 100% correct to assign non-enum values to enum type variables. Found by ICC build (DPDK PMD upstreaming). Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8953 Modified: head/sys/dev/sfxge/common/ef10_filter.c head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_filter.c Modified: head/sys/dev/sfxge/common/ef10_filter.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_filter.c Thu Dec 29 07:04:26 2016 (r310754) +++ head/sys/dev/sfxge/common/ef10_filter.c Thu Dec 29 07:05:47 2016 (r310755) @@ -947,7 +947,7 @@ static __checkReturn efx_rc_t ef10_filter_insert_unicast( __in efx_nic_t *enp, __in_ecount(6) uint8_t const *addr, - __in efx_filter_flag_t filter_flags) + __in efx_filter_flags_t filter_flags) { ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table; efx_filter_spec_t spec; @@ -978,7 +978,7 @@ fail1: static __checkReturn efx_rc_t ef10_filter_insert_all_unicast( __in efx_nic_t *enp, - __in efx_filter_flag_t filter_flags) + __in efx_filter_flags_t filter_flags) { ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table; efx_filter_spec_t spec; @@ -1012,7 +1012,7 @@ ef10_filter_insert_multicast_list( __in boolean_t brdcst, __in_ecount(6*count) uint8_t const *addrs, __in uint32_t count, - __in efx_filter_flag_t filter_flags, + __in efx_filter_flags_t filter_flags, __in boolean_t rollback) { ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table; @@ -1105,7 +1105,7 @@ fail1: static __checkReturn efx_rc_t ef10_filter_insert_all_multicast( __in efx_nic_t *enp, - __in efx_filter_flag_t filter_flags) + __in efx_filter_flags_t filter_flags) { ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table; efx_filter_spec_t spec; @@ -1207,7 +1207,7 @@ ef10_filter_reconfigure( { efx_nic_cfg_t *encp = &enp->en_nic_cfg; ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; - efx_filter_flag_t filter_flags; + efx_filter_flags_t filter_flags; unsigned int i; efx_rc_t all_unicst_rc = 0; efx_rc_t all_mulcst_rc = 0; Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Thu Dec 29 07:04:26 2016 (r310754) +++ head/sys/dev/sfxge/common/efx.h Thu Dec 29 07:05:47 2016 (r310755) @@ -2180,20 +2180,22 @@ efx_tx_qdestroy( #define EFX_IPPROTO_TCP 6 #define EFX_IPPROTO_UDP 17 -typedef enum efx_filter_flag_e { - EFX_FILTER_FLAG_RX_RSS = 0x01, /* use RSS to spread across - * multiple queues */ - EFX_FILTER_FLAG_RX_SCATTER = 0x02, /* enable RX scatter */ - EFX_FILTER_FLAG_RX_OVER_AUTO = 0x04, /* Override an automatic filter - * (priority EFX_FILTER_PRI_AUTO). - * May only be set by the filter - * implementation for each type. - * A removal request will - * restore the automatic filter - * in its place. */ - EFX_FILTER_FLAG_RX = 0x08, /* Filter is for RX */ - EFX_FILTER_FLAG_TX = 0x10, /* Filter is for TX */ -} efx_filter_flag_t; +/* Use RSS to spread across multiple queues */ +#define EFX_FILTER_FLAG_RX_RSS 0x01 +/* Enable RX scatter */ +#define EFX_FILTER_FLAG_RX_SCATTER 0x02 +/* + * Override an automatic filter (priority EFX_FILTER_PRI_AUTO). + * May only be set by the filter implementation for each type. + * A removal request will restore the automatic filter in its place. + */ +#define EFX_FILTER_FLAG_RX_OVER_AUTO 0x04 +/* Filter is for RX */ +#define EFX_FILTER_FLAG_RX 0x08 +/* Filter is for TX */ +#define EFX_FILTER_FLAG_TX 0x10 + +typedef unsigned int efx_filter_flags_t; typedef enum efx_filter_match_flags_e { EFX_FILTER_MATCH_REM_HOST = 0x0001, /* Match by remote IP host @@ -2289,7 +2291,7 @@ extern void efx_filter_spec_init_rx( __out efx_filter_spec_t *spec, __in efx_filter_priority_t priority, - __in efx_filter_flag_t flags, + __in efx_filter_flags_t flags, __in efx_rxq_t *erp); extern void Modified: head/sys/dev/sfxge/common/efx_filter.c ============================================================================== --- head/sys/dev/sfxge/common/efx_filter.c Thu Dec 29 07:04:26 2016 (r310754) +++ head/sys/dev/sfxge/common/efx_filter.c Thu Dec 29 07:05:47 2016 (r310755) @@ -273,7 +273,7 @@ fail1: efx_filter_spec_init_rx( __out efx_filter_spec_t *spec, __in efx_filter_priority_t priority, - __in efx_filter_flag_t flags, + __in efx_filter_flags_t flags, __in efx_rxq_t *erp) { EFSYS_ASSERT3P(spec, !=, NULL); From owner-svn-src-head@freebsd.org Thu Dec 29 07:06:50 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 935CCC941AD; Thu, 29 Dec 2016 07:06:50 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E27D106D; Thu, 29 Dec 2016 07:06:50 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT76n11055050; Thu, 29 Dec 2016 07:06:49 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT76nQE055046; Thu, 29 Dec 2016 07:06:49 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290706.uBT76nQE055046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 07:06:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310756 - in head/sys/dev/sfxge: . common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 07:06:50 -0000 Author: arybchik Date: Thu Dec 29 07:06:49 2016 New Revision: 310756 URL: https://svnweb.freebsd.org/changeset/base/310756 Log: sfxge(4): do not use enum type when values are bitmask ICC complains that enumerated type mixed with another type. Found by DPDK upstream build sanity check. Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8954 Modified: head/sys/dev/sfxge/common/ef10_rx.c head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_rx.c head/sys/dev/sfxge/sfxge_rx.c Modified: head/sys/dev/sfxge/common/ef10_rx.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_rx.c Thu Dec 29 07:05:47 2016 (r310755) +++ head/sys/dev/sfxge/common/ef10_rx.c Thu Dec 29 07:06:49 2016 (r310756) @@ -297,13 +297,13 @@ efx_mcdi_rss_context_set_flags( MCDI_IN_POPULATE_DWORD_4(req, RSS_CONTEXT_SET_FLAGS_IN_FLAGS, RSS_CONTEXT_SET_FLAGS_IN_TOEPLITZ_IPV4_EN, - (type & (1U << EFX_RX_HASH_IPV4)) ? 1 : 0, + (type & EFX_RX_HASH_IPV4) ? 1 : 0, RSS_CONTEXT_SET_FLAGS_IN_TOEPLITZ_TCPV4_EN, - (type & (1U << EFX_RX_HASH_TCPIPV4)) ? 1 : 0, + (type & EFX_RX_HASH_TCPIPV4) ? 1 : 0, RSS_CONTEXT_SET_FLAGS_IN_TOEPLITZ_IPV6_EN, - (type & (1U << EFX_RX_HASH_IPV6)) ? 1 : 0, + (type & EFX_RX_HASH_IPV6) ? 1 : 0, RSS_CONTEXT_SET_FLAGS_IN_TOEPLITZ_TCPV6_EN, - (type & (1U << EFX_RX_HASH_TCPIPV6)) ? 1 : 0); + (type & EFX_RX_HASH_TCPIPV6) ? 1 : 0); efx_mcdi_execute(enp, &req); Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Thu Dec 29 07:05:47 2016 (r310755) +++ head/sys/dev/sfxge/common/efx.h Thu Dec 29 07:06:49 2016 (r310756) @@ -1867,12 +1867,12 @@ typedef enum efx_rx_hash_alg_e { EFX_RX_HASHALG_TOEPLITZ } efx_rx_hash_alg_t; -typedef enum efx_rx_hash_type_e { - EFX_RX_HASH_IPV4 = 0, - EFX_RX_HASH_TCPIPV4, - EFX_RX_HASH_IPV6, - EFX_RX_HASH_TCPIPV6, -} efx_rx_hash_type_t; +#define EFX_RX_HASH_IPV4 (1U << 0) +#define EFX_RX_HASH_TCPIPV4 (1U << 1) +#define EFX_RX_HASH_IPV6 (1U << 2) +#define EFX_RX_HASH_TCPIPV6 (1U << 3) + +typedef unsigned int efx_rx_hash_type_t; typedef enum efx_rx_hash_support_e { EFX_RX_HASH_UNAVAILABLE = 0, /* Hardware hash not inserted */ Modified: head/sys/dev/sfxge/common/efx_rx.c ============================================================================== --- head/sys/dev/sfxge/common/efx_rx.c Thu Dec 29 07:05:47 2016 (r310755) +++ head/sys/dev/sfxge/common/efx_rx.c Thu Dec 29 07:06:49 2016 (r310756) @@ -731,12 +731,12 @@ siena_rx_scale_mode_set( case EFX_RX_HASHALG_TOEPLITZ: EFX_RX_TOEPLITZ_IPV4_HASH(enp, insert, - type & (1 << EFX_RX_HASH_IPV4), - type & (1 << EFX_RX_HASH_TCPIPV4)); + type & EFX_RX_HASH_IPV4, + type & EFX_RX_HASH_TCPIPV4); EFX_RX_TOEPLITZ_IPV6_HASH(enp, - type & (1 << EFX_RX_HASH_IPV6), - type & (1 << EFX_RX_HASH_TCPIPV6), + type & EFX_RX_HASH_IPV6, + type & EFX_RX_HASH_TCPIPV6, rc); if (rc != 0) goto fail1; Modified: head/sys/dev/sfxge/sfxge_rx.c ============================================================================== --- head/sys/dev/sfxge/sfxge_rx.c Thu Dec 29 07:05:47 2016 (r310755) +++ head/sys/dev/sfxge/sfxge_rx.c Thu Dec 29 07:06:49 2016 (r310756) @@ -1140,8 +1140,8 @@ sfxge_rx_start(struct sfxge_softc *sc) nitems(sc->rx_indir_table))) != 0) goto fail; (void)efx_rx_scale_mode_set(sc->enp, EFX_RX_HASHALG_TOEPLITZ, - (1 << EFX_RX_HASH_IPV4) | (1 << EFX_RX_HASH_TCPIPV4) | - (1 << EFX_RX_HASH_IPV6) | (1 << EFX_RX_HASH_TCPIPV6), B_TRUE); + EFX_RX_HASH_IPV4 | EFX_RX_HASH_TCPIPV4 | + EFX_RX_HASH_IPV6 | EFX_RX_HASH_TCPIPV6, B_TRUE); #ifdef RSS rss_getkey(toep_key); From owner-svn-src-head@freebsd.org Thu Dec 29 07:10:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9233DC94355; Thu, 29 Dec 2016 07:10:26 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6093F13C8; Thu, 29 Dec 2016 07:10:26 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT7APer055300; Thu, 29 Dec 2016 07:10:25 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT7APh9055298; Thu, 29 Dec 2016 07:10:25 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290710.uBT7APh9055298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 07:10:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310758 - in head/sys: conf dev/sfxge/common modules/sfxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 07:10:26 -0000 Author: arybchik Date: Thu Dec 29 07:10:25 2016 New Revision: 310758 URL: https://svnweb.freebsd.org/changeset/base/310758 Log: sfxge(4): delete hunt_phy.c Submitted by: Mark Spender Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Deleted: head/sys/dev/sfxge/common/hunt_phy.c Modified: head/sys/conf/files.amd64 head/sys/modules/sfxge/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Thu Dec 29 07:07:16 2016 (r310757) +++ head/sys/conf/files.amd64 Thu Dec 29 07:10:25 2016 (r310758) @@ -385,7 +385,6 @@ dev/sfxge/common/efx_tx.c optional sfxge dev/sfxge/common/efx_vpd.c optional sfxge pci dev/sfxge/common/efx_wol.c optional sfxge pci dev/sfxge/common/hunt_nic.c optional sfxge pci -dev/sfxge/common/hunt_phy.c optional sfxge pci dev/sfxge/common/mcdi_mon.c optional sfxge pci dev/sfxge/common/medford_nic.c optional sfxge pci dev/sfxge/common/siena_mac.c optional sfxge pci Modified: head/sys/modules/sfxge/Makefile ============================================================================== --- head/sys/modules/sfxge/Makefile Thu Dec 29 07:07:16 2016 (r310757) +++ head/sys/modules/sfxge/Makefile Thu Dec 29 07:10:25 2016 (r310758) @@ -33,7 +33,7 @@ SRCS+= ef10_ev.c ef10_filter.c ef10_intr SRCS+= ef10_nvram.c ef10_phy.c ef10_rx.c ef10_tx.c ef10_vpd.c SRCS+= ef10_impl.h -SRCS+= hunt_nic.c hunt_phy.c +SRCS+= hunt_nic.c SRCS+= hunt_impl.h SRCS+= medford_nic.c From owner-svn-src-head@freebsd.org Thu Dec 29 07:20:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C48F4C94718; Thu, 29 Dec 2016 07:20:54 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 918551C18; Thu, 29 Dec 2016 07:20:54 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT7KrZx062237; Thu, 29 Dec 2016 07:20:53 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT7KrkP062234; Thu, 29 Dec 2016 07:20:53 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290720.uBT7KrkP062234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 07:20:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310760 - in head/sys/dev/sfxge: . common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 07:20:54 -0000 Author: arybchik Date: Thu Dec 29 07:20:53 2016 New Revision: 310760 URL: https://svnweb.freebsd.org/changeset/base/310760 Log: sfxge(4): fix typo in pseudo header accessor function names Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_rx.c head/sys/dev/sfxge/sfxge_rx.c Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Thu Dec 29 07:11:20 2016 (r310759) +++ head/sys/dev/sfxge/common/efx.h Thu Dec 29 07:20:53 2016 (r310760) @@ -1920,7 +1920,7 @@ efx_rx_scale_key_set( __in size_t n); extern __checkReturn uint32_t -efx_psuedo_hdr_hash_get( +efx_pseudo_hdr_hash_get( __in efx_rxq_t *erp, __in efx_rx_hash_alg_t func, __in uint8_t *buffer); @@ -1928,7 +1928,7 @@ efx_psuedo_hdr_hash_get( #endif /* EFSYS_OPT_RX_SCALE */ extern __checkReturn efx_rc_t -efx_psuedo_hdr_pkt_length_get( +efx_pseudo_hdr_pkt_length_get( __in efx_rxq_t *erp, __in uint8_t *buffer, __out uint16_t *pkt_lengthp); Modified: head/sys/dev/sfxge/common/efx_rx.c ============================================================================== --- head/sys/dev/sfxge/common/efx_rx.c Thu Dec 29 07:11:20 2016 (r310759) +++ head/sys/dev/sfxge/common/efx_rx.c Thu Dec 29 07:20:53 2016 (r310760) @@ -540,7 +540,7 @@ efx_rx_qdestroy( } __checkReturn efx_rc_t -efx_psuedo_hdr_pkt_length_get( +efx_pseudo_hdr_pkt_length_get( __in efx_rxq_t *erp, __in uint8_t *buffer, __out uint16_t *lengthp) @@ -555,7 +555,7 @@ efx_psuedo_hdr_pkt_length_get( #if EFSYS_OPT_RX_SCALE __checkReturn uint32_t -efx_psuedo_hdr_hash_get( +efx_pseudo_hdr_hash_get( __in efx_rxq_t *erp, __in efx_rx_hash_alg_t func, __in uint8_t *buffer) @@ -949,11 +949,11 @@ fail1: #endif /* - * Falcon/Siena psuedo-header + * Falcon/Siena pseudo-header * -------------------------- * * Receive packets are prefixed by an optional 16 byte pseudo-header. - * The psuedo-header is a byte array of one of the forms: + * The pseudo-header is a byte array of one of the forms: * * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 * xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.TT.TT.TT.TT Modified: head/sys/dev/sfxge/sfxge_rx.c ============================================================================== --- head/sys/dev/sfxge/sfxge_rx.c Thu Dec 29 07:11:20 2016 (r310759) +++ head/sys/dev/sfxge/sfxge_rx.c Thu Dec 29 07:20:53 2016 (r310760) @@ -345,7 +345,7 @@ sfxge_rx_deliver(struct sfxge_rxq *rxq, if (flags & (EFX_PKT_IPV4 | EFX_PKT_IPV6)) { m->m_pkthdr.flowid = - efx_psuedo_hdr_hash_get(rxq->common, + efx_pseudo_hdr_hash_get(rxq->common, EFX_RX_HASHALG_TOEPLITZ, mtod(m, uint8_t *)); /* The hash covers a 4-tuple for TCP only */ @@ -680,7 +680,7 @@ sfxge_lro(struct sfxge_rxq *rxq, struct unsigned bucket; /* Get the hardware hash */ - conn_hash = efx_psuedo_hdr_hash_get(rxq->common, + conn_hash = efx_pseudo_hdr_hash_get(rxq->common, EFX_RX_HASHALG_TOEPLITZ, mtod(m, uint8_t *)); @@ -843,7 +843,7 @@ sfxge_rx_qcomplete(struct sfxge_rxq *rxq if (rx_desc->flags & EFX_PKT_PREFIX_LEN) { uint16_t tmp_size; int rc; - rc = efx_psuedo_hdr_pkt_length_get(rxq->common, + rc = efx_pseudo_hdr_pkt_length_get(rxq->common, mtod(m, uint8_t *), &tmp_size); KASSERT(rc == 0, ("cannot get packet length: %d", rc)); From owner-svn-src-head@freebsd.org Thu Dec 29 08:10:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8A53C956AC; Thu, 29 Dec 2016 08:10:52 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8C7E412C0; Thu, 29 Dec 2016 08:10:52 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT8ApKR080251; Thu, 29 Dec 2016 08:10:51 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT8Ap9s080250; Thu, 29 Dec 2016 08:10:51 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290810.uBT8Ap9s080250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 08:10:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310762 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 08:10:53 -0000 Author: arybchik Date: Thu Dec 29 08:10:51 2016 New Revision: 310762 URL: https://svnweb.freebsd.org/changeset/base/310762 Log: sfxge(4): regenerate MCDI headers from firmwaresrc .yml Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx_regs_mcdi.h Modified: head/sys/dev/sfxge/common/efx_regs_mcdi.h ============================================================================== --- head/sys/dev/sfxge/common/efx_regs_mcdi.h Thu Dec 29 07:27:13 2016 (r310761) +++ head/sys/dev/sfxge/common/efx_regs_mcdi.h Thu Dec 29 08:10:51 2016 (r310762) @@ -136,6 +136,8 @@ #define MCDI_HEADER_XFLAGS_WIDTH 8 /* Request response using event */ #define MCDI_HEADER_XFLAGS_EVREQ 0x01 +/* Request (and signal) early doorbell return */ +#define MCDI_HEADER_XFLAGS_DBRET 0x02 /* Maximum number of payload bytes */ #define MCDI_CTL_SDU_LEN_MAX_V1 0xfc @@ -149,7 +151,7 @@ /* The MC can generate events for two reasons: - * - To complete a shared memory request if XFLAGS_EVREQ was set + * - To advance a shared memory request if XFLAGS_EVREQ was set * - As a notification (link state, i2c event), controlled * via MC_CMD_LOG_CTRL * @@ -302,6 +304,12 @@ /* The clock whose frequency you've attempted to set set * doesn't exist on this NIC */ #define MC_CMD_ERR_NO_CLOCK 0x1015 +/* Returned by MC_CMD_TESTASSERT if the action that should + * have caused an assertion failed to do so. */ +#define MC_CMD_ERR_UNREACHABLE 0x1016 +/* This command needs to be processed in the background but there were no + * resources to do so. Send it again after a command has completed. */ +#define MC_CMD_ERR_QUEUE_FULL 0x1017 #define MC_CMD_ERR_CODE_OFST 0 @@ -483,8 +491,48 @@ #define MCDI_EVENT_AOE_DDR_ECC_STATUS 0xa /* enum: PTP status update */ #define MCDI_EVENT_AOE_PTP_STATUS 0xb +/* enum: FPGA header incorrect */ +#define MCDI_EVENT_AOE_FPGA_LOAD_HEADER_ERR 0xc +/* enum: FPGA Powered Off due to error in powering up FPGA */ +#define MCDI_EVENT_AOE_FPGA_POWER_OFF 0xd +/* enum: AOE FPGA load failed due to MC to MUM communication failure */ +#define MCDI_EVENT_AOE_FPGA_LOAD_FAILED 0xe +/* enum: Notify that invalid flash type detected */ +#define MCDI_EVENT_AOE_INVALID_FPGA_FLASH_TYPE 0xf +/* enum: Notify that the attempt to run FPGA Controller firmware timedout */ +#define MCDI_EVENT_AOE_FC_RUN_TIMEDOUT 0x10 #define MCDI_EVENT_AOE_ERR_DATA_LBN 8 #define MCDI_EVENT_AOE_ERR_DATA_WIDTH 8 +#define MCDI_EVENT_AOE_ERR_CODE_FPGA_HEADER_VERIFY_FAILED_LBN 8 +#define MCDI_EVENT_AOE_ERR_CODE_FPGA_HEADER_VERIFY_FAILED_WIDTH 8 +/* enum: Reading from NV failed */ +#define MCDI_EVENT_AOE_ERR_FPGA_HEADER_NV_READ_FAIL 0x0 +/* enum: Invalid Magic Number if FPGA header */ +#define MCDI_EVENT_AOE_ERR_FPGA_HEADER_MAGIC_FAIL 0x1 +/* enum: Invalid Silicon type detected in header */ +#define MCDI_EVENT_AOE_ERR_FPGA_HEADER_SILICON_TYPE 0x2 +/* enum: Unsupported VRatio */ +#define MCDI_EVENT_AOE_ERR_FPGA_HEADER_VRATIO 0x3 +/* enum: Unsupported DDR Type */ +#define MCDI_EVENT_AOE_ERR_FPGA_HEADER_DDR_TYPE 0x4 +/* enum: DDR Voltage out of supported range */ +#define MCDI_EVENT_AOE_ERR_FPGA_HEADER_DDR_VOLTAGE 0x5 +/* enum: Unsupported DDR speed */ +#define MCDI_EVENT_AOE_ERR_FPGA_HEADER_DDR_SPEED 0x6 +/* enum: Unsupported DDR size */ +#define MCDI_EVENT_AOE_ERR_FPGA_HEADER_DDR_SIZE 0x7 +/* enum: Unsupported DDR rank */ +#define MCDI_EVENT_AOE_ERR_FPGA_HEADER_DDR_RANK 0x8 +#define MCDI_EVENT_AOE_ERR_CODE_INVALID_FPGA_FLASH_TYPE_INFO_LBN 8 +#define MCDI_EVENT_AOE_ERR_CODE_INVALID_FPGA_FLASH_TYPE_INFO_WIDTH 8 +/* enum: Primary boot flash */ +#define MCDI_EVENT_AOE_FLASH_TYPE_BOOT_PRIMARY 0x0 +/* enum: Secondary boot flash */ +#define MCDI_EVENT_AOE_FLASH_TYPE_BOOT_SECONDARY 0x1 +#define MCDI_EVENT_AOE_ERR_CODE_FPGA_POWER_OFF_LBN 8 +#define MCDI_EVENT_AOE_ERR_CODE_FPGA_POWER_OFF_WIDTH 8 +#define MCDI_EVENT_AOE_ERR_CODE_FPGA_LOAD_FAILED_LBN 8 +#define MCDI_EVENT_AOE_ERR_CODE_FPGA_LOAD_FAILED_WIDTH 8 #define MCDI_EVENT_RX_ERR_RXQ_LBN 0 #define MCDI_EVENT_RX_ERR_RXQ_WIDTH 12 #define MCDI_EVENT_RX_ERR_TYPE_LBN 12 @@ -765,7 +813,7 @@ #define FCDI_EVENT_BOOT_RESULT_WIDTH 32 /* FCDI_EXTENDED_EVENT_PPS structuredef: Extended FCDI event to send PPS events - * to the MC. Note that this structure | is overlaid over a normal FCDI event + * to the MC. Note that this structure | is overlayed over a normal FCDI event * such that bits 32-63 containing | event code, level, source etc remain the * same. In this case the data | field of the header is defined to be the * number of timestamps @@ -966,6 +1014,8 @@ #define MC_CMD_COPYCODE_IN_BOOT_MAGIC_SKIP_BOOT_ICORE_SYNC_WIDTH 1 #define MC_CMD_COPYCODE_IN_BOOT_MAGIC_FORCE_STANDALONE_LBN 5 #define MC_CMD_COPYCODE_IN_BOOT_MAGIC_FORCE_STANDALONE_WIDTH 1 +#define MC_CMD_COPYCODE_IN_BOOT_MAGIC_DISABLE_XIP_LBN 6 +#define MC_CMD_COPYCODE_IN_BOOT_MAGIC_DISABLE_XIP_WIDTH 1 /* Destination address */ #define MC_CMD_COPYCODE_IN_DEST_ADDR_OFST 4 #define MC_CMD_COPYCODE_IN_NUMWORDS_OFST 8 @@ -4113,6 +4163,8 @@ #define MC_CMD_PTP_OUT_GET_ATTRIBUTES_CAPABILITIES_OFST 8 #define MC_CMD_PTP_OUT_GET_ATTRIBUTES_REPORT_SYNC_STATUS_LBN 0 #define MC_CMD_PTP_OUT_GET_ATTRIBUTES_REPORT_SYNC_STATUS_WIDTH 1 +#define MC_CMD_PTP_OUT_GET_ATTRIBUTES_RX_TSTAMP_OOB_LBN 1 +#define MC_CMD_PTP_OUT_GET_ATTRIBUTES_RX_TSTAMP_OOB_WIDTH 1 #define MC_CMD_PTP_OUT_GET_ATTRIBUTES_RESERVED0_OFST 12 #define MC_CMD_PTP_OUT_GET_ATTRIBUTES_RESERVED1_OFST 16 #define MC_CMD_PTP_OUT_GET_ATTRIBUTES_RESERVED2_OFST 20 @@ -4676,6 +4728,10 @@ #define MC_CMD_FW_HIGH_TX_RATE 0x3 /* enum: Reserved value */ #define MC_CMD_FW_PACKED_STREAM_HASH_MODE_1 0x4 +/* enum: Prefer to use firmware with additional "rules engine" filtering + * support + */ +#define MC_CMD_FW_RULES_ENGINE 0x5 /* enum: Only this option is allowed for non-admin functions */ #define MC_CMD_FW_DONT_CARE 0xffffffff @@ -6098,6 +6154,8 @@ #define MC_CMD_NVRAM_INFO_OUT_PROTECTED_WIDTH 1 #define MC_CMD_NVRAM_INFO_OUT_TLV_LBN 1 #define MC_CMD_NVRAM_INFO_OUT_TLV_WIDTH 1 +#define MC_CMD_NVRAM_INFO_OUT_READ_ONLY_LBN 5 +#define MC_CMD_NVRAM_INFO_OUT_READ_ONLY_WIDTH 1 #define MC_CMD_NVRAM_INFO_OUT_CMAC_LBN 6 #define MC_CMD_NVRAM_INFO_OUT_CMAC_WIDTH 1 #define MC_CMD_NVRAM_INFO_OUT_A_B_LBN 7 @@ -6117,6 +6175,8 @@ #define MC_CMD_NVRAM_INFO_V2_OUT_PROTECTED_WIDTH 1 #define MC_CMD_NVRAM_INFO_V2_OUT_TLV_LBN 1 #define MC_CMD_NVRAM_INFO_V2_OUT_TLV_WIDTH 1 +#define MC_CMD_NVRAM_INFO_V2_OUT_READ_ONLY_LBN 5 +#define MC_CMD_NVRAM_INFO_V2_OUT_READ_ONLY_WIDTH 1 #define MC_CMD_NVRAM_INFO_V2_OUT_A_B_LBN 7 #define MC_CMD_NVRAM_INFO_V2_OUT_A_B_WIDTH 1 #define MC_CMD_NVRAM_INFO_V2_OUT_PHYSDEV_OFST 16 @@ -6137,12 +6197,27 @@ #define MC_CMD_0x38_PRIVILEGE_CTG SRIOV_CTG_ADMIN -/* MC_CMD_NVRAM_UPDATE_START_IN msgrequest */ +/* MC_CMD_NVRAM_UPDATE_START_IN msgrequest: Legacy NVRAM_UPDATE_START request. + * Use NVRAM_UPDATE_START_V2_IN in new code + */ #define MC_CMD_NVRAM_UPDATE_START_IN_LEN 4 #define MC_CMD_NVRAM_UPDATE_START_IN_TYPE_OFST 0 /* Enum values, see field(s): */ /* MC_CMD_NVRAM_TYPES/MC_CMD_NVRAM_TYPES_OUT/TYPES */ +/* MC_CMD_NVRAM_UPDATE_START_V2_IN msgrequest: Extended NVRAM_UPDATE_START + * request with additional flags indicating version of command in use. See + * MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT for details of extended functionality. Use + * paired up with NVRAM_UPDATE_FINISH_V2_IN. + */ +#define MC_CMD_NVRAM_UPDATE_START_V2_IN_LEN 8 +#define MC_CMD_NVRAM_UPDATE_START_V2_IN_TYPE_OFST 0 +/* Enum values, see field(s): */ +/* MC_CMD_NVRAM_TYPES/MC_CMD_NVRAM_TYPES_OUT/TYPES */ +#define MC_CMD_NVRAM_UPDATE_START_V2_IN_FLAGS_OFST 4 +#define MC_CMD_NVRAM_UPDATE_START_V2_IN_FLAG_REPORT_VERIFY_RESULT_LBN 0 +#define MC_CMD_NVRAM_UPDATE_START_V2_IN_FLAG_REPORT_VERIFY_RESULT_WIDTH 1 + /* MC_CMD_NVRAM_UPDATE_START_OUT msgresponse */ #define MC_CMD_NVRAM_UPDATE_START_OUT_LEN 0 @@ -6271,16 +6346,87 @@ #define MC_CMD_0x3c_PRIVILEGE_CTG SRIOV_CTG_ADMIN -/* MC_CMD_NVRAM_UPDATE_FINISH_IN msgrequest */ +/* MC_CMD_NVRAM_UPDATE_FINISH_IN msgrequest: Legacy NVRAM_UPDATE_FINISH + * request. Use NVRAM_UPDATE_FINISH_V2_IN in new code + */ #define MC_CMD_NVRAM_UPDATE_FINISH_IN_LEN 8 #define MC_CMD_NVRAM_UPDATE_FINISH_IN_TYPE_OFST 0 /* Enum values, see field(s): */ /* MC_CMD_NVRAM_TYPES/MC_CMD_NVRAM_TYPES_OUT/TYPES */ #define MC_CMD_NVRAM_UPDATE_FINISH_IN_REBOOT_OFST 4 -/* MC_CMD_NVRAM_UPDATE_FINISH_OUT msgresponse */ +/* MC_CMD_NVRAM_UPDATE_FINISH_V2_IN msgrequest: Extended NVRAM_UPDATE_FINISH + * request with additional flags indicating version of NVRAM_UPDATE commands in + * use. See MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT for details of extended + * functionality. Use paired up with NVRAM_UPDATE_START_V2_IN. + */ +#define MC_CMD_NVRAM_UPDATE_FINISH_V2_IN_LEN 12 +#define MC_CMD_NVRAM_UPDATE_FINISH_V2_IN_TYPE_OFST 0 +/* Enum values, see field(s): */ +/* MC_CMD_NVRAM_TYPES/MC_CMD_NVRAM_TYPES_OUT/TYPES */ +#define MC_CMD_NVRAM_UPDATE_FINISH_V2_IN_REBOOT_OFST 4 +#define MC_CMD_NVRAM_UPDATE_FINISH_V2_IN_FLAGS_OFST 8 +#define MC_CMD_NVRAM_UPDATE_FINISH_V2_IN_FLAG_REPORT_VERIFY_RESULT_LBN 0 +#define MC_CMD_NVRAM_UPDATE_FINISH_V2_IN_FLAG_REPORT_VERIFY_RESULT_WIDTH 1 + +/* MC_CMD_NVRAM_UPDATE_FINISH_OUT msgresponse: Legacy NVRAM_UPDATE_FINISH + * response. Use NVRAM_UPDATE_FINISH_V2_OUT in new code + */ #define MC_CMD_NVRAM_UPDATE_FINISH_OUT_LEN 0 +/* MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT msgresponse: + * + * Extended NVRAM_UPDATE_FINISH response that communicates the result of secure + * firmware validation where applicable back to the host. + * + * Medford only: For signed firmware images, such as those for medford, the MC + * firmware verifies the signature before marking the firmware image as valid. + * This process takes a few seconds to complete. So is likely to take more than + * the MCDI timeout. Hence signature verification is initiated when + * MC_CMD_NVRAM_UPDATE_FINISH_V2_IN is received by the firmware, however, the + * MCDI command is run in a background MCDI processing thread. This response + * payload includes the results of the signature verification. Note that the + * per-partition nvram lock in firmware is only released after the verification + * has completed. + */ +#define MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT_LEN 4 +/* Result of nvram update completion processing */ +#define MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT_RESULT_CODE_OFST 0 +/* enum: Invalid return code; only non-zero values are defined. Defined as + * unknown for backwards compatibility with NVRAM_UPDATE_FINISH_OUT. + */ +#define MC_CMD_NVRAM_VERIFY_RC_UNKNOWN 0x0 +/* enum: Verify succeeded without any errors. */ +#define MC_CMD_NVRAM_VERIFY_RC_SUCCESS 0x1 +/* enum: CMS format verification failed due to an internal error. */ +#define MC_CMD_NVRAM_VERIFY_RC_CMS_CHECK_FAILED 0x2 +/* enum: Invalid CMS format in image metadata. */ +#define MC_CMD_NVRAM_VERIFY_RC_INVALID_CMS_FORMAT 0x3 +/* enum: Message digest verification failed due to an internal error. */ +#define MC_CMD_NVRAM_VERIFY_RC_MESSAGE_DIGEST_CHECK_FAILED 0x4 +/* enum: Error in message digest calculated over the reflash-header, payload + * and reflash-trailer. + */ +#define MC_CMD_NVRAM_VERIFY_RC_BAD_MESSAGE_DIGEST 0x5 +/* enum: Signature verification failed due to an internal error. */ +#define MC_CMD_NVRAM_VERIFY_RC_SIGNATURE_CHECK_FAILED 0x6 +/* enum: There are no valid signatures in the image. */ +#define MC_CMD_NVRAM_VERIFY_RC_NO_VALID_SIGNATURES 0x7 +/* enum: Trusted approvers verification failed due to an internal error. */ +#define MC_CMD_NVRAM_VERIFY_RC_TRUSTED_APPROVERS_CHECK_FAILED 0x8 +/* enum: The Trusted approver's list is empty. */ +#define MC_CMD_NVRAM_VERIFY_RC_NO_TRUSTED_APPROVERS 0x9 +/* enum: Signature chain verification failed due to an internal error. */ +#define MC_CMD_NVRAM_VERIFY_RC_SIGNATURE_CHAIN_CHECK_FAILED 0xa +/* enum: The signers of the signatures in the image are not listed in the + * Trusted approver's list. + */ +#define MC_CMD_NVRAM_VERIFY_RC_NO_SIGNATURE_MATCH 0xb +/* enum: The image contains a test-signed certificate, but the adapter accepts + * only production signed images. + */ +#define MC_CMD_NVRAM_VERIFY_RC_REJECT_TEST_SIGNED 0xc + /***********************************/ /* MC_CMD_REBOOT @@ -6853,6 +6999,28 @@ /* MC_CMD_TESTASSERT_OUT msgresponse */ #define MC_CMD_TESTASSERT_OUT_LEN 0 +/* MC_CMD_TESTASSERT_V2_IN msgrequest */ +#define MC_CMD_TESTASSERT_V2_IN_LEN 4 +/* How to provoke the assertion */ +#define MC_CMD_TESTASSERT_V2_IN_TYPE_OFST 0 +/* enum: Assert using the FAIL_ASSERTION_WITH_USEFUL_VALUES macro. Unless + * you're testing firmware, this is what you want. + */ +#define MC_CMD_TESTASSERT_V2_IN_FAIL_ASSERTION_WITH_USEFUL_VALUES 0x0 +/* enum: Assert using assert(0); */ +#define MC_CMD_TESTASSERT_V2_IN_ASSERT_FALSE 0x1 +/* enum: Deliberately trigger a watchdog */ +#define MC_CMD_TESTASSERT_V2_IN_WATCHDOG 0x2 +/* enum: Deliberately trigger a trap by loading from an invalid address */ +#define MC_CMD_TESTASSERT_V2_IN_LOAD_TRAP 0x3 +/* enum: Deliberately trigger a trap by storing to an invalid address */ +#define MC_CMD_TESTASSERT_V2_IN_STORE_TRAP 0x4 +/* enum: Jump to an invalid address */ +#define MC_CMD_TESTASSERT_V2_IN_JUMP_TRAP 0x5 + +/* MC_CMD_TESTASSERT_V2_OUT msgresponse */ +#define MC_CMD_TESTASSERT_V2_OUT_LEN 0 + /***********************************/ /* MC_CMD_WORKAROUND @@ -7869,8 +8037,8 @@ #define NVRAM_PARTITION_TYPE_EXPANSION_UEFI 0xd00 /* enum: Spare partition 0 */ #define NVRAM_PARTITION_TYPE_SPARE_0 0x1000 -/* enum: Spare partition 1 */ -#define NVRAM_PARTITION_TYPE_SPARE_1 0x1100 +/* enum: Used for XIP code of shmbooted images */ +#define NVRAM_PARTITION_TYPE_XIP_SCRATCH 0x1100 /* enum: Spare partition 2 */ #define NVRAM_PARTITION_TYPE_SPARE_2 0x1200 /* enum: Manufacturing partition. Used during manufacture to pass information @@ -7881,6 +8049,10 @@ #define NVRAM_PARTITION_TYPE_SPARE_4 0x1400 /* enum: Spare partition 5 */ #define NVRAM_PARTITION_TYPE_SPARE_5 0x1500 +/* enum: Partition for reporting MC status. See mc_flash_layout.h + * medford_mc_status_hdr_t for layout on Medford. + */ +#define NVRAM_PARTITION_TYPE_STATUS 0x1600 /* enum: Start of reserved value range (firmware may use for any purpose) */ #define NVRAM_PARTITION_TYPE_RESERVED_VALUES_MIN 0xff00 /* enum: End of reserved value range (firmware may use for any purpose) */ @@ -7913,6 +8085,14 @@ #define LICENSED_APP_ID_NETWORK_ACCESS_CONTROL 0x80 /* enum: TCP Direct */ #define LICENSED_APP_ID_TCP_DIRECT 0x100 +/* enum: Low Latency */ +#define LICENSED_APP_ID_LOW_LATENCY 0x200 +/* enum: SolarCapture Tap */ +#define LICENSED_APP_ID_SOLARCAPTURE_TAP 0x400 +/* enum: Capture SolarSystem 40G */ +#define LICENSED_APP_ID_CAPTURE_SOLARSYSTEM_40G 0x800 +/* enum: Capture SolarSystem 1G */ +#define LICENSED_APP_ID_CAPTURE_SOLARSYSTEM_1G 0x1000 #define LICENSED_APP_ID_ID_LBN 0 #define LICENSED_APP_ID_ID_WIDTH 32 @@ -7975,6 +8155,10 @@ #define LICENSED_V3_APPS_LOW_LATENCY_WIDTH 1 #define LICENSED_V3_APPS_SOLARCAPTURE_TAP_LBN 10 #define LICENSED_V3_APPS_SOLARCAPTURE_TAP_WIDTH 1 +#define LICENSED_V3_APPS_CAPTURE_SOLARSYSTEM_40G_LBN 11 +#define LICENSED_V3_APPS_CAPTURE_SOLARSYSTEM_40G_WIDTH 1 +#define LICENSED_V3_APPS_CAPTURE_SOLARSYSTEM_1G_LBN 12 +#define LICENSED_V3_APPS_CAPTURE_SOLARSYSTEM_1G_WIDTH 1 #define LICENSED_V3_APPS_MASK_LBN 0 #define LICENSED_V3_APPS_MASK_WIDTH 64 @@ -8054,6 +8238,19 @@ #define RSS_MODE_HASH_SELECTOR_LBN 0 #define RSS_MODE_HASH_SELECTOR_WIDTH 8 +/* CTPIO_STATS_MAP structuredef */ +#define CTPIO_STATS_MAP_LEN 4 +/* The (function relative) VI number */ +#define CTPIO_STATS_MAP_VI_OFST 0 +#define CTPIO_STATS_MAP_VI_LEN 2 +#define CTPIO_STATS_MAP_VI_LBN 0 +#define CTPIO_STATS_MAP_VI_WIDTH 16 +/* The target bucket for the VI */ +#define CTPIO_STATS_MAP_BUCKET_OFST 2 +#define CTPIO_STATS_MAP_BUCKET_LEN 2 +#define CTPIO_STATS_MAP_BUCKET_LBN 16 +#define CTPIO_STATS_MAP_BUCKET_WIDTH 16 + /***********************************/ /* MC_CMD_READ_REGS @@ -8509,6 +8706,8 @@ #define MC_CMD_INIT_TXQ_EXT_IN_FLAG_INNER_TCP_CSUM_EN_WIDTH 1 #define MC_CMD_INIT_TXQ_EXT_IN_FLAG_TSOV2_EN_LBN 12 #define MC_CMD_INIT_TXQ_EXT_IN_FLAG_TSOV2_EN_WIDTH 1 +#define MC_CMD_INIT_TXQ_EXT_IN_FLAG_CTPIO_LBN 13 +#define MC_CMD_INIT_TXQ_EXT_IN_FLAG_CTPIO_WIDTH 1 /* Owner ID to use if in buffer mode (zero if physical) */ #define MC_CMD_INIT_TXQ_EXT_IN_OWNER_ID_OFST 20 /* The port ID associated with the v-adaptor which should contain this DMAQ. */ @@ -9442,7 +9641,11 @@ #define MC_CMD_PARSER_DISP_RW_IN_RX_DICPU 0x0 /* enum: TX dispatcher CPU */ #define MC_CMD_PARSER_DISP_RW_IN_TX_DICPU 0x1 -/* enum: Lookup engine (with original metadata format) */ +/* enum: Lookup engine (with original metadata format). Deprecated; used only + * by cmdclient as a fallback for very old Huntington firmware, and not + * supported in firmware beyond v6.4.0.1005. Use LUE_VERSIONED_METADATA + * instead. + */ #define MC_CMD_PARSER_DISP_RW_IN_LUE 0x2 /* enum: Lookup engine (with requested metadata format) */ #define MC_CMD_PARSER_DISP_RW_IN_LUE_VERSIONED_METADATA 0x3 @@ -10298,7 +10501,9 @@ * (Huntington development only) */ #define MC_CMD_GET_CAPABILITIES_OUT_RXPD_FW_TYPE_SIENA_COMPAT 0x2 -/* enum: Virtual switching (full feature) RX PD production firmware */ +/* enum: Full featured RX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_OUT_RXPD_FW_TYPE_FULL_FEATURED 0x3 +/* enum: (deprecated original name for the FULL_FEATURED variant) */ #define MC_CMD_GET_CAPABILITIES_OUT_RXPD_FW_TYPE_VSWITCH 0x3 /* enum: siena_compat variant RX PD firmware using PM rather than MAC * (Huntington development only) @@ -10312,6 +10517,8 @@ * tests (Medford development only) */ #define MC_CMD_GET_CAPABILITIES_OUT_RXPD_FW_TYPE_LAYER2_PERF 0x7 +/* enum: Rules engine RX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_OUT_RXPD_FW_TYPE_RULES_ENGINE 0x8 /* enum: RX PD firmware for GUE parsing prototype (Medford development only) */ #define MC_CMD_GET_CAPABILITIES_OUT_RXPD_FW_TYPE_TESTFW_GUE_PROTOTYPE 0xe /* enum: RX PD firmware parsing but not filtering network overlay tunnel @@ -10336,7 +10543,9 @@ * (Huntington development only) */ #define MC_CMD_GET_CAPABILITIES_OUT_TXPD_FW_TYPE_SIENA_COMPAT 0x2 -/* enum: Virtual switching (full feature) TX PD production firmware */ +/* enum: Full featured TX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_OUT_TXPD_FW_TYPE_FULL_FEATURED 0x3 +/* enum: (deprecated original name for the FULL_FEATURED variant) */ #define MC_CMD_GET_CAPABILITIES_OUT_TXPD_FW_TYPE_VSWITCH 0x3 /* enum: siena_compat variant TX PD firmware using PM rather than MAC * (Huntington development only) @@ -10347,6 +10556,8 @@ * tests (Medford development only) */ #define MC_CMD_GET_CAPABILITIES_OUT_TXPD_FW_TYPE_LAYER2_PERF 0x7 +/* enum: Rules engine TX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_OUT_TXPD_FW_TYPE_RULES_ENGINE 0x8 /* enum: RX PD firmware for GUE parsing prototype (Medford development only) */ #define MC_CMD_GET_CAPABILITIES_OUT_TXPD_FW_TYPE_TESTFW_GUE_PROTOTYPE 0xe /* Hardware capabilities of NIC */ @@ -10483,7 +10694,9 @@ * (Huntington development only) */ #define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_TYPE_SIENA_COMPAT 0x2 -/* enum: Virtual switching (full feature) RX PD production firmware */ +/* enum: Full featured RX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_TYPE_FULL_FEATURED 0x3 +/* enum: (deprecated original name for the FULL_FEATURED variant) */ #define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_TYPE_VSWITCH 0x3 /* enum: siena_compat variant RX PD firmware using PM rather than MAC * (Huntington development only) @@ -10497,6 +10710,8 @@ * tests (Medford development only) */ #define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_TYPE_LAYER2_PERF 0x7 +/* enum: Rules engine RX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_TYPE_RULES_ENGINE 0x8 /* enum: RX PD firmware for GUE parsing prototype (Medford development only) */ #define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_TYPE_TESTFW_GUE_PROTOTYPE 0xe /* enum: RX PD firmware parsing but not filtering network overlay tunnel @@ -10521,7 +10736,9 @@ * (Huntington development only) */ #define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_TYPE_SIENA_COMPAT 0x2 -/* enum: Virtual switching (full feature) TX PD production firmware */ +/* enum: Full featured TX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_TYPE_FULL_FEATURED 0x3 +/* enum: (deprecated original name for the FULL_FEATURED variant) */ #define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_TYPE_VSWITCH 0x3 /* enum: siena_compat variant TX PD firmware using PM rather than MAC * (Huntington development only) @@ -10532,6 +10749,8 @@ * tests (Medford development only) */ #define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_TYPE_LAYER2_PERF 0x7 +/* enum: Rules engine TX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_TYPE_RULES_ENGINE 0x8 /* enum: RX PD firmware for GUE parsing prototype (Medford development only) */ #define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_TYPE_TESTFW_GUE_PROTOTYPE 0xe /* Hardware capabilities of NIC */ @@ -10556,6 +10775,20 @@ #define MC_CMD_GET_CAPABILITIES_V2_OUT_MAC_STATS_40G_TX_SIZE_BINS_WIDTH 1 #define MC_CMD_GET_CAPABILITIES_V2_OUT_INIT_EVQ_V2_LBN 7 #define MC_CMD_GET_CAPABILITIES_V2_OUT_INIT_EVQ_V2_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_MAC_TIMESTAMPING_LBN 8 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_MAC_TIMESTAMPING_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_TIMESTAMP_LBN 9 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_TIMESTAMP_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_SNIFF_LBN 10 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_SNIFF_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_SNIFF_LBN 11 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_SNIFF_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_NVRAM_UPDATE_REPORT_VERIFY_RESULT_LBN 12 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_NVRAM_UPDATE_REPORT_VERIFY_RESULT_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_MCDI_BACKGROUND_LBN 13 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_MCDI_BACKGROUND_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_MCDI_DB_RETURN_LBN 14 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_MCDI_DB_RETURN_WIDTH 1 /* Number of FATSOv2 contexts per datapath supported by this NIC. Not present * on older firmware (check the length). */ @@ -10612,6 +10845,308 @@ #define MC_CMD_GET_CAPABILITIES_V2_OUT_SIZE_PIO_BUFF_OFST 70 #define MC_CMD_GET_CAPABILITIES_V2_OUT_SIZE_PIO_BUFF_LEN 2 +/* MC_CMD_GET_CAPABILITIES_V3_OUT msgresponse */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_LEN 76 +/* First word of flags. */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_FLAGS1_OFST 0 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VPORT_RECONFIGURE_LBN 3 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VPORT_RECONFIGURE_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_STRIPING_LBN 4 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_STRIPING_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VADAPTOR_QUERY_LBN 5 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VADAPTOR_QUERY_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_EVB_PORT_VLAN_RESTRICT_LBN 6 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_EVB_PORT_VLAN_RESTRICT_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_DRV_ATTACH_PREBOOT_LBN 7 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_DRV_ATTACH_PREBOOT_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_FORCE_EVENT_MERGING_LBN 8 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_FORCE_EVENT_MERGING_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_SET_MAC_ENHANCED_LBN 9 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_SET_MAC_ENHANCED_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_UNKNOWN_UCAST_DST_FILTER_ALWAYS_MULTI_RECIPIENT_LBN 10 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_UNKNOWN_UCAST_DST_FILTER_ALWAYS_MULTI_RECIPIENT_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VADAPTOR_PERMIT_SET_MAC_WHEN_FILTERS_INSTALLED_LBN 11 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VADAPTOR_PERMIT_SET_MAC_WHEN_FILTERS_INSTALLED_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_MAC_SECURITY_FILTERING_LBN 12 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_MAC_SECURITY_FILTERING_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_ADDITIONAL_RSS_MODES_LBN 13 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_ADDITIONAL_RSS_MODES_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_QBB_LBN 14 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_QBB_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_PACKED_STREAM_VAR_BUFFERS_LBN 15 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_PACKED_STREAM_VAR_BUFFERS_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_RSS_LIMITED_LBN 16 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_RSS_LIMITED_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_PACKED_STREAM_LBN 17 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_PACKED_STREAM_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_INCLUDE_FCS_LBN 18 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_INCLUDE_FCS_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_VLAN_INSERTION_LBN 19 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_VLAN_INSERTION_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_VLAN_STRIPPING_LBN 20 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_VLAN_STRIPPING_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_TSO_LBN 21 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_TSO_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_PREFIX_LEN_0_LBN 22 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_PREFIX_LEN_0_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_PREFIX_LEN_14_LBN 23 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_PREFIX_LEN_14_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_TIMESTAMP_LBN 24 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_TIMESTAMP_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_BATCHING_LBN 25 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_BATCHING_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_MCAST_FILTER_CHAINING_LBN 26 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_MCAST_FILTER_CHAINING_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_PM_AND_RXDP_COUNTERS_LBN 27 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_PM_AND_RXDP_COUNTERS_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_DISABLE_SCATTER_LBN 28 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_DISABLE_SCATTER_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_MCAST_UDP_LOOPBACK_LBN 29 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_MCAST_UDP_LOOPBACK_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_EVB_LBN 30 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_EVB_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VXLAN_NVGRE_LBN 31 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VXLAN_NVGRE_WIDTH 1 +/* RxDPCPU firmware id. */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_DPCPU_FW_ID_OFST 4 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_DPCPU_FW_ID_LEN 2 +/* enum: Standard RXDP firmware */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXDP 0x0 +/* enum: Low latency RXDP firmware */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXDP_LOW_LATENCY 0x1 +/* enum: Packed stream RXDP firmware */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXDP_PACKED_STREAM 0x2 +/* enum: BIST RXDP firmware */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXDP_BIST 0x10a +/* enum: RXDP Test firmware image 1 */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXDP_TEST_FW_TO_MC_CUT_THROUGH 0x101 +/* enum: RXDP Test firmware image 2 */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXDP_TEST_FW_TO_MC_STORE_FORWARD 0x102 +/* enum: RXDP Test firmware image 3 */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXDP_TEST_FW_TO_MC_STORE_FORWARD_FIRST 0x103 +/* enum: RXDP Test firmware image 4 */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXDP_TEST_EVERY_EVENT_BATCHABLE 0x104 +/* enum: RXDP Test firmware image 5 */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXDP_TEST_BACKPRESSURE 0x105 +/* enum: RXDP Test firmware image 6 */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXDP_TEST_FW_PACKET_EDITS 0x106 +/* enum: RXDP Test firmware image 7 */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXDP_TEST_FW_RX_HDR_SPLIT 0x107 +/* enum: RXDP Test firmware image 8 */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXDP_TEST_FW_DISABLE_DL 0x108 +/* enum: RXDP Test firmware image 9 */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXDP_TEST_FW_DOORBELL_DELAY 0x10b +/* TxDPCPU firmware id. */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_DPCPU_FW_ID_OFST 6 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_DPCPU_FW_ID_LEN 2 +/* enum: Standard TXDP firmware */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXDP 0x0 +/* enum: Low latency TXDP firmware */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXDP_LOW_LATENCY 0x1 +/* enum: High packet rate TXDP firmware */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXDP_HIGH_PACKET_RATE 0x3 +/* enum: BIST TXDP firmware */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXDP_BIST 0x12d +/* enum: TXDP Test firmware image 1 */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXDP_TEST_FW_TSO_EDIT 0x101 +/* enum: TXDP Test firmware image 2 */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXDP_TEST_FW_PACKET_EDITS 0x102 +/* enum: TXDP CSR bus test firmware */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXDP_TEST_FW_CSR 0x103 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_VERSION_OFST 8 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_VERSION_LEN 2 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_VERSION_REV_LBN 0 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_VERSION_REV_WIDTH 12 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_VERSION_TYPE_LBN 12 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_VERSION_TYPE_WIDTH 4 +/* enum: reserved value - do not use (may indicate alternative interpretation + * of REV field in future) + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_TYPE_RESERVED 0x0 +/* enum: Trivial RX PD firmware for early Huntington development (Huntington + * development only) + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_TYPE_FIRST_PKT 0x1 +/* enum: RX PD firmware with approximately Siena-compatible behaviour + * (Huntington development only) + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_TYPE_SIENA_COMPAT 0x2 +/* enum: Full featured RX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_TYPE_FULL_FEATURED 0x3 +/* enum: (deprecated original name for the FULL_FEATURED variant) */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_TYPE_VSWITCH 0x3 +/* enum: siena_compat variant RX PD firmware using PM rather than MAC + * (Huntington development only) + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_TYPE_SIENA_COMPAT_PM 0x4 +/* enum: Low latency RX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_TYPE_LOW_LATENCY 0x5 +/* enum: Packed stream RX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_TYPE_PACKED_STREAM 0x6 +/* enum: RX PD firmware handling layer 2 only for high packet rate performance + * tests (Medford development only) + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_TYPE_LAYER2_PERF 0x7 +/* enum: Rules engine RX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_TYPE_RULES_ENGINE 0x8 +/* enum: RX PD firmware for GUE parsing prototype (Medford development only) */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_TYPE_TESTFW_GUE_PROTOTYPE 0xe +/* enum: RX PD firmware parsing but not filtering network overlay tunnel + * encapsulations (Medford development only) + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RXPD_FW_TYPE_TESTFW_ENCAP_PARSING_ONLY 0xf +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXPD_FW_VERSION_OFST 10 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXPD_FW_VERSION_LEN 2 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXPD_FW_VERSION_REV_LBN 0 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXPD_FW_VERSION_REV_WIDTH 12 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXPD_FW_VERSION_TYPE_LBN 12 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXPD_FW_VERSION_TYPE_WIDTH 4 +/* enum: reserved value - do not use (may indicate alternative interpretation + * of REV field in future) + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXPD_FW_TYPE_RESERVED 0x0 +/* enum: Trivial TX PD firmware for early Huntington development (Huntington + * development only) + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXPD_FW_TYPE_FIRST_PKT 0x1 +/* enum: TX PD firmware with approximately Siena-compatible behaviour + * (Huntington development only) + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXPD_FW_TYPE_SIENA_COMPAT 0x2 +/* enum: Full featured TX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXPD_FW_TYPE_FULL_FEATURED 0x3 +/* enum: (deprecated original name for the FULL_FEATURED variant) */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXPD_FW_TYPE_VSWITCH 0x3 +/* enum: siena_compat variant TX PD firmware using PM rather than MAC + * (Huntington development only) + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXPD_FW_TYPE_SIENA_COMPAT_PM 0x4 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXPD_FW_TYPE_LOW_LATENCY 0x5 /* enum */ +/* enum: TX PD firmware handling layer 2 only for high packet rate performance + * tests (Medford development only) + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXPD_FW_TYPE_LAYER2_PERF 0x7 +/* enum: Rules engine TX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXPD_FW_TYPE_RULES_ENGINE 0x8 +/* enum: RX PD firmware for GUE parsing prototype (Medford development only) */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TXPD_FW_TYPE_TESTFW_GUE_PROTOTYPE 0xe +/* Hardware capabilities of NIC */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_HW_CAPABILITIES_OFST 12 +/* Licensed capabilities */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_LICENSE_CAPABILITIES_OFST 16 +/* Second word of flags. Not present on older firmware (check the length). */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_FLAGS2_OFST 20 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_TSO_V2_LBN 0 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_TSO_V2_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_TSO_V2_ENCAP_LBN 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_TSO_V2_ENCAP_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_EVQ_TIMER_CTRL_LBN 2 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_EVQ_TIMER_CTRL_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_EVENT_CUT_THROUGH_LBN 3 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_EVENT_CUT_THROUGH_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_CUT_THROUGH_LBN 4 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_CUT_THROUGH_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_VFIFO_ULL_MODE_LBN 5 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_VFIFO_ULL_MODE_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_MAC_STATS_40G_TX_SIZE_BINS_LBN 6 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_MAC_STATS_40G_TX_SIZE_BINS_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_INIT_EVQ_V2_LBN 7 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_INIT_EVQ_V2_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_MAC_TIMESTAMPING_LBN 8 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_MAC_TIMESTAMPING_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_TIMESTAMP_LBN 9 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_TIMESTAMP_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_SNIFF_LBN 10 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_SNIFF_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_SNIFF_LBN 11 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_SNIFF_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_NVRAM_UPDATE_REPORT_VERIFY_RESULT_LBN 12 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_NVRAM_UPDATE_REPORT_VERIFY_RESULT_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_MCDI_BACKGROUND_LBN 13 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_MCDI_BACKGROUND_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_MCDI_DB_RETURN_LBN 14 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_MCDI_DB_RETURN_WIDTH 1 +/* Number of FATSOv2 contexts per datapath supported by this NIC. Not present + * on older firmware (check the length). + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_TSO_V2_N_CONTEXTS_OFST 24 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_TSO_V2_N_CONTEXTS_LEN 2 +/* One byte per PF containing the number of the external port assigned to this + * PF, indexed by PF number. Special values indicate that a PF is either not + * present or not assigned. + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_PFS_TO_PORTS_ASSIGNMENT_OFST 26 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_PFS_TO_PORTS_ASSIGNMENT_LEN 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_PFS_TO_PORTS_ASSIGNMENT_NUM 16 +/* enum: The caller is not permitted to access information on this PF. */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_ACCESS_NOT_PERMITTED 0xff +/* enum: PF does not exist. */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_PF_NOT_PRESENT 0xfe +/* enum: PF does exist but is not assigned to any external port. */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_PF_NOT_ASSIGNED 0xfd +/* enum: This value indicates that PF is assigned, but it cannot be expressed + * in this field. It is intended for a possible future situation where a more + * complex scheme of PFs to ports mapping is being used. The future driver + * should look for a new field supporting the new scheme. The current/old + * driver should treat this value as PF_NOT_ASSIGNED. + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_INCOMPATIBLE_ASSIGNMENT 0xfc +/* One byte per PF containing the number of its VFs, indexed by PF number. A + * special value indicates that a PF is not present. + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_NUM_VFS_PER_PF_OFST 42 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_NUM_VFS_PER_PF_LEN 1 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_NUM_VFS_PER_PF_NUM 16 +/* enum: The caller is not permitted to access information on this PF. */ +/* MC_CMD_GET_CAPABILITIES_V3_OUT_ACCESS_NOT_PERMITTED 0xff */ +/* enum: PF does not exist. */ +/* MC_CMD_GET_CAPABILITIES_V3_OUT_PF_NOT_PRESENT 0xfe */ +/* Number of VIs available for each external port */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_NUM_VIS_PER_PORT_OFST 58 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_NUM_VIS_PER_PORT_LEN 2 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_NUM_VIS_PER_PORT_NUM 4 +/* Size of RX descriptor cache expressed as binary logarithm The actual size + * equals (2 ^ RX_DESC_CACHE_SIZE) + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_DESC_CACHE_SIZE_OFST 66 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_RX_DESC_CACHE_SIZE_LEN 1 +/* Size of TX descriptor cache expressed as binary logarithm The actual size + * equals (2 ^ TX_DESC_CACHE_SIZE) + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_DESC_CACHE_SIZE_OFST 67 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_TX_DESC_CACHE_SIZE_LEN 1 +/* Total number of available PIO buffers */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_NUM_PIO_BUFFS_OFST 68 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_NUM_PIO_BUFFS_LEN 2 +/* Size of a single PIO buffer */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_SIZE_PIO_BUFF_OFST 70 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_SIZE_PIO_BUFF_LEN 2 +/* On chips later than Medford the amount of address space assigned to each VI + * is configurable. This is a global setting that the driver must query to + * discover the VI to address mapping. Cut-through PIO (CTPIO) is not available + * with 8k VI windows. + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VI_WINDOW_MODE_OFST 72 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VI_WINDOW_MODE_LEN 1 +/* enum: Each VI occupies 8k as on Huntington and Medford. PIO is at offset 4k. + * CTPIO is not mapped. + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VI_WINDOW_MODE_8K 0x0 +/* enum: Each VI occupies 16k. PIO is at offset 4k. CTPIO is at offset 12k. */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VI_WINDOW_MODE_16K 0x1 +/* enum: Each VI occupies 64k. PIO is at offset 4k. CTPIO is at offset 12k. */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VI_WINDOW_MODE_64K 0x2 +/* Number of vFIFOs per adapter that can be used for VFIFO Stuffing + * (SF-115995-SW) in the present configuration of firmware and port mode. + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VFIFO_STUFFING_NUM_VFIFOS_OFST 73 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VFIFO_STUFFING_NUM_VFIFOS_LEN 1 +/* Number of buffers per adapter that can be used for VFIFO Stuffing + * (SF-115995-SW) in the present configuration of firmware and port mode. + */ +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VFIFO_STUFFING_NUM_CP_BUFFERS_OFST 74 +#define MC_CMD_GET_CAPABILITIES_V3_OUT_VFIFO_STUFFING_NUM_CP_BUFFERS_LEN 2 + /***********************************/ /* MC_CMD_V2_EXTN @@ -11770,7 +12305,7 @@ #define MC_CMD_GET_RXDP_CONFIG 0xc2 #undef MC_CMD_0xc2_PRIVILEGE_CTG -#define MC_CMD_0xc2_PRIVILEGE_CTG SRIOV_CTG_ADMIN +#define MC_CMD_0xc2_PRIVILEGE_CTG SRIOV_CTG_GENERAL /* MC_CMD_GET_RXDP_CONFIG_IN msgrequest */ #define MC_CMD_GET_RXDP_CONFIG_IN_LEN 0 @@ -12635,6 +13170,8 @@ * more data is returned. */ #define MC_CMD_PCIE_TUNE_IN_POLL_EYE_PLOT 0x6 +/* enum: Enable the SERDES BIST and set it to generate a 200MHz square wave */ +#define MC_CMD_PCIE_TUNE_IN_BIST_SQUARE_WAVE 0x7 /* Align the arguments to 32 bits */ #define MC_CMD_PCIE_TUNE_IN_PCIE_TUNE_RSVD_OFST 1 #define MC_CMD_PCIE_TUNE_IN_PCIE_TUNE_RSVD_LEN 3 @@ -12820,6 +13357,12 @@ #define MC_CMD_PCIE_TUNE_POLL_EYE_PLOT_OUT_SAMPLES_MINNUM 0 #define MC_CMD_PCIE_TUNE_POLL_EYE_PLOT_OUT_SAMPLES_MAXNUM 126 +/* MC_CMD_PCIE_TUNE_BIST_SQUARE_WAVE_IN msgrequest */ +#define MC_CMD_PCIE_TUNE_BIST_SQUARE_WAVE_IN_LEN 0 + +/* MC_CMD_PCIE_TUNE_BIST_SQUARE_WAVE_OUT msgrequest */ +#define MC_CMD_PCIE_TUNE_BIST_SQUARE_WAVE_OUT_LEN 0 + /***********************************/ /* MC_CMD_LICENSING @@ -12887,7 +13430,9 @@ * that this operation returns a zero-length response */ #define MC_CMD_LICENSING_V3_IN_OP_UPDATE_LICENSE 0x0 -/* enum: report counts of installed licenses */ +/* enum: report counts of installed licenses Returns EAGAIN if license + * processing (updating) has been started but not yet completed. + */ #define MC_CMD_LICENSING_V3_IN_OP_REPORT_LICENSE 0x1 /* MC_CMD_LICENSING_V3_OUT msgresponse */ @@ -13142,7 +13687,7 @@ #define MC_CMD_0xd4_PRIVILEGE_CTG SRIOV_CTG_GENERAL /* MC_CMD_LICENSED_V3_VALIDATE_APP_IN msgrequest */ -#define MC_CMD_LICENSED_V3_VALIDATE_APP_IN_LEN 62 +#define MC_CMD_LICENSED_V3_VALIDATE_APP_IN_LEN 56 /* challenge for validation (384 bits) */ #define MC_CMD_LICENSED_V3_VALIDATE_APP_IN_CHALLENGE_OFST 0 #define MC_CMD_LICENSED_V3_VALIDATE_APP_IN_CHALLENGE_LEN 48 @@ -13151,14 +13696,9 @@ #define MC_CMD_LICENSED_V3_VALIDATE_APP_IN_APP_ID_LEN 8 #define MC_CMD_LICENSED_V3_VALIDATE_APP_IN_APP_ID_LO_OFST 48 #define MC_CMD_LICENSED_V3_VALIDATE_APP_IN_APP_ID_HI_OFST 52 -/* MAC address of the calling client MC_CMD_ERR_EPERM is returned if the - * calling client is not allowed to use this MAC address. - */ -#define MC_CMD_LICENSED_V3_VALIDATE_APP_IN_MACADDR_OFST 56 -#define MC_CMD_LICENSED_V3_VALIDATE_APP_IN_MACADDR_LEN 6 /* MC_CMD_LICENSED_V3_VALIDATE_APP_OUT msgresponse */ -#define MC_CMD_LICENSED_V3_VALIDATE_APP_OUT_LEN 104 +#define MC_CMD_LICENSED_V3_VALIDATE_APP_OUT_LEN 116 /* validation response to challenge in the form of ECDSA signature consisting * of two 384-bit integers, r and s, in big-endian order. The signature signs a * SHA-384 digest of a message constructed from the concatenation of the input @@ -13175,6 +13715,17 @@ #define MC_CMD_LICENSED_V3_VALIDATE_APP_OUT_EXPIRY_UNIT_ACC 0x0 /* enum: expiry units are calendar days */ #define MC_CMD_LICENSED_V3_VALIDATE_APP_OUT_EXPIRY_UNIT_DAYS 0x1 +/* base MAC address of the NIC stored in NVRAM (note that this is a constant + * value for a given NIC regardless which function is calling, effectively this + * is PF0 base MAC address) + */ +#define MC_CMD_LICENSED_V3_VALIDATE_APP_OUT_BASE_MACADDR_OFST 104 +#define MC_CMD_LICENSED_V3_VALIDATE_APP_OUT_BASE_MACADDR_LEN 6 +/* MAC address of v-adaptor associated with the client. If no such v-adapator + * exists, then the field is filled with 0xFF. + */ +#define MC_CMD_LICENSED_V3_VALIDATE_APP_OUT_VADAPTOR_MACADDR_OFST 110 +#define MC_CMD_LICENSED_V3_VALIDATE_APP_OUT_VADAPTOR_MACADDR_LEN 6 /***********************************/ @@ -13659,7 +14210,7 @@ #define MC_CMD_PRIVILEGE_MASK_IN_GRP_ALL_MULTICAST 0x200 /* enum */ #define MC_CMD_PRIVILEGE_MASK_IN_GRP_PROMISCUOUS 0x400 /* enum */ /* enum: Allows to set the TX packets' source MAC address to any arbitrary MAC - * address. + * adress. */ #define MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING_TX 0x800 /* enum: Privilege that allows a Function to change the MAC address configured @@ -14565,9 +15116,12 @@ /***********************************/ /* MC_CMD_TSA_BIND * TSAN - TSAC binding communication protocol. Refer to SF-115479-TC for more - * info in respect to the binding protocol. Note- This MCDI command is only - * available over a TLS secure connection between the TSAN and TSAC, and is not - * available to host software. + * info in respect to the binding protocol. This MCDI command is only available + * over a TLS secure connection between the TSAN and TSAC, and is not available + * to host software. Note- The messages definitions that do comprise this MCDI + * command deemed as provisional. This MCDI command has not yet been used in + * any released code and may change during development. This note will be + * removed once it is regarded as stable. */ #define MC_CMD_TSA_BIND 0x119 #undef MC_CMD_0x119_PRIVILEGE_CTG @@ -14644,23 +15198,35 @@ #define MC_CMD_TSA_BIND_IN_UNBIND_TSANID_LEN 6 /* MC_CMD_TSA_BIND_OUT_GET_ID msgresponse */ -#define MC_CMD_TSA_BIND_OUT_GET_ID_LENMIN 11 +#define MC_CMD_TSA_BIND_OUT_GET_ID_LENMIN 15 #define MC_CMD_TSA_BIND_OUT_GET_ID_LENMAX 252 -#define MC_CMD_TSA_BIND_OUT_GET_ID_LEN(num) (10+1*(num)) +#define MC_CMD_TSA_BIND_OUT_GET_ID_LEN(num) (14+1*(num)) /* The operation completion code. */ #define MC_CMD_TSA_BIND_OUT_GET_ID_OP_OFST 0 +/* Rules engine type. Note- The rules engine type allows TSAC to further + * identify the connected endpoint (e.g. TSAN, NIC Emulator) type and take the + * proper action accordingly. As an example, TSAC uses the rules engine type to + * select the SF key that differs in the case of TSAN vs. NIC Emulator. + */ +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_OFST 4 +/* enum: Hardware rules engine. */ +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_TSAN 0x1 +/* enum: Nic emulator rules engine. */ +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_NEMU 0x2 +/* enum: SSFE. */ +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_SSFE 0x3 /* TSAN unique identifier for the network adapter */ -#define MC_CMD_TSA_BIND_OUT_GET_ID_TSANID_OFST 4 +#define MC_CMD_TSA_BIND_OUT_GET_ID_TSANID_OFST 8 #define MC_CMD_TSA_BIND_OUT_GET_ID_TSANID_LEN 6 /* The signature data blob. The signature is computed against the message * formed by TSAN ID concatenated with the NONCE value. Refer to SF-115479-TC * for more information also in respect to the private keys that are used to * sign the message based on TSAN pre/post-binding authentication procedure. */ -#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_OFST 10 +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_OFST 14 #define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_LEN 1 #define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MINNUM 1 -#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MAXNUM 242 +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MAXNUM 238 /* MC_CMD_TSA_BIND_OUT_GET_TICKET msgresponse */ #define MC_CMD_TSA_BIND_OUT_GET_TICKET_LENMIN 5 @@ -15044,4 +15610,84 @@ /* MC_CMD_DEALLOCATE_TX_VFIFO_CP_OUT msgresponse */ #define MC_CMD_DEALLOCATE_TX_VFIFO_CP_OUT_LEN 0 + +/***********************************/ +/* MC_CMD_REKEY + * This request causes the NIC to generate a new per-NIC key and program it + * into the write-once memory. During the process all flash partitions that are + * protected with a CMAC are verified with the old per-NIC key and then signed + * with the new per-NIC key. If the NIC has already reached its rekey limit the + * REKEY op will return MC_CMD_ERR_ERANGE. The REKEY op may block until + * completion or it may return 0 and continue processing, therefore the caller + * must poll at least once to confirm that the rekeying has completed. The POLL + * operation returns MC_CMD_ERR_EBUSY if the rekey process is still running + * otherwise it will return the result of the last completed rekey operation, + * or 0 if there has not been a previous rekey. + */ +#define MC_CMD_REKEY 0x123 +#undef MC_CMD_0x123_PRIVILEGE_CTG + +#define MC_CMD_0x123_PRIVILEGE_CTG SRIOV_CTG_ADMIN + +/* MC_CMD_REKEY_IN msgrequest */ +#define MC_CMD_REKEY_IN_LEN 4 +/* the type of operation requested */ +#define MC_CMD_REKEY_IN_OP_OFST 0 +/* enum: Start the rekeying operation */ +#define MC_CMD_REKEY_IN_OP_REKEY 0x0 +/* enum: Poll for completion of the rekeying operation */ +#define MC_CMD_REKEY_IN_OP_POLL 0x1 + +/* MC_CMD_REKEY_OUT msgresponse */ +#define MC_CMD_REKEY_OUT_LEN 0 + + +/***********************************/ +/* MC_CMD_SWITCH_GET_UNASSIGNED_BUFFERS + * This interface allows the host to find out how many common pool buffers are + * not yet assigned. + */ +#define MC_CMD_SWITCH_GET_UNASSIGNED_BUFFERS 0x124 +#undef MC_CMD_0x124_PRIVILEGE_CTG + +#define MC_CMD_0x124_PRIVILEGE_CTG SRIOV_CTG_ADMIN + +/* MC_CMD_SWITCH_GET_UNASSIGNED_BUFFERS_IN msgrequest */ +#define MC_CMD_SWITCH_GET_UNASSIGNED_BUFFERS_IN_LEN 0 + +/* MC_CMD_SWITCH_GET_UNASSIGNED_BUFFERS_OUT msgresponse */ +#define MC_CMD_SWITCH_GET_UNASSIGNED_BUFFERS_OUT_LEN 8 +/* Available buffers for the ENG to NET vFIFOs. */ +#define MC_CMD_SWITCH_GET_UNASSIGNED_BUFFERS_OUT_NET_OFST 0 +/* Available buffers for the ENG to ENG and NET to ENG vFIFOs. */ +#define MC_CMD_SWITCH_GET_UNASSIGNED_BUFFERS_OUT_ENG_OFST 4 + + +/***********************************/ +/* MC_CMD_SET_SECURITY_FUSES + * Change the security level of the adapter by setting bits in the write-once + * memory. The firmware maps each flag in the message to a set of one or more + * hardware-defined or software-defined bits and sets these bits in the write- + * once memory. For Medford the hardware-defined bits are defined in *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Dec 29 08:16:45 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D184C95856; Thu, 29 Dec 2016 08:16:45 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5BA91638; Thu, 29 Dec 2016 08:16:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT8GiB4084154; Thu, 29 Dec 2016 08:16:44 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT8GiXB084153; Thu, 29 Dec 2016 08:16:44 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612290816.uBT8GiXB084153@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Thu, 29 Dec 2016 08:16:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310763 - head/contrib/bsnmp/snmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 08:16:45 -0000 Author: ngie Date: Thu Dec 29 08:16:43 2016 New Revision: 310763 URL: https://svnweb.freebsd.org/changeset/base/310763 Log: Use uint32_t instead of u_int32_t for or_last_change and services in "struct systemg" This is being done to match "struct systemg" in snmpmod(3) No functional change MFC after: 3 days Modified: head/contrib/bsnmp/snmpd/snmpmod.h Modified: head/contrib/bsnmp/snmpd/snmpmod.h ============================================================================== --- head/contrib/bsnmp/snmpd/snmpmod.h Thu Dec 29 08:10:51 2016 (r310762) +++ head/contrib/bsnmp/snmpd/snmpmod.h Thu Dec 29 08:16:43 2016 (r310763) @@ -317,8 +317,8 @@ struct systemg { u_char *contact; u_char *name; u_char *location; - u_int32_t services; - u_int32_t or_last_change; + uint32_t services; + uint32_t or_last_change; }; extern struct systemg systemg; From owner-svn-src-head@freebsd.org Thu Dec 29 08:25:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00203C95D71; Thu, 29 Dec 2016 08:25:01 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6B591D00; Thu, 29 Dec 2016 08:25:01 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT8P0qd088301; Thu, 29 Dec 2016 08:25:00 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT8P065088300; Thu, 29 Dec 2016 08:25:00 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290825.uBT8P065088300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 08:25:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310764 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 08:25:02 -0000 Author: arybchik Date: Thu Dec 29 08:25:00 2016 New Revision: 310764 URL: https://svnweb.freebsd.org/changeset/base/310764 Log: sfxge(4): sync up tlv_layout.h (from firmwaresrc 82cd8a5715e9) Submitted by: Matthew Slattery Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/ef10_tlv_layout.h Modified: head/sys/dev/sfxge/common/ef10_tlv_layout.h ============================================================================== --- head/sys/dev/sfxge/common/ef10_tlv_layout.h Thu Dec 29 08:16:43 2016 (r310763) +++ head/sys/dev/sfxge/common/ef10_tlv_layout.h Thu Dec 29 08:25:00 2016 (r310764) @@ -432,6 +432,7 @@ struct tlv_firmware_options { #define TLV_FIRMWARE_VARIANT_HIGH_TX_RATE MC_CMD_FW_HIGH_TX_RATE #define TLV_FIRMWARE_VARIANT_PACKED_STREAM_HASH_MODE_1 \ MC_CMD_FW_PACKED_STREAM_HASH_MODE_1 +#define TLV_FIRMWARE_VARIANT_RULES_ENGINE MC_CMD_FW_RULES_ENGINE }; /* Voltage settings @@ -797,20 +798,6 @@ struct tlv_tx_event_merging_config { #define TLV_TX_EVENT_MERGING_TIMEOUT_NS_DEFAULT (0xffffffff) #define TLV_TX_EVENT_MERGING_QEMPTY_TIMEOUT_NS_DEFAULT (0xffffffff) -/* Tx vFIFO Low latency configuration - * - * To keep the desired booting behaviour for the switch, it just requires to - * know if the low latency mode is enabled. - */ - -#define TLV_TAG_TX_VFIFO_ULL_MODE (0x10270000) -struct tlv_tx_vfifo_ull_mode { - uint32_t tag; - uint32_t length; - uint8_t mode; -#define TLV_TX_VFIFO_ULL_MODE_DEFAULT 0 -}; - /* BIU mode * * Medford2 tag for selecting VI window decode (see values below) @@ -856,8 +843,8 @@ typedef struct tlv_tsan_config { uint32_t netmask; uint32_t gateway; uint32_t port; - uint32_t bind_retry; - uint32_t bind_bkout; + uint32_t bind_retry; /* DEPRECATED */ + uint32_t bind_bkout; /* DEPRECATED */ } tlv_tsan_config_t; /* TSA Controller IP address configuration @@ -898,7 +885,7 @@ typedef struct tlv_binding_ticket { uint8_t bytes[]; } tlv_binding_ticket_t; -/* Solarflare private key +/* Solarflare private key (DEPRECATED) * * Sets the Solareflare private key used for signing during the binding process * @@ -907,7 +894,7 @@ typedef struct tlv_binding_ticket { * released code yet. */ -#define TLV_TAG_TMP_PIK_SF (0x10250000) +#define TLV_TAG_TMP_PIK_SF (0x10250000) /* DEPRECATED */ typedef struct tlv_pik_sf { uint32_t tag; @@ -933,4 +920,18 @@ typedef struct tlv_ca_root_cert { uint8_t bytes[]; } tlv_ca_root_cert_t; +/* Tx vFIFO Low latency configuration + * + * To keep the desired booting behaviour for the switch, it just requires to + * know if the low latency mode is enabled. + */ + +#define TLV_TAG_TX_VFIFO_ULL_MODE (0x10270000) +struct tlv_tx_vfifo_ull_mode { + uint32_t tag; + uint32_t length; + uint8_t mode; +#define TLV_TX_VFIFO_ULL_MODE_DEFAULT 0 +}; + #endif /* CI_MGMT_TLV_LAYOUT_H */ From owner-svn-src-head@freebsd.org Thu Dec 29 08:28:45 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 093E3C95EA5; Thu, 29 Dec 2016 08:28:45 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC5501F9A; Thu, 29 Dec 2016 08:28:44 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT8SiLn088587; Thu, 29 Dec 2016 08:28:44 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT8Shd6088578; Thu, 29 Dec 2016 08:28:43 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290828.uBT8Shd6088578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 08:28:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310765 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 08:28:45 -0000 Author: arybchik Date: Thu Dec 29 08:28:42 2016 New Revision: 310765 URL: https://svnweb.freebsd.org/changeset/base/310765 Log: sfxge(4): add support for firmware-verified NVRAM updates to the common code Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8942 Modified: head/sys/dev/sfxge/common/ef10_impl.h head/sys/dev/sfxge/common/ef10_nic.c head/sys/dev/sfxge/common/ef10_nvram.c head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_impl.h head/sys/dev/sfxge/common/efx_nvram.c head/sys/dev/sfxge/common/siena_impl.h head/sys/dev/sfxge/common/siena_nic.c head/sys/dev/sfxge/common/siena_nvram.c Modified: head/sys/dev/sfxge/common/ef10_impl.h ============================================================================== --- head/sys/dev/sfxge/common/ef10_impl.h Thu Dec 29 08:25:00 2016 (r310764) +++ head/sys/dev/sfxge/common/ef10_impl.h Thu Dec 29 08:28:42 2016 (r310765) @@ -384,7 +384,7 @@ ef10_nvram_partn_lock( __in efx_nic_t *enp, __in uint32_t partn); -extern void +extern __checkReturn efx_rc_t ef10_nvram_partn_unlock( __in efx_nic_t *enp, __in uint32_t partn); @@ -451,7 +451,7 @@ ef10_nvram_partn_write( __out_bcount(size) caddr_t data, __in size_t size); -extern void +extern __checkReturn efx_rc_t ef10_nvram_partn_rw_finish( __in efx_nic_t *enp, __in uint32_t partn); Modified: head/sys/dev/sfxge/common/ef10_nic.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_nic.c Thu Dec 29 08:25:00 2016 (r310764) +++ head/sys/dev/sfxge/common/ef10_nic.c Thu Dec 29 08:28:42 2016 (r310765) @@ -1105,6 +1105,18 @@ ef10_get_datapath_caps( encp->enc_mac_stats_40g_tx_size_bins = CAP_FLAG2(flags2, MAC_STATS_40G_TX_SIZE_BINS) ? B_TRUE : B_FALSE; + /* + * Check if firmware-verified NVRAM updates must be used. + * + * The firmware trusted installer requires all NVRAM updates to use + * version 2 of MC_CMD_NVRAM_UPDATE_START (to enable verified update) + * and version 2 of MC_CMD_NVRAM_UPDATE_FINISH (to verify the updated + * partition and report the result). + */ + encp->enc_fw_verified_nvram_update_required = + CAP_FLAG2(flags2, NVRAM_UPDATE_REPORT_VERIFY_RESULT) ? + B_TRUE : B_FALSE; + #undef CAP_FLAG #undef CAP_FLAG2 Modified: head/sys/dev/sfxge/common/ef10_nvram.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_nvram.c Thu Dec 29 08:25:00 2016 (r310764) +++ head/sys/dev/sfxge/common/ef10_nvram.c Thu Dec 29 08:28:42 2016 (r310765) @@ -2046,22 +2046,26 @@ fail1: return (rc); } - void + __checkReturn efx_rc_t ef10_nvram_partn_unlock( __in efx_nic_t *enp, __in uint32_t partn) { - boolean_t reboot; + boolean_t reboot = B_FALSE; + uint32_t result = 0; /* FIXME: MC_CMD_NVRAM_VERIFY_RC_UNKNOWN */ efx_rc_t rc; - reboot = B_FALSE; - if ((rc = efx_mcdi_nvram_update_finish(enp, partn, reboot)) != 0) + rc = efx_mcdi_nvram_update_finish(enp, partn, reboot, &result); + if (rc != 0) goto fail1; - return; + return (0); fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); + + /* FIXME: log result if verified firmware update fails */ + return (rc); } __checkReturn efx_rc_t @@ -2359,12 +2363,22 @@ fail1: return (rc); } - void + __checkReturn efx_rc_t ef10_nvram_partn_rw_finish( __in efx_nic_t *enp, __in uint32_t partn) { - ef10_nvram_partn_unlock(enp, partn); + efx_rc_t rc; + + if ((rc = ef10_nvram_partn_unlock(enp, partn)) != 0) + goto fail1; + + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); } #endif /* EFSYS_OPT_NVRAM */ Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Thu Dec 29 08:25:00 2016 (r310764) +++ head/sys/dev/sfxge/common/efx.h Thu Dec 29 08:28:42 2016 (r310765) @@ -1183,6 +1183,8 @@ typedef struct efx_nic_cfg_s { /* Minimum unidirectional bandwidth in Mb/s to max out all ports */ uint32_t enc_required_pcie_bandwidth_mbps; uint32_t enc_max_pcie_link_gen; + /* Firmware verifies integrity of NVRAM updates */ + uint32_t enc_fw_verified_nvram_update_required; } efx_nic_cfg_t; #define EFX_PCI_FUNCTION_IS_PF(_encp) ((_encp)->enc_vf == 0xffff) @@ -1366,7 +1368,7 @@ efx_nvram_rw_start( __in efx_nvram_type_t type, __out_opt size_t *pref_chunkp); -extern void +extern __checkReturn efx_rc_t efx_nvram_rw_finish( __in efx_nic_t *enp, __in efx_nvram_type_t type); Modified: head/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- head/sys/dev/sfxge/common/efx_impl.h Thu Dec 29 08:25:00 2016 (r310764) +++ head/sys/dev/sfxge/common/efx_impl.h Thu Dec 29 08:28:42 2016 (r310765) @@ -453,7 +453,7 @@ typedef struct efx_nvram_ops_s { unsigned int, size_t); efx_rc_t (*envo_partn_write)(efx_nic_t *, uint32_t, unsigned int, caddr_t, size_t); - void (*envo_partn_rw_finish)(efx_nic_t *, uint32_t); + efx_rc_t (*envo_partn_rw_finish)(efx_nic_t *, uint32_t); efx_rc_t (*envo_partn_get_version)(efx_nic_t *, uint32_t, uint32_t *, uint16_t *); efx_rc_t (*envo_partn_set_version)(efx_nic_t *, uint32_t, @@ -541,7 +541,8 @@ efx_mcdi_nvram_write( efx_mcdi_nvram_update_finish( __in efx_nic_t *enp, __in uint32_t partn, - __in boolean_t reboot); + __in boolean_t reboot, + __out_opt uint32_t *resultp); #if EFSYS_OPT_DIAG Modified: head/sys/dev/sfxge/common/efx_nvram.c ============================================================================== --- head/sys/dev/sfxge/common/efx_nvram.c Thu Dec 29 08:25:00 2016 (r310764) +++ head/sys/dev/sfxge/common/efx_nvram.c Thu Dec 29 08:28:42 2016 (r310765) @@ -362,13 +362,14 @@ fail1: return (rc); } - void + __checkReturn efx_rc_t efx_nvram_rw_finish( __in efx_nic_t *enp, __in efx_nvram_type_t type) { const efx_nvram_ops_t *envop = enp->en_envop; uint32_t partn; + efx_rc_t rc; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM); @@ -378,10 +379,24 @@ efx_nvram_rw_finish( EFSYS_ASSERT3U(enp->en_nvram_locked, ==, type); - if (envop->envo_type_to_partn(enp, type, &partn) == 0) - envop->envo_partn_rw_finish(enp, partn); + if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0) + goto fail1; + + if ((rc = envop->envo_partn_rw_finish(enp, partn)) != 0) + goto fail2; + + enp->en_nvram_locked = EFX_NVRAM_INVALID; + + return (0); +fail2: + EFSYS_PROBE(fail2); enp->en_nvram_locked = EFX_NVRAM_INVALID; + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); } __checkReturn efx_rc_t @@ -696,12 +711,16 @@ fail1: return (rc); } +/* + * MC_CMD_NVRAM_UPDATE_START_V2 must be used to support firmware-verified + * NVRAM updates. Older firmware will ignore the flags field in the request. + */ __checkReturn efx_rc_t efx_mcdi_nvram_update_start( __in efx_nic_t *enp, __in uint32_t partn) { - uint8_t payload[MAX(MC_CMD_NVRAM_UPDATE_START_IN_LEN, + uint8_t payload[MAX(MC_CMD_NVRAM_UPDATE_START_V2_IN_LEN, MC_CMD_NVRAM_UPDATE_START_OUT_LEN)]; efx_mcdi_req_t req; efx_rc_t rc; @@ -709,11 +728,14 @@ efx_mcdi_nvram_update_start( (void) memset(payload, 0, sizeof (payload)); req.emr_cmd = MC_CMD_NVRAM_UPDATE_START; req.emr_in_buf = payload; - req.emr_in_length = MC_CMD_NVRAM_UPDATE_START_IN_LEN; + req.emr_in_length = MC_CMD_NVRAM_UPDATE_START_V2_IN_LEN; req.emr_out_buf = payload; req.emr_out_length = MC_CMD_NVRAM_UPDATE_START_OUT_LEN; - MCDI_IN_SET_DWORD(req, NVRAM_UPDATE_START_IN_TYPE, partn); + MCDI_IN_SET_DWORD(req, NVRAM_UPDATE_START_V2_IN_TYPE, partn); + + MCDI_IN_POPULATE_DWORD_1(req, NVRAM_UPDATE_START_V2_IN_FLAGS, + NVRAM_UPDATE_START_V2_IN_FLAG_REPORT_VERIFY_RESULT, 1); efx_mcdi_execute(enp, &req); @@ -886,26 +908,37 @@ fail1: return (rc); } + +/* + * MC_CMD_NVRAM_UPDATE_FINISH_V2 must be used to support firmware-verified + * NVRAM updates. Older firmware will ignore the flags field in the request. + */ __checkReturn efx_rc_t efx_mcdi_nvram_update_finish( __in efx_nic_t *enp, __in uint32_t partn, - __in boolean_t reboot) + __in boolean_t reboot, + __out_opt uint32_t *resultp) { + const efx_nic_cfg_t *encp = &enp->en_nic_cfg; efx_mcdi_req_t req; - uint8_t payload[MAX(MC_CMD_NVRAM_UPDATE_FINISH_IN_LEN, - MC_CMD_NVRAM_UPDATE_FINISH_OUT_LEN)]; + uint8_t payload[MAX(MC_CMD_NVRAM_UPDATE_FINISH_V2_IN_LEN, + MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT_LEN)]; + uint32_t result = 0; /* FIXME: use MC_CMD_NVRAM_VERIFY_RC_UNKNOWN */ efx_rc_t rc; (void) memset(payload, 0, sizeof (payload)); req.emr_cmd = MC_CMD_NVRAM_UPDATE_FINISH; req.emr_in_buf = payload; - req.emr_in_length = MC_CMD_NVRAM_UPDATE_FINISH_IN_LEN; + req.emr_in_length = MC_CMD_NVRAM_UPDATE_FINISH_V2_IN_LEN; req.emr_out_buf = payload; - req.emr_out_length = MC_CMD_NVRAM_UPDATE_FINISH_OUT_LEN; + req.emr_out_length = MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT_LEN; - MCDI_IN_SET_DWORD(req, NVRAM_UPDATE_FINISH_IN_TYPE, partn); - MCDI_IN_SET_DWORD(req, NVRAM_UPDATE_FINISH_IN_REBOOT, reboot); + MCDI_IN_SET_DWORD(req, NVRAM_UPDATE_FINISH_V2_IN_TYPE, partn); + MCDI_IN_SET_DWORD(req, NVRAM_UPDATE_FINISH_V2_IN_REBOOT, reboot); + + MCDI_IN_POPULATE_DWORD_1(req, NVRAM_UPDATE_FINISH_V2_IN_FLAGS, + NVRAM_UPDATE_FINISH_V2_IN_FLAG_REPORT_VERIFY_RESULT, 1); efx_mcdi_execute(enp, &req); @@ -914,11 +947,42 @@ efx_mcdi_nvram_update_finish( goto fail1; } + if (encp->enc_fw_verified_nvram_update_required == B_FALSE) { + /* Report success if verified updates are not supported. */ + result = MC_CMD_NVRAM_VERIFY_RC_SUCCESS; + } else { + /* Firmware-verified NVRAM updates are required */ + if (req.emr_out_length_used < + MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT_LEN) { + rc = EMSGSIZE; + goto fail2; + } + result = + MCDI_OUT_DWORD(req, NVRAM_UPDATE_FINISH_V2_OUT_RESULT_CODE); + + if (result != MC_CMD_NVRAM_VERIFY_RC_SUCCESS) { + /* Mandatory verification failed */ + rc = EINVAL; + goto fail3; + } + } + + if (resultp != NULL) + *resultp = result; + return (0); +fail3: + EFSYS_PROBE(fail3); +fail2: + EFSYS_PROBE(fail2); fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); + /* Always report verification result */ + if (resultp != NULL) + *resultp = result; + return (rc); } Modified: head/sys/dev/sfxge/common/siena_impl.h ============================================================================== --- head/sys/dev/sfxge/common/siena_impl.h Thu Dec 29 08:25:00 2016 (r310764) +++ head/sys/dev/sfxge/common/siena_impl.h Thu Dec 29 08:28:42 2016 (r310765) @@ -136,7 +136,7 @@ siena_nvram_partn_lock( __in efx_nic_t *enp, __in uint32_t partn); -extern void +extern __checkReturn efx_rc_t siena_nvram_partn_unlock( __in efx_nic_t *enp, __in uint32_t partn); @@ -208,7 +208,7 @@ siena_nvram_partn_write( __out_bcount(size) caddr_t data, __in size_t size); -extern void +extern __checkReturn efx_rc_t siena_nvram_partn_rw_finish( __in efx_nic_t *enp, __in uint32_t partn); Modified: head/sys/dev/sfxge/common/siena_nic.c ============================================================================== --- head/sys/dev/sfxge/common/siena_nic.c Thu Dec 29 08:25:00 2016 (r310764) +++ head/sys/dev/sfxge/common/siena_nic.c Thu Dec 29 08:28:42 2016 (r310765) @@ -166,6 +166,8 @@ siena_board_cfg( encp->enc_required_pcie_bandwidth_mbps = 2 * 10000; encp->enc_max_pcie_link_gen = EFX_PCIE_LINK_SPEED_GEN2; + encp->enc_fw_verified_nvram_update_required = B_FALSE; + return (0); fail2: Modified: head/sys/dev/sfxge/common/siena_nvram.c ============================================================================== --- head/sys/dev/sfxge/common/siena_nvram.c Thu Dec 29 08:25:00 2016 (r310764) +++ head/sys/dev/sfxge/common/siena_nvram.c Thu Dec 29 08:28:42 2016 (r310765) @@ -170,7 +170,7 @@ fail1: return (rc); } - void + __checkReturn efx_rc_t siena_nvram_partn_unlock( __in efx_nic_t *enp, __in uint32_t partn) @@ -186,14 +186,16 @@ siena_nvram_partn_unlock( partn == MC_CMD_NVRAM_TYPE_PHY_PORT1 || partn == MC_CMD_NVRAM_TYPE_DISABLED_CALLISTO); - if ((rc = efx_mcdi_nvram_update_finish(enp, partn, reboot)) != 0) { + rc = efx_mcdi_nvram_update_finish(enp, partn, reboot, NULL); + if (rc != 0) goto fail1; - } - return; + return (0); fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); } #endif /* EFSYS_OPT_VPD || EFSYS_OPT_NVRAM */ @@ -585,12 +587,22 @@ fail1: return (rc); } - void + __checkReturn efx_rc_t siena_nvram_partn_rw_finish( __in efx_nic_t *enp, __in uint32_t partn) { - siena_nvram_partn_unlock(enp, partn); + efx_rc_t rc; + + if ((rc = siena_nvram_partn_unlock(enp, partn)) != 0) + goto fail1; + + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); } __checkReturn efx_rc_t From owner-svn-src-head@freebsd.org Thu Dec 29 08:34:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28DE8C960B2; Thu, 29 Dec 2016 08:34:52 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF34B13D7; Thu, 29 Dec 2016 08:34:51 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT8YpS1092349; Thu, 29 Dec 2016 08:34:51 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT8YpeX092348; Thu, 29 Dec 2016 08:34:51 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201612290834.uBT8YpeX092348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 29 Dec 2016 08:34:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310766 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 08:34:52 -0000 Author: mjg Date: Thu Dec 29 08:34:50 2016 New Revision: 310766 URL: https://svnweb.freebsd.org/changeset/base/310766 Log: cache: drop the NULL check from VP2VNODELOCK Now that negative entries are annotated with a dedicated flag, NULL vnodes are no longer passed. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Thu Dec 29 08:28:42 2016 (r310765) +++ head/sys/kern/vfs_cache.c Thu Dec 29 08:34:50 2016 (r310766) @@ -260,12 +260,8 @@ static struct mtx *vnodelocks; static inline struct mtx * VP2VNODELOCK(struct vnode *vp) { - struct mtx *vlp; - if (vp == NULL) - return (NULL); - vlp = &vnodelocks[(((uintptr_t)(vp) >> 8) % numvnodelocks)]; - return (vlp); + return (&vnodelocks[(((uintptr_t)(vp) >> 8) % numvnodelocks)]); } /* @@ -1373,10 +1369,9 @@ cache_lock_vnodes_cel_3(struct celocksta cache_assert_vlp_locked(cel->vlp[0]); cache_assert_vlp_locked(cel->vlp[1]); MPASS(cel->vlp[2] == NULL); + MPASS(vp != NULL); vlp = VP2VNODELOCK(vp); - MPASS(vlp != NULL); - ret = true; if (vlp >= cel->vlp[1]) { mtx_lock(vlp); From owner-svn-src-head@freebsd.org Thu Dec 29 08:41:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7813BC9632D; Thu, 29 Dec 2016 08:41:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3909318E9; Thu, 29 Dec 2016 08:41:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT8fPtK095539; Thu, 29 Dec 2016 08:41:25 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT8fPfc095538; Thu, 29 Dec 2016 08:41:25 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201612290841.uBT8fPfc095538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 29 Dec 2016 08:41:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310767 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 08:41:26 -0000 Author: mjg Date: Thu Dec 29 08:41:25 2016 New Revision: 310767 URL: https://svnweb.freebsd.org/changeset/base/310767 Log: cache: depessimize hashing macros/inlines All hash sizes are power-of-2, but the compiler does not know that for sure and 'foo % size' forces doing a division. Store the size - 1 and use 'foo & hash' instead which allows mere shift. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Thu Dec 29 08:34:50 2016 (r310766) +++ head/sys/kern/vfs_cache.c Thu Dec 29 08:41:25 2016 (r310767) @@ -242,26 +242,29 @@ static struct neglist ncneg_hot; static int shrink_list_turn; -static u_int numneglists; +#define numneglists (ncneghash + 1) +static u_int ncneghash; static inline struct neglist * NCP2NEGLIST(struct namecache *ncp) { - return (&neglists[(((uintptr_t)(ncp) >> 8) % numneglists)]); + return (&neglists[(((uintptr_t)(ncp) >> 8) & ncneghash)]); } -static u_int numbucketlocks; +#define numbucketlocks (ncbuckethash + 1) +static u_int ncbuckethash; static struct rwlock_padalign *bucketlocks; #define HASH2BUCKETLOCK(hash) \ - ((struct rwlock *)(&bucketlocks[((hash) % numbucketlocks)])) + ((struct rwlock *)(&bucketlocks[((hash) & ncbuckethash)])) -static u_int numvnodelocks; +#define numvnodelocks (ncvnodehash + 1) +static u_int ncvnodehash; static struct mtx *vnodelocks; static inline struct mtx * VP2VNODELOCK(struct vnode *vp) { - return (&vnodelocks[(((uintptr_t)(vp) >> 8) % numvnodelocks)]); + return (&vnodelocks[(((uintptr_t)(vp) >> 8) & ncvnodehash)]); } /* @@ -1369,9 +1372,10 @@ cache_lock_vnodes_cel_3(struct celocksta cache_assert_vlp_locked(cel->vlp[0]); cache_assert_vlp_locked(cel->vlp[1]); MPASS(cel->vlp[2] == NULL); - MPASS(vp != NULL); + MPASS(vp != NULL); vlp = VP2VNODELOCK(vp); + ret = true; if (vlp >= cel->vlp[1]) { mtx_lock(vlp); @@ -1774,21 +1778,21 @@ nchinit(void *dummy __unused) NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); nchashtbl = hashinit(desiredvnodes * 2, M_VFSCACHE, &nchash); - numbucketlocks = cache_roundup_2(mp_ncpus * 64); - if (numbucketlocks > nchash + 1) - numbucketlocks = nchash + 1; + ncbuckethash = cache_roundup_2(mp_ncpus * 64) - 1; + if (ncbuckethash > nchash) + ncbuckethash = nchash; bucketlocks = malloc(sizeof(*bucketlocks) * numbucketlocks, M_VFSCACHE, M_WAITOK | M_ZERO); for (i = 0; i < numbucketlocks; i++) rw_init_flags(&bucketlocks[i], "ncbuc", RW_DUPOK | RW_RECURSE); - numvnodelocks = cache_roundup_2(mp_ncpus * 64); + ncvnodehash = cache_roundup_2(mp_ncpus * 64) - 1; vnodelocks = malloc(sizeof(*vnodelocks) * numvnodelocks, M_VFSCACHE, M_WAITOK | M_ZERO); for (i = 0; i < numvnodelocks; i++) mtx_init(&vnodelocks[i], "ncvn", NULL, MTX_DUPOK | MTX_RECURSE); ncpurgeminvnodes = numbucketlocks; - numneglists = 4; + ncneghash = 3; neglists = malloc(sizeof(*neglists) * numneglists, M_VFSCACHE, M_WAITOK | M_ZERO); for (i = 0; i < numneglists; i++) { From owner-svn-src-head@freebsd.org Thu Dec 29 09:15:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2785C96F00; Thu, 29 Dec 2016 09:15:28 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71DC910C8; Thu, 29 Dec 2016 09:15:28 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBT9FRdY009233; Thu, 29 Dec 2016 09:15:27 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBT9FRGa009232; Thu, 29 Dec 2016 09:15:27 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612290915.uBT9FRGa009232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Dec 2016 09:15:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310770 - head/sys/dev/sfxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 09:15:28 -0000 Author: arybchik Date: Thu Dec 29 09:15:27 2016 New Revision: 310770 URL: https://svnweb.freebsd.org/changeset/base/310770 Log: sfxge(4): cleanup: clarify/unify variable name used for put-list length get_count is used for get-list. Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/sfxge_tx.c Modified: head/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- head/sys/dev/sfxge/sfxge_tx.c Thu Dec 29 09:10:37 2016 (r310769) +++ head/sys/dev/sfxge/sfxge_tx.c Thu Dec 29 09:15:27 2016 (r310770) @@ -608,7 +608,7 @@ sfxge_tx_qdpl_put_unlocked(struct sfxge_ volatile uintptr_t *putp; uintptr_t old; uintptr_t new; - unsigned old_len; + unsigned int put_count; KASSERT(mbuf->m_nextpkt == NULL, ("mbuf->m_nextpkt != NULL")); @@ -622,14 +622,14 @@ sfxge_tx_qdpl_put_unlocked(struct sfxge_ old = *putp; if (old != 0) { struct mbuf *mp = (struct mbuf *)old; - old_len = mp->m_pkthdr.csum_data; + put_count = mp->m_pkthdr.csum_data; } else - old_len = 0; - if (old_len >= stdp->std_put_max) { + put_count = 0; + if (put_count >= stdp->std_put_max) { atomic_add_long(&txq->put_overflow, 1); return (ENOBUFS); } - mbuf->m_pkthdr.csum_data = old_len + 1; + mbuf->m_pkthdr.csum_data = put_count + 1; mbuf->m_nextpkt = (void *)old; } while (atomic_cmpset_ptr(putp, old, new) == 0); From owner-svn-src-head@freebsd.org Thu Dec 29 11:48:13 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F07BC9615D; Thu, 29 Dec 2016 11:48:13 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 080C7159F; Thu, 29 Dec 2016 11:48:12 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id uBTBm7uW021544 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 29 Dec 2016 13:48:07 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua uBTBm7uW021544 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id uBTBm6xx021543; Thu, 29 Dec 2016 13:48:06 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 29 Dec 2016 13:48:06 +0200 From: Konstantin Belousov To: Adrian Chadd Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r310234 - head/sys/vm Message-ID: <20161229114806.GH1923@kib.kiev.ua> References: <201612182056.uBIKuElT070792@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 11:48:13 -0000 On Wed, Dec 28, 2016 at 07:03:52PM -0800, Adrian Chadd wrote: > hi, > > I've bisected a boot failure on mips24k (carambola2) to this commit. > Nothing useful is printed - it hangs at startup time. What do you mean exactly ? Is copyright notice printed ? Show verbose dmesg of the failing boot. > > Any ideas? No. The patch you picked changes code that is only executed for the shadowed anonymous memory. AFAIK, including mips, there is no shadow chains in the kernel map. Such constructs are only instantiated when user space is operating and forking. Even if such data structure appears in the kernel mappings, vm object code is not initialized until much later in the boot, at vm_init stage. > > > -adrian > > > On 18 December 2016 at 12:56, Konstantin Belousov wrote: > > Author: kib > > Date: Sun Dec 18 20:56:14 2016 > > New Revision: 310234 > > URL: https://svnweb.freebsd.org/changeset/base/310234 > > > > Log: > > Improve vm_object_scan_all_shadowed() to also check swap backing objects. > > > > As noted in the removed comment, it is possible and not prohibitively > > costly to look up the swap blocks for the given page index. Implement > > a swap_pager_find_least() function to do that, and use it to iterate > > simultaneously over both backing object page queue and swap > > allocations when looking for shadowed pages. > > > > Testing shows that number of new succesful scans, enabled by this > > addition, is small but non-zero. When worked out, the change both > > further reduces the depth of the shadow object chain, and frees unused > > but allocated swap and memory. > > > > Suggested and reviewed by: alc > > Tested by: pho (previous version) > > Sponsored by: The FreeBSD Foundation > > MFC after: 2 weeks > > > > Modified: > > head/sys/vm/swap_pager.c > > head/sys/vm/swap_pager.h > > head/sys/vm/vm_object.c > > > > Modified: head/sys/vm/swap_pager.c > > ============================================================================== > > --- head/sys/vm/swap_pager.c Sun Dec 18 20:40:22 2016 (r310233) > > +++ head/sys/vm/swap_pager.c Sun Dec 18 20:56:14 2016 (r310234) > > @@ -2013,6 +2013,44 @@ swp_pager_meta_ctl(vm_object_t object, v > > } > > > > /* > > + * Returns the least page index which is greater than or equal to the > > + * parameter pindex and for which there is a swap block allocated. > > + * Returns object's size if the object's type is not swap or if there > > + * are no allocated swap blocks for the object after the requested > > + * pindex. > > + */ > > +vm_pindex_t > > +swap_pager_find_least(vm_object_t object, vm_pindex_t pindex) > > +{ > > + struct swblock **pswap, *swap; > > + vm_pindex_t i, j, lim; > > + int idx; > > + > > + VM_OBJECT_ASSERT_LOCKED(object); > > + if (object->type != OBJT_SWAP || object->un_pager.swp.swp_bcount == 0) > > + return (object->size); > > + > > + mtx_lock(&swhash_mtx); > > + for (j = pindex; j < object->size; j = lim) { > > + pswap = swp_pager_hash(object, j); > > + lim = rounddown2(j + SWAP_META_PAGES, SWAP_META_PAGES); > > + if (lim > object->size) > > + lim = object->size; > > + if ((swap = *pswap) != NULL) { > > + for (idx = j & SWAP_META_MASK, i = j; i < lim; > > + i++, idx++) { > > + if (swap->swb_pages[idx] != SWAPBLK_NONE) > > + goto found; > > + } > > + } > > + } > > + i = object->size; > > +found: > > + mtx_unlock(&swhash_mtx); > > + return (i); > > +} > > + > > +/* > > * System call swapon(name) enables swapping on device name, > > * which must be in the swdevsw. Return EBUSY > > * if already swapping on this device. > > > > Modified: head/sys/vm/swap_pager.h > > ============================================================================== > > --- head/sys/vm/swap_pager.h Sun Dec 18 20:40:22 2016 (r310233) > > +++ head/sys/vm/swap_pager.h Sun Dec 18 20:56:14 2016 (r310234) > > @@ -79,6 +79,7 @@ extern int swap_pager_avail; > > struct xswdev; > > int swap_dev_info(int name, struct xswdev *xs, char *devname, size_t len); > > void swap_pager_copy(vm_object_t, vm_object_t, vm_pindex_t, int); > > +vm_pindex_t swap_pager_find_least(vm_object_t object, vm_pindex_t pindex); > > void swap_pager_freespace(vm_object_t, vm_pindex_t, vm_size_t); > > void swap_pager_swap_init(void); > > int swap_pager_isswapped(vm_object_t, struct swdevt *); > > > > Modified: head/sys/vm/vm_object.c > > ============================================================================== > > --- head/sys/vm/vm_object.c Sun Dec 18 20:40:22 2016 (r310233) > > +++ head/sys/vm/vm_object.c Sun Dec 18 20:56:14 2016 (r310234) > > @@ -1436,36 +1436,40 @@ vm_object_scan_all_shadowed(vm_object_t > > { > > vm_object_t backing_object; > > vm_page_t p, pp; > > - vm_pindex_t backing_offset_index, new_pindex; > > + vm_pindex_t backing_offset_index, new_pindex, pi, ps; > > > > VM_OBJECT_ASSERT_WLOCKED(object); > > VM_OBJECT_ASSERT_WLOCKED(object->backing_object); > > > > backing_object = object->backing_object; > > > > - /* > > - * Initial conditions: > > - * > > - * We do not want to have to test for the existence of swap > > - * pages in the backing object. XXX but with the new swapper this > > - * would be pretty easy to do. > > - */ > > - if (backing_object->type != OBJT_DEFAULT) > > + if (backing_object->type != OBJT_DEFAULT && > > + backing_object->type != OBJT_SWAP) > > return (false); > > > > - backing_offset_index = OFF_TO_IDX(object->backing_object_offset); > > + pi = backing_offset_index = OFF_TO_IDX(object->backing_object_offset); > > + p = vm_page_find_least(backing_object, pi); > > + ps = swap_pager_find_least(backing_object, pi); > > > > - for (p = TAILQ_FIRST(&backing_object->memq); p != NULL; > > - p = TAILQ_NEXT(p, listq)) { > > - new_pindex = p->pindex - backing_offset_index; > > + /* > > + * Only check pages inside the parent object's range and > > + * inside the parent object's mapping of the backing object. > > + */ > > + for (;; pi++) { > > + if (p != NULL && p->pindex < pi) > > + p = TAILQ_NEXT(p, listq); > > + if (ps < pi) > > + ps = swap_pager_find_least(backing_object, pi); > > + if (p == NULL && ps >= backing_object->size) > > + break; > > + else if (p == NULL) > > + pi = ps; > > + else > > + pi = MIN(p->pindex, ps); > > > > - /* > > - * Ignore pages outside the parent object's range and outside > > - * the parent object's mapping of the backing object. > > - */ > > - if (p->pindex < backing_offset_index || > > - new_pindex >= object->size) > > - continue; > > + new_pindex = pi - backing_offset_index; > > + if (new_pindex >= object->size) > > + break; > > > > /* > > * See if the parent has the page or if the parent's object > > From owner-svn-src-head@freebsd.org Thu Dec 29 12:01:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9241C93222; Thu, 29 Dec 2016 12:01:55 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8EBD15CE; Thu, 29 Dec 2016 12:01:55 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTC1sQt077799; Thu, 29 Dec 2016 12:01:54 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTC1sdj077798; Thu, 29 Dec 2016 12:01:54 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201612291201.uBTC1sdj077798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 29 Dec 2016 12:01:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310774 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 12:01:56 -0000 Author: mjg Date: Thu Dec 29 12:01:54 2016 New Revision: 310774 URL: https://svnweb.freebsd.org/changeset/base/310774 Log: cache: move shrink lock init to nchinit This gets rid of unnecesary sysinit usage. While here also rename the lock to be consistent with the rest. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Thu Dec 29 11:32:42 2016 (r310773) +++ head/sys/kern/vfs_cache.c Thu Dec 29 12:01:54 2016 (r310774) @@ -229,8 +229,6 @@ SYSCTL_UINT(_vfs, OID_AUTO, ncneghitsreq struct nchstats nchstats; /* cache effectiveness statistics */ static struct mtx ncneg_shrink_lock; -MTX_SYSINIT(vfscache_shrink_neg, &ncneg_shrink_lock, "Name Cache shrink neg", - MTX_DEF); struct neglist { struct mtx nl_lock; @@ -1802,6 +1800,8 @@ nchinit(void *dummy __unused) mtx_init(&ncneg_hot.nl_lock, "ncneglh", NULL, MTX_DEF); TAILQ_INIT(&ncneg_hot.nl_list); + mtx_init(&ncneg_shrink_lock, "ncnegs", NULL, MTX_DEF); + numcalls = counter_u64_alloc(M_WAITOK); dothits = counter_u64_alloc(M_WAITOK); dotdothits = counter_u64_alloc(M_WAITOK); From owner-svn-src-head@freebsd.org Thu Dec 29 12:11:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 463ACC93732; Thu, 29 Dec 2016 12:11:08 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wj0-x230.google.com (mail-wj0-x230.google.com [IPv6:2a00:1450:400c:c01::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E6BD41AD3; Thu, 29 Dec 2016 12:11:07 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wj0-x230.google.com with SMTP id tq7so119863216wjb.0; Thu, 29 Dec 2016 04:11:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=PJkmFAzNzwfWdGzAHYk8e3lcPhmApRvBxo1hnw/tbNU=; b=lVB4BY/cR4YxGPqNwjKfHpPnhblfBQACrbA4So17eXbiOwxFptRaVmFyJMWgIi/Uqy cb77+RKOiTHz3QGfmtPn7RoskX43D+ORpL/4TseNKYldX0dASnW2mfUr5/kniVMCpTHY 9zeZX4p7YRwCbDgUcNRHO5z5wj3HJ+jtBEKGVp2y+amOT9wXoyZ6hcn5V0wTyi3rlffc vv8Dyimz64m6tEdsEiuKJJHnkne2zf4hkyl5F03elveMz3SVpN/LVTRul7W9iItFBfQB Q/ti4kHaeAaIOnmCPXuhpnkXDHrcPKmYbHmJaJQmi27XaHjDf7C7TW4EPAUEMYwwt2rV BO6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=PJkmFAzNzwfWdGzAHYk8e3lcPhmApRvBxo1hnw/tbNU=; b=lq5AlTNV41Nnhp9jmJT0GWtH966/jgnEkQrmfVcSRhEr50rNLa+5lmkkFcjUtfSHZ5 82eOzPvFSUUd12Jh7p5AFmmJJvc1xZbVrkJmnuat6RBZmMSS97whYgwMmzGKr/xJ/w5f 0lvUmkW61H67ZCpZAfGEXQpHNnzigzrxw9BdKtiYm3kjzFiOI8dAlLnMu6GdjSurcd9a 3vkNDwu/hnhzZSGKgb1/aNtC/ShyDRFtLY9twZNEaZkMcPmLeKlU9YSErEtFifp6RLxl jEL+9JaftdRcsAN/T1ll+YRmhLCXZy8Q4nxprbtTFqljkke/m9cFeie5glA0IiRtnWKv 7YWg== X-Gm-Message-State: AIkVDXJJDIbqRaLzQfrIqmVAWbSUzvqA6iK+K4g973Kyu2BZdww4otVaE8yYAcZ2wGnlllKJ6jTE9rwoFtcEMg== X-Received: by 10.194.67.67 with SMTP id l3mr39345871wjt.151.1483013466331; Thu, 29 Dec 2016 04:11:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.44.1 with HTTP; Thu, 29 Dec 2016 04:11:05 -0800 (PST) In-Reply-To: <20161229114806.GH1923@kib.kiev.ua> References: <201612182056.uBIKuElT070792@repo.freebsd.org> <20161229114806.GH1923@kib.kiev.ua> From: Adrian Chadd Date: Thu, 29 Dec 2016 04:11:05 -0800 Message-ID: Subject: Re: svn commit: r310234 - head/sys/vm To: Konstantin Belousov Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 12:11:08 -0000 Hiya, It hung completely. No echoing, no early printf (after I added it), nothing. I dug into it some more and yes, it doesn't seem to be this. Something else is causing the now much larger kernel then before to not boot. Sorry! Thanks for the explanation though! -adrian From owner-svn-src-head@freebsd.org Thu Dec 29 13:27:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D175C893A4; Thu, 29 Dec 2016 13:27:06 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0DB2D1A26; Thu, 29 Dec 2016 13:27:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTDR5o2013249; Thu, 29 Dec 2016 13:27:05 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTDR57Y013247; Thu, 29 Dec 2016 13:27:05 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201612291327.uBTDR57Y013247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 29 Dec 2016 13:27:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310775 - in head: lib/clang/libllvm usr.bin/clang X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 13:27:06 -0000 Author: dim Date: Thu Dec 29 13:27:04 2016 New Revision: 310775 URL: https://svnweb.freebsd.org/changeset/base/310775 Log: Move llvm-objdump from CLANG_EXTRAS to installed by default We currently install three tools from binutils 2.17.50: as, ld, and objdump. Work is underway to migrate to a permissively-licensed tool-chain, with one goal being the retirement of binutils 2.17.50. LLVM's llvm-objdump is intended to be compatible with GNU objdump although it is currently missing some options and may have formatting differences. Enable it by default for testing and further investigation. It may later be changed to install as /usr/bin/objdump, it becomes a fully viable replacement. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D8879 Modified: head/lib/clang/libllvm/Makefile head/usr.bin/clang/Makefile Modified: head/lib/clang/libllvm/Makefile ============================================================================== --- head/lib/clang/libllvm/Makefile Thu Dec 29 12:01:54 2016 (r310774) +++ head/lib/clang/libllvm/Makefile Thu Dec 29 13:27:04 2016 (r310775) @@ -308,24 +308,24 @@ SRCS_MIN+= DebugInfo/CodeView/TypeRecord SRCS_MIN+= DebugInfo/CodeView/TypeRecordBuilder.cpp SRCS_MIN+= DebugInfo/CodeView/TypeStreamMerger.cpp SRCS_MIN+= DebugInfo/CodeView/TypeTableBuilder.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFAcceleratorTable.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFCompileUnit.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFContext.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugAbbrev.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugArangeSet.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugAranges.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugFrame.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugInfoEntry.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugLine.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugLoc.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugMacro.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugRangeList.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFFormValue.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFTypeUnit.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFUnit.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFUnitIndex.cpp -SRCS_EXT+= DebugInfo/DWARF/SyntaxHighlighting.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFAcceleratorTable.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFCompileUnit.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFContext.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugAbbrev.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugArangeSet.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugAranges.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugFrame.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugInfoEntry.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugLine.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugLoc.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugMacro.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugRangeList.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFFormValue.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFTypeUnit.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFUnit.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFUnitIndex.cpp +SRCS_MIW+= DebugInfo/DWARF/SyntaxHighlighting.cpp SRCS_EXT+= DebugInfo/PDB/GenericError.cpp SRCS_EXT+= DebugInfo/PDB/PDB.cpp SRCS_EXT+= DebugInfo/PDB/PDBContext.cpp @@ -699,7 +699,7 @@ SRCS_MIN+= Target/AArch64/AArch64TargetO SRCS_MIN+= Target/AArch64/AArch64TargetTransformInfo.cpp SRCS_MIN+= Target/AArch64/AsmParser/AArch64AsmParser.cpp SRCS_XDB+= Target/AArch64/Disassembler/AArch64Disassembler.cpp -SRCS_XDB+= Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp +SRCS_XDW+= Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp SRCS_MIN+= Target/AArch64/InstPrinter/AArch64InstPrinter.cpp SRCS_MIN+= Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp SRCS_MIN+= Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp @@ -880,7 +880,7 @@ SRCS_MIN+= Target/TargetSubtargetInfo.cp SRCS_MIN+= Target/X86/AsmParser/X86AsmInstrumentation.cpp SRCS_MIN+= Target/X86/AsmParser/X86AsmParser.cpp SRCS_XDB+= Target/X86/Disassembler/X86Disassembler.cpp -SRCS_XDB+= Target/X86/Disassembler/X86DisassemblerDecoder.cpp +SRCS_XDW+= Target/X86/Disassembler/X86DisassemblerDecoder.cpp SRCS_MIN+= Target/X86/InstPrinter/X86ATTInstPrinter.cpp SRCS_MIN+= Target/X86/InstPrinter/X86InstComments.cpp SRCS_MIN+= Target/X86/InstPrinter/X86IntelInstPrinter.cpp @@ -1090,6 +1090,9 @@ SRCS_MIN+= Transforms/Vectorize/SLPVecto SRCS_EXT+= Transforms/Vectorize/Vectorize.cpp SRCS_ALL+= ${SRCS_MIN} +.if !defined(TOOLS_PREFIX) +SRCS_ALL+= ${SRCS_MIW} +.endif .if ${MK_CLANG_EXTRAS} != "no" SRCS_ALL+= ${SRCS_EXT} .endif @@ -1105,6 +1108,9 @@ SRCS_ALL+= ${SRCS_XDB} .if ${MK_CLANG_EXTRAS} != "no" || ${MK_LLDB} != "no" || ${MK_LLD} != "no" SRCS_ALL+= ${SRCS_XDL} .endif +.if ${MK_CLANG_EXTRAS} != "no" || ${MK_LLDB} != "no" || !defined(TOOLS_PREFIX) +SRCS_ALL+= ${SRCS_XDW} +.endif SRCS+= ${SRCS_ALL:O} llvm/IR/Attributes.inc: ${LLVM_SRCS}/include/llvm/IR/Attributes.td Modified: head/usr.bin/clang/Makefile ============================================================================== --- head/usr.bin/clang/Makefile Thu Dec 29 12:01:54 2016 (r310774) +++ head/usr.bin/clang/Makefile Thu Dec 29 13:27:04 2016 (r310775) @@ -7,6 +7,8 @@ SUBDIR+= clang-tblgen SUBDIR+= llvm-tblgen .if !defined(TOOLS_PREFIX) +SUBDIR+= llvm-objdump + .if ${MK_CLANG_EXTRAS} != "no" SUBDIR+= bugpoint SUBDIR+= clang-format @@ -25,7 +27,6 @@ SUBDIR+= llvm-link SUBDIR+= llvm-lto SUBDIR+= llvm-mc SUBDIR+= llvm-nm -SUBDIR+= llvm-objdump SUBDIR+= llvm-pdbdump SUBDIR+= llvm-profdata SUBDIR+= llvm-rtdyld From owner-svn-src-head@freebsd.org Thu Dec 29 14:00:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8490FC95066; Thu, 29 Dec 2016 14:00:11 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F3341C31; Thu, 29 Dec 2016 14:00:11 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTE0A04026004; Thu, 29 Dec 2016 14:00:10 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTE0AOX026001; Thu, 29 Dec 2016 14:00:10 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201612291400.uBTE0AOX026001@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Thu, 29 Dec 2016 14:00:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310776 - head/sys/mips/ingenic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 14:00:11 -0000 Author: jmcneill Date: Thu Dec 29 14:00:10 2016 New Revision: 310776 URL: https://svnweb.freebsd.org/changeset/base/310776 Log: The JZ4780 I2S can feed either the internal audio codec or the HDMI transmitter, but not both at the same time. This patch: - Adds a dev.pcm.0.internal_codec sysctl node for selecting between internal and external codec - Changes playback sample rate from 96 kHz to 48 kHz for HDMI compatibility - Enables i2s clock on codec access Reviewed by: br Differential Revision: https://reviews.freebsd.org/D8960 Modified: head/sys/mips/ingenic/jz4780_aic.c head/sys/mips/ingenic/jz4780_codec.c head/sys/mips/ingenic/jz4780_codec.h Modified: head/sys/mips/ingenic/jz4780_aic.c ============================================================================== --- head/sys/mips/ingenic/jz4780_aic.c Thu Dec 29 13:27:04 2016 (r310775) +++ head/sys/mips/ingenic/jz4780_aic.c Thu Dec 29 14:00:10 2016 (r310776) @@ -81,6 +81,7 @@ struct aic_softc { void *ih; struct xdma_channel *xchan; xdma_controller_t *xdma_tx; + int internal_codec; }; /* Channel registers */ @@ -120,7 +121,7 @@ struct aic_rate { }; static struct aic_rate rate_map[] = { - { 96000 }, + { 48000 }, /* TODO: add more frequences */ { 0 }, }; @@ -355,7 +356,6 @@ aic_start(struct sc_pcminfo *scp) int reg; sc = scp->sc; - sc->pos = 0; /* Ensure clock enabled. */ reg = READ4(sc, I2SCR); @@ -387,10 +387,6 @@ aic_stop(struct sc_pcminfo *scp) xdma_terminate(sc->xchan); - sc->pos = 0; - - bzero(sc->buf_base, sc->dma_size); - return (0); } @@ -411,6 +407,8 @@ aicchan_trigger(kobj_t obj, void *data, case PCMTRIG_START: ch->run = 1; + sc->pos = 0; + aic_start(scp); break; @@ -421,6 +419,10 @@ aicchan_trigger(kobj_t obj, void *data, aic_stop(scp); + sc->pos = 0; + + bzero(sc->buf_base, sc->dma_size); + break; } @@ -448,7 +450,7 @@ static uint32_t aic_pfmt[] = { 0 }; -static struct pcmchan_caps aic_pcaps = {96000, 96000, aic_pfmt, 0}; +static struct pcmchan_caps aic_pcaps = {48000, 48000, aic_pfmt, 0}; static struct pcmchan_caps * aicchan_getcaps(kobj_t obj, void *data) @@ -583,16 +585,13 @@ aic_configure_clocks(struct aic_softc *s static int aic_configure(struct aic_softc *sc) { - int internal_codec; int reg; - internal_codec = 1; - WRITE4(sc, AICFR, AICFR_RST); /* Configure AIC */ reg = 0; - if (internal_codec) { + if (sc->internal_codec) { reg |= (AICFR_ICDC); } else { reg |= (AICFR_SYNCD | AICFR_BCKD); @@ -610,6 +609,48 @@ aic_configure(struct aic_softc *sc) } static int +sysctl_hw_pcm_internal_codec(SYSCTL_HANDLER_ARGS) +{ + struct sc_pcminfo *scp; + struct sc_chinfo *ch; + struct aic_softc *sc; + int error, val; + + if (arg1 == NULL) + return (EINVAL); + + scp = arg1; + sc = scp->sc; + ch = &scp->chan[0]; + + snd_mtxlock(sc->lock); + + val = sc->internal_codec; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error || req->newptr == NULL) { + snd_mtxunlock(sc->lock); + return (error); + } + if (val < 0 || val > 1) { + snd_mtxunlock(sc->lock); + return (EINVAL); + } + + if (sc->internal_codec != val) { + sc->internal_codec = val; + if (ch->run) + aic_stop(scp); + aic_configure(sc); + if (ch->run) + aic_start(scp); + } + + snd_mtxunlock(sc->lock); + + return (0); +} + +static int aic_probe(device_t dev) { @@ -635,6 +676,7 @@ aic_attach(device_t dev) sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); sc->dev = dev; sc->pos = 0; + sc->internal_codec = 1; /* Get xDMA controller */ sc->xdma_tx = xdma_ofw_get(sc->dev, "tx"); @@ -718,6 +760,13 @@ aic_attach(device_t dev) mixer_init(dev, &aicmixer_class, scp); + /* Create device sysctl node. */ + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "internal_codec", CTLTYPE_INT | CTLFLAG_RW, + scp, 0, sysctl_hw_pcm_internal_codec, "I", + "use internal audio codec"); + return (0); } Modified: head/sys/mips/ingenic/jz4780_codec.c ============================================================================== --- head/sys/mips/ingenic/jz4780_codec.c Thu Dec 29 13:27:04 2016 (r310775) +++ head/sys/mips/ingenic/jz4780_codec.c Thu Dec 29 14:00:10 2016 (r310776) @@ -53,6 +53,8 @@ __FBSDID("$FreeBSD$"); #include +#include + #include #include @@ -64,6 +66,7 @@ struct codec_softc { struct resource *res[1]; bus_space_tag_t bst; bus_space_handle_t bsh; + clk_t clk; }; static struct resource_spec codec_spec[] = { @@ -81,6 +84,8 @@ codec_write(struct codec_softc *sc, uint { uint32_t tmp; + clk_enable(sc->clk); + tmp = (reg << RGADW_RGADDR_S); tmp |= (val << RGADW_RGDIN_S); tmp |= RGADW_RGWR; @@ -90,6 +95,8 @@ codec_write(struct codec_softc *sc, uint while(READ4(sc, CODEC_RGADW) & RGADW_RGWR) ; + clk_disable(sc->clk); + return (0); } @@ -98,11 +105,15 @@ codec_read(struct codec_softc *sc, uint3 { uint32_t tmp; + clk_enable(sc->clk); + tmp = (reg << RGADW_RGADDR_S); WRITE4(sc, CODEC_RGADW, tmp); tmp = READ4(sc, CODEC_RGDATA); + clk_disable(sc->clk); + return (tmp); } @@ -223,6 +234,12 @@ codec_attach(device_t dev) sc->bst = rman_get_bustag(sc->res[0]); sc->bsh = rman_get_bushandle(sc->res[0]); + if (clk_get_by_ofw_name(dev, 0, "i2s", &sc->clk) != 0) { + device_printf(dev, "could not get i2s clock\n"); + bus_release_resources(dev, codec_spec, sc->res); + return (ENXIO); + } + /* Initialize codec. */ reg = codec_read(sc, CR_VIC); reg &= ~(VIC_SB_SLEEP | VIC_SB); @@ -236,7 +253,7 @@ codec_attach(device_t dev) DELAY(10000); - /* I2S, 16-bit, 96 kHz. */ + /* I2S, 16-bit, 48 kHz. */ reg = codec_read(sc, AICR_DAC); reg &= ~(AICR_DAC_SB | DAC_ADWL_M); reg |= DAC_ADWL_16; @@ -246,7 +263,7 @@ codec_attach(device_t dev) DELAY(10000); - reg = FCR_DAC_96; + reg = FCR_DAC_48; codec_write(sc, FCR_DAC, reg); DELAY(10000); Modified: head/sys/mips/ingenic/jz4780_codec.h ============================================================================== --- head/sys/mips/ingenic/jz4780_codec.h Thu Dec 29 13:27:04 2016 (r310775) +++ head/sys/mips/ingenic/jz4780_codec.h Thu Dec 29 14:00:10 2016 (r310776) @@ -74,6 +74,7 @@ #define VIC_SB (1 << 0) /* complete power-down */ #define CR_CK 0x1C /* Clock Control Register */ #define FCR_DAC 0x1D /* DAC Frequency Control Register */ +#define FCR_DAC_48 8 /* 48 kHz. */ #define FCR_DAC_96 10 /* 96 kHz. */ #define FCR_ADC 0x20 /* ADC Frequency Control Register */ #define CR_TIMER_MSB 0x21 /* MSB of programmable counter */ From owner-svn-src-head@freebsd.org Thu Dec 29 14:08:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C762C953E1; Thu, 29 Dec 2016 14:08:26 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D1E41343; Thu, 29 Dec 2016 14:08:26 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTE8Pfs030221; Thu, 29 Dec 2016 14:08:25 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTE8O73030217; Thu, 29 Dec 2016 14:08:24 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201612291408.uBTE8O73030217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Thu, 29 Dec 2016 14:08:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310777 - in head/sys: arm/freescale/imx dev/hdmi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 14:08:26 -0000 Author: jmcneill Date: Thu Dec 29 14:08:24 2016 New Revision: 310777 URL: https://svnweb.freebsd.org/changeset/base/310777 Log: Add support for audio on I2S based DesignWare HDMI controllers. Relnotes: yes Modified: head/sys/arm/freescale/imx/imx6_hdmi.c head/sys/dev/hdmi/dwc_hdmi.c head/sys/dev/hdmi/dwc_hdmi.h head/sys/dev/hdmi/dwc_hdmi_fdt.c head/sys/dev/hdmi/dwc_hdmireg.h Modified: head/sys/arm/freescale/imx/imx6_hdmi.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_hdmi.c Thu Dec 29 14:00:10 2016 (r310776) +++ head/sys/arm/freescale/imx/imx6_hdmi.c Thu Dec 29 14:08:24 2016 (r310777) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/dev/hdmi/dwc_hdmi.c ============================================================================== --- head/sys/dev/hdmi/dwc_hdmi.c Thu Dec 29 14:00:10 2016 (r310776) +++ head/sys/dev/hdmi/dwc_hdmi.c Thu Dec 29 14:08:24 2016 (r310777) @@ -53,8 +53,23 @@ __FBSDID("$FreeBSD$"); #include "hdmi_if.h" #define I2C_DDC_ADDR (0x50 << 1) +#define I2C_DDC_SEGADDR (0x30 << 1) #define EDID_LENGTH 0x80 +#define EXT_TAG 0x00 +#define CEA_TAG_ID 0x02 +#define CEA_DTD 0x03 +#define DTD_BASIC_AUDIO (1 << 6) +#define CEA_REV 0x02 +#define CEA_DATA_OFF 0x03 +#define CEA_DATA_START 4 +#define BLOCK_TAG(x) (((x) >> 5) & 0x7) +#define BLOCK_TAG_VSDB 3 +#define BLOCK_LEN(x) ((x) & 0x1f) +#define HDMI_VSDB_MINLEN 5 +#define HDMI_OUI "\x03\x0c\x00" +#define HDMI_OUI_LEN 3 + static void dwc_hdmi_phy_wait_i2c_done(struct dwc_hdmi_softc *sc, int msec) { @@ -122,7 +137,7 @@ dwc_hdmi_av_composer(struct dwc_hdmi_sof HDMI_FC_INVIDCONF_IN_I_P_PROGRESSIVE); /* TODO: implement HDMI part */ - is_dvi = 1; + is_dvi = sc->sc_has_audio == 0; inv_val |= (is_dvi ? HDMI_FC_INVIDCONF_DVI_MODEZ_DVI_MODE : HDMI_FC_INVIDCONF_DVI_MODEZ_HDMI_MODE); @@ -419,6 +434,70 @@ dwc_hdmi_enable_video_path(struct dwc_hd } static void +dwc_hdmi_configure_audio(struct dwc_hdmi_softc *sc) +{ + unsigned int n; + uint8_t val; + + if (sc->sc_has_audio == 0) + return; + + /* The following values are for 48 kHz */ + switch (sc->sc_mode.dot_clock) { + case 25170: + n = 6864; + break; + case 27020: + n = 6144; + break; + case 74170: + n = 11648; + break; + case 148350: + n = 5824; + break; + default: + n = 6144; + break; + } + + WR1(sc, HDMI_AUD_N1, (n >> 0) & 0xff); + WR1(sc, HDMI_AUD_N2, (n >> 8) & 0xff); + WR1(sc, HDMI_AUD_N3, (n >> 16) & 0xff); + + val = RD1(sc, HDMI_AUD_CTS3); + val &= ~(HDMI_AUD_CTS3_N_SHIFT_MASK | HDMI_AUD_CTS3_CTS_MANUAL); + WR1(sc, HDMI_AUD_CTS3, val); + + val = RD1(sc, HDMI_AUD_CONF0); + val &= ~HDMI_AUD_CONF0_INTERFACE_MASK; + val |= HDMI_AUD_CONF0_INTERFACE_IIS; + val &= ~HDMI_AUD_CONF0_I2SINEN_MASK; + val |= HDMI_AUD_CONF0_I2SINEN_CH2; + WR1(sc, HDMI_AUD_CONF0, val); + + val = RD1(sc, HDMI_AUD_CONF1); + val &= ~HDMI_AUD_CONF1_DATAMODE_MASK; + val |= HDMI_AUD_CONF1_DATAMODE_IIS; + val &= ~HDMI_AUD_CONF1_DATWIDTH_MASK; + val |= HDMI_AUD_CONF1_DATWIDTH_16BIT; + WR1(sc, HDMI_AUD_CONF1, val); + + WR1(sc, HDMI_AUD_INPUTCLKFS, HDMI_AUD_INPUTCLKFS_64); + + WR1(sc, HDMI_FC_AUDICONF0, 1 << 4); /* CC=1 */ + WR1(sc, HDMI_FC_AUDICONF1, 0); + WR1(sc, HDMI_FC_AUDICONF2, 0); /* CA=0 */ + WR1(sc, HDMI_FC_AUDICONF3, 0); + WR1(sc, HDMI_FC_AUDSV, 0xee); /* channels valid */ + + /* Enable audio clock */ + val = RD1(sc, HDMI_MC_CLKDIS); + val &= ~HDMI_MC_CLKDIS_AUDCLK_DISABLE; + WR1(sc, HDMI_MC_CLKDIS, val); +} + +static void dwc_hdmi_video_packetize(struct dwc_hdmi_softc *sc) { unsigned int color_depth = 0; @@ -552,11 +631,15 @@ static int dwc_hdmi_set_mode(struct dwc_hdmi_softc *sc) { + /* XXX */ + sc->sc_has_audio = 1; + dwc_hdmi_disable_overflow_interrupts(sc); dwc_hdmi_av_composer(sc); dwc_hdmi_phy_init(sc); dwc_hdmi_enable_video_path(sc); - /* TODO: AVI infoframes */ + dwc_hdmi_configure_audio(sc); + /* TODO: dwc_hdmi_config_avi(sc); */ dwc_hdmi_video_packetize(sc); /* TODO: dwc_hdmi_video_csc(sc); */ dwc_hdmi_video_sample(sc); @@ -567,14 +650,17 @@ dwc_hdmi_set_mode(struct dwc_hdmi_softc } static int -hdmi_edid_read(struct dwc_hdmi_softc *sc, uint8_t **edid, uint32_t *edid_len) +hdmi_edid_read(struct dwc_hdmi_softc *sc, int block, uint8_t **edid, + uint32_t *edid_len) { device_t i2c_dev; int result; - uint8_t addr = 0; + uint8_t addr = block & 1 ? EDID_LENGTH : 0; + uint8_t segment = block >> 1; struct iic_msg msg[] = { - { 0, IIC_M_WR, 1, &addr }, - { 0, IIC_M_RD, EDID_LENGTH, NULL} + { I2C_DDC_SEGADDR, IIC_M_WR, 1, &segment }, + { I2C_DDC_ADDR, IIC_M_WR, 1, &addr }, + { I2C_DDC_ADDR, IIC_M_RD, EDID_LENGTH, sc->sc_edid } }; *edid = NULL; @@ -588,12 +674,10 @@ hdmi_edid_read(struct dwc_hdmi_softc *sc return (ENXIO); } - device_printf(sc->sc_dev, "reading EDID from %s, addr %02x\n", - device_get_nameunit(i2c_dev), I2C_DDC_ADDR/2); - - msg[0].slave = I2C_DDC_ADDR; - msg[1].slave = I2C_DDC_ADDR; - msg[1].buf = sc->sc_edid; + if (bootverbose) + device_printf(sc->sc_dev, + "reading EDID from %s, block %d, addr %02x\n", + device_get_nameunit(i2c_dev), block, I2C_DDC_ADDR/2); result = iicbus_request_bus(i2c_dev, sc->sc_dev, IIC_INTRWAIT); @@ -602,7 +686,7 @@ hdmi_edid_read(struct dwc_hdmi_softc *sc return (result); } - result = iicbus_transfer(i2c_dev, msg, 2); + result = iicbus_transfer(i2c_dev, msg, 3); iicbus_release_bus(i2c_dev, sc->sc_dev); if (result) { @@ -670,11 +754,84 @@ out: return (err); } +static int +dwc_hdmi_detect_hdmi_vsdb(uint8_t *edid) +{ + int off, p, btag, blen; + + if (edid[EXT_TAG] != CEA_TAG_ID) + return (0); + + off = edid[CEA_DATA_OFF]; + + /* CEA data block collection starts at byte 4 */ + if (off <= CEA_DATA_START) + return (0); + + /* Parse the CEA data blocks */ + for (p = CEA_DATA_START; p < off;) { + btag = BLOCK_TAG(edid[p]); + blen = BLOCK_LEN(edid[p]); + + /* Make sure the length is sane */ + if (p + blen + 1 > off) + break; + + /* Look for a VSDB with the HDMI 24-bit IEEE registration ID */ + if (btag == BLOCK_TAG_VSDB && blen >= HDMI_VSDB_MINLEN && + memcmp(&edid[p + 1], HDMI_OUI, HDMI_OUI_LEN) == 0) + return (1); + + /* Next data block */ + p += (1 + blen); + } + + /* Not found */ + return (0); +} + +static void +dwc_hdmi_detect_hdmi(struct dwc_hdmi_softc *sc) +{ + uint8_t *edid; + uint32_t edid_len; + int block; + + sc->sc_has_audio = 0; + + /* Scan through extension blocks, looking for a CEA-861 block */ + for (block = 1; block <= sc->sc_edid_info.edid_ext_block_count; + block++) { + if (hdmi_edid_read(sc, block, &edid, &edid_len) != 0) + return; + if (dwc_hdmi_detect_hdmi_vsdb(edid) != 0) { + if (bootverbose) + device_printf(sc->sc_dev, + "enabling audio support\n"); + sc->sc_has_audio = + (edid[CEA_DTD] & DTD_BASIC_AUDIO) != 0; + return; + } + } +} + int dwc_hdmi_get_edid(device_t dev, uint8_t **edid, uint32_t *edid_len) { + struct dwc_hdmi_softc *sc; + int error; + + sc = device_get_softc(dev); - return (hdmi_edid_read(device_get_softc(dev), edid, edid_len)); + memset(&sc->sc_edid_info, 0, sizeof(sc->sc_edid_info)); + + error = hdmi_edid_read(sc, 0, edid, edid_len); + if (error != 0) + return (error); + + edid_parse(*edid, &sc->sc_edid_info); + + return (0); } int @@ -685,6 +842,8 @@ dwc_hdmi_set_videomode(device_t dev, con sc = device_get_softc(dev); memcpy(&sc->sc_mode, mode, sizeof(*mode)); + dwc_hdmi_detect_hdmi(sc); + dwc_hdmi_set_mode(sc); return (0); Modified: head/sys/dev/hdmi/dwc_hdmi.h ============================================================================== --- head/sys/dev/hdmi/dwc_hdmi.h Thu Dec 29 14:00:10 2016 (r310776) +++ head/sys/dev/hdmi/dwc_hdmi.h Thu Dec 29 14:08:24 2016 (r310777) @@ -40,6 +40,9 @@ struct dwc_hdmi_softc { uint8_t sc_edid_len; struct intr_config_hook sc_mode_hook; struct videomode sc_mode; + + struct edid_info sc_edid_info; + int sc_has_audio; }; static inline uint8_t Modified: head/sys/dev/hdmi/dwc_hdmi_fdt.c ============================================================================== --- head/sys/dev/hdmi/dwc_hdmi_fdt.c Thu Dec 29 14:00:10 2016 (r310776) +++ head/sys/dev/hdmi/dwc_hdmi_fdt.c Thu Dec 29 14:08:24 2016 (r310777) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include Modified: head/sys/dev/hdmi/dwc_hdmireg.h ============================================================================== --- head/sys/dev/hdmi/dwc_hdmireg.h Thu Dec 29 14:00:10 2016 (r310776) +++ head/sys/dev/hdmi/dwc_hdmireg.h Thu Dec 29 14:08:24 2016 (r310777) @@ -250,6 +250,7 @@ #define HDMI_FC_SPDDEVICEINF 0x1062 #define HDMI_FC_AUDSCONF 0x1063 #define HDMI_FC_AUDSSTAT 0x1064 +#define HDMI_FC_AUDSV 0x1065 #define HDMI_FC_DATACH0FILL 0x1070 #define HDMI_FC_DATACH1FILL 0x1071 #define HDMI_FC_DATACH2FILL 0x1072 @@ -472,7 +473,24 @@ /* Audio Sampler Registers */ #define HDMI_AUD_CONF0 0x3100 +#define HDMI_AUD_CONF0_INTERFACE_MASK 0x20 +#define HDMI_AUD_CONF0_INTERFACE_IIS 0x20 +#define HDMI_AUD_CONF0_INTERFACE_SPDIF 0x00 +#define HDMI_AUD_CONF0_I2SINEN_MASK 0x0f +#define HDMI_AUD_CONF0_I2SINEN_CH2 0x01 +#define HDMI_AUD_CONF0_I2SINEN_CH4 0x03 +#define HDMI_AUD_CONF0_I2SINEN_CH6 0x07 +#define HDMI_AUD_CONF0_I2SINEN_CH8 0x0f #define HDMI_AUD_CONF1 0x3101 +#define HDMI_AUD_CONF1_DATAMODE_MASK 0xe0 +#define HDMI_AUD_CONF1_DATAMODE_IIS 0x00 +#define HDMI_AUD_CONF1_DATAMODE_RIGHT_J 0x20 +#define HDMI_AUD_CONF1_DATAMODE_LEFT_J 0x40 +#define HDMI_AUD_CONF1_DATAMODE_BURST_1 0x60 +#define HDMI_AUD_CONF1_DATAMDOE_BURST_2 0x80 +#define HDMI_AUD_CONF1_DATWIDTH_MASK 0x1f +#define HDMI_AUD_CONF1_DATWIDTH_16BIT 16 +#define HDMI_AUD_CONF1_DATWIDTH_24BIT 24 #define HDMI_AUD_INT 0x3102 #define HDMI_AUD_CONF2 0x3103 #define HDMI_AUD_N1 0x3200 @@ -481,7 +499,14 @@ #define HDMI_AUD_CTS1 0x3203 #define HDMI_AUD_CTS2 0x3204 #define HDMI_AUD_CTS3 0x3205 +#define HDMI_AUD_CTS3_N_SHIFT_MASK 0xe0 +#define HDMI_AUD_CTS3_CTS_MANUAL 0x10 #define HDMI_AUD_INPUTCLKFS 0x3206 +#define HDMI_AUD_INPUTCLKFS_128 0 +#define HDMI_AUD_INPUTCLKFS_256 1 +#define HDMI_AUD_INPUTCLKFS_512 2 +#define HDMI_AUD_INPUTCLKFS_1024 3 +#define HDMI_AUD_INPUTCLKFS_64 4 #define HDMI_AUD_SPDIFINT 0x3302 #define HDMI_AUD_CONF0_HBR 0x3400 #define HDMI_AUD_HBR_STATUS 0x3401 From owner-svn-src-head@freebsd.org Thu Dec 29 15:09:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9CBB9C96A13; Thu, 29 Dec 2016 15:09:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3AEA5170C; Thu, 29 Dec 2016 15:09:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTF9Ywk055184; Thu, 29 Dec 2016 15:09:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTF9YxM055182; Thu, 29 Dec 2016 15:09:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612291509.uBTF9YxM055182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 29 Dec 2016 15:09:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310778 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 15:09:35 -0000 Author: mav Date: Thu Dec 29 15:09:34 2016 New Revision: 310778 URL: https://svnweb.freebsd.org/changeset/base/310778 Log: Improve use of I/O's private area. - Since I/Os are allocates from per-port pools, make allocations store pointer to CTL softc there, and use it where needed instead of global. - Created bunch of helper macros to access LUN, port and CTL softc. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c head/sys/cam/ctl/ctl_error.c head/sys/cam/ctl/ctl_io.h head/sys/cam/ctl/ctl_tpc.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Dec 29 14:08:24 2016 (r310777) +++ head/sys/cam/ctl/ctl.c Thu Dec 29 15:09:34 2016 (r310778) @@ -437,7 +437,6 @@ static int ctl_alloc_lun(struct ctl_soft struct ctl_be_lun *be_lun); static int ctl_free_lun(struct ctl_lun *lun); static void ctl_create_lun(struct ctl_be_lun *be_lun); -static struct ctl_port * ctl_io_port(struct ctl_io_hdr *io_hdr); static int ctl_do_mode_select(union ctl_io *io); static int ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, @@ -448,7 +447,7 @@ static int ctl_pro_preempt(struct ctl_so struct scsi_per_res_out_parms* param); static void ctl_pro_preempt_other(struct ctl_lun *lun, union ctl_ha_msg *msg); -static void ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg); +static void ctl_hndl_per_res_out_on_other_sc(union ctl_io *io); static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len); @@ -567,13 +566,12 @@ static struct ctl_frontend ha_frontend = static void ctl_ha_datamove(union ctl_io *io) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(io); struct ctl_sg_entry *sgl; union ctl_ha_msg msg; uint32_t sg_entries_sent; int do_sg_copy, i, j; - lun = (struct ctl_lun *)io->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; memset(&msg.dt, 0, sizeof(msg.dt)); msg.hdr.msg_type = CTL_MSG_DATAMOVE; msg.hdr.original_sc = io->io_hdr.original_sc; @@ -1803,7 +1801,8 @@ ctl_init(void) args.mda_si_drv1 = softc; error = make_dev_s(&args, &softc->dev, "cam/ctl"); if (error != 0) { - free(control_softc, M_DEVBUF); + free(softc, M_DEVBUF); + control_softc = NULL; return (error); } @@ -1815,7 +1814,7 @@ ctl_init(void) if (softc->sysctl_tree == NULL) { printf("%s: unable to allocate sysctl tree\n", __func__); destroy_dev(softc->dev); - free(control_softc, M_DEVBUF); + free(softc, M_DEVBUF); control_softc = NULL; return (ENOMEM); } @@ -1963,7 +1962,7 @@ ctl_shutdown(void) sysctl_ctx_free(&softc->sysctl_ctx); - free(control_softc, M_DEVBUF); + free(softc, M_DEVBUF); control_softc = NULL; } @@ -2205,18 +2204,16 @@ ctl_create_iid(struct ctl_port *port, in static void ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) { - struct ctl_softc *softc = control_softc; + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); union ctl_ha_msg msg_info; - struct ctl_port *port; struct ctl_lun *lun; const struct ctl_cmd_entry *entry; uint32_t targ_lun; targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; - mtx_lock(&softc->ctl_lock); /* Make sure that we know about this port. */ - port = ctl_io_port(&ctsio->io_hdr); if (port == NULL || (port->status & CTL_PORT_STATUS_ONLINE) == 0) { ctl_set_internal_failure(ctsio, /*sks_valid*/ 0, /*retry_count*/ 1); @@ -2224,6 +2221,7 @@ ctl_serialize_other_sc_cmd(struct ctl_sc } /* Make sure that we know about this LUN. */ + mtx_lock(&softc->ctl_lock); if (targ_lun >= CTL_MAX_LUNS || (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); @@ -2256,8 +2254,8 @@ ctl_serialize_other_sc_cmd(struct ctl_sc goto badjuju; } - ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr = lun; - ctsio->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptr = lun->be_lun; + CTL_LUN(ctsio) = lun; + CTL_BACKEND_LUN(ctsio) = lun->be_lun; /* * Every I/O goes into the OOA queue for a @@ -3625,13 +3623,6 @@ ctl_encode_lun(uint32_t decoded) return ((((uint64_t)RPL_LUNDATA_ATYP_EXTLUN | 0x22) << 56) | (l << 16)); } -static struct ctl_port * -ctl_io_port(struct ctl_io_hdr *io_hdr) -{ - - return (control_softc->ctl_ports[io_hdr->nexus.targ_port]); -} - int ctl_ffz(uint32_t *mask, uint32_t first, uint32_t last) { @@ -3749,7 +3740,6 @@ int ctl_pool_create(struct ctl_softc *ctl_softc, const char *pool_name, uint32_t total_ctl_io, void **npool) { -#ifdef IO_POOLS struct ctl_io_pool *pool; pool = (struct ctl_io_pool *)malloc(sizeof(*pool), M_CTL, @@ -3759,14 +3749,15 @@ ctl_pool_create(struct ctl_softc *ctl_so snprintf(pool->name, sizeof(pool->name), "CTL IO %s", pool_name); pool->ctl_softc = ctl_softc; +#ifdef IO_POOLS pool->zone = uma_zsecond_create(pool->name, NULL, NULL, NULL, NULL, ctl_softc->io_zone); /* uma_prealloc(pool->zone, total_ctl_io); */ - - *npool = pool; #else - *npool = ctl_softc->io_zone; + pool->zone = ctl_softc->io_zone; #endif + + *npool = pool; return (0); } @@ -3779,64 +3770,54 @@ ctl_pool_free(struct ctl_io_pool *pool) #ifdef IO_POOLS uma_zdestroy(pool->zone); - free(pool, M_CTL); #endif + free(pool, M_CTL); } union ctl_io * ctl_alloc_io(void *pool_ref) { - union ctl_io *io; -#ifdef IO_POOLS struct ctl_io_pool *pool = (struct ctl_io_pool *)pool_ref; + union ctl_io *io; io = uma_zalloc(pool->zone, M_WAITOK); -#else - io = uma_zalloc((uma_zone_t)pool_ref, M_WAITOK); -#endif - if (io != NULL) + if (io != NULL) { io->io_hdr.pool = pool_ref; + CTL_SOFTC(io) = pool->ctl_softc; + } return (io); } union ctl_io * ctl_alloc_io_nowait(void *pool_ref) { - union ctl_io *io; -#ifdef IO_POOLS struct ctl_io_pool *pool = (struct ctl_io_pool *)pool_ref; + union ctl_io *io; io = uma_zalloc(pool->zone, M_NOWAIT); -#else - io = uma_zalloc((uma_zone_t)pool_ref, M_NOWAIT); -#endif - if (io != NULL) + if (io != NULL) { io->io_hdr.pool = pool_ref; + CTL_SOFTC(io) = pool->ctl_softc; + } return (io); } void ctl_free_io(union ctl_io *io) { -#ifdef IO_POOLS struct ctl_io_pool *pool; -#endif if (io == NULL) return; -#ifdef IO_POOLS pool = (struct ctl_io_pool *)io->io_hdr.pool; uma_zfree(pool->zone, io); -#else - uma_zfree((uma_zone_t)io->io_hdr.pool, io); -#endif } void ctl_zero_io(union ctl_io *io) { - void *pool_ref; + struct ctl_io_pool *pool; if (io == NULL) return; @@ -3844,9 +3825,10 @@ ctl_zero_io(union ctl_io *io) /* * May need to preserve linked list pointers at some point too. */ - pool_ref = io->io_hdr.pool; + pool = io->io_hdr.pool; memset(io, 0, sizeof(*io)); - io->io_hdr.pool = pool_ref; + io->io_hdr.pool = pool; + CTL_SOFTC(io) = pool->ctl_softc; } int @@ -4653,12 +4635,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft static int ctl_free_lun(struct ctl_lun *lun) { - struct ctl_softc *softc; + struct ctl_softc *softc = lun->ctl_softc; struct ctl_lun *nlun; int i; - softc = lun->ctl_softc; - mtx_assert(&softc->ctl_lock, MA_OWNED); STAILQ_REMOVE(&softc->lun_list, lun, ctl_lun, links); @@ -5159,13 +5139,12 @@ ctl_config_read_done(union ctl_io *io) int ctl_scsi_release(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint32_t residx; CTL_DEBUG_PRINT(("ctl_scsi_release\n")); residx = ctl_get_initindex(&ctsio->io_hdr.nexus); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; /* * XXX KDM right now, we only support LUN reservation. We don't @@ -5197,13 +5176,12 @@ ctl_scsi_release(struct ctl_scsiio *ctsi int ctl_scsi_reserve(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint32_t residx; CTL_DEBUG_PRINT(("ctl_reserve\n")); residx = ctl_get_initindex(&ctsio->io_hdr.nexus); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; /* * XXX KDM right now, we only support LUN reservation. We don't @@ -5238,13 +5216,12 @@ bailout: int ctl_start_stop(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_start_stop_unit *cdb; - struct ctl_lun *lun; int retval; CTL_DEBUG_PRINT(("ctl_start_stop\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_start_stop_unit *)ctsio->cdb; if ((cdb->how & SSS_PC_MASK) == 0) { @@ -5293,14 +5270,13 @@ ctl_start_stop(struct ctl_scsiio *ctsio) int ctl_prevent_allow(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_prevent *cdb; int retval; uint32_t initidx; CTL_DEBUG_PRINT(("ctl_prevent_allow\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_prevent *)ctsio->cdb; if ((lun->flags & CTL_LUN_REMOVABLE) == 0) { @@ -5334,8 +5310,7 @@ ctl_prevent_allow(struct ctl_scsiio *cts int ctl_sync_cache(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; - struct ctl_softc *softc; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t starting_lba; uint32_t block_count; @@ -5344,8 +5319,6 @@ ctl_sync_cache(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_sync_cache\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; retval = 0; switch (ctsio->cdb[0]) { @@ -5401,13 +5374,10 @@ int ctl_format(struct ctl_scsiio *ctsio) { struct scsi_format *cdb; - struct ctl_lun *lun; int length, defect_list_len; CTL_DEBUG_PRINT(("ctl_format\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - cdb = (struct scsi_format *)ctsio->cdb; length = 0; @@ -5486,7 +5456,7 @@ bailout: int ctl_read_buffer(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint64_t buffer_offset; uint32_t len; uint8_t byte2; @@ -5494,7 +5464,7 @@ ctl_read_buffer(struct ctl_scsiio *ctsio static uint8_t echo_descr[4] = { 0 }; CTL_DEBUG_PRINT(("ctl_read_buffer\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + switch (ctsio->cdb[0]) { case READ_BUFFER: { struct scsi_read_buffer *cdb; @@ -5561,13 +5531,12 @@ ctl_read_buffer(struct ctl_scsiio *ctsio int ctl_write_buffer(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_write_buffer *cdb; - struct ctl_lun *lun; int buffer_offset, len; CTL_DEBUG_PRINT(("ctl_write_buffer\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_write_buffer *)ctsio->cdb; len = scsi_3btoul(cdb->length); @@ -5614,7 +5583,7 @@ ctl_write_buffer(struct ctl_scsiio *ctsi int ctl_write_same(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; @@ -5623,8 +5592,6 @@ ctl_write_same(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_write_same\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - switch (ctsio->cdb[0]) { case WRITE_SAME_10: { struct scsi_write_same_10 *cdb; @@ -5728,7 +5695,7 @@ ctl_write_same(struct ctl_scsiio *ctsio) int ctl_unmap(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_unmap *cdb; struct ctl_ptr_len_flags *ptrlen; struct scsi_unmap_header *hdr; @@ -5740,9 +5707,7 @@ ctl_unmap(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_unmap\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_unmap *)ctsio->cdb; - len = scsi_2btoul(cdb->length); byte2 = cdb->byte2; @@ -5832,12 +5797,11 @@ int ctl_default_page_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, uint8_t *page_ptr) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint8_t *current_cp; int set_ua; uint32_t initidx; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); set_ua = 0; @@ -5887,13 +5851,12 @@ int ctl_ie_page_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, uint8_t *page_ptr) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_info_exceptions_page *pg; - struct ctl_lun *lun; uint64_t t; (void)ctl_default_page_handler(ctsio, page_index, page_ptr); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; pg = (struct scsi_info_exceptions_page *)page_ptr; mtx_lock(&lun->lun_lock); if (pg->info_flags & SIEP_FLAGS_TEST) { @@ -5930,19 +5893,18 @@ ctl_ie_page_handler(struct ctl_scsiio *c static int ctl_do_mode_select(union ctl_io *io) { + struct ctl_lun *lun = CTL_LUN(io); struct scsi_mode_page_header *page_header; struct ctl_page_index *page_index; struct ctl_scsiio *ctsio; int page_len, page_len_offset, page_len_size; union ctl_modepage_info *modepage_info; - struct ctl_lun *lun; uint16_t *len_left, *len_used; int retval, i; ctsio = &io->scsiio; page_index = NULL; page_len = 0; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; modepage_info = (union ctl_modepage_info *) ctsio->io_hdr.ctl_private[CTL_PRIV_MODEPAGE].bytes; @@ -6155,12 +6117,11 @@ bailout_no_done: int ctl_mode_select(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); union ctl_modepage_info *modepage_info; int bd_len, i, header_size, param_len, pf, rtd, sp; uint32_t initidx; - lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); switch (ctsio->cdb[0]) { case MODE_SELECT_6: { @@ -6305,7 +6266,7 @@ ctl_mode_select(struct ctl_scsiio *ctsio int ctl_mode_sense(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); int pc, page_code, dbd, llba, subpage; int alloc_len, page_len, header_len, total_len; struct scsi_mode_block_descr *block_desc; @@ -6317,7 +6278,6 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_mode_sense\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; switch (ctsio->cdb[0]) { case MODE_SENSE_6: { struct scsi_mode_sense_6 *cdb; @@ -6653,12 +6613,11 @@ ctl_lbp_log_sense_handler(struct ctl_scs struct ctl_page_index *page_index, int pc) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_log_param_header *phdr; uint8_t *data; uint64_t val; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; data = page_index->page_data; if (lun->backend->lun_attr != NULL && @@ -6722,13 +6681,12 @@ ctl_sap_log_sense_handler(struct ctl_scs struct ctl_page_index *page_index, int pc) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct stat_page *data; uint64_t rn, wn, rb, wb; struct bintime rt, wt; int i; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; data = (struct stat_page *)page_index->page_data; scsi_ulto2b(SLP_SAP, data->sap.hdr.param_code); @@ -6781,10 +6739,9 @@ ctl_ie_log_sense_handler(struct ctl_scsi struct ctl_page_index *page_index, int pc) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_log_informational_exceptions *data; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; data = (struct scsi_log_informational_exceptions *)page_index->page_data; scsi_ulto2b(SLP_IE_GEN, data->hdr.param_code); @@ -6800,7 +6757,7 @@ ctl_ie_log_sense_handler(struct ctl_scsi int ctl_log_sense(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); int i, pc, page_code, subpage; int alloc_len, total_len; struct ctl_page_index *page_index; @@ -6809,7 +6766,6 @@ ctl_log_sense(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_log_sense\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_log_sense *)ctsio->cdb; pc = (cdb->page & SLS_PAGE_CTRL_MASK) >> 6; page_code = cdb->page & SLS_PAGE_CODE; @@ -6886,9 +6842,9 @@ ctl_log_sense(struct ctl_scsiio *ctsio) int ctl_read_capacity(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_read_capacity *cdb; struct scsi_read_capacity_data *data; - struct ctl_lun *lun; uint32_t lba; CTL_DEBUG_PRINT(("ctl_read_capacity\n")); @@ -6908,8 +6864,6 @@ ctl_read_capacity(struct ctl_scsiio *cts return (CTL_RETVAL_COMPLETE); } - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK | M_ZERO); data = (struct scsi_read_capacity_data *)ctsio->kern_data_ptr; ctsio->residual = 0; @@ -6944,9 +6898,9 @@ ctl_read_capacity(struct ctl_scsiio *cts int ctl_read_capacity_16(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_read_capacity_16 *cdb; struct scsi_read_capacity_data_long *data; - struct ctl_lun *lun; uint64_t lba; uint32_t alloc_len; @@ -6969,8 +6923,6 @@ ctl_read_capacity_16(struct ctl_scsiio * return (CTL_RETVAL_COMPLETE); } - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK | M_ZERO); data = (struct scsi_read_capacity_data_long *)ctsio->kern_data_ptr; @@ -7005,9 +6957,9 @@ ctl_read_capacity_16(struct ctl_scsiio * int ctl_get_lba_status(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_get_lba_status *cdb; struct scsi_get_lba_status_data *data; - struct ctl_lun *lun; struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t alloc_len, total_len; @@ -7015,7 +6967,6 @@ ctl_get_lba_status(struct ctl_scsiio *ct CTL_DEBUG_PRINT(("ctl_get_lba_status\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_get_lba_status *)ctsio->cdb; lba = scsi_8btou64(cdb->addr); alloc_len = scsi_4btoul(cdb->alloc_len); @@ -7128,12 +7079,12 @@ ctl_read_defect(struct ctl_scsiio *ctsio int ctl_report_tagret_port_groups(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_maintenance_in *cdb; int retval; int alloc_len, ext, total_len = 0, g, pc, pg, ts, os; int num_ha_groups, num_target_ports, shared_group; - struct ctl_lun *lun; - struct ctl_softc *softc; struct ctl_port *port; struct scsi_target_group_data *rtg_ptr; struct scsi_target_group_data_extended *rtg_ext_ptr; @@ -7142,9 +7093,6 @@ ctl_report_tagret_port_groups(struct ctl CTL_DEBUG_PRINT(("ctl_report_tagret_port_groups\n")); cdb = (struct scsi_maintenance_in *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; - retval = CTL_RETVAL_COMPLETE; switch (cdb->byte2 & STG_PDF_MASK) { @@ -7310,7 +7258,7 @@ ctl_report_tagret_port_groups(struct ctl int ctl_report_supported_opcodes(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_report_supported_opcodes *cdb; const struct ctl_cmd_entry *entry, *sentry; struct scsi_report_supported_opcodes_all *all; @@ -7323,8 +7271,6 @@ ctl_report_supported_opcodes(struct ctl_ CTL_DEBUG_PRINT(("ctl_report_supported_opcodes\n")); cdb = (struct scsi_report_supported_opcodes *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - retval = CTL_RETVAL_COMPLETE; opcode = cdb->requested_opcode; @@ -7589,11 +7535,11 @@ ctl_report_timestamp(struct ctl_scsiio * int ctl_persistent_reserve_in(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_per_res_in *cdb; int alloc_len, total_len = 0; /* struct scsi_per_res_in_rsrv in_data; */ - struct ctl_lun *lun; - struct ctl_softc *softc; uint64_t key; CTL_DEBUG_PRINT(("ctl_persistent_reserve_in\n")); @@ -7602,9 +7548,6 @@ ctl_persistent_reserve_in(struct ctl_scs alloc_len = scsi_2btoul(cdb->length); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; - retry: mtx_lock(&lun->lun_lock); switch (cdb->action) { @@ -8167,12 +8110,12 @@ ctl_pro_preempt_other(struct ctl_lun *lu int ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); int retval; u_int32_t param_len; struct scsi_per_res_out *cdb; - struct ctl_lun *lun; struct scsi_per_res_out_parms* param; - struct ctl_softc *softc; uint32_t residx; uint64_t res_key, sa_res_key, key; uint8_t type; @@ -8181,11 +8124,8 @@ ctl_persistent_reserve_out(struct ctl_sc CTL_DEBUG_PRINT(("ctl_persistent_reserve_out\n")); - retval = CTL_RETVAL_COMPLETE; - cdb = (struct scsi_per_res_out *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; + retval = CTL_RETVAL_COMPLETE; /* * We only support whole-LUN scope. The scope & type are ignored for @@ -8559,9 +8499,10 @@ done: * in sync. */ static void -ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg) +ctl_hndl_per_res_out_on_other_sc(union ctl_io *io) { - struct ctl_softc *softc = control_softc; + struct ctl_softc *softc = CTL_SOFTC(io); + union ctl_ha_msg *msg = (union ctl_ha_msg *)&io->presio.pr_msg; struct ctl_lun *lun; int i; uint32_t residx, targ_lun; @@ -8680,15 +8621,13 @@ ctl_hndl_per_res_out_on_other_sc(union c int ctl_read_write(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; int flags, retval; int isread; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_read_write: command: %#x\n", ctsio->cdb[0])); flags = 0; @@ -8873,15 +8812,14 @@ ctl_read_write(struct ctl_scsiio *ctsio) static int ctl_cnw_cont(union ctl_io *io) { + struct ctl_lun *lun = CTL_LUN(io); struct ctl_scsiio *ctsio; - struct ctl_lun *lun; struct ctl_lba_len_flags *lbalen; int retval; ctsio = &io->scsiio; ctsio->io_hdr.status = CTL_STATUS_NONE; ctsio->io_hdr.flags &= ~CTL_FLAG_IO_CONT; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; lbalen = (struct ctl_lba_len_flags *) &ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; lbalen->flags &= ~CTL_LLF_COMPARE; @@ -8895,14 +8833,12 @@ ctl_cnw_cont(union ctl_io *io) int ctl_cnw(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; int flags, retval; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_cnw: command: %#x\n", ctsio->cdb[0])); flags = 0; @@ -8983,15 +8919,13 @@ ctl_cnw(struct ctl_scsiio *ctsio) int ctl_verify(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; int bytchk, flags; int retval; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_verify: command: %#x\n", ctsio->cdb[0])); bytchk = 0; @@ -9087,19 +9021,17 @@ ctl_verify(struct ctl_scsiio *ctsio) int ctl_report_luns(struct ctl_scsiio *ctsio) { - struct ctl_softc *softc; + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); + struct ctl_lun *lun, *request_lun = CTL_LUN(ctsio); struct scsi_report_luns *cdb; struct scsi_report_luns_data *lun_data; - struct ctl_lun *lun, *request_lun; - struct ctl_port *port; int num_filled, num_luns, num_port_luns, retval; uint32_t alloc_len, lun_datalen; uint32_t initidx, targ_lun_id, lun_id; retval = CTL_RETVAL_COMPLETE; cdb = (struct scsi_report_luns *)ctsio->cdb; - port = ctl_io_port(&ctsio->io_hdr); - softc = port->ctl_softc; CTL_DEBUG_PRINT(("ctl_report_luns\n")); @@ -9152,9 +9084,6 @@ ctl_report_luns(struct ctl_scsiio *ctsio return (retval); } - request_lun = (struct ctl_lun *) - ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - lun_datalen = sizeof(*lun_data) + (num_luns * sizeof(struct scsi_report_luns_lundata)); @@ -9245,10 +9174,10 @@ ctl_report_luns(struct ctl_scsiio *ctsio int ctl_request_sense(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_request_sense *cdb; struct scsi_sense_data *sense_ptr; - struct ctl_softc *softc; - struct ctl_lun *lun; uint32_t initidx; int have_error; u_int sense_len = SSD_FULL_SIZE; @@ -9258,9 +9187,6 @@ ctl_request_sense(struct ctl_scsiio *cts cdb = (struct scsi_request_sense *)ctsio->cdb; - softc = control_softc; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_request_sense\n")); /* @@ -9403,13 +9329,11 @@ ctl_tur(struct ctl_scsiio *ctsio) static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_supported_pages *pages; int sup_page_size; - struct ctl_lun *lun; int p; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - sup_page_size = sizeof(struct scsi_vpd_supported_pages) * SCSI_EVPD_NUM_SUPPORTED_PAGES; ctsio->kern_data_ptr = malloc(sup_page_size, M_CTL, M_WAITOK | M_ZERO); @@ -9478,12 +9402,10 @@ ctl_inquiry_evpd_supported(struct ctl_sc static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_unit_serial_number *sn_ptr; - struct ctl_lun *lun; int data_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = 4 + CTL_SN_LEN; ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); sn_ptr = (struct scsi_vpd_unit_serial_number *)ctsio->kern_data_ptr; @@ -9537,12 +9459,10 @@ ctl_inquiry_evpd_serial(struct ctl_scsii static int ctl_inquiry_evpd_eid(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_extended_inquiry_data *eid_ptr; - struct ctl_lun *lun; int data_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_extended_inquiry_data); ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); eid_ptr = (struct scsi_vpd_extended_inquiry_data *)ctsio->kern_data_ptr; @@ -9613,12 +9533,10 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio * static int ctl_inquiry_evpd_mpp(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_mode_page_policy *mpp_ptr; - struct ctl_lun *lun; int data_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_mode_page_policy) + sizeof(struct scsi_vpd_mode_page_policy_descr); @@ -9667,19 +9585,14 @@ ctl_inquiry_evpd_mpp(struct ctl_scsiio * static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_device_id *devid_ptr; struct scsi_vpd_id_descriptor *desc; - struct ctl_softc *softc; - struct ctl_lun *lun; - struct ctl_port *port; int data_len, g; uint8_t proto; - softc = control_softc; - - port = ctl_io_port(&ctsio->io_hdr); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_device_id) + sizeof(struct scsi_vpd_id_descriptor) + sizeof(struct scsi_vpd_id_rel_trgt_port_id) + @@ -9792,16 +9705,14 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio static int ctl_inquiry_evpd_scsi_ports(struct ctl_scsiio *ctsio, int alloc_len) { - struct ctl_softc *softc = control_softc; + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_scsi_ports *sp; struct scsi_vpd_port_designation *pd; struct scsi_vpd_port_designation_cont *pdc; - struct ctl_lun *lun; struct ctl_port *port; int data_len, num_target_ports, iid_len, id_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - num_target_ports = 0; iid_len = 0; id_len = 0; @@ -9895,12 +9806,10 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s static int ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_block_limits *bl_ptr; - struct ctl_lun *lun; uint64_t ival; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*bl_ptr), M_CTL, M_WAITOK | M_ZERO); bl_ptr = (struct scsi_vpd_block_limits *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -9972,13 +9881,11 @@ ctl_inquiry_evpd_block_limits(struct ctl static int ctl_inquiry_evpd_bdc(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_block_device_characteristics *bdc_ptr; - struct ctl_lun *lun; const char *value; u_int i; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*bdc_ptr), M_CTL, M_WAITOK | M_ZERO); bdc_ptr = (struct scsi_vpd_block_device_characteristics *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -10032,12 +9939,10 @@ ctl_inquiry_evpd_bdc(struct ctl_scsiio * static int ctl_inquiry_evpd_lbp(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_logical_block_prov *lbp_ptr; - struct ctl_lun *lun; const char *value; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*lbp_ptr), M_CTL, M_WAITOK | M_ZERO); lbp_ptr = (struct scsi_vpd_logical_block_prov *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -10095,11 +10000,10 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio * static int ctl_inquiry_evpd(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_inquiry *cdb; int alloc_len, retval; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_inquiry *)ctsio->cdb; alloc_len = scsi_2btoul(cdb->length); @@ -10162,21 +10066,19 @@ err: static int ctl_inquiry_std(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Dec 29 16:35:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22769C95746; Thu, 29 Dec 2016 16:35:51 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE1381933; Thu, 29 Dec 2016 16:35:50 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTGZo14091754; Thu, 29 Dec 2016 16:35:50 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTGZo4W091753; Thu, 29 Dec 2016 16:35:50 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201612291635.uBTGZo4W091753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 29 Dec 2016 16:35:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310779 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 16:35:51 -0000 Author: mjg Date: Thu Dec 29 16:35:49 2016 New Revision: 310779 URL: https://svnweb.freebsd.org/changeset/base/310779 Log: cache: sprinkle __predict_false Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Thu Dec 29 15:09:34 2016 (r310778) +++ head/sys/kern/vfs_cache.c Thu Dec 29 16:35:49 2016 (r310779) @@ -1104,7 +1104,7 @@ cache_lookup(struct vnode *dvp, struct v uint32_t hash; int error, ltype; - if (!doingcache) { + if (__predict_false(!doingcache)) { cnp->cn_flags &= ~MAKEENTRY; return (0); } @@ -1544,13 +1544,13 @@ cache_enter_time(struct vnode *dvp, stru VNASSERT(dvp == NULL || (dvp->v_iflag & VI_DOOMED) == 0, dvp, ("cache_enter: Doomed vnode used as src")); - if (!doingcache) + if (__predict_false(!doingcache)) return; /* * Avoid blowout in namecache entries. */ - if (numcache >= desiredvnodes * ncsizefactor) + if (__predict_false(numcache >= desiredvnodes * ncsizefactor)) return; cache_celockstate_init(&cel); @@ -2054,9 +2054,9 @@ kern___getcwd(struct thread *td, char *b struct vnode *cdir, *rdir; int error; - if (disablecwd) + if (__predict_false(disablecwd)) return (ENODEV); - if (buflen < 2) + if (__predict_false(buflen < 2)) return (EINVAL); if (buflen > path_max) buflen = path_max; @@ -2107,9 +2107,9 @@ vn_fullpath(struct thread *td, struct vn struct vnode *rdir; int error; - if (disablefullpath) + if (__predict_false(disablefullpath)) return (ENODEV); - if (vn == NULL) + if (__predict_false(vn == NULL)) return (EINVAL); buf = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); @@ -2141,9 +2141,9 @@ vn_fullpath_global(struct thread *td, st char *buf; int error; - if (disablefullpath) + if (__predict_false(disablefullpath)) return (ENODEV); - if (vn == NULL) + if (__predict_false(vn == NULL)) return (EINVAL); buf = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); error = vn_fullpath1(td, vn, rootvnode, buf, retbuf, MAXPATHLEN); @@ -2407,7 +2407,7 @@ vn_path_to_global_path(struct thread *td ASSERT_VOP_ELOCKED(vp, __func__); /* Return ENODEV if sysctl debug.disablefullpath==1 */ - if (disablefullpath) + if (__predict_false(disablefullpath)) return (ENODEV); /* Construct global filesystem path from vp. */ From owner-svn-src-head@freebsd.org Thu Dec 29 17:31:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70211C96AB6; Thu, 29 Dec 2016 17:31:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3DD50157A; Thu, 29 Dec 2016 17:31:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTHV7ed013722; Thu, 29 Dec 2016 17:31:07 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTHV7C9013708; Thu, 29 Dec 2016 17:31:07 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201612291731.uBTHV7C9013708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 29 Dec 2016 17:31:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310780 - head/sys/mips/atheros X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 17:31:08 -0000 Author: adrian Date: Thu Dec 29 17:31:07 2016 New Revision: 310780 URL: https://svnweb.freebsd.org/changeset/base/310780 Log: [ar71xx] put in an implicit read-after-write to flush things out. Note: I may need to revisit this for mips74k. Modified: head/sys/mips/atheros/ar71xxreg.h Modified: head/sys/mips/atheros/ar71xxreg.h ============================================================================== --- head/sys/mips/atheros/ar71xxreg.h Thu Dec 29 16:35:49 2016 (r310779) +++ head/sys/mips/atheros/ar71xxreg.h Thu Dec 29 17:31:07 2016 (r310780) @@ -527,7 +527,10 @@ typedef enum { *((volatile uint32_t *)MIPS_PHYS_TO_KSEG1((reg))) #define ATH_WRITE_REG(reg, val) \ - *((volatile uint32_t *)MIPS_PHYS_TO_KSEG1((reg))) = (val) + do { \ + *((volatile uint32_t *)MIPS_PHYS_TO_KSEG1((reg))) = (val); \ + (void) ATH_READ_REG(reg); \ + } while (0) static inline void ar71xx_ddr_flush(uint32_t reg) From owner-svn-src-head@freebsd.org Thu Dec 29 17:31:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B120AC96B77; Thu, 29 Dec 2016 17:31:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80B9A178D; Thu, 29 Dec 2016 17:31:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTHVcjq015367; Thu, 29 Dec 2016 17:31:38 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTHVc74015366; Thu, 29 Dec 2016 17:31:38 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201612291731.uBTHVc74015366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 29 Dec 2016 17:31:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310781 - head/sys/mips/atheros X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 17:31:39 -0000 Author: adrian Date: Thu Dec 29 17:31:38 2016 New Revision: 310781 URL: https://svnweb.freebsd.org/changeset/base/310781 Log: [ar71xx] add EARLY_PRINTF support for the AR933x (Hornet) UART. Tested: * Carambola 2 Modified: head/sys/mips/atheros/uart_bus_ar933x.c Modified: head/sys/mips/atheros/uart_bus_ar933x.c ============================================================================== --- head/sys/mips/atheros/uart_bus_ar933x.c Thu Dec 29 17:31:07 2016 (r310780) +++ head/sys/mips/atheros/uart_bus_ar933x.c Thu Dec 29 17:31:38 2016 (r310781) @@ -44,6 +44,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef EARLY_PRINTF +#include +#endif #include "uart_if.h" @@ -88,4 +91,25 @@ uart_ar933x_probe(device_t dev) return (uart_bus_probe(dev, 2, freq, 0, 0)); } +/* + * Assume the UART is setup by the bootloader and just echo that. + */ +#if defined(EARLY_PRINTF) +static void +ar933x_early_putc(int c) +{ + int i = 1000; + + /* Wait until FIFO is clear */ + while ((i > 0) && (ATH_READ_REG(AR71XX_UART_ADDR + AR933X_UART_CS_REG) & + AR933X_UART_CS_TX_BUSY)) + i--; + + /* Write it out */ + ATH_WRITE_REG(AR71XX_UART_ADDR + AR933X_UART_DATA_REG, + (c & 0xff)| AR933X_UART_DATA_TX_CSR); +} +early_putc_t *early_putc = ar933x_early_putc; +#endif /* EARLY_PRINTF */ + DRIVER_MODULE(uart, apb, uart_ar933x_driver, uart_devclass, 0, 0); From owner-svn-src-head@freebsd.org Thu Dec 29 18:02:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF22CC966F6; Thu, 29 Dec 2016 18:02:29 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wj0-x242.google.com (mail-wj0-x242.google.com [IPv6:2a00:1450:400c:c01::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7189E1038; Thu, 29 Dec 2016 18:02:29 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wj0-x242.google.com with SMTP id qs7so20744879wjc.1; Thu, 29 Dec 2016 10:02:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=VKzF+RRrmNeMDMt0RHM7aLXIVKET5scTKxT26mHUN2Y=; b=ERXT8lD3eCMfUwNUNZs62APACFL2y62f8oRYkIT2sLzLiXBxvNAlFQNrxq0pEo9RZD L7lj1aZqNgoXaV0dmnl3YcKJqOtCgHCB2QOcBkfypyO6FTLwRIf1e9ZoAarrP/qarBGt T5QifcLO25FrWU5AyePH5gGqfR1A3T51nvDNQfQNrMkvY6oz525w4+KwBiuRXoZemj71 vdbu0KrjcTLUMFEBwO1u5vaj5VIyXeAb0CSDAg6FSLyEV2LkUf651YTf6NrOOuvavuua BHTW6GaTwzFoagle5c3jyQvPvtLsFu5inQrOBsS1tvzJ2nvZqv0Ix5nvfdUXNYOr15d+ lSZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=VKzF+RRrmNeMDMt0RHM7aLXIVKET5scTKxT26mHUN2Y=; b=CkBeqDN2BPS8QdGUCje2Hx89IxrIonFxTu4ibylDJfTOn57UMtc9s1SlxpiRqKw91d WBQKNhz5R/kY8lkn6nxWxQlO5zn/WmSFFcrFc7gZ1xslC3x7UxB0BAU96QzkOKHJmB8M QExPlur1QCPmzFC5zGXIUjI1rxZllH7X/aS8McHQNaXGOaK4HbsYckhKYT6VAsblGNgw Zda3/vjGlfV1mhJd/ANxbQE/UOHScJXX2fr80eq8tmqwz42So44O8QdMavliiPRFVchh WEbz5cjQ4x7ZBnePZV5QepkvXauVMuJqucAmuLIqlohrDj89DHy600vM3h191TtXYDTe Ei7Q== X-Gm-Message-State: AIkVDXKEf2q4l5U3l/JyWgfcwkGCgYLIe6z1jxSahCNUIHhwZh/NR1wK50zx7mWEGiQtgw== X-Received: by 10.194.69.230 with SMTP id h6mr43158332wju.63.1483034547252; Thu, 29 Dec 2016 10:02:27 -0800 (PST) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by smtp.gmail.com with ESMTPSA id g184sm66350143wme.23.2016.12.29.10.02.25 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 29 Dec 2016 10:02:26 -0800 (PST) Date: Thu, 29 Dec 2016 19:02:24 +0100 From: Mateusz Guzik To: Alexander Motin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310778 - head/sys/cam/ctl Message-ID: <20161229180223.GD29676@dft-labs.eu> References: <201612291509.uBTF9YxM055182@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201612291509.uBTF9YxM055182@repo.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 18:02:29 -0000 On Thu, Dec 29, 2016 at 03:09:34PM +0000, Alexander Motin wrote: > Author: mav > Date: Thu Dec 29 15:09:34 2016 > New Revision: 310778 > URL: https://svnweb.freebsd.org/changeset/base/310778 > > Log: > Improve use of I/O's private area. > > - Since I/Os are allocates from per-port pools, make allocations store > pointer to CTL softc there, and use it where needed instead of global. > - Created bunch of helper macros to access LUN, port and CTL softc. > This fails to build with: sys/modules/ctl/../../cam/ctl/ctl.c:12522:27: error: member reference base type 'void' is not a structure or union mtx_assert(&CTL_SOFTC(io)->ctl_lock, MA_NOTOWNED); Looks like thep roblem is that CTL_SOFTC indeed does not cast and returns void instead: +#define CTL_SOFTC(io) ((io)->io_hdr.ctl_private[CTL_PRIV_LUN].ptrs[1]) -- Mateusz Guzik From owner-svn-src-head@freebsd.org Thu Dec 29 18:08:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D42BAC96937; Thu, 29 Dec 2016 18:08:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C8E71448; Thu, 29 Dec 2016 18:08:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTI84EW029033; Thu, 29 Dec 2016 18:08:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTI84k1029032; Thu, 29 Dec 2016 18:08:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612291808.uBTI84k1029032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 29 Dec 2016 18:08:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310782 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 18:08:05 -0000 Author: mav Date: Thu Dec 29 18:08:04 2016 New Revision: 310782 URL: https://svnweb.freebsd.org/changeset/base/310782 Log: Fix build with enabled debug after r310778. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Dec 29 17:31:38 2016 (r310781) +++ head/sys/cam/ctl/ctl.c Thu Dec 29 18:08:04 2016 (r310782) @@ -12519,7 +12519,7 @@ ctl_datamove(union ctl_io *io) { void (*fe_datamove)(union ctl_io *io); - mtx_assert(&CTL_SOFTC(io)->ctl_lock, MA_NOTOWNED); + mtx_assert(&((struct ctl_softc *)CTL_SOFTC(io))->ctl_lock, MA_NOTOWNED); CTL_DEBUG_PRINT(("ctl_datamove\n")); @@ -13012,7 +13012,7 @@ static void ctl_datamove_remote(union ctl_io *io) { - mtx_assert(&CTL_SOFTC(io)->ctl_lock, MA_NOTOWNED); + mtx_assert(&((struct ctl_softc *)CTL_SOFTC(io))->ctl_lock, MA_NOTOWNED); if (io->io_hdr.flags & CTL_FLAG_FAILOVER) { ctl_failover_io(io, /*have_lock*/ 0); From owner-svn-src-head@freebsd.org Thu Dec 29 18:09:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B21ABC969BC; Thu, 29 Dec 2016 18:09:01 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A3031612; Thu, 29 Dec 2016 18:09:01 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-wm0-x241.google.com with SMTP id u144so67563235wmu.0; Thu, 29 Dec 2016 10:09:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=uxuFp7Xe/E1EEnH+TWX5XbO3EsrDUoO724HR46wCKME=; b=WKBJzMGRzNItwmqC85NEZX3uyWofimCicLtlV47znuzdDpuIC0YLorKfgi2RmzZNEP 6siXZIe118U78TSmBQhwskROFRc5kXNgkJxxFDB0OyitN4LDzBCp8YogOWKgRNc2YYyd ylVrH4D2hfLPPN0mRbn3qCN6JKzoxp2Plchffp7ibZO6nsxQgqZR8rDL9d39ndFOjcWv XCDMFKSMPFyN0F5QKq1yix73rC6KuAVx9wWK3+QtE4AKMGiNOANIfqjFWF1BLupH1onN lnW3T225XY/d3ndS/8RnuzzgN1GC18dhtjbNb4npvkqxf98aixEUP3IN0GdO6biKqA6l 4hHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=uxuFp7Xe/E1EEnH+TWX5XbO3EsrDUoO724HR46wCKME=; b=QYO5uxQXKjziNovXFU93utu/npvTxuXK52LyC/9JOKtz6BGIFOoX2V/h/13Y05A58W PeBcdRxCmF5iolkIOs+9Q0wsa+B1qSwLWb+ugUsekbeIWSr7eXliqI8LgNJWF+9IzRpJ BcgG+jYzyjxEWafmUjNw8wdNKBV4vtivivcpu88QAzjNSQaADFonHoqP4skjbF+DWDe9 qtjroti6EF7xm4A9D/ab1lAk87VsEErF/NNl3hnWKi9pJIhLxplT869dj9Um9mzXVJbn AHZ5k/iOfhstnC1yUvFMAD20lSqSjMEttgu+CMOxv4rtwmQ3pEl2HOQJ+wHwV2kVps6+ UShg== X-Gm-Message-State: AIkVDXJklLQazx5+4ei0BTWp9EQQvYwOZMG6dBxP+11bUzsuun7cAy/uNYyho7eowStB4A== X-Received: by 10.28.136.80 with SMTP id k77mr38560690wmd.57.1483034939337; Thu, 29 Dec 2016 10:08:59 -0800 (PST) Received: from spectre.mavhome.dp.ua ([92.38.100.11]) by smtp.gmail.com with ESMTPSA id l67sm66249685wmf.20.2016.12.29.10.08.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Dec 2016 10:08:58 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r310778 - head/sys/cam/ctl To: Mateusz Guzik References: <201612291509.uBTF9YxM055182@repo.freebsd.org> <20161229180223.GD29676@dft-labs.eu> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Alexander Motin Message-ID: <88db7459-d498-7c19-d335-e9e33cf5b529@FreeBSD.org> Date: Thu, 29 Dec 2016 20:08:57 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161229180223.GD29676@dft-labs.eu> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 18:09:01 -0000 On 29.12.2016 20:02, Mateusz Guzik wrote: > On Thu, Dec 29, 2016 at 03:09:34PM +0000, Alexander Motin wrote: >> Author: mav >> Date: Thu Dec 29 15:09:34 2016 >> New Revision: 310778 >> URL: https://svnweb.freebsd.org/changeset/base/310778 >> >> Log: >> Improve use of I/O's private area. >> >> - Since I/Os are allocates from per-port pools, make allocations store >> pointer to CTL softc there, and use it where needed instead of global. >> - Created bunch of helper macros to access LUN, port and CTL softc. >> > > This fails to build with: > > sys/modules/ctl/../../cam/ctl/ctl.c:12522:27: error: member reference > base type 'void' is not a structure or union > mtx_assert(&CTL_SOFTC(io)->ctl_lock, MA_NOTOWNED); > > Looks like thep roblem is that CTL_SOFTC indeed does not cast and > returns void instead: > +#define CTL_SOFTC(io) ((io)->io_hdr.ctl_private[CTL_PRIV_LUN].ptrs[1]) Thank you! Fixed. -- Alexander Motin From owner-svn-src-head@freebsd.org Thu Dec 29 19:57:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63774C96D11; Thu, 29 Dec 2016 19:57:47 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2BE331444; Thu, 29 Dec 2016 19:57:47 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTJvkKd073985; Thu, 29 Dec 2016 19:57:46 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTJvkAK073983; Thu, 29 Dec 2016 19:57:46 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201612291957.uBTJvkAK073983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 29 Dec 2016 19:57:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310783 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 19:57:47 -0000 Author: ae Date: Thu Dec 29 19:57:46 2016 New Revision: 310783 URL: https://svnweb.freebsd.org/changeset/base/310783 Log: When we are sending IP fragments, update ip pointers in IP_PROBE() for each fragment. MFC after: 1 week Modified: head/sys/netinet/ip_fastfwd.c head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_fastfwd.c ============================================================================== --- head/sys/netinet/ip_fastfwd.c Thu Dec 29 18:08:04 2016 (r310782) +++ head/sys/netinet/ip_fastfwd.c Thu Dec 29 19:57:46 2016 (r310783) @@ -400,8 +400,9 @@ passout: */ m_clrprotoflags(m); - IP_PROBE(send, NULL, NULL, ip, nh.nh_ifp, - ip, NULL); + IP_PROBE(send, NULL, NULL, + mtod(m, struct ip *), nh.nh_ifp, + mtod(m, struct ip *), NULL); /* XXX: we can use cached route here */ error = (*nh.nh_ifp->if_output)(nh.nh_ifp, m, (struct sockaddr *)&dst, NULL); Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Thu Dec 29 18:08:04 2016 (r310782) +++ head/sys/netinet/ip_output.c Thu Dec 29 19:57:46 2016 (r310783) @@ -696,7 +696,8 @@ sendit: */ m_clrprotoflags(m); - IP_PROBE(send, NULL, NULL, ip, ifp, ip, NULL); + IP_PROBE(send, NULL, NULL, mtod(m, struct ip *), ifp, + mtod(m, struct ip *), NULL); error = (*ifp->if_output)(ifp, m, (const struct sockaddr *)gw, ro); } else From owner-svn-src-head@freebsd.org Thu Dec 29 20:11:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DB11C9633D; Thu, 29 Dec 2016 20:11:51 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07A991F1F; Thu, 29 Dec 2016 20:11:50 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTKBobQ080979; Thu, 29 Dec 2016 20:11:50 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTKBofm080964; Thu, 29 Dec 2016 20:11:50 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201612292011.uBTKBofm080964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Thu, 29 Dec 2016 20:11:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310784 - head/sys/mips/mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 20:11:51 -0000 Author: kan Date: Thu Dec 29 20:11:50 2016 New Revision: 310784 URL: https://svnweb.freebsd.org/changeset/base/310784 Log: Use mips_dcache_wbinv_range instead of mips_dcache_wb_range on CPU_XBURST Ingenic CPUs treat plain cache writeback as local-only operation and do nothing if that is a remote CPU that holds the dirty cache line. They do broadcast invalidate and write-and-invalidate to other cores though, so take advantage of that and use wbinv in place of wb as this still gives us required busdma semantics. Otherwise we'd have to do IPI to remote CPU ourselves. Modified: head/sys/mips/mips/busdma_machdep.c Modified: head/sys/mips/mips/busdma_machdep.c ============================================================================== --- head/sys/mips/mips/busdma_machdep.c Thu Dec 29 19:57:46 2016 (r310783) +++ head/sys/mips/mips/busdma_machdep.c Thu Dec 29 20:11:50 2016 (r310784) @@ -66,6 +66,16 @@ __FBSDID("$FreeBSD$"); #define BUS_DMA_COULD_BOUNCE BUS_DMA_BUS3 #define BUS_DMA_MIN_ALLOC_COMP BUS_DMA_BUS4 +/* + * On XBurst cores from Ingenic, cache-line writeback is local + * only, unless accompanied by invalidation. Invalidations force + * dirty line writeout and invalidation requests forwarded to + * other cores if other cores have the cache line dirty. + */ +#if defined(SMP) && defined(CPU_XBURST) +#define BUS_DMA_FORCE_WBINV +#endif + struct bounce_zone; struct bus_dma_tag { @@ -1069,7 +1079,7 @@ bus_dmamap_sync_buf(vm_offset_t buf, int /* * dcache invalidation operates on cache line aligned addresses * and could modify areas of memory that share the same cache line - * at the beginning and the ending of the buffer. In order to + * at the beginning and the ending of the buffer. In order to * prevent a data loss we save these chunks in temporary buffer * before invalidation and restore them afer it. * @@ -1099,7 +1109,7 @@ bus_dmamap_sync_buf(vm_offset_t buf, int case BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE: case BUS_DMASYNC_POSTREAD: - /* + /* * Save buffers that might be modified by invalidation */ if (size_cl) @@ -1107,14 +1117,14 @@ bus_dmamap_sync_buf(vm_offset_t buf, int if (size_clend) memcpy (tmp_clend, (void*)buf_clend, size_clend); mips_dcache_inv_range(buf, len); - /* + /* * Restore them */ if (size_cl) memcpy ((void*)buf_cl, tmp_cl, size_cl); if (size_clend) memcpy ((void*)buf_clend, tmp_clend, size_clend); - /* + /* * Copies above have brought corresponding memory * cache lines back into dirty state. Write them back * out and invalidate affected cache lines again if @@ -1132,7 +1142,7 @@ bus_dmamap_sync_buf(vm_offset_t buf, int break; case BUS_DMASYNC_PREREAD: - /* + /* * Save buffers that might be modified by invalidation */ if (size_cl) @@ -1147,7 +1157,7 @@ bus_dmamap_sync_buf(vm_offset_t buf, int memcpy ((void *)buf_cl, tmp_cl, size_cl); if (size_clend) memcpy ((void *)buf_clend, tmp_clend, size_clend); - /* + /* * Copies above have brought corresponding memory * cache lines back into dirty state. Write them back * out and invalidate affected cache lines again if @@ -1161,7 +1171,11 @@ bus_dmamap_sync_buf(vm_offset_t buf, int break; case BUS_DMASYNC_PREWRITE: +#ifdef BUS_DMA_FORCE_WBINV + mips_dcache_wbinv_range(buf, len); +#else mips_dcache_wb_range(buf, len); +#endif break; } } @@ -1175,19 +1189,24 @@ _bus_dmamap_sync_bp(bus_dma_tag_t dmat, if (op & BUS_DMASYNC_PREWRITE) { if (bpage->datavaddr != 0) bcopy((void *)bpage->datavaddr, - (void *)(bpage->vaddr_nocache != 0 ? + (void *)(bpage->vaddr_nocache != 0 ? bpage->vaddr_nocache : bpage->vaddr), bpage->datacount); else physcopyout(bpage->dataaddr, - (void *)(bpage->vaddr_nocache != 0 ? + (void *)(bpage->vaddr_nocache != 0 ? bpage->vaddr_nocache : bpage->vaddr), bpage->datacount); if (bpage->vaddr_nocache == 0) { +#ifdef BUS_DMA_FORCE_WBINV + mips_dcache_wbinv_range(bpage->vaddr, + bpage->datacount); +#else mips_dcache_wb_range(bpage->vaddr, bpage->datacount); +#endif } dmat->bounce_zone->total_bounced++; } @@ -1197,11 +1216,11 @@ _bus_dmamap_sync_bp(bus_dma_tag_t dmat, bpage->datacount); } if (bpage->datavaddr != 0) - bcopy((void *)(bpage->vaddr_nocache != 0 ? + bcopy((void *)(bpage->vaddr_nocache != 0 ? bpage->vaddr_nocache : bpage->vaddr), (void *)bpage->datavaddr, bpage->datacount); else - physcopyin((void *)(bpage->vaddr_nocache != 0 ? + physcopyin((void *)(bpage->vaddr_nocache != 0 ? bpage->vaddr_nocache : bpage->vaddr), bpage->dataaddr, bpage->datacount); dmat->bounce_zone->total_bounced++; @@ -1214,7 +1233,7 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus { struct sync_list *sl, *end; int aligned; - + if (op == BUS_DMASYNC_POSTWRITE) return; if (STAILQ_FIRST(&map->bpages)) @@ -1233,7 +1252,7 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus if (map->sync_count) { end = &map->slist[map->sync_count]; for (sl = &map->slist[0]; sl != end; sl++) - bus_dmamap_sync_buf(sl->vaddr, sl->datacount, op, + bus_dmamap_sync_buf(sl->vaddr, sl->datacount, op, aligned); } } From owner-svn-src-head@freebsd.org Thu Dec 29 20:27:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEC37C96801; Thu, 29 Dec 2016 20:27:55 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E5BA17CB; Thu, 29 Dec 2016 20:27:55 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTKRsa6086081; Thu, 29 Dec 2016 20:27:54 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTKRsxi086080; Thu, 29 Dec 2016 20:27:54 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201612292027.uBTKRsxi086080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 29 Dec 2016 20:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310785 - head/cddl/lib/libdtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 20:27:55 -0000 Author: ae Date: Thu Dec 29 20:27:54 2016 New Revision: 310785 URL: https://svnweb.freebsd.org/changeset/base/310785 Log: Convert ipv4_flags and ipv4_offset fields into host byte order. Also save only high bits in the ipv4_flags, because it is defined as uint8_t. So now it will show DF and MF flags as 0x40 and 0x20. Reviewed by: markj@ MFC after: 1 week Modified: head/cddl/lib/libdtrace/ip.d Modified: head/cddl/lib/libdtrace/ip.d ============================================================================== --- head/cddl/lib/libdtrace/ip.d Thu Dec 29 20:11:50 2016 (r310784) +++ head/cddl/lib/libdtrace/ip.d Thu Dec 29 20:27:54 2016 (r310785) @@ -255,8 +255,8 @@ translator ipv4info_t < struct ip *p > { ipv4_tos = p == NULL ? 0 : p->ip_tos; ipv4_length = p == NULL ? 0 : ntohs(p->ip_len); ipv4_ident = p == NULL ? 0 : ntohs(p->ip_id); - ipv4_flags = p == NULL ? 0 : (p->ip_off & 0xe000); - ipv4_offset = p == NULL ? 0 : p->ip_off; + ipv4_flags = p == NULL ? 0 : (ntohs(p->ip_off) & 0xe000) >> 8; + ipv4_offset = p == NULL ? 0 : ntohs(p->ip_off) & 0x1fff; ipv4_ttl = p == NULL ? 0 : p->ip_ttl; ipv4_protocol = p == NULL ? 0 : p->ip_p; ipv4_protostr = p == NULL ? "" : protocols[p->ip_p]; From owner-svn-src-head@freebsd.org Thu Dec 29 20:28:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4329C96892; Thu, 29 Dec 2016 20:28:52 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50D6E1954; Thu, 29 Dec 2016 20:28:52 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTKSppw086162; Thu, 29 Dec 2016 20:28:51 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTKSolC086152; Thu, 29 Dec 2016 20:28:50 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201612292028.uBTKSolC086152@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 29 Dec 2016 20:28:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310786 - head/tests/sys/geom/class/eli X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 20:28:52 -0000 Author: asomers Date: Thu Dec 29 20:28:50 2016 New Revision: 310786 URL: https://svnweb.freebsd.org/changeset/base/310786 Log: Reduce the runtime of the GELI tests There is no reduction in test coverage. On my system runtime is reduced from 38m32s to 6m24s. tests/sys/geom/class/eli/conf.sh tests/sys/geom/class/eli/init_a_test.sh tests/sys/geom/class/eli/init_test.sh tests/sys/geom/class/eli/integrity_copy_test.sh tests/sys/geom/class/eli/integrity_data_test.sh tests/sys/geom/class/eli/integrity_hmac_test.sh tests/sys/geom/class/eli/onetime_a_test.sh tests/sys/geom/class/eli/onetime_test.sh Move the looping code into common functions in conf.sh, and remove alias ciphers from the list. tests/sys/geom/class/eli/init_a_test.sh tests/sys/geom/class/eli/init_test.sh tests/sys/geom/class/eli/integrity_copy_test.sh tests/sys/geom/class/eli/integrity_data_test.sh tests/sys/geom/class/eli/integrity_hmac_test.sh tests/sys/geom/class/eli/onetime_a_test.sh Move a few commands that don't need to be in the inner loop out. tests/sys/geom/class/eli/init_test.sh tests/sys/geom/class/eli/onetime_a_test.sh Reduce the sector count tests/sys/geom/class/eli/Makefile tests/sys/geom/class/eli/init_alias_test.sh Add a test for initializing a GELI device using one of the cipher aliases, and check that the alias is correctly interpreted. MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8814 Added: head/tests/sys/geom/class/eli/init_alias_test.sh (contents, props changed) Modified: head/tests/sys/geom/class/eli/Makefile head/tests/sys/geom/class/eli/conf.sh head/tests/sys/geom/class/eli/init_a_test.sh head/tests/sys/geom/class/eli/init_test.sh head/tests/sys/geom/class/eli/integrity_copy_test.sh head/tests/sys/geom/class/eli/integrity_data_test.sh head/tests/sys/geom/class/eli/integrity_hmac_test.sh head/tests/sys/geom/class/eli/onetime_a_test.sh head/tests/sys/geom/class/eli/onetime_test.sh Modified: head/tests/sys/geom/class/eli/Makefile ============================================================================== --- head/tests/sys/geom/class/eli/Makefile Thu Dec 29 20:27:54 2016 (r310785) +++ head/tests/sys/geom/class/eli/Makefile Thu Dec 29 20:28:50 2016 (r310786) @@ -11,6 +11,7 @@ TAP_TESTS_SH+= detach_l_test TAP_TESTS_SH+= init_B_test TAP_TESTS_SH+= init_J_test TAP_TESTS_SH+= init_a_test +TAP_TESTS_SH+= init_alias_test TAP_TESTS_SH+= init_i_P_test TAP_TESTS_SH+= init_test TAP_TESTS_SH+= integrity_copy_test Modified: head/tests/sys/geom/class/eli/conf.sh ============================================================================== --- head/tests/sys/geom/class/eli/conf.sh Thu Dec 29 20:27:54 2016 (r310785) +++ head/tests/sys/geom/class/eli/conf.sh Thu Dec 29 20:28:50 2016 (r310786) @@ -11,6 +11,54 @@ while [ -c /dev/md$no ]; do : $(( no += 1 )) done +# Execute `func` for each combination of cipher, sectorsize, and hmac algo +# `func` usage should be: +# func +for_each_geli_config() { + func=$1 + + for cipher in aes-xts:128 aes-xts:256 \ + aes-cbc:128 aes-cbc:192 aes-cbc:256 \ + 3des-cbc:192 \ + blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 \ + blowfish-cbc:224 blowfish-cbc:256 blowfish-cbc:288 \ + blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do + ealgo=${cipher%%:*} + keylen=${cipher##*:} + for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 \ + hmac/sha384 hmac/sha512; do + for secsize in 512 1024 2048 4096 8192; do + ${func} $cipher $aalgo $secsize + done + done + done +} + +# Execute `func` for each combination of cipher, and sectorsize, with no hmac +# `func` usage should be: +# func +for_each_geli_config_nointegrity() { + func=$1 + + for cipher in aes-xts:128 aes-xts:256 \ + aes-cbc:128 aes-cbc:192 aes-cbc:256 \ + 3des-cbc:192 \ + blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 \ + blowfish-cbc:224 blowfish-cbc:256 blowfish-cbc:288 \ + blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do + ealgo=${cipher%%:*} + keylen=${cipher##*:} + for secsize in 512 1024 2048 4096 8192; do + ${func} $cipher $aalgo $secsize + done + done +} + + geli_test_cleanup() { [ -c /dev/md${no}.eli ] && geli detach md${no}.eli Modified: head/tests/sys/geom/class/eli/init_a_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/init_a_test.sh Thu Dec 29 20:27:54 2016 (r310785) +++ head/tests/sys/geom/class/eli/init_a_test.sh Thu Dec 29 20:28:50 2016 (r310786) @@ -6,55 +6,45 @@ base=`basename $0` sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 +rnd=`mktemp $base.XXXXXX` || exit 1 -echo "1..1380" - -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done - done -done + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +echo "1..600" + +i=1 + +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 +dd if=/dev/random of=${rnd} bs=8192 count=${sectors} >/dev/null 2>&1 + +for_each_geli_config do_test + +rm -f $rnd rm -f $keyfile Added: head/tests/sys/geom/class/eli/init_alias_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/eli/init_alias_test.sh Thu Dec 29 20:28:50 2016 (r310786) @@ -0,0 +1,64 @@ +#!/bin/sh +# $FreeBSD$ + +# Test "geli init"'s various cipher aliases +. $(dirname $0)/conf.sh + +base=`basename $0` +sectors=100 +keyfile=`mktemp $base.XXXXXX` || exit 1 +rnd=`mktemp $base.XXXXXX` || exit 1 + +do_test() { + ealgo=$1 + keylen=$2 + expected_ealgo=$3 + expected_keylen=$4 + + geli init -B none -e $ealgo -l $keylen -P -K $keyfile md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + real_ealgo=`geli list md${no}.eli | awk '/EncryptionAlgorithm/ {print $2}'` + real_keylen=`geli list md${no}.eli | awk '/KeyLength/ {print $2}'` + + if [ ${real_ealgo} = ${expected_ealgo} ]; then + echo "ok $i - ${ealgo} aliased to ${real_ealgo}" + else + echo "not ok $i - expected ${expected_ealgo} but got ${real_ealgo}" + fi + i=$((i+1)) + + if [ ${real_keylen} = ${expected_keylen} ]; then + echo "ok $i - keylen=${keylen} for ealgo=${ealgo} aliases to ${real_keylen}" + else + echo "not ok $i - expected ${expected_keylen} but got ${real_keylen}" + fi + i=$((i+1)) + + geli detach md${no} +} + +echo "1..38" +i=1 +mdconfig -a -t malloc -s 1024k -u $no || exit 1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for spec in aes:0:AES-XTS:128 aes:128:AES-XTS:128 aes:256:AES-XTS:256 \ + 3des:0:3DES-CBC:192 3des:192:3DES-CBC:192 \ + blowfish:0:Blowfish-CBC:128 blowfish:128:Blowfish-CBC:128 \ + blowfish:160:Blowfish-CBC:160 blowfish:192:Blowfish-CBC:192 \ + blowfish:224:Blowfish-CBC:224 blowfish:256:Blowfish-CBC:256 \ + blowfish:288:Blowfish-CBC:288 blowfish:352:Blowfish-CBC:352 \ + blowfish:384:Blowfish-CBC:384 blowfish:416:Blowfish-CBC:416 \ + blowfish:448:Blowfish-CBC:448 \ + camellia:0:CAMELLIA-CBC:128 camellia:128:CAMELLIA-CBC:128 \ + camellia:256:CAMELLIA-CBC:256 ; do + + ealgo=`echo $spec | cut -d : -f 1` + keylen=`echo $spec | cut -d : -f 2` + expected_ealgo=`echo $spec | cut -d : -f 3` + expected_keylen=`echo $spec | cut -d : -f 4` + + do_test $ealgo $keylen $expected_ealgo $expected_keylen +done + +rm -f $keyfile Modified: head/tests/sys/geom/class/eli/init_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/init_test.sh Thu Dec 29 20:27:54 2016 (r310785) +++ head/tests/sys/geom/class/eli/init_test.sh Thu Dec 29 20:28:50 2016 (r310786) @@ -4,62 +4,52 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 +sectors=32 keyfile=`mktemp $base.XXXXXX` || exit 1 +rnd=`mktemp $base.XXXXXX` || exit 1 -echo "1..460" +echo "1..200" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + secsize=$2 ealgo=${cipher%%:*} keylen=${cipher##*:} - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - if [ ${md_rnd} != ${md_edev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done -done + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 + + geli init -B none -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + if [ ${md_rnd} != ${md_edev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 +for_each_geli_config_nointegrity do_test + +rm -f $rnd rm -f $keyfile Modified: head/tests/sys/geom/class/eli/integrity_copy_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/integrity_copy_test.sh Thu Dec 29 20:27:54 2016 (r310785) +++ head/tests/sys/geom/class/eli/integrity_copy_test.sh Thu Dec 29 20:28:50 2016 (r310786) @@ -4,96 +4,85 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 -echo "1..5520" +echo "1..2400" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - #mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 - mdconfig -a -t malloc -s $sectors -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Copy first small sector to the second small sector. - # This should be detected as corruption. - dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=512 count=1 seek=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - ms=`diskinfo /dev/md${no} | awk '{print $3 - 512}'` - ns=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - usecsize=`echo "($ms / $ns) - (($ms / $ns) % 512)" | bc` - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Copy first big sector to the second big sector. - # This should be detected as corruption. - dd if=/dev/md${no} of=${sector} bs=${usecsize} count=1 >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=${usecsize} count=1 seek=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=2 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + + dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 + + dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + # Copy first small sector to the second small sector. + # This should be detected as corruption. + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=512 count=1 seek=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + ms=`diskinfo /dev/md${no} | awk '{print $3 - 512}'` + ns=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + usecsize=`echo "($ms / $ns) - (($ms / $ns) % 512)" | bc` + + # Fix the corruption + dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 + + dd if=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + # Copy first big sector to the second big sector. + # This should be detected as corruption. + dd if=/dev/md${no} of=${sector} bs=${usecsize} count=1 >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=${usecsize} count=1 seek=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=2 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for_each_geli_config do_test rm -f $keyfile $sector Modified: head/tests/sys/geom/class/eli/integrity_data_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/integrity_data_test.sh Thu Dec 29 20:27:54 2016 (r310785) +++ head/tests/sys/geom/class/eli/integrity_data_test.sh Thu Dec 29 20:28:50 2016 (r310786) @@ -4,66 +4,42 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 -echo "1..2760" +echo "1..600" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Corrupt 8 bytes of data. - dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 - dd if=/dev/random of=${sector} bs=1 count=8 seek=64 conv=notrunc >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + + # Corrupt 8 bytes of data. + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 + dd if=/dev/random of=${sector} bs=1 count=8 seek=64 conv=notrunc >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for_each_geli_config do_test rm -f $keyfile $sector Modified: head/tests/sys/geom/class/eli/integrity_hmac_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/integrity_hmac_test.sh Thu Dec 29 20:27:54 2016 (r310785) +++ head/tests/sys/geom/class/eli/integrity_hmac_test.sh Thu Dec 29 20:28:50 2016 (r310786) @@ -4,66 +4,43 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 -echo "1..2760" +echo "1..600" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Corrupt 8 bytes of HMAC. - dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 - dd if=/dev/random of=${sector} bs=1 count=16 conv=notrunc >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 2 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + + # Corrupt 8 bytes of HMAC. + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 + dd if=/dev/random of=${sector} bs=1 count=16 conv=notrunc >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for_each_geli_config do_test rm -f $keyfile $sector Modified: head/tests/sys/geom/class/eli/onetime_a_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/onetime_a_test.sh Thu Dec 29 20:27:54 2016 (r310785) +++ head/tests/sys/geom/class/eli/onetime_a_test.sh Thu Dec 29 20:28:50 2016 (r310786) @@ -4,51 +4,42 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 +sectors=8 +rnd=`mktemp $base.XXXXXX` || exit 1 -echo "1..1380" +echo "1..600" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 - - geli onetime -a $aalgo -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 + geli onetime -a $aalgo -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +i=1 +dd if=/dev/random of=${rnd} bs=1024 count=1024 >/dev/null 2>&1 + +for_each_geli_config do_test + +rm -f $rnd Modified: head/tests/sys/geom/class/eli/onetime_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/onetime_test.sh Thu Dec 29 20:27:54 2016 (r310785) +++ head/tests/sys/geom/class/eli/onetime_test.sh Thu Dec 29 20:28:50 2016 (r310786) @@ -6,54 +6,45 @@ base=`basename $0` sectors=100 -echo "1..460" +echo "1..200" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + secsize=$2 ealgo=${cipher%%:*} keylen=${cipher##*:} - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors`b -u $no || exit 1 - - geli onetime -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - if [ ${md_rnd} != ${md_edev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done -done + + rnd=`mktemp $base.XXXXXX` || exit 1 + mdconfig -a -t malloc -s `expr $secsize \* $sectors`b -u $no || exit 1 + + geli onetime -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + if [ ${md_rnd} != ${md_edev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + rm -f $rnd + mdconfig -d -u $no +} + +i=1 +for_each_geli_config_nointegrity do_test From owner-svn-src-head@freebsd.org Thu Dec 29 21:30:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FED8C96391; Thu, 29 Dec 2016 21:30:53 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F98012FA; Thu, 29 Dec 2016 21:30:53 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTLUq57011630; Thu, 29 Dec 2016 21:30:52 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTLUqus011628; Thu, 29 Dec 2016 21:30:52 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201612292130.uBTLUqus011628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Thu, 29 Dec 2016 21:30:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310789 - head/lib/libpam/static_libpam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 21:30:53 -0000 Author: kan Date: Thu Dec 29 21:30:52 2016 New Revision: 310789 URL: https://svnweb.freebsd.org/changeset/base/310789 Log: Use compiler driver to build relocatable object This works better with external toolchains where LD will not necessarily defailt to emulation we want. Compiler driver knows better. Modified: head/lib/libpam/static_libpam/Makefile Modified: head/lib/libpam/static_libpam/Makefile ============================================================================== --- head/lib/libpam/static_libpam/Makefile Thu Dec 29 21:06:31 2016 (r310788) +++ head/lib/libpam/static_libpam/Makefile Thu Dec 29 21:30:52 2016 (r310789) @@ -64,6 +64,6 @@ CLEANFILES+= openpam_static.o \ openpam_static_modules.o openpam_static_modules.o: openpam_static.o ${STATIC_MODULES} - ${LD} -o ${.TARGET} -r --whole-archive ${.ALLSRC} + ${CC} -nostdlib ${CFLAGS} -o ${.TARGET} -r -Wl,--whole-archive ${.ALLSRC} .include "${.CURDIR}/../libpam/Makefile" From owner-svn-src-head@freebsd.org Thu Dec 29 21:36:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB0D0C966C6; Thu, 29 Dec 2016 21:36:05 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 73F481950; Thu, 29 Dec 2016 21:36:05 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTLa48N014149; Thu, 29 Dec 2016 21:36:04 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTLa4Yq014148; Thu, 29 Dec 2016 21:36:04 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201612292136.uBTLa4Yq014148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Thu, 29 Dec 2016 21:36:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310790 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 21:36:05 -0000 Author: kan Date: Thu Dec 29 21:36:04 2016 New Revision: 310790 URL: https://svnweb.freebsd.org/changeset/base/310790 Log: Use TARGET_ARCH instead of MACHINE_ARCH for MIPS kernel MACHINE_ARCH is overwritten by config file and will not contain -hf suffix, so uname -p reported by kernel will be wrong. Modified: head/sys/conf/kern.pre.mk Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Thu Dec 29 21:30:52 2016 (r310789) +++ head/sys/conf/kern.pre.mk Thu Dec 29 21:36:04 2016 (r310790) @@ -74,7 +74,7 @@ CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KE CFLAGS_PARAM_INLINE_UNIT_GROWTH?=100 CFLAGS_PARAM_LARGE_FUNCTION_GROWTH?=1000 .if ${MACHINE_CPUARCH} == "mips" -CFLAGS_ARCH_PARAMS?=--param max-inline-insns-single=1000 -DMACHINE_ARCH='"${MACHINE_ARCH}"' +CFLAGS_ARCH_PARAMS?=--param max-inline-insns-single=1000 -DMACHINE_ARCH='"${TARGET_ARCH}"' .endif CFLAGS.gcc+= -fno-common -fms-extensions -finline-limit=${INLINE_LIMIT} CFLAGS.gcc+= --param inline-unit-growth=${CFLAGS_PARAM_INLINE_UNIT_GROWTH} From owner-svn-src-head@freebsd.org Thu Dec 29 21:55:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8283FC96E61; Thu, 29 Dec 2016 21:55:24 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 51CA01366; Thu, 29 Dec 2016 21:55:24 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTLtNUF022329; Thu, 29 Dec 2016 21:55:23 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTLtNc5022328; Thu, 29 Dec 2016 21:55:23 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201612292155.uBTLtNc5022328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 29 Dec 2016 21:55:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310791 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 21:55:24 -0000 Author: gonzo Date: Thu Dec 29 21:55:23 2016 New Revision: 310791 URL: https://svnweb.freebsd.org/changeset/base/310791 Log: [qemu] Fix VERSATILEPB kernel boot in QEMU broken by r300968 QEMU does not implement hardware debug registers so when dbg_monitor_is_enabled is called kernel receives "invalid instruction" exception. QEMU implements only DIDR register and on read returns all zeroes to indicate that it doesn't support other registers. Real hardware has Version bits set. MFC after: 1 week Modified: head/sys/arm/arm/debug_monitor.c Modified: head/sys/arm/arm/debug_monitor.c ============================================================================== --- head/sys/arm/arm/debug_monitor.c Thu Dec 29 21:36:04 2016 (r310790) +++ head/sys/arm/arm/debug_monitor.c Thu Dec 29 21:55:23 2016 (r310791) @@ -792,10 +792,21 @@ dbg_get_ossr(void) static __inline boolean_t dbg_arch_supported(void) { + uint32_t dbg_didr; switch (dbg_model) { case ID_DFR0_CP_DEBUG_M_V6: case ID_DFR0_CP_DEBUG_M_V6_1: + dbg_didr = cp14_dbgdidr_get(); + /* + * read-all-zeroes is used by QEMU + * to indicate that ARMv6 debug support + * is not implemented. Real hardware has at + * least version bits set + */ + if (dbg_didr == 0) + return (FALSE); + return (TRUE); case ID_DFR0_CP_DEBUG_M_V7: case ID_DFR0_CP_DEBUG_M_V7_1: /* fall through */ return (TRUE); From owner-svn-src-head@freebsd.org Thu Dec 29 21:57:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89B62C96ED2; Thu, 29 Dec 2016 21:57:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AD011597; Thu, 29 Dec 2016 21:57:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTLvGR3022470; Thu, 29 Dec 2016 21:57:16 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTLvGWJ022468; Thu, 29 Dec 2016 21:57:16 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201612292157.uBTLvGWJ022468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 29 Dec 2016 21:57:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310792 - in head: lib/clang/libllvm usr.bin/clang X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 21:57:17 -0000 Author: dim Date: Thu Dec 29 21:57:16 2016 New Revision: 310792 URL: https://svnweb.freebsd.org/changeset/base/310792 Log: Revert r310775 for now, until we can figure out why it does not seem to work properly when cross-building. Sorry for the breakage. Modified: head/lib/clang/libllvm/Makefile head/usr.bin/clang/Makefile Modified: head/lib/clang/libllvm/Makefile ============================================================================== --- head/lib/clang/libllvm/Makefile Thu Dec 29 21:55:23 2016 (r310791) +++ head/lib/clang/libllvm/Makefile Thu Dec 29 21:57:16 2016 (r310792) @@ -308,24 +308,24 @@ SRCS_MIN+= DebugInfo/CodeView/TypeRecord SRCS_MIN+= DebugInfo/CodeView/TypeRecordBuilder.cpp SRCS_MIN+= DebugInfo/CodeView/TypeStreamMerger.cpp SRCS_MIN+= DebugInfo/CodeView/TypeTableBuilder.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFAcceleratorTable.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFCompileUnit.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFContext.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugAbbrev.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugArangeSet.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugAranges.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugFrame.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugInfoEntry.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugLine.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugLoc.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugMacro.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugRangeList.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFFormValue.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFTypeUnit.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFUnit.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFUnitIndex.cpp -SRCS_MIW+= DebugInfo/DWARF/SyntaxHighlighting.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFAcceleratorTable.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFCompileUnit.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFContext.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFDebugAbbrev.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFDebugArangeSet.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFDebugAranges.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFDebugFrame.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFDebugInfoEntry.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFDebugLine.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFDebugLoc.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFDebugMacro.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFDebugRangeList.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFFormValue.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFTypeUnit.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFUnit.cpp +SRCS_EXT+= DebugInfo/DWARF/DWARFUnitIndex.cpp +SRCS_EXT+= DebugInfo/DWARF/SyntaxHighlighting.cpp SRCS_EXT+= DebugInfo/PDB/GenericError.cpp SRCS_EXT+= DebugInfo/PDB/PDB.cpp SRCS_EXT+= DebugInfo/PDB/PDBContext.cpp @@ -699,7 +699,7 @@ SRCS_MIN+= Target/AArch64/AArch64TargetO SRCS_MIN+= Target/AArch64/AArch64TargetTransformInfo.cpp SRCS_MIN+= Target/AArch64/AsmParser/AArch64AsmParser.cpp SRCS_XDB+= Target/AArch64/Disassembler/AArch64Disassembler.cpp -SRCS_XDW+= Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp +SRCS_XDB+= Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp SRCS_MIN+= Target/AArch64/InstPrinter/AArch64InstPrinter.cpp SRCS_MIN+= Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp SRCS_MIN+= Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp @@ -880,7 +880,7 @@ SRCS_MIN+= Target/TargetSubtargetInfo.cp SRCS_MIN+= Target/X86/AsmParser/X86AsmInstrumentation.cpp SRCS_MIN+= Target/X86/AsmParser/X86AsmParser.cpp SRCS_XDB+= Target/X86/Disassembler/X86Disassembler.cpp -SRCS_XDW+= Target/X86/Disassembler/X86DisassemblerDecoder.cpp +SRCS_XDB+= Target/X86/Disassembler/X86DisassemblerDecoder.cpp SRCS_MIN+= Target/X86/InstPrinter/X86ATTInstPrinter.cpp SRCS_MIN+= Target/X86/InstPrinter/X86InstComments.cpp SRCS_MIN+= Target/X86/InstPrinter/X86IntelInstPrinter.cpp @@ -1090,9 +1090,6 @@ SRCS_MIN+= Transforms/Vectorize/SLPVecto SRCS_EXT+= Transforms/Vectorize/Vectorize.cpp SRCS_ALL+= ${SRCS_MIN} -.if !defined(TOOLS_PREFIX) -SRCS_ALL+= ${SRCS_MIW} -.endif .if ${MK_CLANG_EXTRAS} != "no" SRCS_ALL+= ${SRCS_EXT} .endif @@ -1108,9 +1105,6 @@ SRCS_ALL+= ${SRCS_XDB} .if ${MK_CLANG_EXTRAS} != "no" || ${MK_LLDB} != "no" || ${MK_LLD} != "no" SRCS_ALL+= ${SRCS_XDL} .endif -.if ${MK_CLANG_EXTRAS} != "no" || ${MK_LLDB} != "no" || !defined(TOOLS_PREFIX) -SRCS_ALL+= ${SRCS_XDW} -.endif SRCS+= ${SRCS_ALL:O} llvm/IR/Attributes.inc: ${LLVM_SRCS}/include/llvm/IR/Attributes.td Modified: head/usr.bin/clang/Makefile ============================================================================== --- head/usr.bin/clang/Makefile Thu Dec 29 21:55:23 2016 (r310791) +++ head/usr.bin/clang/Makefile Thu Dec 29 21:57:16 2016 (r310792) @@ -7,8 +7,6 @@ SUBDIR+= clang-tblgen SUBDIR+= llvm-tblgen .if !defined(TOOLS_PREFIX) -SUBDIR+= llvm-objdump - .if ${MK_CLANG_EXTRAS} != "no" SUBDIR+= bugpoint SUBDIR+= clang-format @@ -27,6 +25,7 @@ SUBDIR+= llvm-link SUBDIR+= llvm-lto SUBDIR+= llvm-mc SUBDIR+= llvm-nm +SUBDIR+= llvm-objdump SUBDIR+= llvm-pdbdump SUBDIR+= llvm-profdata SUBDIR+= llvm-rtdyld From owner-svn-src-head@freebsd.org Thu Dec 29 21:57:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DB43C96F43 for ; Thu, 29 Dec 2016 21:57:51 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x242.google.com (mail-it0-x242.google.com [IPv6:2607:f8b0:4001:c0b::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EB60D1708 for ; Thu, 29 Dec 2016 21:57:50 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x242.google.com with SMTP id 75so39948407ite.1 for ; Thu, 29 Dec 2016 13:57:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=zJXTIwJ/gwvLhnjsZPWR0uDdMXpUIu+q/Aat+5Sk0rM=; b=kaMn4wAMwzjNy1wyEwDAPvVepmhbMcpYgSv75ikTg4DlDtY78L8stImmcWz6MXK3rh J6ckMmql0u0Zf9Fgzj04zIFlfmM3gObltmeunv4YaRFRTWfSI3SHRY4YJtX2p6g1LmJ1 TlMdji41WQDUgT6s/J9mXjRZOTyVdt8j5BsaRBymn3S+0MP+70BNxGP9JsZ3891Fu/8X 2PFqG1nhnEZ0CzftDtkQNVHPwEhnrbX0j6vZSnaOc88SJBWrY+2WrR7EfSWvft9/Ydhk 7jMuJnl2Ii6DY27cnS71UDjDdeO1ai56sX7UI9tLWMYv35wALTyrjlQsh/eSnIPGKqD4 OjqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=zJXTIwJ/gwvLhnjsZPWR0uDdMXpUIu+q/Aat+5Sk0rM=; b=cUkx+JSX7T4WwIJdL1mZPE7+NXLgcT+qzijtpiGWD2D/dmzJKSbDAw8erPj5OLxWOn do8h0GSvEcx/GSzoS+/EGklhCEx1CrOuUbSa5PJOJK0vr/v/6Cg5tf+fR/dylhn1TcHw 2tr6JmO9akM8zPovOf+rUsF6mpsAkAVZlYwT3QUOCb0tYCjLgVyDOGWIokenVKAGSf/K RC7BwWqHJT4/foRqbFJf0vCNWP8f57v0YYiN0q5z6GmmaIcNCiWFKM8zzMlonHHaaYxd alWawUiDfBh8R+7YUAc6AdmJDXEz33gApsXwtJzxJXQC97D07JrhXqPwMBNxm16crymN ipFw== X-Gm-Message-State: AIkVDXLFBSga5CYjz5gkWUxPlTJzyZQChBP9GTKHpMi8vI8FQrdaIEYuOu0CtjLQN8Zh7xX7N+wS57HeQ0bhbw== X-Received: by 10.36.73.134 with SMTP id e6mr4522124itd.60.1483048670288; Thu, 29 Dec 2016 13:57:50 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.22.135 with HTTP; Thu, 29 Dec 2016 13:57:49 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <201612292136.uBTLa4Yq014148@repo.freebsd.org> References: <201612292136.uBTLa4Yq014148@repo.freebsd.org> From: Warner Losh Date: Thu, 29 Dec 2016 14:57:49 -0700 X-Google-Sender-Auth: WjSGcJUqAz_D-MWRo-Z4Jkr5_eU Message-ID: Subject: Re: svn commit: r310790 - head/sys/conf To: Alexander Kabaev Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 21:57:51 -0000 On Thu, Dec 29, 2016 at 2:36 PM, Alexander Kabaev wrote: > Author: kan > Date: Thu Dec 29 21:36:04 2016 > New Revision: 310790 > URL: https://svnweb.freebsd.org/changeset/base/310790 > > Log: > Use TARGET_ARCH instead of MACHINE_ARCH for MIPS kernel TARGET_ARCH is only defined for cross builds. I'm pretty sure this is wrong. It won't work for native builds. TARGET_ARCH only has meaning in Makefile.inc1. > MACHINE_ARCH is overwritten by config file and will not > contain -hf suffix, so uname -p reported by kernel will > be wrong. Then that must be fixed instead. Warner > Modified: > head/sys/conf/kern.pre.mk > > Modified: head/sys/conf/kern.pre.mk > ============================================================================== > --- head/sys/conf/kern.pre.mk Thu Dec 29 21:30:52 2016 (r310789) > +++ head/sys/conf/kern.pre.mk Thu Dec 29 21:36:04 2016 (r310790) > @@ -74,7 +74,7 @@ CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KE > CFLAGS_PARAM_INLINE_UNIT_GROWTH?=100 > CFLAGS_PARAM_LARGE_FUNCTION_GROWTH?=1000 > .if ${MACHINE_CPUARCH} == "mips" > -CFLAGS_ARCH_PARAMS?=--param max-inline-insns-single=1000 -DMACHINE_ARCH='"${MACHINE_ARCH}"' > +CFLAGS_ARCH_PARAMS?=--param max-inline-insns-single=1000 -DMACHINE_ARCH='"${TARGET_ARCH}"' > .endif > CFLAGS.gcc+= -fno-common -fms-extensions -finline-limit=${INLINE_LIMIT} > CFLAGS.gcc+= --param inline-unit-growth=${CFLAGS_PARAM_INLINE_UNIT_GROWTH} > From owner-svn-src-head@freebsd.org Thu Dec 29 22:36:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4C9FC96EBF; Thu, 29 Dec 2016 22:36:17 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 845541DCA; Thu, 29 Dec 2016 22:36:17 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTMaGwE038799; Thu, 29 Dec 2016 22:36:16 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTMaG5B038798; Thu, 29 Dec 2016 22:36:16 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201612292236.uBTMaG5B038798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Thu, 29 Dec 2016 22:36:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310793 - head/sys/dev/rtwn/rtl8812a X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 22:36:17 -0000 Author: avos Date: Thu Dec 29 22:36:16 2016 New Revision: 310793 URL: https://svnweb.freebsd.org/changeset/base/310793 Log: rtwn: silence compiler warning (-Wmaybe-uninitialized). Reported by: adrian Modified: head/sys/dev/rtwn/rtl8812a/r12a_chan.c Modified: head/sys/dev/rtwn/rtl8812a/r12a_chan.c ============================================================================== --- head/sys/dev/rtwn/rtl8812a/r12a_chan.c Thu Dec 29 21:57:16 2016 (r310792) +++ head/sys/dev/rtwn/rtl8812a/r12a_chan.c Thu Dec 29 22:36:16 2016 (r310793) @@ -332,7 +332,7 @@ r12a_set_band(struct rtwn_softc *sc, str /* XXX PATH_B is set by vendor driver. */ for (i = 0; i < 2; i++) { - uint16_t val; + uint16_t val = 0; switch ((swing >> i * 2) & 0x3) { case 0: From owner-svn-src-head@freebsd.org Fri Dec 30 00:34:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB312C97662; Fri, 30 Dec 2016 00:34:53 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5DA31363; Fri, 30 Dec 2016 00:34:53 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBU0YqwZ088923; Fri, 30 Dec 2016 00:34:52 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBU0YqFA088918; Fri, 30 Dec 2016 00:34:52 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201612300034.uBU0YqFA088918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Fri, 30 Dec 2016 00:34:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310794 - in head/sys: conf mips/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 00:34:54 -0000 Author: kan Date: Fri Dec 30 00:34:52 2016 New Revision: 310794 URL: https://svnweb.freebsd.org/changeset/base/310794 Log: Support mips[*]hf variants in config files Recognize new MACHINE_ARCH names now as we have added hardfloat support. Switch JZ4780 to mipselhf and remove all uses of TARGET_ARCH in kernel .mk files. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D8989 Modified: head/sys/conf/files.mips head/sys/conf/kern.mk head/sys/conf/kern.pre.mk head/sys/conf/options.mips head/sys/mips/conf/JZ4780 Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Thu Dec 29 22:36:16 2016 (r310793) +++ head/sys/conf/files.mips Fri Dec 30 00:34:52 2016 (r310794) @@ -52,7 +52,7 @@ kern/kern_clocksource.c standard kern/link_elf_obj.c standard kern/subr_busdma_bufalloc.c standard kern/subr_dummy_vdso_tc.c standard -kern/subr_sfbuf.c optional mips | mipsel | mipsn32 +kern/subr_sfbuf.c standard # gcc/clang runtime libkern/ffsl.c standard @@ -61,8 +61,8 @@ libkern/fls.c standard libkern/flsl.c standard libkern/flsll.c standard libkern/memmove.c standard -libkern/cmpdi2.c optional mips | mipsel -libkern/ucmpdi2.c optional mips | mipsel +libkern/cmpdi2.c optional mips | mipshf | mipsel | mipselhf +libkern/ucmpdi2.c optional mips | mipshf | mipsel | mipselhf libkern/ashldi3.c standard libkern/ashrdi3.c standard Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Thu Dec 29 22:36:16 2016 (r310793) +++ head/sys/conf/kern.mk Fri Dec 30 00:34:52 2016 (r310794) @@ -184,7 +184,7 @@ CFLAGS.gcc+= -mcall-aixdesc .if ${MACHINE_CPUARCH} == "mips" CFLAGS+= -msoft-float INLINE_LIMIT?= 8000 -.if ${TARGET_ARCH:Mmips*hf} != "" +.if ${MACHINE_ARCH:Mmips*hf} != "" CFLAGS+= -DCPU_HAVEFPU .endif .endif Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Thu Dec 29 22:36:16 2016 (r310793) +++ head/sys/conf/kern.pre.mk Fri Dec 30 00:34:52 2016 (r310794) @@ -74,7 +74,7 @@ CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KE CFLAGS_PARAM_INLINE_UNIT_GROWTH?=100 CFLAGS_PARAM_LARGE_FUNCTION_GROWTH?=1000 .if ${MACHINE_CPUARCH} == "mips" -CFLAGS_ARCH_PARAMS?=--param max-inline-insns-single=1000 -DMACHINE_ARCH='"${TARGET_ARCH}"' +CFLAGS_ARCH_PARAMS?=--param max-inline-insns-single=1000 -DMACHINE_ARCH='"${MACHINE_ARCH}"' .endif CFLAGS.gcc+= -fno-common -fms-extensions -finline-limit=${INLINE_LIMIT} CFLAGS.gcc+= --param inline-unit-growth=${CFLAGS_PARAM_INLINE_UNIT_GROWTH} Modified: head/sys/conf/options.mips ============================================================================== --- head/sys/conf/options.mips Thu Dec 29 22:36:16 2016 (r310793) +++ head/sys/conf/options.mips Fri Dec 30 00:34:52 2016 (r310794) @@ -50,9 +50,13 @@ CPU_MALTA opt_global.h # which MACHINE_ARCH architecture MIPS +MIPSHF MIPSEL +MIPSELHF MIPS64 +MIPS64HF MIPS64EL +MIPS64ELHF MIPSN32 COMPAT_FREEBSD32 opt_compat.h Modified: head/sys/mips/conf/JZ4780 ============================================================================== --- head/sys/mips/conf/JZ4780 Thu Dec 29 22:36:16 2016 (r310793) +++ head/sys/mips/conf/JZ4780 Fri Dec 30 00:34:52 2016 (r310794) @@ -5,7 +5,7 @@ #NO_UNIVERSE ident JZ4780 -machine mips mipsel +machine mips mipselhf cpu CPU_XBURST cpu CPU_MIPS4KC From owner-svn-src-head@freebsd.org Fri Dec 30 00:41:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07128C979E5; Fri, 30 Dec 2016 00:41:15 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from st11p00im-asmtp002.me.com (st11p00im-asmtp002.me.com [17.172.80.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2F4817AD; Fri, 30 Dec 2016 00:41:14 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.st11p00im-asmtp002.me.com by st11p00im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OIZ00A002Q7A400@st11p00im-asmtp002.me.com>; Fri, 30 Dec 2016 00:41:07 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=4d515a; t=1483058467; bh=WIxk6NTYZRSHD46Rc8u5XNlNxT1uiJ0IV241iewp8LY=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=qnwj5cYFgWI5dmoo1o7Az26CUuhO/duLkIHYaNM9eA+hlYSXi1+C+4WIdoQmCCl0F vpkYWh7+BtsZQIU6IDDSUkuFPccQx0fJjcY8WVTZ7Lq518T29tA/bsra01s+5ntSVd ThxZwFMVDVJvUBza/U3S7SJ3sBpImcGLCzsU2Jfhu0YWccTo3FzQI/TMCQmqa2zXim azHy4dkheS7fELULsxursbXOmsndKzrYRCMwZFrsMYdQAb1Jw4Fh+tbvDKUfC1sh5n vVdZ4KHBbMMj9A9F/RscLZU9qt9s1v3dWurzom5hLOfODHZtbUPlm2bhLPUJaXsUwh glymK7+Q+Q0GA== Received: from [10.0.0.7] (c-73-6-177-70.hsd1.tx.comcast.net [73.6.177.70]) by st11p00im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OIZ00AS538H2K00@st11p00im-asmtp002.me.com>; Fri, 30 Dec 2016 00:41:07 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-29_19:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1603290000 definitions=main-1612300010 User-Agent: Microsoft-MacOutlook/f.1d.0.161209 Date: Thu, 29 Dec 2016 18:41:05 -0600 Subject: Re: svn commit: r310782 - head/sys/cam/ctl From: Ravi Pokala Sender: "Pokala, Ravi" To: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: <18B83785-95E0-42B1-B359-72C94C2E5D0D@panasas.com> Thread-topic: svn commit: r310782 - head/sys/cam/ctl References: <201612291808.uBTI84k1029032@repo.freebsd.org> In-reply-to: <201612291808.uBTI84k1029032@repo.freebsd.org> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 00:41:15 -0000 Hi Alexander, Wouldn't it be better to put the cast directly in the definition of CTL_SOFTC()? That puts the cast in a single place, and anything that calls CTL_SOFTC() will expect a (struct ctl_softc *) anyway. Thanks, and happy holidays! -Ravi (rpokala@) -----Original Message----- > From: on behalf of Alexander Motin > Date: 2016-12-29, Thursday at 12:08 > To: , , > Subject: svn commit: r310782 - head/sys/cam/ctl > > Author: mav > Date: Thu Dec 29 18:08:04 2016 > New Revision: 310782 > URL: https://svnweb.freebsd.org/changeset/base/310782 > > Log: > Fix build with enabled debug after r310778. > > MFC after: 2 weeks > > Modified: > head/sys/cam/ctl/ctl.c > > Modified: head/sys/cam/ctl/ctl.c > ============================================================================== > --- head/sys/cam/ctl/ctl.c Thu Dec 29 17:31:38 2016 (r310781) > +++ head/sys/cam/ctl/ctl.c Thu Dec 29 18:08:04 2016 (r310782) > @@ -12519,7 +12519,7 @@ ctl_datamove(union ctl_io *io) > { > void (*fe_datamove)(union ctl_io *io); > > - mtx_assert(&CTL_SOFTC(io)->ctl_lock, MA_NOTOWNED); > + mtx_assert(&((struct ctl_softc *)CTL_SOFTC(io))->ctl_lock, MA_NOTOWNED); > > CTL_DEBUG_PRINT(("ctl_datamove\n")); > > @@ -13012,7 +13012,7 @@ static void > ctl_datamove_remote(union ctl_io *io) > { > > - mtx_assert(&CTL_SOFTC(io)->ctl_lock, MA_NOTOWNED); > + mtx_assert(&((struct ctl_softc *)CTL_SOFTC(io))->ctl_lock, MA_NOTOWNED); > > if (io->io_hdr.flags & CTL_FLAG_FAILOVER) { > ctl_failover_io(io, /*have_lock*/ 0); From owner-svn-src-head@freebsd.org Fri Dec 30 02:00:43 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D1F5C97546; Fri, 30 Dec 2016 02:00:43 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from st11p00im-asmtp003.me.com (st11p00im-asmtp003.me.com [17.172.80.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E96EF15D1; Fri, 30 Dec 2016 02:00:42 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.st11p00im-asmtp003.me.com by st11p00im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OIZ0050041U0Z00@st11p00im-asmtp003.me.com>; Fri, 30 Dec 2016 00:59:26 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=4d515a; t=1483059566; bh=nfna8saqi11VWLLv4lqG21xac7TWPsR5WFKEMqhuXF0=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=mqx0/Ln1SQuuqXSSESW7BA/6OTHkqBFuKvSoxBr3E3Z1vILaMhq95Ft15wNoX0SER zDGhBj8KTIixyykbi7NZ5BqXNkj99RkjzV7KypvKIgzRZYJuqKgAD8gYrRERdB0v29 2+joYAko+yNspO+4gnfM8sXd/9nVbWZevnOTEe++xIjvwIQaxuzidz0yPYnsfjdxrX dfRx2uFIvHyghycVuCO6Sh9MyZdt5SJ71+KaesM0C77hu8O2MEcx0NRaBBHuehw+9e Aq9PYtLbR4rVpgIRyR+TqCsKv0GTwCV/HZf54Eqmmn0/bX7KF4vX7faDEYt84L32sw idshNlav3H7tw== Received: from [10.0.0.7] (c-73-6-177-70.hsd1.tx.comcast.net [73.6.177.70]) by st11p00im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OIZ0001542XGK10@st11p00im-asmtp003.me.com>; Fri, 30 Dec 2016 00:59:25 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-29_19:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1603290000 definitions=main-1612300013 User-Agent: Microsoft-MacOutlook/f.1d.0.161209 Date: Thu, 29 Dec 2016 18:59:17 -0600 Subject: Re: svn commit: r310789 - head/lib/libpam/static_libpam From: Ravi Pokala Sender: "Pokala, Ravi" To: Alexander Kabaev , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: <1A7F0D4F-1F4D-4885-B7E9-F764D4FA72BF@panasas.com> Thread-topic: svn commit: r310789 - head/lib/libpam/static_libpam References: <201612292130.uBTLUqus011628@repo.freebsd.org> In-reply-to: <201612292130.uBTLUqus011628@repo.freebsd.org> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 02:00:43 -0000 Hi Alexander, I'm a little confused - the original version had to have had a compile-only step to generate the object first, before running the link-only operation against the object. The new code replaces the link-only operation with a compile+link operation. Shouldn't the pre-existing compile-only operation be removed, since the new compile+link operation supersedes it? Thanks, Ravi (rpokala@) -----Original Message----- > From: on behalf of Alexander Kabaev > Date: 2016-12-29, Thursday at 15:30 > To: , , > Subject: svn commit: r310789 - head/lib/libpam/static_libpam > > Author: kan > Date: Thu Dec 29 21:30:52 2016 > New Revision: 310789 > URL: https://svnweb.freebsd.org/changeset/base/310789 > > Log: > Use compiler driver to build relocatable object > > This works better with external toolchains where LD > will not necessarily defailt to emulation we want. > Compiler driver knows better. > > Modified: > head/lib/libpam/static_libpam/Makefile > > Modified: head/lib/libpam/static_libpam/Makefile > ============================================================================== > --- head/lib/libpam/static_libpam/Makefile Thu Dec 29 21:06:31 2016 (r310788) > +++ head/lib/libpam/static_libpam/Makefile Thu Dec 29 21:30:52 2016 (r310789) > @@ -64,6 +64,6 @@ CLEANFILES+= openpam_static.o \ > openpam_static_modules.o > > openpam_static_modules.o: openpam_static.o ${STATIC_MODULES} > - ${LD} -o ${.TARGET} -r --whole-archive ${.ALLSRC} > + ${CC} -nostdlib ${CFLAGS} -o ${.TARGET} -r -Wl,--whole-archive ${.ALLSRC} > > .include "${.CURDIR}/../libpam/Makefile" From owner-svn-src-head@freebsd.org Fri Dec 30 02:06:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68DCAC977FB; Fri, 30 Dec 2016 02:06:19 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-qk0-x244.google.com (mail-qk0-x244.google.com [IPv6:2607:f8b0:400d:c09::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 20F841BD8; Fri, 30 Dec 2016 02:06:19 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: by mail-qk0-x244.google.com with SMTP id n21so37334300qka.0; Thu, 29 Dec 2016 18:06:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version; bh=kp2PJbhLjq1XmvJogHDxpLTu+ieazEmd6N4OMDJBk4w=; b=T3Sr9Gh0yYi0SceSiHufXKeD+QwHKSWW/ifMDS/S5fMS+rZGXaMYYls9MuW1sZS2lA WZjiumvlZggV1+9cB2cvMARCgbfPoLwSL4p24ZE6zjgknrvoLGGBmXu4ylPeu8bnDiPH 8mXQc5l2vjz5foXQBERvSftKoH+EYATaa+e3yuRP6aRsMj09r8BG2M+YSe9BowMRFdeY sUIjjxcrNctWgxK0O4Q+bo/AVXvdHfZg6DIZQhugnJC+BeDFWJAz3oCd6/NYQ0PQXDSk acfKiiUUYSvaQehoA2g8CAhadsk1V4rzQ+9+BnzSx2jpaUsf9EDIgyfevOzpQZfHwvrX 1KKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version; bh=kp2PJbhLjq1XmvJogHDxpLTu+ieazEmd6N4OMDJBk4w=; b=V5gtTjy/h+DgQjkKkEZ/o3oUJMBmtepPIX1MQS23aej8EB+CoWlEOsve7u3HaAQhTf 1gWfsPg9Z8atqm6GUGJP+W5pytfQX5pd8WEcdZLlgd5NA6coAf10nhKRWosYs+x78+Ke wjr+06lqIGE+4myUp9BDWA3W5igR8a0llb9ey625Kf5AySdgito9SnRrg2pPcV3b+wRO ksjFir3wkb/biRKUpRWbWJ9Sdtnxotx/yx3WO4t94X8rYShYTEmOUunyLAgAgwCJ++Dv UCf8gnZA5HnAef5S9+DcS+X66GJBvT6HptDLFiHaGzq/LMXxhCXjtNmpn4VbVlD48jjj 9ZQA== X-Gm-Message-State: AIkVDXIw+3wlak6zaGlLbhqx/qZ6E80B4S1QuAI8UP19n0XlwUx6z7HCJbACuPMR23LtJg== X-Received: by 10.55.72.141 with SMTP id v135mr38997207qka.50.1483063578365; Thu, 29 Dec 2016 18:06:18 -0800 (PST) Received: from kan ([2601:18f:802:4680:226:18ff:fe00:232e]) by smtp.gmail.com with ESMTPSA id 5sm34336480qts.47.2016.12.29.18.06.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Dec 2016 18:06:17 -0800 (PST) Date: Thu, 29 Dec 2016 21:06:12 -0500 From: Alexander Kabaev To: Ravi Pokala Cc: Alexander Kabaev , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310789 - head/lib/libpam/static_libpam Message-ID: <20161229210612.3696bff0@kan> In-Reply-To: <1A7F0D4F-1F4D-4885-B7E9-F764D4FA72BF@panasas.com> References: <201612292130.uBTLUqus011628@repo.freebsd.org> <1A7F0D4F-1F4D-4885-B7E9-F764D4FA72BF@panasas.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.29; amd64-portbld-freebsd12.0) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/RQnhCKh2Cbfb=ik3eCsZc0c"; protocol="application/pgp-signature" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 02:06:19 -0000 --Sig_/RQnhCKh2Cbfb=ik3eCsZc0c Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Thu, 29 Dec 2016 18:59:17 -0600 Ravi Pokala wrote: > Hi Alexander, >=20 > I'm a little confused - the original version had to have had a > compile-only step to generate the object first, before running the > link-only operation against the object. The new code replaces the > link-only operation with a compile+link operation. Shouldn't the > pre-existing compile-only operation be removed, since the new > compile+link operation supersedes it? >=20 > Thanks, >=20 > Ravi (rpokala@) >=20 Well, clearly it does not replace link-only operation with compile+link as you suggest. It feeds .o file to to the compiler driver which then invokes ld with all the correct parameters for the target object format. --=20 Alexander Kabaev --Sig_/RQnhCKh2Cbfb=ik3eCsZc0c Content-Type: application/pgp-signature Content-Description: Цифровая подпись OpenPGP -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEExffZlZm2QeE8UVaRBxMimZJ5Ln4FAlhlwRRfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEM1 RjdEOTk1OTlCNjQxRTEzQzUxNTY5MTA3MTMyMjk5OTI3OTJFN0UACgkQBxMimZJ5 Ln55tw//VIbU0QL0qAG5vSOAKAAAb0W3BsexhuM4iMYO6qNCsSY+wgjq+dxmgoco kePb2YDc4l/+eTfAx1PeIMNHUHAyhihECJiQ276Dj8OUgog8j8wjzEUdmeJAlk9A hVI8mV/MAY5onkQ2YTsRX/F0L5mPZzqHeks/Sr745fCrn30bBr81E/o8k90yj/vq vqs3CsXFVxPGgcopv5jGSIvtYGj92jC56C49oCfZyq2S4mgCBW0+Kk4uq2jxm39q 68cQUznKtTfPMeODKKgOvf+D/iipu6aaT127r7QfQm7vzJJpPdDAARDpNX7nKcrs EVYEtKGhz0PO0sY7wVCPwmjFAamdOqaHQezaxsBynLrgbfcUEUX7kyjv3tYDY3/5 2J8R20eAYox5TuMGgkWK77xYEyHiODNcAgrwQ77/uFV8vodtgKFbfkdwKVmQnzk+ VDcuLHTTk99e7Jwggcu7XUOvJr7G26Gb0g32j3yp7qlAr2ZGEBJxSMPgrQzd5zXK gG8VHTby5c7/7R9MJw/L/gT0Y3rdt0tOMO5zU46jLm3+6yke+nqG5AQ9fK2Cim4i oVKDL4G4EcfVicMqCgihtORXawt9Zn0G4KXtWrCRBcJr67cNuFMn6eedznL9pr01 SUpnVCPvLy1m/tM9RM3BQFa3zLR3NCjI70RNyhX4ecZcjwzDgBU= =i6OC -----END PGP SIGNATURE----- --Sig_/RQnhCKh2Cbfb=ik3eCsZc0c-- From owner-svn-src-head@freebsd.org Fri Dec 30 02:22:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C696C97D15; Fri, 30 Dec 2016 02:22:39 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C8961553; Fri, 30 Dec 2016 02:22:39 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBU2Mc0l033355; Fri, 30 Dec 2016 02:22:38 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBU2Mcqd033353; Fri, 30 Dec 2016 02:22:38 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201612300222.uBU2Mcqd033353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 30 Dec 2016 02:22:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310803 - head/tests/sys/geom/class/nop X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 02:22:39 -0000 Author: asomers Date: Fri Dec 30 02:22:38 2016 New Revision: 310803 URL: https://svnweb.freebsd.org/changeset/base/310803 Log: ATFify the gnop tests Also, add test cases for the -p, -P, and -s options to gnop create Reviewed by: ngie MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D8892 Added: head/tests/sys/geom/class/nop/nop_test.sh (contents, props changed) Deleted: head/tests/sys/geom/class/nop/1_test.sh head/tests/sys/geom/class/nop/2_test.sh head/tests/sys/geom/class/nop/conf.sh Modified: head/tests/sys/geom/class/nop/Makefile Modified: head/tests/sys/geom/class/nop/Makefile ============================================================================== --- head/tests/sys/geom/class/nop/Makefile Fri Dec 30 02:18:34 2016 (r310802) +++ head/tests/sys/geom/class/nop/Makefile Fri Dec 30 02:22:38 2016 (r310803) @@ -4,13 +4,6 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} -TAP_TESTS_SH+= 1_test -TAP_TESTS_SH+= 2_test - -${PACKAGE}FILES+= conf.sh - -.for t in ${TAP_TESTS_SH} -TEST_METADATA.$t+= required_user="root" -.endfor +ATF_TESTS_SH+= nop_test .include Added: head/tests/sys/geom/class/nop/nop_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/nop/nop_test.sh Fri Dec 30 02:22:38 2016 (r310803) @@ -0,0 +1,166 @@ +# Copyright (c) 2016 Alan Somers +# All rights reserved. +# +# 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 AUTHOR 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 AUTHOR 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. +# +# $FreeBSD$ + +MD_DEVS="md.devs" +PLAINFILES=plainfiles + +atf_test_case diskinfo cleanup +diskinfo_head() +{ + atf_set "descr" "gnop should preserve diskinfo's basic properties" + atf_set "require.user" "root" + atf_set "timeout" 15 +} +diskinfo_body() +{ + us=$(alloc_md) + atf_check gnop create /dev/${us} + md_secsize=$(diskinfo ${us} | cut -wf 2) + md_mediasize=$(diskinfo ${us} | cut -wf 3) + md_stripesize=$(diskinfo ${us} | cut -wf 5) + nop_secsize=$(diskinfo ${us}.nop | cut -wf 2) + nop_mediasize=$(diskinfo ${us}.nop | cut -wf 3) + nop_stripesize=$(diskinfo ${us}.nop | cut -wf 5) + atf_check_equal "$md_secsize" "$nop_secsize" + atf_check_equal "$md_mediasize" "$nop_mediasize" + atf_check_equal "$md_stripesize" "$nop_stripesize" +} +diskinfo_cleanup() +{ + common_cleanup +} + +atf_test_case io cleanup +io_head() +{ + atf_set "descr" "I/O works on gnop devices" + atf_set "require.user" "root" + atf_set "timeout" 15 +} +io_body() +{ + us=$(alloc_md) + atf_check gnop create /dev/${us} + + echo src >> $PLAINFILES + echo dst >> $PLAINFILES + dd if=/dev/random of=src bs=1m count=1 >/dev/null 2>&1 + dd if=src of=/dev/${us}.nop bs=1m count=1 > /dev/null 2>&1 + dd if=/dev/${us}.nop of=dst bs=1m count=1 > /dev/null 2>&1 + + atf_check_equal `md5 -q src` `md5 -q dst` +} +io_cleanup() +{ + common_cleanup +} + +atf_test_case size cleanup +size_head() +{ + atf_set "descr" "Test gnop's -s option" + atf_set "require.user" "root" + atf_set "timeout" 15 +} +size_body() +{ + us=$(alloc_md) + for mediasize in 65536 524288 1048576; do + atf_check gnop create -s ${mediasize} /dev/${us} + gnop_mediasize=`diskinfo /dev/${us}.nop | cut -wf 3` + atf_check_equal "${mediasize}" "${gnop_mediasize}" + atf_check gnop destroy /dev/${us}.nop + done + # We shouldn't be able to extend the provider's size + atf_check -s not-exit:0 -e ignore gnop create -s 2097152 /dev/${us} +} +size_cleanup() +{ + common_cleanup +} + +atf_test_case stripesize cleanup +stripesize_head() +{ + atf_set "descr" "Test gnop's -p and -P options" + atf_set "require.user" "root" + atf_set "timeout" 15 +} +stripesize_body() +{ + us=$(alloc_md) + for ss in 512 1024 2048 4096 8192; do + for sofs in `seq 0 512 ${ss}`; do + [ "$sofs" -eq "$ss" ] && continue + atf_check gnop create -p ${ss} -P ${sofs} /dev/${us} + gnop_ss=`diskinfo /dev/${us}.nop | cut -wf 5` + gnop_sofs=`diskinfo /dev/${us}.nop | cut -wf 6` + atf_check_equal "${ss}" "${gnop_ss}" + atf_check_equal "${sofs}" "${gnop_sofs}" + atf_check gnop destroy /dev/${us}.nop + done + done +} +stripesize_cleanup() +{ + common_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case io + atf_add_test_case diskinfo + atf_add_test_case stripesize + atf_add_test_case size +} + +alloc_md() +{ + local md + + md=$(mdconfig -a -t swap -s 1M) || atf_fail "mdconfig -a failed" + echo ${md} >> $MD_DEVS + echo ${md} +} + +common_cleanup() +{ + if [ -f "$MD_DEVS" ]; then + while read test_md; do + gnop destroy -f ${test_md}.nop 2>/dev/null + mdconfig -d -u $test_md 2>/dev/null + done < $MD_DEVS + rm $MD_DEVS + fi + + if [ -f "$PLAINFILES" ]; then + while read f; do + rm -f ${f} + done < ${PLAINFILES} + rm ${PLAINFILES} + fi + true +} From owner-svn-src-head@freebsd.org Fri Dec 30 03:08:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA80EC967A8; Fri, 30 Dec 2016 03:08:47 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B5C31723; Fri, 30 Dec 2016 03:08:47 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBU38kc5049967; Fri, 30 Dec 2016 03:08:46 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBU38kNu049966; Fri, 30 Dec 2016 03:08:46 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201612300308.uBU38kNu049966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Fri, 30 Dec 2016 03:08:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310804 - head/sys/dev/rtwn/rtl8812a X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 03:08:47 -0000 Author: kevlo Date: Fri Dec 30 03:08:46 2016 New Revision: 310804 URL: https://svnweb.freebsd.org/changeset/base/310804 Log: - Fix incorrect values in the computation of OFDM and MCS Tx power. - Make power a uint8_t rather than a uint16_t. - Replace the hardcoded RF chains. Reviewed by: avos Modified: head/sys/dev/rtwn/rtl8812a/r12a_chan.c Modified: head/sys/dev/rtwn/rtl8812a/r12a_chan.c ============================================================================== --- head/sys/dev/rtwn/rtl8812a/r12a_chan.c Fri Dec 30 02:22:38 2016 (r310803) +++ head/sys/dev/rtwn/rtl8812a/r12a_chan.c Fri Dec 30 03:08:46 2016 (r310804) @@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$"); static void r12a_write_txpower(struct rtwn_softc *sc, int chain, - struct ieee80211_channel *c, uint16_t power[RTWN_RIDX_COUNT]) + struct ieee80211_channel *c, uint8_t power[RTWN_RIDX_COUNT]) { if (IEEE80211_IS_CHAN_2GHZ(c)) { @@ -163,7 +163,7 @@ r12a_get_power_group(struct rtwn_softc * static void r12a_get_txpower(struct rtwn_softc *sc, int chain, - struct ieee80211_channel *c, uint16_t power[RTWN_RIDX_COUNT]) + struct ieee80211_channel *c, uint8_t power[RTWN_RIDX_COUNT]) { struct r12a_softc *rs = sc->sc_priv; int i, ridx, group, max_mcs; @@ -187,11 +187,8 @@ r12a_get_txpower(struct rtwn_softc *sc, for (ridx = RTWN_RIDX_OFDM6; ridx <= max_mcs; ridx++) power[ridx] = rs->ht40_tx_pwr_2g[chain][group]; - if (RTWN_RATE_IS_OFDM(ridx)) { - uint8_t pwr_diff = rs->ofdm_tx_pwr_diff_2g[chain][0]; - for (ridx = RTWN_RIDX_CCK1; ridx <= max_mcs; ridx++) - power[ridx] += pwr_diff; - } + for (ridx = RTWN_RIDX_OFDM6; ridx <= RTWN_RIDX_OFDM54; ridx++) + power[ridx] += rs->ofdm_tx_pwr_diff_2g[chain][0]; for (i = 0; i < sc->ntxchains; i++) { uint8_t min_mcs; @@ -208,7 +205,7 @@ r12a_get_txpower(struct rtwn_softc *sc, else pwr_diff = rs->bw20_tx_pwr_diff_2g[chain][i]; - min_mcs = RTWN_RIDX_MCS(i * 8 + 7); + min_mcs = RTWN_RIDX_MCS(i * 8); for (ridx = min_mcs; ridx <= max_mcs; ridx++) power[ridx] += pwr_diff; } @@ -216,6 +213,9 @@ r12a_get_txpower(struct rtwn_softc *sc, for (ridx = RTWN_RIDX_OFDM6; ridx <= max_mcs; ridx++) power[ridx] = rs->ht40_tx_pwr_5g[chain][group]; + for (ridx = RTWN_RIDX_OFDM6; ridx <= RTWN_RIDX_OFDM54; ridx++) + power[ridx] += rs->ofdm_tx_pwr_diff_5g[chain][0]; + for (i = 0; i < sc->ntxchains; i++) { uint8_t min_mcs; uint8_t pwr_diff; @@ -231,7 +231,7 @@ r12a_get_txpower(struct rtwn_softc *sc, else pwr_diff = rs->bw20_tx_pwr_diff_5g[chain][i]; - min_mcs = RTWN_RIDX_MCS(i * 8 + 7); + min_mcs = RTWN_RIDX_MCS(i * 8); for (ridx = min_mcs; ridx <= max_mcs; ridx++) power[ridx] += pwr_diff; } @@ -256,7 +256,7 @@ r12a_get_txpower(struct rtwn_softc *sc, static void r12a_set_txpower(struct rtwn_softc *sc, struct ieee80211_channel *c) { - uint16_t power[RTWN_RIDX_COUNT]; + uint8_t power[RTWN_RIDX_COUNT]; int i; for (i = 0; i < sc->ntxchains; i++) { @@ -463,7 +463,7 @@ r12a_set_chan(struct rtwn_softc *sc, str /* RTL8812AU-specific */ rtwn_r12a_fix_spur(sc, c); - for (i = 0; i < 2; i++) + for (i = 0; i < sc->nrxchains; i++) rtwn_rf_setbits(sc, i, R92C_RF_CHNLBW, 0xc00, val); /* Set Tx power for this new channel. */ From owner-svn-src-head@freebsd.org Fri Dec 30 06:26:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E880C97B29; Fri, 30 Dec 2016 06:26:19 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1447F1F5B; Fri, 30 Dec 2016 06:26:19 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBU6QIV0030142; Fri, 30 Dec 2016 06:26:18 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBU6QIuS030139; Fri, 30 Dec 2016 06:26:18 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201612300626.uBU6QIuS030139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 30 Dec 2016 06:26:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310805 - in head/sys: kern sys vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 06:26:19 -0000 Author: mjg Date: Fri Dec 30 06:26:17 2016 New Revision: 310805 URL: https://svnweb.freebsd.org/changeset/base/310805 Log: Remove cpu_spinwait after seq_consistent. It does not add any benefit as the read routine will do it as necessary. Modified: head/sys/kern/kern_descrip.c head/sys/sys/seq.h head/sys/vm/vm_domain.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Dec 30 03:08:46 2016 (r310804) +++ head/sys/kern/kern_descrip.c Fri Dec 30 06:26:17 2016 (r310805) @@ -2556,10 +2556,8 @@ fget_unlocked(struct filedesc *fdp, int fde = &fdt->fdt_ofiles[fd]; haverights = *cap_rights_fde(fde); fp = fde->fde_file; - if (!seq_consistent(fd_seq(fdt, fd), seq)) { - cpu_spinwait(); + if (!seq_consistent(fd_seq(fdt, fd), seq)) continue; - } #else fp = fdt->fdt_ofiles[fd].fde_file; #endif Modified: head/sys/sys/seq.h ============================================================================== --- head/sys/sys/seq.h Fri Dec 30 03:08:46 2016 (r310804) +++ head/sys/sys/seq.h Fri Dec 30 06:26:17 2016 (r310805) @@ -59,7 +59,6 @@ typedef uint32_t seq_t; * lobj = gobj; * if (seq_consistent(&gobj->seq, seq)) * break; - * cpu_spinwait(); * } * foo(lobj); */ Modified: head/sys/vm/vm_domain.c ============================================================================== --- head/sys/vm/vm_domain.c Fri Dec 30 03:08:46 2016 (r310804) +++ head/sys/vm/vm_domain.c Fri Dec 30 06:26:17 2016 (r310805) @@ -140,7 +140,6 @@ vm_domain_policy_localcopy(struct vm_dom *dst = *src; if (seq_consistent(&src->seq, seq)) return; - cpu_spinwait(); } } @@ -168,7 +167,6 @@ vm_domain_policy_copy(struct vm_domain_p seq_write_end(&dst->seq); return; } - cpu_spinwait(); } } @@ -330,7 +328,6 @@ vm_domain_iterator_set_policy(struct vm_ _vm_domain_iterator_set_policy(vi, &vt_lcl); return; } - cpu_spinwait(); } } From owner-svn-src-head@freebsd.org Fri Dec 30 08:37:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15CE6C97828; Fri, 30 Dec 2016 08:37:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E4913122B; Fri, 30 Dec 2016 08:37:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBU8bVec082815; Fri, 30 Dec 2016 08:37:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBU8bV6t082814; Fri, 30 Dec 2016 08:37:31 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612300837.uBU8bV6t082814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 30 Dec 2016 08:37:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310806 - head/sys/dev/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 08:37:32 -0000 Author: hselasky Date: Fri Dec 30 08:37:30 2016 New Revision: 310806 URL: https://svnweb.freebsd.org/changeset/base/310806 Log: Add MSIX rewrite table quirk for use with VMs. This patch solves IRQ generation problems using the mlx5en(4) driver with xenserver v6.5.0 in SRIOV and PCI-passthrough modes. Until further the hw.pci.msix_rewrite_table quirk must be set manually in /boot/loader.conf . Reviewed by: jhb @ Sponsored by: Mellanox Technologies MFC after: 2 weeks Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Fri Dec 30 06:26:17 2016 (r310805) +++ head/sys/dev/pci/pci.c Fri Dec 30 08:37:30 2016 (r310806) @@ -356,6 +356,11 @@ static int pci_do_msix = 1; SYSCTL_INT(_hw_pci, OID_AUTO, enable_msix, CTLFLAG_RWTUN, &pci_do_msix, 1, "Enable support for MSI-X interrupts"); +static int pci_msix_rewrite_table = 0; +SYSCTL_INT(_hw_pci, OID_AUTO, msix_rewrite_table, CTLFLAG_RWTUN, + &pci_msix_rewrite_table, 0, + "Rewrite entire MSI-X table when updating MSI-X entries"); + static int pci_honor_msi_blacklist = 1; SYSCTL_INT(_hw_pci, OID_AUTO, honor_msi_blacklist, CTLFLAG_RDTUN, &pci_honor_msi_blacklist, 1, "Honor chipset blacklist for MSI/MSI-X"); @@ -1482,11 +1487,10 @@ pci_find_extcap_method(device_t dev, dev /* * Support for MSI-X message interrupts. */ -void -pci_enable_msix_method(device_t dev, device_t child, u_int index, - uint64_t address, uint32_t data) +static void +pci_write_msix_entry(device_t dev, u_int index, uint64_t address, uint32_t data) { - struct pci_devinfo *dinfo = device_get_ivars(child); + struct pci_devinfo *dinfo = device_get_ivars(dev); struct pcicfg_msix *msix = &dinfo->cfg.msix; uint32_t offset; @@ -1495,6 +1499,31 @@ pci_enable_msix_method(device_t dev, dev bus_write_4(msix->msix_table_res, offset, address & 0xffffffff); bus_write_4(msix->msix_table_res, offset + 4, address >> 32); bus_write_4(msix->msix_table_res, offset + 8, data); +} + +void +pci_enable_msix_method(device_t dev, device_t child, u_int index, + uint64_t address, uint32_t data) +{ + + if (pci_msix_rewrite_table) { + struct pci_devinfo *dinfo = device_get_ivars(child); + struct pcicfg_msix *msix = &dinfo->cfg.msix; + + /* + * Some VM hosts require MSIX to be disabled in the + * control register before updating the MSIX table + * entries are allowed. It is not enough to only + * disable MSIX while updating a single entry. MSIX + * must be disabled while updating all entries in the + * table. + */ + pci_write_config(child, + msix->msix_location + PCIR_MSIX_CTRL, + msix->msix_ctrl & ~PCIM_MSIXCTRL_MSIX_ENABLE, 2); + pci_resume_msix(child); + } else + pci_write_msix_entry(child, index, address, data); /* Enable MSI -> HT mapping. */ pci_ht_map_msi(child, address); @@ -1570,7 +1599,8 @@ pci_resume_msix(device_t dev) if (mte->mte_vector == 0 || mte->mte_handlers == 0) continue; mv = &msix->msix_vectors[mte->mte_vector - 1]; - pci_enable_msix(dev, i, mv->mv_address, mv->mv_data); + pci_write_msix_entry(dev, i, mv->mv_address, + mv->mv_data); pci_unmask_msix(dev, i); } } @@ -4401,12 +4431,20 @@ pci_setup_intr(device_t dev, device_t ch mv->mv_address = addr; mv->mv_data = data; } - if (mte->mte_handlers == 0) { + + /* + * The MSIX table entry must be made valid by + * incrementing the mte_handlers before + * calling pci_enable_msix() and + * pci_resume_msix(). Else the MSIX rewrite + * table quirk will not work as expected. + */ + mte->mte_handlers++; + if (mte->mte_handlers == 1) { pci_enable_msix(child, rid - 1, mv->mv_address, mv->mv_data); pci_unmask_msix(child, rid - 1); } - mte->mte_handlers++; } /* From owner-svn-src-head@freebsd.org Fri Dec 30 08:59:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9ADABC97D7E; Fri, 30 Dec 2016 08:59:51 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C1F81B4E; Fri, 30 Dec 2016 08:59:51 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBU8xoB0091084; Fri, 30 Dec 2016 08:59:50 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBU8xoBd091077; Fri, 30 Dec 2016 08:59:50 GMT (envelope-from np@FreeBSD.org) Message-Id: <201612300859.uBU8xoBd091077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 30 Dec 2016 08:59:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310807 - in head: share/man/man4 sys/dev/cxgbe sys/dev/cxgbe/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 08:59:51 -0000 Author: np Date: Fri Dec 30 08:59:49 2016 New Revision: 310807 URL: https://svnweb.freebsd.org/changeset/base/310807 Log: cxgbe(4): Updates to link configuration. - Update struct link_settings and associated shared code. - Add tunables to control FEC and autonegotiation. All ports inherit these values as their initial settings. hw.cxgbe.fec hw.cxgbe.autoneg - Add per-port sysctls to control FEC and autonegotiation. These can be modified at any time. dev...fec dev...autoneg MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/share/man/man4/cxgbe.4 head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_vf.c Modified: head/share/man/man4/cxgbe.4 ============================================================================== --- head/share/man/man4/cxgbe.4 Fri Dec 30 08:37:30 2016 (r310806) +++ head/share/man/man4/cxgbe.4 Fri Dec 30 08:59:49 2016 (r310807) @@ -289,6 +289,24 @@ The default is 3 (both rx_pause and tx_p This tunable establishes the default PAUSE settings for all ports. Settings can be displayed and controlled on a per-port basis via the dev..X.pause_settings sysctl. +.It Va hw.cxgbe.fec +FEC (Forward Error Correction) settings. +0 diables FEC. +Bit 0 enables RS FEC, bit 1 enables BASE-R RS, bit 3 is reserved. +The default is -1 which lets the driver pick a value. +This tunable establishes the default FEC settings for all ports. +Settings can be displayed and controlled on a per-port basis via the +dev..X.fec sysctl. +.It Va hw.cxgbe.autoneg +Link autonegotiation settings. +This tunable establishes the default autonegotiation settings for all ports. +Settings can be displayed and controlled on a per-port basis via the +dev..X.autoneg sysctl. +0 disables autonegotiation. +1 enables autonegotiation. +The default is -1 which lets the driver pick a value. +dev..X.autoneg is -1 for port and module combinations that do not support +autonegotiation. .It Va hw.cxgbe.buffer_packing Allow the hardware to deliver multiple frames in the same receive buffer opportunistically. Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Fri Dec 30 08:37:30 2016 (r310806) +++ head/sys/dev/cxgbe/adapter.h Fri Dec 30 08:59:49 2016 (r310807) @@ -265,7 +265,6 @@ struct port_info { uint8_t tx_chan; uint8_t rx_chan_map; /* rx MPS channel bitmap */ - int linkdnrc; struct link_config link_cfg; struct timeval last_refreshed; @@ -1098,7 +1097,7 @@ int t4_os_find_pci_capability(struct ada int t4_os_pci_save_state(struct adapter *); int t4_os_pci_restore_state(struct adapter *); void t4_os_portmod_changed(const struct adapter *, int); -void t4_os_link_changed(struct adapter *, int, int, int); +void t4_os_link_changed(struct adapter *, int, int); void t4_iterate(void (*)(struct adapter *, void *), void *); void t4_init_devnames(struct adapter *); void t4_add_adapter(struct adapter *); Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Fri Dec 30 08:37:30 2016 (r310806) +++ head/sys/dev/cxgbe/common/common.h Fri Dec 30 08:59:49 2016 (r310807) @@ -62,6 +62,12 @@ enum { PAUSE_AUTONEG = 1 << 2 }; +enum { + FEC_RS = 1 << 0, + FEC_BASER_RS = 1 << 1, + FEC_RESERVED = 1 << 2, +}; + struct port_stats { u64 tx_octets; /* total # of octets in good frames */ u64 tx_frames; /* all good frames */ @@ -392,12 +398,16 @@ struct trace_params { struct link_config { unsigned short supported; /* link capabilities */ unsigned short advertising; /* advertised capabilities */ - unsigned int requested_speed; /* speed user has requested */ - unsigned int speed; /* actual link speed */ + unsigned short lp_advertising; /* peer advertised capabilities */ + unsigned int requested_speed; /* speed user has requested */ + unsigned int speed; /* actual link speed */ unsigned char requested_fc; /* flow control user has requested */ unsigned char fc; /* actual link flow control */ + unsigned char requested_fec; /* FEC user has requested */ + unsigned char fec; /* actual FEC */ unsigned char autoneg; /* autonegotiating? */ unsigned char link_ok; /* link up? */ + unsigned char link_down_rc; /* link down reason */ }; #include "adapter.h" Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Fri Dec 30 08:37:30 2016 (r310806) +++ head/sys/dev/cxgbe/common/t4_hw.c Fri Dec 30 08:59:49 2016 (r310807) @@ -3683,9 +3683,7 @@ void t4_ulprx_read_la(struct adapter *ad } } -#define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ - FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_25G | \ - FW_PORT_CAP_SPEED_40G | FW_PORT_CAP_SPEED_100G | \ +#define ADVERT_MASK (V_FW_PORT_CAP_SPEED(M_FW_PORT_CAP_SPEED) | \ FW_PORT_CAP_ANEG) /** @@ -3705,14 +3703,23 @@ int t4_link_l1cfg(struct adapter *adap, struct link_config *lc) { struct fw_port_cmd c; - unsigned int fc = 0, mdi = V_FW_PORT_CAP_MDI(FW_PORT_CAP_MDI_AUTO); + unsigned int mdi = V_FW_PORT_CAP_MDI(FW_PORT_CAP_MDI_AUTO); + unsigned int fc, fec; - lc->link_ok = 0; + fc = 0; if (lc->requested_fc & PAUSE_RX) fc |= FW_PORT_CAP_FC_RX; if (lc->requested_fc & PAUSE_TX) fc |= FW_PORT_CAP_FC_TX; + fec = 0; + if (lc->requested_fec & FEC_RS) + fec |= FW_PORT_CAP_FEC_RS; + if (lc->requested_fec & FEC_BASER_RS) + fec |= FW_PORT_CAP_FEC_BASER_RS; + if (lc->requested_fec & FEC_RESERVED) + fec |= FW_PORT_CAP_FEC_RESERVED; + memset(&c, 0, sizeof(c)); c.op_to_portid = cpu_to_be32(V_FW_CMD_OP(FW_PORT_CMD) | F_FW_CMD_REQUEST | F_FW_CMD_EXEC | @@ -3723,13 +3730,16 @@ int t4_link_l1cfg(struct adapter *adap, if (!(lc->supported & FW_PORT_CAP_ANEG)) { c.u.l1cfg.rcap = cpu_to_be32((lc->supported & ADVERT_MASK) | - fc); - lc->fc = lc->requested_fc & (PAUSE_RX | PAUSE_TX); + fc | fec); + lc->fc = lc->requested_fc & ~PAUSE_AUTONEG; + lc->fec = lc->requested_fec; } else if (lc->autoneg == AUTONEG_DISABLE) { - c.u.l1cfg.rcap = cpu_to_be32(lc->requested_speed | fc | mdi); - lc->fc = lc->requested_fc & (PAUSE_RX | PAUSE_TX); + c.u.l1cfg.rcap = cpu_to_be32(lc->requested_speed | + fc | fec | mdi); + lc->fc = lc->requested_fc & ~PAUSE_AUTONEG; + lc->fec = lc->requested_fec; } else - c.u.l1cfg.rcap = cpu_to_be32(lc->advertising | fc | mdi); + c.u.l1cfg.rcap = cpu_to_be32(lc->advertising | fc | fec | mdi); return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); } @@ -7517,18 +7527,14 @@ int t4_handle_fw_rpl(struct adapter *ada } if (link_ok != lc->link_ok || speed != lc->speed || fc != lc->fc) { /* something changed */ - int reason; - if (!link_ok && lc->link_ok) - reason = G_FW_PORT_CMD_LINKDNRC(stat); - else - reason = -1; - + lc->link_down_rc = G_FW_PORT_CMD_LINKDNRC(stat); lc->link_ok = link_ok; lc->speed = speed; lc->fc = fc; lc->supported = be16_to_cpu(p->u.info.pcap); - t4_os_link_changed(adap, i, link_ok, reason); + lc->lp_advertising = be16_to_cpu(p->u.info.lpacap); + t4_os_link_changed(adap, i, link_ok); } } else { CH_WARN_RATELIMIT(adap, "Unknown firmware reply %d\n", opcode); @@ -7562,17 +7568,34 @@ static void get_pci_mode(struct adapter /** * init_link_config - initialize a link's SW state * @lc: structure holding the link state - * @caps: link capabilities + * @pcaps: supported link capabilities + * @acaps: advertised link capabilities * * Initializes the SW state maintained for each link, including the link's * capabilities and default speed/flow-control/autonegotiation settings. */ -static void init_link_config(struct link_config *lc, unsigned int caps) +static void init_link_config(struct link_config *lc, unsigned int pcaps, + unsigned int acaps) { - lc->supported = caps; + unsigned int fec; + + lc->supported = pcaps; + lc->lp_advertising = 0; lc->requested_speed = 0; lc->speed = 0; lc->requested_fc = lc->fc = PAUSE_RX | PAUSE_TX; + lc->link_ok = 0; + lc->link_down_rc = 255; + + fec = 0; + if (acaps & FW_PORT_CAP_FEC_RS) + fec |= FEC_RS; + if (acaps & FW_PORT_CAP_FEC_BASER_RS) + fec |= FEC_BASER_RS; + if (acaps & FW_PORT_CAP_FEC_RESERVED) + fec |= FEC_RESERVED; + lc->requested_fec = lc->fec = fec; + if (lc->supported & FW_PORT_CAP_ANEG) { lc->advertising = lc->supported & ADVERT_MASK; lc->autoneg = AUTONEG_ENABLE; @@ -8126,7 +8149,8 @@ int t4_port_init(struct adapter *adap, i p->port_type = G_FW_PORT_CMD_PTYPE(ret); p->mod_type = G_FW_PORT_CMD_MODTYPE(ret); - init_link_config(&p->link_cfg, be16_to_cpu(c.u.info.pcap)); + init_link_config(&p->link_cfg, be16_to_cpu(c.u.info.pcap), + be16_to_cpu(c.u.info.acap)); } ret = t4_alloc_vi(adap, mbox, j, pf, vf, 1, addr, &rss_size); Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Dec 30 08:37:30 2016 (r310806) +++ head/sys/dev/cxgbe/t4_main.c Fri Dec 30 08:59:49 2016 (r310807) @@ -359,6 +359,24 @@ static int t4_pause_settings = PAUSE_TX TUNABLE_INT("hw.cxgbe.pause_settings", &t4_pause_settings); /* + * Forward Error Correction settings (bit 0, 1, 2 = FEC_RS, FEC_BASER_RS, + * FEC_RESERVED respectively). + * -1 to run with the firmware default. + * 0 to disable FEC. + */ +static int t4_fec = -1; +TUNABLE_INT("hw.cxgbe.fec", &t4_fec); + +/* + * Link autonegotiation. + * -1 to run with the firmware default. + * 0 to disable. + * 1 to enable. + */ +static int t4_autoneg = -1; +TUNABLE_INT("hw.cxgbe.autoneg", &t4_autoneg); + +/* * Firmware auto-install by driver during attach (0, 1, 2 = prohibited, allowed, * encouraged respectively). */ @@ -493,6 +511,8 @@ static int sysctl_holdoff_pktc_idx(SYSCT static int sysctl_qsize_rxq(SYSCTL_HANDLER_ARGS); static int sysctl_qsize_txq(SYSCTL_HANDLER_ARGS); static int sysctl_pause_settings(SYSCTL_HANDLER_ARGS); +static int sysctl_fec(SYSCTL_HANDLER_ARGS); +static int sysctl_autoneg(SYSCTL_HANDLER_ARGS); static int sysctl_handle_t4_reg64(SYSCTL_HANDLER_ARGS); static int sysctl_temperature(SYSCTL_HANDLER_ARGS); #ifdef SBUF_DRAIN @@ -922,6 +942,7 @@ t4_attach(device_t dev) n10g = n1g = 0; for_each_port(sc, i) { struct port_info *pi; + struct link_config *lc; pi = malloc(sizeof(*pi), M_CXGBE, M_ZERO | M_WAITOK); sc->port[i] = pi; @@ -950,12 +971,19 @@ t4_attach(device_t dev) goto done; } - pi->link_cfg.requested_fc &= ~(PAUSE_TX | PAUSE_RX); - pi->link_cfg.requested_fc |= t4_pause_settings; - pi->link_cfg.fc &= ~(PAUSE_TX | PAUSE_RX); - pi->link_cfg.fc |= t4_pause_settings; + lc = &pi->link_cfg; + lc->requested_fc &= ~(PAUSE_TX | PAUSE_RX); + lc->requested_fc |= t4_pause_settings; + if (t4_fec != -1) { + lc->requested_fec = t4_fec & + G_FW_PORT_CAP_FEC(lc->supported); + } + if (lc->supported & FW_PORT_CAP_ANEG && t4_autoneg != -1) { + lc->autoneg = t4_autoneg ? AUTONEG_ENABLE : + AUTONEG_DISABLE; + } - rc = -t4_link_l1cfg(sc, sc->mbox, pi->tx_chan, &pi->link_cfg); + rc = -t4_link_l1cfg(sc, sc->mbox, pi->tx_chan, lc); if (rc != 0) { device_printf(dev, "port %d l1cfg failed: %d\n", i, rc); free(pi->vi, M_CXGBE); @@ -978,8 +1006,6 @@ t4_attach(device_t dev) n1g++; } - pi->linkdnrc = -1; - pi->dev = device_add_child(dev, sc->names->ifnet_name, -1); if (pi->dev == NULL) { device_printf(dev, @@ -4060,8 +4086,8 @@ cxgbe_uninit_synchronized(struct vi_info pi->link_cfg.link_ok = 0; pi->link_cfg.speed = 0; - pi->linkdnrc = -1; - t4_os_link_changed(sc, pi->port_id, 0, -1); + pi->link_cfg.link_down_rc = 255; + t4_os_link_changed(sc, pi->port_id, 0); return (0); } @@ -5274,8 +5300,14 @@ cxgbe_sysctls(struct port_info *pi) } SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "pause_settings", - CTLTYPE_STRING | CTLFLAG_RW, pi, PAUSE_TX, sysctl_pause_settings, - "A", "PAUSE settings (bit 0 = rx_pause, bit 1 = tx_pause)"); + CTLTYPE_STRING | CTLFLAG_RW, pi, 0, sysctl_pause_settings, "A", + "PAUSE settings (bit 0 = rx_pause, bit 1 = tx_pause)"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "fec", + CTLTYPE_STRING | CTLFLAG_RW, pi, 0, sysctl_fec, "A", + "Forward Error Correction (bit 0 = RS, bit 1 = BASER_RS)"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "autoneg", + CTLTYPE_INT | CTLFLAG_RW, pi, 0, sysctl_autoneg, "I", + "autonegotiation (-1 = not supported)"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "max_speed", CTLFLAG_RD, NULL, port_top_speed(pi), "max speed (in Gbps)"); @@ -5735,12 +5767,9 @@ sysctl_pause_settings(SYSCTL_HANDLER_ARG if (rc) return (rc); if ((lc->requested_fc & (PAUSE_TX | PAUSE_RX)) != n) { - int link_ok = lc->link_ok; - lc->requested_fc &= ~(PAUSE_TX | PAUSE_RX); lc->requested_fc |= n; rc = -t4_link_l1cfg(sc, sc->mbox, pi->tx_chan, lc); - lc->link_ok = link_ok; /* restore */ } end_synchronized_op(sc, 0); } @@ -5749,6 +5778,97 @@ sysctl_pause_settings(SYSCTL_HANDLER_ARG } static int +sysctl_fec(SYSCTL_HANDLER_ARGS) +{ + struct port_info *pi = arg1; + struct adapter *sc = pi->adapter; + struct link_config *lc = &pi->link_cfg; + int rc; + + if (req->newptr == NULL) { + struct sbuf *sb; + static char *bits = "\20\1RS\2BASER_RS\3RESERVED"; + + rc = sysctl_wire_old_buffer(req, 0); + if (rc != 0) + return(rc); + + sb = sbuf_new_for_sysctl(NULL, NULL, 128, req); + if (sb == NULL) + return (ENOMEM); + + sbuf_printf(sb, "%b", lc->fec & M_FW_PORT_CAP_FEC, bits); + rc = sbuf_finish(sb); + sbuf_delete(sb); + } else { + char s[2]; + int n; + + s[0] = '0' + (lc->requested_fec & M_FW_PORT_CAP_FEC); + s[1] = 0; + + rc = sysctl_handle_string(oidp, s, sizeof(s), req); + if (rc != 0) + return(rc); + + if (s[1] != 0) + return (EINVAL); + if (s[0] < '0' || s[0] > '9') + return (EINVAL); /* not a number */ + n = s[0] - '0'; + if (n & ~M_FW_PORT_CAP_FEC) + return (EINVAL); /* some other bit is set too */ + + rc = begin_synchronized_op(sc, &pi->vi[0], SLEEP_OK | INTR_OK, + "t4fec"); + if (rc) + return (rc); + if ((lc->requested_fec & M_FW_PORT_CAP_FEC) != n) { + lc->requested_fec = n & + G_FW_PORT_CAP_FEC(lc->supported); + rc = -t4_link_l1cfg(sc, sc->mbox, pi->tx_chan, lc); + } + end_synchronized_op(sc, 0); + } + + return (rc); +} + +static int +sysctl_autoneg(SYSCTL_HANDLER_ARGS) +{ + struct port_info *pi = arg1; + struct adapter *sc = pi->adapter; + struct link_config *lc = &pi->link_cfg; + int rc, val, old; + + if (lc->supported & FW_PORT_CAP_ANEG) + val = lc->autoneg == AUTONEG_ENABLE ? 1 : 0; + else + val = -1; + rc = sysctl_handle_int(oidp, &val, 0, req); + if (rc != 0 || req->newptr == NULL) + return (rc); + if ((lc->supported & FW_PORT_CAP_ANEG) == 0) + return (ENOTSUP); + + val = val ? AUTONEG_ENABLE : AUTONEG_DISABLE; + if (lc->autoneg == val) + return (0); /* no change */ + + rc = begin_synchronized_op(sc, &pi->vi[0], SLEEP_OK | INTR_OK, + "t4aneg"); + if (rc) + return (rc); + old = lc->autoneg; + lc->autoneg = val; + rc = -t4_link_l1cfg(sc, sc->mbox, pi->tx_chan, lc); + if (rc != 0) + lc->autoneg = old; + return (rc); +} + +static int sysctl_handle_t4_reg64(SYSCTL_HANDLER_ARGS) { struct adapter *sc = arg1; @@ -6493,6 +6613,7 @@ sysctl_linkdnrc(SYSCTL_HANDLER_ARGS) { int rc = 0; struct port_info *pi = arg1; + struct link_config *lc = &pi->link_cfg; struct sbuf *sb; rc = sysctl_wire_old_buffer(req, 0); @@ -6502,10 +6623,10 @@ sysctl_linkdnrc(SYSCTL_HANDLER_ARGS) if (sb == NULL) return (ENOMEM); - if (pi->linkdnrc < 0) + if (lc->link_ok || lc->link_down_rc == 255) sbuf_printf(sb, "n/a"); else - sbuf_printf(sb, "%s", t4_link_down_rc_str(pi->linkdnrc)); + sbuf_printf(sb, "%s", t4_link_down_rc_str(lc->link_down_rc)); rc = sbuf_finish(sb); sbuf_delete(sb); @@ -8973,19 +9094,13 @@ t4_os_portmod_changed(const struct adapt } void -t4_os_link_changed(struct adapter *sc, int idx, int link_stat, int reason) +t4_os_link_changed(struct adapter *sc, int idx, int link_stat) { struct port_info *pi = sc->port[idx]; struct vi_info *vi; struct ifnet *ifp; int v; - if (link_stat) - pi->linkdnrc = -1; - else { - if (reason >= 0) - pi->linkdnrc = reason; - } for_each_vi(pi, v, vi) { ifp = vi->ifp; if (ifp == NULL) Modified: head/sys/dev/cxgbe/t4_vf.c ============================================================================== --- head/sys/dev/cxgbe/t4_vf.c Fri Dec 30 08:37:30 2016 (r310806) +++ head/sys/dev/cxgbe/t4_vf.c Fri Dec 30 08:59:49 2016 (r310807) @@ -668,8 +668,6 @@ t4vf_attach(device_t dev) n1g++; } - pi->linkdnrc = -1; - pi->dev = device_add_child(dev, sc->names->vf_ifnet_name, -1); if (pi->dev == NULL) { device_printf(dev, From owner-svn-src-head@freebsd.org Fri Dec 30 11:02:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6965C9638B; Fri, 30 Dec 2016 11:02:17 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 863471333; Fri, 30 Dec 2016 11:02:17 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUB2GHF042263; Fri, 30 Dec 2016 11:02:16 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUB2GSF042262; Fri, 30 Dec 2016 11:02:16 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201612301102.uBUB2GSF042262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Fri, 30 Dec 2016 11:02:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310809 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 11:02:17 -0000 Author: gavin Date: Fri Dec 30 11:02:16 2016 New Revision: 310809 URL: https://svnweb.freebsd.org/changeset/base/310809 Log: Fix bit value for a debug flag definition. Pointy hat to: gavin Modified: head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Fri Dec 30 09:38:45 2016 (r310808) +++ head/sys/dev/usb/wlan/if_run.c Fri Dec 30 11:02:16 2016 (r310809) @@ -105,7 +105,7 @@ enum { RUN_DEBUG_RSSI = 0x00004000, /* dump RSSI lookups */ RUN_DEBUG_RESET = 0x00008000, /* initialization progress */ RUN_DEBUG_CALIB = 0x00010000, /* calibration progress */ - RUN_DEBUG_CMD = 0x00010000, /* command queue */ + RUN_DEBUG_CMD = 0x00020000, /* command queue */ RUN_DEBUG_ANY = 0xffffffff }; From owner-svn-src-head@freebsd.org Fri Dec 30 11:49:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60C32C96D23; Fri, 30 Dec 2016 11:49:39 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 042C61505; Fri, 30 Dec 2016 11:49:38 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUBnc2t059704; Fri, 30 Dec 2016 11:49:38 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUBncWm059703; Fri, 30 Dec 2016 11:49:38 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612301149.uBUBncWm059703@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 30 Dec 2016 11:49:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310810 - head/sys/dev/sfxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 11:49:39 -0000 Author: arybchik Date: Fri Dec 30 11:49:37 2016 New Revision: 310810 URL: https://svnweb.freebsd.org/changeset/base/310810 Log: sfxge(4): cleanup: check deferred packet list tunables once Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8973 Modified: head/sys/dev/sfxge/sfxge_tx.c Modified: head/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- head/sys/dev/sfxge/sfxge_tx.c Fri Dec 30 11:02:16 2016 (r310809) +++ head/sys/dev/sfxge/sfxge_tx.c Fri Dec 30 11:49:37 2016 (r310810) @@ -1785,26 +1785,6 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u (rc = tso_init(txq)) != 0) goto fail3; - if (sfxge_tx_dpl_get_max <= 0) { - log(LOG_ERR, "%s=%d must be greater than 0", - SFXGE_PARAM_TX_DPL_GET_MAX, sfxge_tx_dpl_get_max); - rc = EINVAL; - goto fail_tx_dpl_get_max; - } - if (sfxge_tx_dpl_get_non_tcp_max <= 0) { - log(LOG_ERR, "%s=%d must be greater than 0", - SFXGE_PARAM_TX_DPL_GET_NON_TCP_MAX, - sfxge_tx_dpl_get_non_tcp_max); - rc = EINVAL; - goto fail_tx_dpl_get_max; - } - if (sfxge_tx_dpl_put_max < 0) { - log(LOG_ERR, "%s=%d must be greater or equal to 0", - SFXGE_PARAM_TX_DPL_PUT_MAX, sfxge_tx_dpl_put_max); - rc = EINVAL; - goto fail_tx_dpl_put_max; - } - /* Initialize the deferred packet list. */ stdp = &txq->dpl; stdp->std_put_max = sfxge_tx_dpl_put_max; @@ -1849,8 +1829,6 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u fail_txq_stat_init: fail_dpl_node: -fail_tx_dpl_put_max: -fail_tx_dpl_get_max: fail3: fail_txq_node: free(txq->pend_desc, M_SFXGE); @@ -1951,6 +1929,26 @@ sfxge_tx_init(struct sfxge_softc *sc) KASSERT(intr->state == SFXGE_INTR_INITIALIZED, ("intr->state != SFXGE_INTR_INITIALIZED")); + if (sfxge_tx_dpl_get_max <= 0) { + log(LOG_ERR, "%s=%d must be greater than 0", + SFXGE_PARAM_TX_DPL_GET_MAX, sfxge_tx_dpl_get_max); + rc = EINVAL; + goto fail_tx_dpl_get_max; + } + if (sfxge_tx_dpl_get_non_tcp_max <= 0) { + log(LOG_ERR, "%s=%d must be greater than 0", + SFXGE_PARAM_TX_DPL_GET_NON_TCP_MAX, + sfxge_tx_dpl_get_non_tcp_max); + rc = EINVAL; + goto fail_tx_dpl_get_non_tcp_max; + } + if (sfxge_tx_dpl_put_max < 0) { + log(LOG_ERR, "%s=%d must be greater or equal to 0", + SFXGE_PARAM_TX_DPL_PUT_MAX, sfxge_tx_dpl_put_max); + rc = EINVAL; + goto fail_tx_dpl_put_max; + } + sc->txq_count = SFXGE_TXQ_NTYPES - 1 + sc->intr.n_alloc; sc->tso_fw_assisted = sfxge_tso_fw_assisted; @@ -2003,5 +2001,8 @@ fail2: fail: fail_txq_node: sc->txq_count = 0; +fail_tx_dpl_put_max: +fail_tx_dpl_get_non_tcp_max: +fail_tx_dpl_get_max: return (rc); } From owner-svn-src-head@freebsd.org Fri Dec 30 11:52:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAD67C96FEE; Fri, 30 Dec 2016 11:52:56 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD53B1A39; Fri, 30 Dec 2016 11:52:56 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUBqt1P063546; Fri, 30 Dec 2016 11:52:55 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUBqtS2063544; Fri, 30 Dec 2016 11:52:55 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612301152.uBUBqtS2063544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 30 Dec 2016 11:52:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310811 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 11:52:57 -0000 Author: arybchik Date: Fri Dec 30 11:52:55 2016 New Revision: 310811 URL: https://svnweb.freebsd.org/changeset/base/310811 Log: sfxge(4): cleanup: remove now-unused function flags Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8966 Modified: head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_mcdi.c Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Fri Dec 30 11:49:37 2016 (r310810) +++ head/sys/dev/sfxge/common/efx.h Fri Dec 30 11:52:55 2016 (r310811) @@ -128,11 +128,6 @@ typedef struct efx_rxq_s efx_rxq_t; typedef struct efx_nic_s efx_nic_t; -#define EFX_NIC_FUNC_PRIMARY 0x00000001 -#define EFX_NIC_FUNC_LINKCTRL 0x00000002 -#define EFX_NIC_FUNC_TRUSTED 0x00000004 - - extern __checkReturn efx_rc_t efx_nic_create( __in efx_family_t family, @@ -1100,7 +1095,6 @@ typedef struct efx_nic_cfg_s { unsigned int enc_features; uint8_t enc_mac_addr[6]; uint8_t enc_port; /* PHY port number */ - uint32_t enc_func_flags; uint32_t enc_intr_vec_base; uint32_t enc_intr_limit; uint32_t enc_evq_limit; Modified: head/sys/dev/sfxge/common/efx_mcdi.c ============================================================================== --- head/sys/dev/sfxge/common/efx_mcdi.c Fri Dec 30 11:49:37 2016 (r310810) +++ head/sys/dev/sfxge/common/efx_mcdi.c Fri Dec 30 11:52:55 2016 (r310811) @@ -1184,11 +1184,9 @@ efx_mcdi_drv_attach( __in efx_nic_t *enp, __in boolean_t attach) { - efx_nic_cfg_t *encp = &(enp->en_nic_cfg); efx_mcdi_req_t req; uint8_t payload[MAX(MC_CMD_DRV_ATTACH_IN_LEN, MC_CMD_DRV_ATTACH_EXT_OUT_LEN)]; - uint32_t flags; efx_rc_t rc; (void) memset(payload, 0, sizeof (payload)); @@ -1219,36 +1217,8 @@ efx_mcdi_drv_attach( goto fail2; } - if (attach == B_FALSE) { - flags = 0; - } else if (enp->en_family == EFX_FAMILY_SIENA) { - efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); - - /* Create synthetic privileges for Siena functions */ - flags = EFX_NIC_FUNC_LINKCTRL | EFX_NIC_FUNC_TRUSTED; - if (emip->emi_port == 1) - flags |= EFX_NIC_FUNC_PRIMARY; - } else { - EFX_STATIC_ASSERT(EFX_NIC_FUNC_PRIMARY == - (1u << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_PRIMARY)); - EFX_STATIC_ASSERT(EFX_NIC_FUNC_LINKCTRL == - (1u << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_LINKCTRL)); - EFX_STATIC_ASSERT(EFX_NIC_FUNC_TRUSTED == - (1u << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_TRUSTED)); - - /* Save function privilege flags (EF10 and later) */ - if (req.emr_out_length_used < MC_CMD_DRV_ATTACH_EXT_OUT_LEN) { - rc = EMSGSIZE; - goto fail3; - } - flags = MCDI_OUT_DWORD(req, DRV_ATTACH_EXT_OUT_FUNC_FLAGS); - } - encp->enc_func_flags = flags; - return (0); -fail3: - EFSYS_PROBE(fail3); fail2: EFSYS_PROBE(fail2); fail1: From owner-svn-src-head@freebsd.org Fri Dec 30 11:54:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34D58C960F0; Fri, 30 Dec 2016 11:54:29 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E9A311C23; Fri, 30 Dec 2016 11:54:28 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUBsSnX063644; Fri, 30 Dec 2016 11:54:28 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUBsR99063640; Fri, 30 Dec 2016 11:54:27 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612301154.uBUBsR99063640@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 30 Dec 2016 11:54:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310812 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 11:54:29 -0000 Author: arybchik Date: Fri Dec 30 11:54:27 2016 New Revision: 310812 URL: https://svnweb.freebsd.org/changeset/base/310812 Log: sfxge(4): support non-interrupting event queues creation Poll-mode driver does not use interrupts and number of used event queues should not be limitted by the number of interrupts allocated for the NIC. Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8967 Modified: head/sys/dev/sfxge/common/ef10_ev.c head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_ev.c head/sys/dev/sfxge/common/efx_impl.h Modified: head/sys/dev/sfxge/common/ef10_ev.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_ev.c Fri Dec 30 11:52:55 2016 (r310811) +++ head/sys/dev/sfxge/common/ef10_ev.c Fri Dec 30 11:54:27 2016 (r310812) @@ -49,6 +49,12 @@ __FBSDID("$FreeBSD$"); #define EFX_EV_QSTAT_INCR(_eep, _stat) #endif +/* + * Non-interrupting event queue requires interrrupting event queue to + * refer to for wake-up events even if wake ups are never used. + * It could be even non-allocated event queue. + */ +#define EFX_EF10_ALWAYS_INTERRUPTING_EVQ_INDEX (0) static __checkReturn boolean_t ef10_ev_rx( @@ -151,6 +157,7 @@ efx_mcdi_init_evq( uint64_t addr; int npages; int i; + boolean_t interrupting; int ev_cut_through; efx_rc_t rc; @@ -171,6 +178,9 @@ efx_mcdi_init_evq( MCDI_IN_SET_DWORD(req, INIT_EVQ_IN_INSTANCE, instance); MCDI_IN_SET_DWORD(req, INIT_EVQ_IN_IRQ_NUM, irq); + interrupting = ((flags & EFX_EVQ_FLAGS_NOTIFY_MASK) == + EFX_EVQ_FLAGS_NOTIFY_INTERRUPT); + /* * On Huntington RX and TX event batching can only be requested together * (even if the datapath firmware doesn't actually support RX @@ -194,7 +204,7 @@ efx_mcdi_init_evq( goto fail2; } MCDI_IN_POPULATE_DWORD_6(req, INIT_EVQ_IN_FLAGS, - INIT_EVQ_IN_FLAG_INTERRUPTING, 1, + INIT_EVQ_IN_FLAG_INTERRUPTING, interrupting, INIT_EVQ_IN_FLAG_RPTR_DOS, 0, INIT_EVQ_IN_FLAG_INT_ARMD, 0, INIT_EVQ_IN_FLAG_CUT_THRU, ev_cut_through, @@ -280,6 +290,7 @@ efx_mcdi_init_evq_v2( uint8_t payload[ MAX(MC_CMD_INIT_EVQ_V2_IN_LEN(EFX_EVQ_NBUFS(EFX_EVQ_MAXNEVS)), MC_CMD_INIT_EVQ_V2_OUT_LEN)]; + boolean_t interrupting; unsigned int evq_type; efx_qword_t *dma_addr; uint64_t addr; @@ -304,6 +315,9 @@ efx_mcdi_init_evq_v2( MCDI_IN_SET_DWORD(req, INIT_EVQ_V2_IN_INSTANCE, instance); MCDI_IN_SET_DWORD(req, INIT_EVQ_V2_IN_IRQ_NUM, irq); + interrupting = ((flags & EFX_EVQ_FLAGS_NOTIFY_MASK) == + EFX_EVQ_FLAGS_NOTIFY_INTERRUPT); + switch (flags & EFX_EVQ_FLAGS_TYPE_MASK) { case EFX_EVQ_FLAGS_TYPE_AUTO: evq_type = MC_CMD_INIT_EVQ_V2_IN_FLAG_TYPE_AUTO; @@ -319,7 +333,7 @@ efx_mcdi_init_evq_v2( goto fail2; } MCDI_IN_POPULATE_DWORD_4(req, INIT_EVQ_V2_IN_FLAGS, - INIT_EVQ_V2_IN_FLAG_INTERRUPTING, 1, + INIT_EVQ_V2_IN_FLAG_INTERRUPTING, interrupting, INIT_EVQ_V2_IN_FLAG_RPTR_DOS, 0, INIT_EVQ_V2_IN_FLAG_INT_ARMD, 0, INIT_EVQ_V2_IN_FLAG_TYPE, evq_type); @@ -484,7 +498,17 @@ ef10_ev_qcreate( eep->ee_mcdi = ef10_ev_mcdi; /* Set up the event queue */ - irq = index; /* INIT_EVQ expects function-relative vector number */ + /* INIT_EVQ expects function-relative vector number */ + if ((flags & EFX_EVQ_FLAGS_NOTIFY_MASK) == + EFX_EVQ_FLAGS_NOTIFY_INTERRUPT) { + irq = index; + } else if (index == EFX_EF10_ALWAYS_INTERRUPTING_EVQ_INDEX) { + irq = index; + flags = (flags & ~EFX_EVQ_FLAGS_NOTIFY_MASK) | + EFX_EVQ_FLAGS_NOTIFY_INTERRUPT; + } else { + irq = EFX_EF10_ALWAYS_INTERRUPTING_EVQ_INDEX; + } /* * Interrupts may be raised for events immediately after the queue is Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Fri Dec 30 11:52:55 2016 (r310811) +++ head/sys/dev/sfxge/common/efx.h Fri Dec 30 11:54:27 2016 (r310812) @@ -1624,6 +1624,10 @@ efx_ev_fini( #define EFX_EVQ_FLAGS_TYPE_THROUGHPUT (0x1) #define EFX_EVQ_FLAGS_TYPE_LOW_LATENCY (0x2) +#define EFX_EVQ_FLAGS_NOTIFY_MASK (0xC) +#define EFX_EVQ_FLAGS_NOTIFY_INTERRUPT (0x0) /* Interrupting (default) */ +#define EFX_EVQ_FLAGS_NOTIFY_DISABLED (0x4) /* Non-interrupting */ + extern __checkReturn efx_rc_t efx_ev_qcreate( __in efx_nic_t *enp, Modified: head/sys/dev/sfxge/common/efx_ev.c ============================================================================== --- head/sys/dev/sfxge/common/efx_ev.c Fri Dec 30 11:52:55 2016 (r310811) +++ head/sys/dev/sfxge/common/efx_ev.c Fri Dec 30 11:54:27 2016 (r310812) @@ -235,17 +235,32 @@ efx_ev_qcreate( EFSYS_ASSERT3U(enp->en_ev_qcount + 1, <, encp->enc_evq_limit); + switch (flags & EFX_EVQ_FLAGS_NOTIFY_MASK) { + case EFX_EVQ_FLAGS_NOTIFY_INTERRUPT: + break; + case EFX_EVQ_FLAGS_NOTIFY_DISABLED: + if (us != 0) { + rc = EINVAL; + goto fail1; + } + break; + default: + rc = EINVAL; + goto fail2; + } + /* Allocate an EVQ object */ EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (efx_evq_t), eep); if (eep == NULL) { rc = ENOMEM; - goto fail1; + goto fail3; } eep->ee_magic = EFX_EVQ_MAGIC; eep->ee_enp = enp; eep->ee_index = index; eep->ee_mask = n - 1; + eep->ee_flags = flags; eep->ee_esmp = esmp; /* @@ -261,16 +276,20 @@ efx_ev_qcreate( if ((rc = eevop->eevo_qcreate(enp, index, esmp, n, id, us, flags, eep)) != 0) - goto fail2; + goto fail4; return (0); -fail2: - EFSYS_PROBE(fail2); +fail4: + EFSYS_PROBE(fail4); *eepp = NULL; enp->en_ev_qcount--; EFSYS_KMEM_FREE(enp->en_esip, sizeof (efx_evq_t), eep); +fail3: + EFSYS_PROBE(fail3); +fail2: + EFSYS_PROBE(fail2); fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); return (rc); @@ -553,11 +572,19 @@ efx_ev_qmoderate( EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC); - if ((rc = eevop->eevo_qmoderate(eep, us)) != 0) + if ((eep->ee_flags & EFX_EVQ_FLAGS_NOTIFY_MASK) == + EFX_EVQ_FLAGS_NOTIFY_DISABLED) { + rc = EINVAL; goto fail1; + } + + if ((rc = eevop->eevo_qmoderate(eep, us)) != 0) + goto fail2; return (0); +fail2: + EFSYS_PROBE(fail2); fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); return (rc); @@ -1267,6 +1294,7 @@ siena_ev_qcreate( uint32_t size; efx_oword_t oword; efx_rc_t rc; + boolean_t notify_mode; _NOTE(ARGUNUSED(esmp)) @@ -1307,8 +1335,13 @@ siena_ev_qcreate( eep->ee_mcdi = siena_ev_mcdi; #endif /* EFSYS_OPT_MCDI */ + notify_mode = ((flags & EFX_EVQ_FLAGS_NOTIFY_MASK) != + EFX_EVQ_FLAGS_NOTIFY_INTERRUPT); + /* Set up the new event queue */ - EFX_POPULATE_OWORD_1(oword, FRF_CZ_TIMER_Q_EN, 1); + EFX_POPULATE_OWORD_3(oword, FRF_CZ_TIMER_Q_EN, 1, + FRF_CZ_HOST_NOTIFY_MODE, notify_mode, + FRF_CZ_TIMER_MODE, FFE_CZ_TIMER_MODE_DIS); EFX_BAR_TBL_WRITEO(enp, FR_AZ_TIMER_TBL, index, &oword, B_TRUE); EFX_POPULATE_OWORD_3(oword, FRF_AZ_EVQ_EN, 1, FRF_AZ_EVQ_SIZE, size, Modified: head/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- head/sys/dev/sfxge/common/efx_impl.h Fri Dec 30 11:52:55 2016 (r310811) +++ head/sys/dev/sfxge/common/efx_impl.h Fri Dec 30 11:54:27 2016 (r310812) @@ -711,6 +711,8 @@ struct efx_evq_s { #endif /* EFSYS_OPT_MCDI */ efx_evq_rxq_state_t ee_rxq_state[EFX_EV_RX_NLABELS]; + + uint32_t ee_flags; }; #define EFX_EVQ_MAGIC 0x08081997 From owner-svn-src-head@freebsd.org Fri Dec 30 11:56:14 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E5DAC96167; Fri, 30 Dec 2016 11:56:14 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78EA21DC3; Fri, 30 Dec 2016 11:56:14 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUBuDpI063787; Fri, 30 Dec 2016 11:56:13 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUBuDZi063780; Fri, 30 Dec 2016 11:56:13 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612301156.uBUBuDZi063780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 30 Dec 2016 11:56:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310813 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 11:56:14 -0000 Author: arybchik Date: Fri Dec 30 11:56:12 2016 New Revision: 310813 URL: https://svnweb.freebsd.org/changeset/base/310813 Log: sfxge(4): add per-command timeout reporting to the common code In newer firmware that supports multithreaded MCDI processing, longer running commands may be run ina background thread. Add support for drivers to query the appropriate timeout for each MCDI request. Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8968 Modified: head/sys/dev/sfxge/common/ef10_impl.h head/sys/dev/sfxge/common/ef10_mcdi.c head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_impl.h head/sys/dev/sfxge/common/efx_mcdi.c head/sys/dev/sfxge/common/siena_impl.h head/sys/dev/sfxge/common/siena_mcdi.c Modified: head/sys/dev/sfxge/common/ef10_impl.h ============================================================================== --- head/sys/dev/sfxge/common/ef10_impl.h Fri Dec 30 11:54:27 2016 (r310812) +++ head/sys/dev/sfxge/common/ef10_impl.h Fri Dec 30 11:56:12 2016 (r310813) @@ -330,6 +330,12 @@ ef10_mcdi_feature_supported( __in efx_mcdi_feature_id_t id, __out boolean_t *supportedp); +extern void +ef10_mcdi_get_timeout( + __in efx_nic_t *enp, + __in efx_mcdi_req_t *emrp, + __out uint32_t *timeoutp); + #endif /* EFSYS_OPT_MCDI */ /* NVRAM */ Modified: head/sys/dev/sfxge/common/ef10_mcdi.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_mcdi.c Fri Dec 30 11:54:27 2016 (r310812) +++ head/sys/dev/sfxge/common/ef10_mcdi.c Fri Dec 30 11:56:12 2016 (r310813) @@ -108,6 +108,46 @@ ef10_mcdi_fini( emip->emi_new_epoch = B_FALSE; } +/* + * In older firmware all commands are processed in a single thread, so a long + * running command for one PCIe function can block processing for another + * function (see bug 61269). + * + * In newer firmware that supports multithreaded MCDI processing, we can extend + * the timeout for long-running requests which we know firmware may choose to + * process in a background thread. + */ +#define EF10_MCDI_CMD_TIMEOUT_US (10 * 1000 * 1000) +#define EF10_MCDI_CMD_LONG_TIMEOUT_US (60 * 1000 * 1000) + + void +ef10_mcdi_get_timeout( + __in efx_nic_t *enp, + __in efx_mcdi_req_t *emrp, + __out uint32_t *timeoutp) +{ + efx_nic_cfg_t *encp = &(enp->en_nic_cfg); + + switch (emrp->emr_cmd) { + case MC_CMD_POLL_BIST: + case MC_CMD_NVRAM_ERASE: + case MC_CMD_LICENSING_V3: + case MC_CMD_NVRAM_UPDATE_FINISH: + if (encp->enc_fw_verified_nvram_update_required != B_FALSE) { + /* + * Potentially longer running commands, which firmware + * may choose to process in a background thread. + */ + *timeoutp = EF10_MCDI_CMD_LONG_TIMEOUT_US; + break; + } + /* FALLTHRU */ + default: + *timeoutp = EF10_MCDI_CMD_TIMEOUT_US; + break; + } +} + void ef10_mcdi_send_request( __in efx_nic_t *enp, Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Fri Dec 30 11:54:27 2016 (r310812) +++ head/sys/dev/sfxge/common/efx.h Fri Dec 30 11:56:12 2016 (r310813) @@ -243,6 +243,12 @@ efx_mcdi_new_epoch( __in efx_nic_t *enp); extern void +efx_mcdi_get_timeout( + __in efx_nic_t *enp, + __in efx_mcdi_req_t *emrp, + __out uint32_t *usec_timeoutp); + +extern void efx_mcdi_request_start( __in efx_nic_t *enp, __in efx_mcdi_req_t *emrp, Modified: head/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- head/sys/dev/sfxge/common/efx_impl.h Fri Dec 30 11:54:27 2016 (r310812) +++ head/sys/dev/sfxge/common/efx_impl.h Fri Dec 30 11:56:12 2016 (r310813) @@ -427,7 +427,10 @@ typedef struct efx_mcdi_ops_s { boolean_t (*emco_poll_response)(efx_nic_t *); void (*emco_read_response)(efx_nic_t *, void *, size_t, size_t); void (*emco_fini)(efx_nic_t *); - efx_rc_t (*emco_feature_supported)(efx_nic_t *, efx_mcdi_feature_id_t, boolean_t *); + efx_rc_t (*emco_feature_supported)(efx_nic_t *, + efx_mcdi_feature_id_t, boolean_t *); + void (*emco_get_timeout)(efx_nic_t *, efx_mcdi_req_t *, + uint32_t *); } efx_mcdi_ops_t; typedef struct efx_mcdi_s { Modified: head/sys/dev/sfxge/common/efx_mcdi.c ============================================================================== --- head/sys/dev/sfxge/common/efx_mcdi.c Fri Dec 30 11:54:27 2016 (r310812) +++ head/sys/dev/sfxge/common/efx_mcdi.c Fri Dec 30 11:56:12 2016 (r310813) @@ -67,6 +67,7 @@ static const efx_mcdi_ops_t __efx_mcdi_s siena_mcdi_read_response, /* emco_read_response */ siena_mcdi_fini, /* emco_fini */ siena_mcdi_feature_supported, /* emco_feature_supported */ + siena_mcdi_get_timeout, /* emco_get_timeout */ }; #endif /* EFSYS_OPT_SIENA */ @@ -81,6 +82,7 @@ static const efx_mcdi_ops_t __efx_mcdi_e ef10_mcdi_read_response, /* emco_read_response */ ef10_mcdi_fini, /* emco_fini */ ef10_mcdi_feature_supported, /* emco_feature_supported */ + ef10_mcdi_get_timeout, /* emco_get_timeout */ }; #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ @@ -605,6 +607,17 @@ efx_mcdi_request_abort( return (aborted); } + void +efx_mcdi_get_timeout( + __in efx_nic_t *enp, + __in efx_mcdi_req_t *emrp, + __out uint32_t *timeoutp) +{ + const efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop; + + emcop->emco_get_timeout(enp, emrp, timeoutp); +} + __checkReturn efx_rc_t efx_mcdi_request_errcode( __in unsigned int err) Modified: head/sys/dev/sfxge/common/siena_impl.h ============================================================================== --- head/sys/dev/sfxge/common/siena_impl.h Fri Dec 30 11:54:27 2016 (r310812) +++ head/sys/dev/sfxge/common/siena_impl.h Fri Dec 30 11:56:12 2016 (r310813) @@ -127,6 +127,12 @@ siena_mcdi_feature_supported( __in efx_mcdi_feature_id_t id, __out boolean_t *supportedp); +extern void +siena_mcdi_get_timeout( + __in efx_nic_t *enp, + __in efx_mcdi_req_t *emrp, + __out uint32_t *timeoutp); + #endif /* EFSYS_OPT_MCDI */ #if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD Modified: head/sys/dev/sfxge/common/siena_mcdi.c ============================================================================== --- head/sys/dev/sfxge/common/siena_mcdi.c Fri Dec 30 11:54:27 2016 (r310812) +++ head/sys/dev/sfxge/common/siena_mcdi.c Fri Dec 30 11:56:12 2016 (r310813) @@ -247,4 +247,19 @@ fail1: return (rc); } +/* Default timeout for MCDI command processing. */ +#define SIENA_MCDI_CMD_TIMEOUT_US (10 * 1000 * 1000) + + void +siena_mcdi_get_timeout( + __in efx_nic_t *enp, + __in efx_mcdi_req_t *emrp, + __out uint32_t *timeoutp) +{ + _NOTE(ARGUNUSED(enp, emrp)) + + *timeoutp = SIENA_MCDI_CMD_TIMEOUT_US; +} + + #endif /* EFSYS_OPT_SIENA && EFSYS_OPT_MCDI */ From owner-svn-src-head@freebsd.org Fri Dec 30 11:58:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE53DC96268; Fri, 30 Dec 2016 11:58:24 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F870105C; Fri, 30 Dec 2016 11:58:24 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUBwNAR064010; Fri, 30 Dec 2016 11:58:23 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUBwNB3064008; Fri, 30 Dec 2016 11:58:23 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612301158.uBUBwNB3064008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 30 Dec 2016 11:58:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310814 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 11:58:24 -0000 Author: arybchik Date: Fri Dec 30 11:58:23 2016 New Revision: 310814 URL: https://svnweb.freebsd.org/changeset/base/310814 Log: sfxge(4): make verified update result available from ef10_nvram_partn_unlock() Manftest needs to know exactly what went wrong with the verified update so that failing boards can be correctly diagnosed. Submitted by: Tom Millington Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8969 Modified: head/sys/dev/sfxge/common/ef10_impl.h head/sys/dev/sfxge/common/ef10_nvram.c Modified: head/sys/dev/sfxge/common/ef10_impl.h ============================================================================== --- head/sys/dev/sfxge/common/ef10_impl.h Fri Dec 30 11:56:12 2016 (r310813) +++ head/sys/dev/sfxge/common/ef10_impl.h Fri Dec 30 11:58:23 2016 (r310814) @@ -393,7 +393,8 @@ ef10_nvram_partn_lock( extern __checkReturn efx_rc_t ef10_nvram_partn_unlock( __in efx_nic_t *enp, - __in uint32_t partn); + __in uint32_t partn, + __out_opt uint32_t *resultp); #endif /* EFSYS_OPT_NVRAM || EFSYS_OPT_VPD */ Modified: head/sys/dev/sfxge/common/ef10_nvram.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_nvram.c Fri Dec 30 11:56:12 2016 (r310813) +++ head/sys/dev/sfxge/common/ef10_nvram.c Fri Dec 30 11:58:23 2016 (r310814) @@ -1828,7 +1828,7 @@ ef10_nvram_partn_write_segment_tlv( goto fail7; /* Unlock the partition */ - ef10_nvram_partn_unlock(enp, partn); + ef10_nvram_partn_unlock(enp, partn, NULL); EFSYS_KMEM_FREE(enp->en_esip, partn_size, partn_data); @@ -1843,7 +1843,7 @@ fail5: fail4: EFSYS_PROBE(fail4); - ef10_nvram_partn_unlock(enp, partn); + ef10_nvram_partn_unlock(enp, partn, NULL); fail3: EFSYS_PROBE(fail3); @@ -2049,13 +2049,16 @@ fail1: __checkReturn efx_rc_t ef10_nvram_partn_unlock( __in efx_nic_t *enp, - __in uint32_t partn) + __in uint32_t partn, + __out_opt uint32_t *resultp) { boolean_t reboot = B_FALSE; - uint32_t result = 0; /* FIXME: MC_CMD_NVRAM_VERIFY_RC_UNKNOWN */ efx_rc_t rc; - rc = efx_mcdi_nvram_update_finish(enp, partn, reboot, &result); + if (resultp != NULL) + *resultp = MC_CMD_NVRAM_VERIFY_RC_UNKNOWN; + + rc = efx_mcdi_nvram_update_finish(enp, partn, reboot, resultp); if (rc != 0) goto fail1; @@ -2064,7 +2067,6 @@ ef10_nvram_partn_unlock( fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); - /* FIXME: log result if verified firmware update fails */ return (rc); } @@ -2370,7 +2372,7 @@ ef10_nvram_partn_rw_finish( { efx_rc_t rc; - if ((rc = ef10_nvram_partn_unlock(enp, partn)) != 0) + if ((rc = ef10_nvram_partn_unlock(enp, partn, NULL)) != 0) goto fail1; return (0); From owner-svn-src-head@freebsd.org Fri Dec 30 12:00:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1DA9C968C1; Fri, 30 Dec 2016 12:00:18 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C32815D7; Fri, 30 Dec 2016 12:00:18 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUC0H24064154; Fri, 30 Dec 2016 12:00:17 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUC0HAq064152; Fri, 30 Dec 2016 12:00:17 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612301200.uBUC0HAq064152@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 30 Dec 2016 12:00:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310815 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 12:00:18 -0000 Author: arybchik Date: Fri Dec 30 12:00:17 2016 New Revision: 310815 URL: https://svnweb.freebsd.org/changeset/base/310815 Log: sfxge(4): add functions to efx_bootcfg supporting whole partition access Expose expcfg partition layout discovery and validating buffer copy routines. Needed for whole-partition expcfg operations. Submitted by: Richard Houldsworth Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8970 Modified: head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_bootcfg.c Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Fri Dec 30 11:58:23 2016 (r310814) +++ head/sys/dev/sfxge/common/efx.h Fri Dec 30 12:00:17 2016 (r310815) @@ -1422,6 +1422,29 @@ efx_nvram_fini( #if EFSYS_OPT_BOOTCFG +/* Report size and offset of bootcfg sector in NVRAM partition. */ +extern __checkReturn efx_rc_t +efx_bootcfg_sector_info( + __in efx_nic_t *enp, + __in uint32_t pf, + __out_opt uint32_t *sector_countp, + __out size_t *offsetp, + __out size_t *max_sizep); + +/* + * Copy bootcfg sector data to a target buffer which may differ in size. + * Optionally corrects format errors in source buffer. + */ +extern efx_rc_t +efx_bootcfg_copy_sector( + __in efx_nic_t *enp, + __inout_bcount(sector_length) + uint8_t *sector, + __in size_t sector_length, + __out_bcount(data_size) uint8_t *data, + __in size_t data_size, + __in boolean_t handle_format_errors); + extern efx_rc_t efx_bootcfg_read( __in efx_nic_t *enp, Modified: head/sys/dev/sfxge/common/efx_bootcfg.c ============================================================================== --- head/sys/dev/sfxge/common/efx_bootcfg.c Fri Dec 30 11:58:23 2016 (r310814) +++ head/sys/dev/sfxge/common/efx_bootcfg.c Fri Dec 30 12:00:17 2016 (r310815) @@ -42,17 +42,24 @@ __FBSDID("$FreeBSD$"); */ #define BOOTCFG_MAX_SIZE 0x1000 +/* Medford per-PF bootcfg sector */ +#define BOOTCFG_PER_PF 0x800 +#define BOOTCFG_PF_COUNT 16 + #define DHCP_END ((uint8_t)0xff) #define DHCP_PAD ((uint8_t)0) -/* Report size and offset of bootcfg sector in NVRAM partition. */ -static __checkReturn efx_rc_t -efx_bootcfg_sector( +/* Report the layout of bootcfg sectors in NVRAM partition. */ + __checkReturn efx_rc_t +efx_bootcfg_sector_info( __in efx_nic_t *enp, + __in uint32_t pf, + __out_opt uint32_t *sector_countp, __out size_t *offsetp, __out size_t *max_sizep) { + uint32_t count; size_t max_size; size_t offset; int rc; @@ -62,6 +69,7 @@ efx_bootcfg_sector( case EFX_FAMILY_SIENA: max_size = BOOTCFG_MAX_SIZE; offset = 0; + count = 1; break; #endif /* EFSYS_OPT_SIENA */ @@ -69,16 +77,20 @@ efx_bootcfg_sector( case EFX_FAMILY_HUNTINGTON: max_size = BOOTCFG_MAX_SIZE; offset = 0; + count = 1; break; #endif /* EFSYS_OPT_HUNTINGTON */ #if EFSYS_OPT_MEDFORD case EFX_FAMILY_MEDFORD: { - efx_nic_cfg_t *encp = &(enp->en_nic_cfg); - /* Shared partition (array indexed by PF) */ - max_size = 0x0800; - offset = max_size * encp->enc_pf; + max_size = BOOTCFG_PER_PF; + count = BOOTCFG_PF_COUNT; + if (pf >= count) { + rc = EINVAL; + goto fail2; + } + offset = max_size * pf; break; } #endif /* EFSYS_OPT_MEDFORD */ @@ -90,11 +102,17 @@ efx_bootcfg_sector( } EFSYS_ASSERT3U(max_size, <=, BOOTCFG_MAX_SIZE); + if (sector_countp != NULL) + *sector_countp = count; *offsetp = offset; *max_sizep = max_size; return (0); +#if EFSYS_OPT_MEDFORD +fail2: + EFSYS_PROBE(fail2); +#endif fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); return (rc); @@ -104,7 +122,7 @@ fail1: static __checkReturn uint8_t efx_bootcfg_csum( __in efx_nic_t *enp, - __in_bcount(size) caddr_t data, + __in_bcount(size) uint8_t const *data, __in size_t size) { _NOTE(ARGUNUSED(enp)) @@ -120,7 +138,7 @@ efx_bootcfg_csum( static __checkReturn efx_rc_t efx_bootcfg_verify( __in efx_nic_t *enp, - __in_bcount(size) caddr_t data, + __in_bcount(size) uint8_t const *data, __in size_t size, __out_opt size_t *usedp) { @@ -183,6 +201,95 @@ fail1: return (rc); } +/* + * Copy bootcfg sector data to a target buffer which may differ in size. + * Optionally corrects format errors in source buffer. + */ + efx_rc_t +efx_bootcfg_copy_sector( + __in efx_nic_t *enp, + __inout_bcount(sector_length) + uint8_t *sector, + __in size_t sector_length, + __out_bcount(data_size) uint8_t *data, + __in size_t data_size, + __in boolean_t handle_format_errors) +{ + size_t used_bytes; + efx_rc_t rc; + + /* Verify that the area is correctly formatted and checksummed */ + rc = efx_bootcfg_verify(enp, sector, sector_length, + &used_bytes); + + if (!handle_format_errors) { + if (rc != 0) + goto fail1; + + if ((used_bytes < 2) || + (sector[used_bytes - 1] != DHCP_END)) { + /* Block too short, or DHCP_END missing */ + rc = ENOENT; + goto fail2; + } + } + + /* Synthesize empty format on verification failure */ + if (rc != 0 || used_bytes == 0) { + sector[0] = 0; + sector[1] = DHCP_END; + used_bytes = 2; + } + EFSYS_ASSERT(used_bytes >= 2); /* checksum and DHCP_END */ + EFSYS_ASSERT(used_bytes <= sector_length); + EFSYS_ASSERT(sector_length >= 2); + + /* + * Legacy bootcfg sectors don't terminate with a DHCP_END character. + * Modify the returned payload so it does. + * Reinitialise the sector if there isn't room for the character. + */ + if (sector[used_bytes - 1] != DHCP_END) { + if (used_bytes >= sector_length) { + sector[0] = 0; + used_bytes = 1; + } + sector[used_bytes] = DHCP_END; + ++used_bytes; + } + + /* + * Verify that the target buffer is large enough for the + * entire used bootcfg area, then copy into the target buffer. + */ + if (used_bytes > data_size) { + rc = ENOSPC; + goto fail3; + } + memcpy(data, sector, used_bytes); + + /* Zero out the unused portion of the target buffer */ + if (used_bytes < data_size) + (void) memset(data + used_bytes, 0, data_size - used_bytes); + + /* + * The checksum includes trailing data after any DHCP_END character, + * which we've just modified (by truncation or appending DHCP_END). + */ + data[0] -= efx_bootcfg_csum(enp, data, data_size); + + return (0); + +fail3: + EFSYS_PROBE(fail3); +fail2: + EFSYS_PROBE(fail2); +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); +} + efx_rc_t efx_bootcfg_read( __in efx_nic_t *enp, @@ -195,13 +302,20 @@ efx_bootcfg_read( size_t sector_length; size_t sector_offset; efx_rc_t rc; + uint32_t sector_number; +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD + sector_number = enp->en_nic_cfg.enc_pf; +#else + sector_number = 0; +#endif rc = efx_nvram_size(enp, EFX_NVRAM_BOOTROM_CFG, &partn_length); if (rc != 0) goto fail1; /* The bootcfg sector may be stored in a (larger) shared partition */ - rc = efx_bootcfg_sector(enp, §or_offset, §or_length); + rc = efx_bootcfg_sector_info(enp, sector_number, + NULL, §or_offset, §or_length); if (rc != 0) goto fail2; @@ -232,17 +346,18 @@ efx_bootcfg_read( if ((rc = efx_nvram_rw_start(enp, EFX_NVRAM_BOOTROM_CFG, NULL)) != 0) goto fail5; - rc = efx_nvram_read_chunk(enp, EFX_NVRAM_BOOTROM_CFG, sector_offset, - (caddr_t)payload, sector_length); - - efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG); - - if (rc != 0) + if ((rc = efx_nvram_read_chunk(enp, EFX_NVRAM_BOOTROM_CFG, + sector_offset, (caddr_t)payload, sector_length)) != 0) { + (void) efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG); goto fail6; + } + + if ((rc = efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG)) != 0) + goto fail7; /* Verify that the area is correctly formatted and checksummed */ rc = efx_bootcfg_verify(enp, (caddr_t)payload, sector_length, - &used_bytes); + &used_bytes); if (rc != 0 || used_bytes == 0) { payload[0] = (uint8_t)~DHCP_END; payload[1] = DHCP_END; @@ -274,7 +389,7 @@ efx_bootcfg_read( */ if (used_bytes > size) { rc = ENOSPC; - goto fail7; + goto fail8; } if (sector_length > size) { memcpy(data, payload, used_bytes); @@ -293,6 +408,8 @@ efx_bootcfg_read( return (0); +fail8: + EFSYS_PROBE(fail8); fail7: EFSYS_PROBE(fail7); fail6: @@ -326,13 +443,21 @@ efx_bootcfg_write( size_t sector_offset; size_t used_bytes; efx_rc_t rc; + uint32_t sector_number; + +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD + sector_number = enp->en_nic_cfg.enc_pf; +#else + sector_number = 0; +#endif rc = efx_nvram_size(enp, EFX_NVRAM_BOOTROM_CFG, &partn_length); if (rc != 0) goto fail1; /* The bootcfg sector may be stored in a (larger) shared partition */ - rc = efx_bootcfg_sector(enp, §or_offset, §or_length); + rc = efx_bootcfg_sector_info(enp, sector_number, + NULL, §or_offset, §or_length); if (rc != 0) goto fail2; @@ -396,16 +521,18 @@ efx_bootcfg_write( goto fail10; if ((rc = efx_nvram_write_chunk(enp, EFX_NVRAM_BOOTROM_CFG, - 0, partn_data, partn_length)) != 0) { + 0, (caddr_t)partn_data, partn_length)) != 0) goto fail11; - } - efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG); + if ((rc = efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG)) != 0) + goto fail12; EFSYS_KMEM_FREE(enp->en_esip, partn_length, partn_data); return (0); +fail12: + EFSYS_PROBE(fail12); fail11: EFSYS_PROBE(fail11); fail10: @@ -413,7 +540,7 @@ fail10: fail9: EFSYS_PROBE(fail9); - efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG); + (void) efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG); fail8: EFSYS_PROBE(fail8); From owner-svn-src-head@freebsd.org Fri Dec 30 12:02:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2195DC96DE2; Fri, 30 Dec 2016 12:02:18 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D68B51AAF; Fri, 30 Dec 2016 12:02:17 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUC2Hul067849; Fri, 30 Dec 2016 12:02:17 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUC2GiB067845; Fri, 30 Dec 2016 12:02:16 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612301202.uBUC2GiB067845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 30 Dec 2016 12:02:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310816 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 12:02:18 -0000 Author: arybchik Date: Fri Dec 30 12:02:16 2016 New Revision: 310816 URL: https://svnweb.freebsd.org/changeset/base/310816 Log: sfxge(4): fix efx_filter_supported_filters API The previous API had various problems, including the length of the caller provided buffer not being specified, no means being available to discover how big the buffer needs to be, and a lack of clarity of what the resulting list contains. To fix it: - add the buffer length as a parameter - if the provided buffer is too short, fail with ENOSPC and return the required length - ensure that the list contents are valid and add comments describing it It is safe to change this API as, unsuprisingly, it has no users. Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8971 Modified: head/sys/dev/sfxge/common/ef10_filter.c head/sys/dev/sfxge/common/ef10_impl.h head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_filter.c head/sys/dev/sfxge/common/efx_impl.h Modified: head/sys/dev/sfxge/common/ef10_filter.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_filter.c Fri Dec 30 12:00:17 2016 (r310815) +++ head/sys/dev/sfxge/common/ef10_filter.c Fri Dec 30 12:02:16 2016 (r310816) @@ -871,13 +871,16 @@ fail1: static __checkReturn efx_rc_t efx_mcdi_get_parser_disp_info( - __in efx_nic_t *enp, - __out uint32_t *list, - __out size_t *length) + __in efx_nic_t *enp, + __out_ecount(buffer_length) uint32_t *buffer, + __in size_t buffer_length, + __out size_t *list_lengthp) { efx_mcdi_req_t req; uint8_t payload[MAX(MC_CMD_GET_PARSER_DISP_INFO_IN_LEN, MC_CMD_GET_PARSER_DISP_INFO_OUT_LENMAX)]; + size_t matches_count; + size_t list_size; efx_rc_t rc; (void) memset(payload, 0, sizeof (payload)); @@ -897,25 +900,41 @@ efx_mcdi_get_parser_disp_info( goto fail1; } - *length = MCDI_OUT_DWORD(req, + matches_count = MCDI_OUT_DWORD(req, GET_PARSER_DISP_INFO_OUT_NUM_SUPPORTED_MATCHES); if (req.emr_out_length_used < - MC_CMD_GET_PARSER_DISP_INFO_OUT_LEN(*length)) { + MC_CMD_GET_PARSER_DISP_INFO_OUT_LEN(matches_count)) { rc = EMSGSIZE; goto fail2; } - memcpy(list, - MCDI_OUT2(req, - uint32_t, - GET_PARSER_DISP_INFO_OUT_SUPPORTED_MATCHES), - (*length) * sizeof (uint32_t)); + *list_lengthp = matches_count; + + if (buffer_length < matches_count) { + rc = ENOSPC; + goto fail3; + } + + /* + * Check that the elements in the list in the MCDI response are the size + * we expect, so we can just copy them directly. Any conversion of the + * flags is handled by the caller. + */ EFX_STATIC_ASSERT(sizeof (uint32_t) == MC_CMD_GET_PARSER_DISP_INFO_OUT_SUPPORTED_MATCHES_LEN); + list_size = matches_count * + MC_CMD_GET_PARSER_DISP_INFO_OUT_SUPPORTED_MATCHES_LEN; + memcpy(buffer, + MCDI_OUT2(req, uint32_t, + GET_PARSER_DISP_INFO_OUT_SUPPORTED_MATCHES), + list_size); + return (0); +fail3: + EFSYS_PROBE(fail3); fail2: EFSYS_PROBE(fail2); fail1: @@ -926,14 +945,55 @@ fail1: __checkReturn efx_rc_t ef10_filter_supported_filters( - __in efx_nic_t *enp, - __out uint32_t *list, - __out size_t *length) + __in efx_nic_t *enp, + __out_ecount(buffer_length) uint32_t *buffer, + __in size_t buffer_length, + __out size_t *list_lengthp) { - efx_rc_t rc; - if ((rc = efx_mcdi_get_parser_disp_info(enp, list, length)) != 0) + size_t mcdi_list_length; + size_t list_length; + uint32_t i; + efx_rc_t rc; + uint32_t all_filter_flags = + (EFX_FILTER_MATCH_REM_HOST | EFX_FILTER_MATCH_LOC_HOST | + EFX_FILTER_MATCH_REM_MAC | EFX_FILTER_MATCH_REM_PORT | + EFX_FILTER_MATCH_LOC_MAC | EFX_FILTER_MATCH_LOC_PORT | + EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_INNER_VID | + EFX_FILTER_MATCH_OUTER_VID | EFX_FILTER_MATCH_IP_PROTO | + EFX_FILTER_MATCH_UNKNOWN_MCAST_DST | + EFX_FILTER_MATCH_UNKNOWN_UCAST_DST); + + rc = efx_mcdi_get_parser_disp_info(enp, buffer, buffer_length, + &mcdi_list_length); + if (rc != 0) { + if (rc == ENOSPC) { + /* Pass through mcdi_list_length for the list length */ + *list_lengthp = mcdi_list_length; + } goto fail1; + } + + /* + * The static assertions in ef10_filter_init() ensure that the values of + * the EFX_FILTER_MATCH flags match those used by MCDI, so they don't + * need to be converted. + * + * In case support is added to MCDI for additional flags, remove any + * matches from the list which include flags we don't support. The order + * of the matches is preserved as they are ordered from highest to + * lowest priority. + */ + EFSYS_ASSERT(mcdi_list_length <= buffer_length); + list_length = 0; + for (i = 0; i < mcdi_list_length; i++) { + if ((buffer[i] & ~all_filter_flags) == 0) { + buffer[list_length] = buffer[i]; + list_length++; + } + } + + *list_lengthp = list_length; return (0); Modified: head/sys/dev/sfxge/common/ef10_impl.h ============================================================================== --- head/sys/dev/sfxge/common/ef10_impl.h Fri Dec 30 12:00:17 2016 (r310815) +++ head/sys/dev/sfxge/common/ef10_impl.h Fri Dec 30 12:02:16 2016 (r310816) @@ -1028,9 +1028,10 @@ ef10_filter_delete( extern __checkReturn efx_rc_t ef10_filter_supported_filters( - __in efx_nic_t *enp, - __out uint32_t *list, - __out size_t *length); + __in efx_nic_t *enp, + __out_ecount(buffer_length) uint32_t *buffer, + __in size_t buffer_length, + __out size_t *list_lengthp); extern __checkReturn efx_rc_t ef10_filter_reconfigure( Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Fri Dec 30 12:00:17 2016 (r310815) +++ head/sys/dev/sfxge/common/efx.h Fri Dec 30 12:02:16 2016 (r310816) @@ -2312,9 +2312,10 @@ efx_filter_restore( extern __checkReturn efx_rc_t efx_filter_supported_filters( - __in efx_nic_t *enp, - __out uint32_t *list, - __out size_t *length); + __in efx_nic_t *enp, + __out_ecount(buffer_length) uint32_t *buffer, + __in size_t buffer_length, + __out size_t *list_lengthp); extern void efx_filter_spec_init_rx( Modified: head/sys/dev/sfxge/common/efx_filter.c ============================================================================== --- head/sys/dev/sfxge/common/efx_filter.c Fri Dec 30 12:00:17 2016 (r310815) +++ head/sys/dev/sfxge/common/efx_filter.c Fri Dec 30 12:02:16 2016 (r310816) @@ -64,9 +64,10 @@ siena_filter_delete( static __checkReturn efx_rc_t siena_filter_supported_filters( - __in efx_nic_t *enp, - __out uint32_t *list, - __out size_t *length); + __in efx_nic_t *enp, + __out_ecount(buffer_length) uint32_t *buffer, + __in size_t buffer_length, + __out size_t *list_lengthp); #endif /* EFSYS_OPT_SIENA */ @@ -212,11 +213,22 @@ efx_filter_fini( enp->en_mod_flags &= ~EFX_MOD_FILTER; } +/* + * Query the possible combinations of match flags which can be filtered on. + * These are returned as a list, of which each 32 bit element is a bitmask + * formed of EFX_FILTER_MATCH flags. + * + * The combinations are ordered in priority from highest to lowest. + * + * If the provided buffer is too short to hold the list, the call with fail with + * ENOSPC and *list_lengthp will be set to the buffer length required. + */ __checkReturn efx_rc_t efx_filter_supported_filters( - __in efx_nic_t *enp, - __out uint32_t *list, - __out size_t *length) + __in efx_nic_t *enp, + __out_ecount(buffer_length) uint32_t *buffer, + __in size_t buffer_length, + __out size_t *list_lengthp) { efx_rc_t rc; @@ -225,11 +237,20 @@ efx_filter_supported_filters( EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_FILTER); EFSYS_ASSERT(enp->en_efop->efo_supported_filters != NULL); - if ((rc = enp->en_efop->efo_supported_filters(enp, list, length)) != 0) + if (buffer == NULL) { + rc = EINVAL; goto fail1; + } + + rc = enp->en_efop->efo_supported_filters(enp, buffer, buffer_length, + list_lengthp); + if (rc != 0) + goto fail2; return (0); +fail2: + EFSYS_PROBE(fail2); fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); @@ -1349,23 +1370,20 @@ fail1: return (rc); } -#define MAX_SUPPORTED 4 +#define SIENA_MAX_SUPPORTED_MATCHES 4 static __checkReturn efx_rc_t siena_filter_supported_filters( - __in efx_nic_t *enp, - __out uint32_t *list, - __out size_t *length) -{ - int index = 0; - uint32_t rx_matches[MAX_SUPPORTED]; + __in efx_nic_t *enp, + __out_ecount(buffer_length) uint32_t *buffer, + __in size_t buffer_length, + __out size_t *list_lengthp) +{ + uint32_t index = 0; + uint32_t rx_matches[SIENA_MAX_SUPPORTED_MATCHES]; + size_t list_length; efx_rc_t rc; - if (list == NULL) { - rc = EINVAL; - goto fail1; - } - rx_matches[index++] = EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_IP_PROTO | EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_LOC_PORT | @@ -1382,14 +1400,22 @@ siena_filter_supported_filters( rx_matches[index++] = EFX_FILTER_MATCH_LOC_MAC; } - EFSYS_ASSERT3U(index, <=, MAX_SUPPORTED); + EFSYS_ASSERT3U(index, <=, SIENA_MAX_SUPPORTED_MATCHES); + list_length = index; + + *list_lengthp = list_length; + + if (buffer_length < list_length) { + rc = ENOSPC; + goto fail1; + } - *length = index; - memcpy(list, rx_matches, *length); + memcpy(buffer, rx_matches, list_length * sizeof (rx_matches[0])); return (0); fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); return (rc); } Modified: head/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- head/sys/dev/sfxge/common/efx_impl.h Fri Dec 30 12:00:17 2016 (r310815) +++ head/sys/dev/sfxge/common/efx_impl.h Fri Dec 30 12:02:16 2016 (r310816) @@ -231,7 +231,8 @@ typedef struct efx_filter_ops_s { efx_rc_t (*efo_add)(efx_nic_t *, efx_filter_spec_t *, boolean_t may_replace); efx_rc_t (*efo_delete)(efx_nic_t *, efx_filter_spec_t *); - efx_rc_t (*efo_supported_filters)(efx_nic_t *, uint32_t *, size_t *); + efx_rc_t (*efo_supported_filters)(efx_nic_t *, uint32_t *, + size_t, size_t *); efx_rc_t (*efo_reconfigure)(efx_nic_t *, uint8_t const *, boolean_t, boolean_t, boolean_t, boolean_t, uint8_t const *, uint32_t); From owner-svn-src-head@freebsd.org Fri Dec 30 12:06:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27A66C96F0D; Fri, 30 Dec 2016 12:06:57 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 024301D9B; Fri, 30 Dec 2016 12:06:56 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUC6ufI068206; Fri, 30 Dec 2016 12:06:56 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUC6txq068199; Fri, 30 Dec 2016 12:06:55 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612301206.uBUC6txq068199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 30 Dec 2016 12:06:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310817 - in head/sys: conf dev/sfxge/common modules/sfxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 12:06:57 -0000 Author: arybchik Date: Fri Dec 30 12:06:55 2016 New Revision: 310817 URL: https://svnweb.freebsd.org/changeset/base/310817 Log: sfxge(4): remove obsolete Wake-On-LAN support Wake-on-lan is not supported in production on any of our adapters, as they don't have the required AUX power connector. (It's possible that AUX power is supplied to some of our ALOM or mezz adapters, but if so then we've never implemented or tested WoL support.) Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8972 Deleted: head/sys/dev/sfxge/common/efx_wol.c Modified: head/sys/conf/files.amd64 head/sys/dev/sfxge/common/efsys.h head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_check.h head/sys/dev/sfxge/common/efx_impl.h head/sys/dev/sfxge/common/efx_nic.c head/sys/modules/sfxge/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Fri Dec 30 12:02:16 2016 (r310816) +++ head/sys/conf/files.amd64 Fri Dec 30 12:06:55 2016 (r310817) @@ -383,7 +383,6 @@ dev/sfxge/common/efx_rx.c optional sfxge dev/sfxge/common/efx_sram.c optional sfxge pci dev/sfxge/common/efx_tx.c optional sfxge pci dev/sfxge/common/efx_vpd.c optional sfxge pci -dev/sfxge/common/efx_wol.c optional sfxge pci dev/sfxge/common/hunt_nic.c optional sfxge pci dev/sfxge/common/mcdi_mon.c optional sfxge pci dev/sfxge/common/medford_nic.c optional sfxge pci Modified: head/sys/dev/sfxge/common/efsys.h ============================================================================== --- head/sys/dev/sfxge/common/efsys.h Fri Dec 30 12:02:16 2016 (r310816) +++ head/sys/dev/sfxge/common/efsys.h Fri Dec 30 12:06:55 2016 (r310817) @@ -266,7 +266,6 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, b #define EFSYS_OPT_BOOTCFG 0 #define EFSYS_OPT_DIAG 0 -#define EFSYS_OPT_WOL 1 #define EFSYS_OPT_RX_SCALE 1 #define EFSYS_OPT_QSTATS 1 #define EFSYS_OPT_FILTER 1 Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Fri Dec 30 12:02:16 2016 (r310816) +++ head/sys/dev/sfxge/common/efx.h Fri Dec 30 12:06:55 2016 (r310817) @@ -1075,7 +1075,6 @@ efx_bist_stop( #define EFX_FEATURE_LFSR_HASH_INSERT 0x00000002 #define EFX_FEATURE_LINK_EVENTS 0x00000004 #define EFX_FEATURE_PERIODIC_MAC_STATS 0x00000008 -#define EFX_FEATURE_WOL 0x00000010 #define EFX_FEATURE_MCDI 0x00000020 #define EFX_FEATURE_LOOKAHEAD_SPLIT 0x00000040 #define EFX_FEATURE_MAC_HEADER_FILTERS 0x00000080 @@ -1459,87 +1458,6 @@ efx_bootcfg_write( #endif /* EFSYS_OPT_BOOTCFG */ -#if EFSYS_OPT_WOL - -typedef enum efx_wol_type_e { - EFX_WOL_TYPE_INVALID, - EFX_WOL_TYPE_MAGIC, - EFX_WOL_TYPE_BITMAP, - EFX_WOL_TYPE_LINK, - EFX_WOL_NTYPES, -} efx_wol_type_t; - -typedef enum efx_lightsout_offload_type_e { - EFX_LIGHTSOUT_OFFLOAD_TYPE_INVALID, - EFX_LIGHTSOUT_OFFLOAD_TYPE_ARP, - EFX_LIGHTSOUT_OFFLOAD_TYPE_NS, -} efx_lightsout_offload_type_t; - -#define EFX_WOL_BITMAP_MASK_SIZE (48) -#define EFX_WOL_BITMAP_VALUE_SIZE (128) - -typedef union efx_wol_param_u { - struct { - uint8_t mac_addr[6]; - } ewp_magic; - struct { - uint8_t mask[EFX_WOL_BITMAP_MASK_SIZE]; /* 1 bit per byte */ - uint8_t value[EFX_WOL_BITMAP_VALUE_SIZE]; /* value to match */ - uint8_t value_len; - } ewp_bitmap; -} efx_wol_param_t; - -typedef union efx_lightsout_offload_param_u { - struct { - uint8_t mac_addr[6]; - uint32_t ip; - } elop_arp; - struct { - uint8_t mac_addr[6]; - uint32_t solicited_node[4]; - uint32_t ip[4]; - } elop_ns; -} efx_lightsout_offload_param_t; - -extern __checkReturn efx_rc_t -efx_wol_init( - __in efx_nic_t *enp); - -extern __checkReturn efx_rc_t -efx_wol_filter_clear( - __in efx_nic_t *enp); - -extern __checkReturn efx_rc_t -efx_wol_filter_add( - __in efx_nic_t *enp, - __in efx_wol_type_t type, - __in efx_wol_param_t *paramp, - __out uint32_t *filter_idp); - -extern __checkReturn efx_rc_t -efx_wol_filter_remove( - __in efx_nic_t *enp, - __in uint32_t filter_id); - -extern __checkReturn efx_rc_t -efx_lightsout_offload_add( - __in efx_nic_t *enp, - __in efx_lightsout_offload_type_t type, - __in efx_lightsout_offload_param_t *paramp, - __out uint32_t *filter_idp); - -extern __checkReturn efx_rc_t -efx_lightsout_offload_remove( - __in efx_nic_t *enp, - __in efx_lightsout_offload_type_t type, - __in uint32_t filter_id); - -extern void -efx_wol_fini( - __in efx_nic_t *enp); - -#endif /* EFSYS_OPT_WOL */ - #if EFSYS_OPT_DIAG typedef enum efx_pattern_type_t { Modified: head/sys/dev/sfxge/common/efx_check.h ============================================================================== --- head/sys/dev/sfxge/common/efx_check.h Fri Dec 30 12:02:16 2016 (r310816) +++ head/sys/dev/sfxge/common/efx_check.h Fri Dec 30 12:06:55 2016 (r310817) @@ -307,10 +307,8 @@ #endif /* EFSYS_OPT_VPD */ /* Support Wake on LAN */ -#if EFSYS_OPT_WOL -# if !EFSYS_OPT_SIENA -# error "WOL requires SIENA" -# endif +#ifdef EFSYS_OPT_WOL +# error "WOL is obsolete and is not supported" #endif /* EFSYS_OPT_WOL */ #ifdef EFSYS_OPT_MCAST_FILTER_LIST Modified: head/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- head/sys/dev/sfxge/common/efx_impl.h Fri Dec 30 12:02:16 2016 (r310816) +++ head/sys/dev/sfxge/common/efx_impl.h Fri Dec 30 12:06:55 2016 (r310817) @@ -74,7 +74,6 @@ extern "C" { #define EFX_MOD_TX 0x00000100 #define EFX_MOD_PORT 0x00000200 #define EFX_MOD_MON 0x00000400 -#define EFX_MOD_WOL 0x00000800 #define EFX_MOD_FILTER 0x00001000 #define EFX_MOD_LIC 0x00002000 Modified: head/sys/dev/sfxge/common/efx_nic.c ============================================================================== --- head/sys/dev/sfxge/common/efx_nic.c Fri Dec 30 12:02:16 2016 (r310816) +++ head/sys/dev/sfxge/common/efx_nic.c Fri Dec 30 12:06:55 2016 (r310817) @@ -268,7 +268,6 @@ efx_nic_create( EFX_FEATURE_LFSR_HASH_INSERT | EFX_FEATURE_LINK_EVENTS | EFX_FEATURE_PERIODIC_MAC_STATS | - EFX_FEATURE_WOL | EFX_FEATURE_MCDI | EFX_FEATURE_LOOKAHEAD_SPLIT | EFX_FEATURE_MAC_HEADER_FILTERS | @@ -279,7 +278,6 @@ efx_nic_create( #if EFSYS_OPT_HUNTINGTON case EFX_FAMILY_HUNTINGTON: enp->en_enop = &__efx_nic_hunt_ops; - /* FIXME: Add WOL support */ enp->en_features = EFX_FEATURE_IPV6 | EFX_FEATURE_LINK_EVENTS | Modified: head/sys/modules/sfxge/Makefile ============================================================================== --- head/sys/modules/sfxge/Makefile Fri Dec 30 12:02:16 2016 (r310816) +++ head/sys/modules/sfxge/Makefile Fri Dec 30 12:06:55 2016 (r310817) @@ -17,7 +17,7 @@ SRCS+= sfxge.h sfxge_rx.h sfxge_tx.h sfx SRCS+= efx_bootcfg.c efx_crc32.c efx_ev.c efx_intr.c efx_lic.c efx_mac.c SRCS+= efx_mcdi.c efx_mon.c efx_nic.c SRCS+= efx_nvram.c efx_phy.c efx_port.c efx_rx.c efx_sram.c efx_tx.c -SRCS+= efx_vpd.c efx_wol.c efx_filter.c efx_hash.c +SRCS+= efx_vpd.c efx_filter.c efx_hash.c SRCS+= efsys.h SRCS+= efx.h efx_check.h efx_impl.h efx_mcdi.h efx_regs.h efx_regs_ef10.h SRCS+= efx_regs_mcdi.h efx_regs_pci.h efx_types.h efx_phy_ids.h From owner-svn-src-head@freebsd.org Fri Dec 30 12:10:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 441EEC96FF2; Fri, 30 Dec 2016 12:10:17 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EDD501F47; Fri, 30 Dec 2016 12:10:16 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUCAGUi068384; Fri, 30 Dec 2016 12:10:16 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUCAGlR068383; Fri, 30 Dec 2016 12:10:16 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612301210.uBUCAGlR068383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 30 Dec 2016 12:10:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310818 - head/sys/dev/sfxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 12:10:17 -0000 Author: arybchik Date: Fri Dec 30 12:10:15 2016 New Revision: 310818 URL: https://svnweb.freebsd.org/changeset/base/310818 Log: sfxge(4): support per-command MCDI timeout Submitted by: Andy Moreton Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Modified: head/sys/dev/sfxge/sfxge_mcdi.c Modified: head/sys/dev/sfxge/sfxge_mcdi.c ============================================================================== --- head/sys/dev/sfxge/sfxge_mcdi.c Fri Dec 30 12:06:55 2016 (r310817) +++ head/sys/dev/sfxge/sfxge_mcdi.c Fri Dec 30 12:10:15 2016 (r310818) @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #define SFXGE_MCDI_POLL_INTERVAL_MIN 10 /* 10us in 1us units */ #define SFXGE_MCDI_POLL_INTERVAL_MAX 100000 /* 100ms in 1us units */ -#define SFXGE_MCDI_WATCHDOG_INTERVAL 10000000 /* 10s in 1us units */ static void sfxge_mcdi_timeout(struct sfxge_softc *sc) @@ -70,7 +69,7 @@ sfxge_mcdi_timeout(struct sfxge_softc *s } static void -sfxge_mcdi_poll(struct sfxge_softc *sc) +sfxge_mcdi_poll(struct sfxge_softc *sc, uint32_t timeout_us) { efx_nic_t *enp; clock_t delay_total; @@ -87,7 +86,7 @@ sfxge_mcdi_poll(struct sfxge_softc *sc) return; } - if (delay_total > SFXGE_MCDI_WATCHDOG_INTERVAL) { + if (delay_total > timeout_us) { aborted = efx_mcdi_request_abort(enp); KASSERT(aborted, ("abort failed")); sfxge_mcdi_timeout(sc); @@ -115,6 +114,7 @@ sfxge_mcdi_execute(void *arg, efx_mcdi_r { struct sfxge_softc *sc; struct sfxge_mcdi *mcdi; + uint32_t timeout_us = 0; sc = (struct sfxge_softc *)arg; mcdi = &sc->mcdi; @@ -125,8 +125,11 @@ sfxge_mcdi_execute(void *arg, efx_mcdi_r ("MCDI not initialized")); /* Issue request and poll for completion. */ + efx_mcdi_get_timeout(sc->enp, emrp, &timeout_us); + KASSERT(timeout_us > 0, ("MCDI timeout not initialized")); + efx_mcdi_request_start(sc->enp, emrp, B_FALSE); - sfxge_mcdi_poll(sc); + sfxge_mcdi_poll(sc, timeout_us); SFXGE_MCDI_UNLOCK(mcdi); } From owner-svn-src-head@freebsd.org Fri Dec 30 12:19:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42B7CC972F7; Fri, 30 Dec 2016 12:19:42 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03BB516B6; Fri, 30 Dec 2016 12:19:41 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUCJfFW072777; Fri, 30 Dec 2016 12:19:41 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUCJeHV072773; Fri, 30 Dec 2016 12:19:40 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612301219.uBUCJeHV072773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 30 Dec 2016 12:19:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310819 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 12:19:42 -0000 Author: arybchik Date: Fri Dec 30 12:19:40 2016 New Revision: 310819 URL: https://svnweb.freebsd.org/changeset/base/310819 Log: sfxge(4): cleanup: add efsys_lock_state_t for type of state param in EFSYS_LOCK() This allows the common code to use the correct type for the lock state local variable passed to EFSYS_LOCK() and EFSYS_UNLOCK(). On Windows, this allows warning supression pragmas to be removed. Submitted by: Andy Moreton Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/ef10_filter.c head/sys/dev/sfxge/common/efsys.h head/sys/dev/sfxge/common/efx_filter.c head/sys/dev/sfxge/common/efx_mcdi.c Modified: head/sys/dev/sfxge/common/ef10_filter.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_filter.c Fri Dec 30 12:10:15 2016 (r310818) +++ head/sys/dev/sfxge/common/ef10_filter.c Fri Dec 30 12:19:40 2016 (r310819) @@ -471,7 +471,7 @@ ef10_filter_restore( efx_filter_spec_t *spec; ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table; boolean_t restoring; - int state; + efsys_lock_state_t state; efx_rc_t rc; EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || @@ -546,7 +546,7 @@ ef10_filter_add_internal( int ins_index; boolean_t replacing = B_FALSE; unsigned int i; - int state; + efsys_lock_state_t state; boolean_t locked = B_FALSE; EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || @@ -748,7 +748,7 @@ ef10_filter_delete_internal( efx_rc_t rc; ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; efx_filter_spec_t *spec; - int state; + efsys_lock_state_t state; uint32_t filter_idx = filter_id % EFX_EF10_FILTER_TBL_ROWS; /* @@ -822,7 +822,7 @@ ef10_filter_delete( unsigned int hash; unsigned int depth; unsigned int i; - int state; + efsys_lock_state_t state; boolean_t locked = B_FALSE; EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || Modified: head/sys/dev/sfxge/common/efsys.h ============================================================================== --- head/sys/dev/sfxge/common/efsys.h Fri Dec 30 12:10:15 2016 (r310818) +++ head/sys/dev/sfxge/common/efsys.h Fri Dec 30 12:19:40 2016 (r310819) @@ -1094,6 +1094,8 @@ typedef struct efsys_lock_s { #define SFXGE_EFSYS_LOCK_ASSERT_OWNED(_eslp) \ mtx_assert(&(_eslp)->lock, MA_OWNED) +typedef int efsys_lock_state_t; + #define EFSYS_LOCK_MAGIC 0x000010c4 #define EFSYS_LOCK(_lockp, _state) \ Modified: head/sys/dev/sfxge/common/efx_filter.c ============================================================================== --- head/sys/dev/sfxge/common/efx_filter.c Fri Dec 30 12:10:15 2016 (r310818) +++ head/sys/dev/sfxge/common/efx_filter.c Fri Dec 30 12:19:40 2016 (r310819) @@ -1047,7 +1047,7 @@ siena_filter_tbl_clear( siena_filter_t *sfp = enp->en_filter.ef_siena_filter; siena_filter_tbl_t *sftp = &sfp->sf_tbl[tbl_id]; int index; - int state; + efsys_lock_state_t state; EFSYS_LOCK(enp->en_eslp, state); @@ -1195,7 +1195,7 @@ siena_filter_restore( siena_filter_spec_t *spec; efx_oword_t filter; int filter_idx; - int state; + efsys_lock_state_t state; uint32_t key; efx_rc_t rc; @@ -1253,7 +1253,7 @@ siena_filter_add( efx_oword_t filter; int filter_idx; unsigned int depth; - int state; + efsys_lock_state_t state; uint32_t key; @@ -1334,7 +1334,7 @@ siena_filter_delete( efx_oword_t filter; int filter_idx; unsigned int depth; - int state; + efsys_lock_state_t state; uint32_t key; EFSYS_ASSERT3P(spec, !=, NULL); Modified: head/sys/dev/sfxge/common/efx_mcdi.c ============================================================================== --- head/sys/dev/sfxge/common/efx_mcdi.c Fri Dec 30 12:10:15 2016 (r310818) +++ head/sys/dev/sfxge/common/efx_mcdi.c Fri Dec 30 12:19:40 2016 (r310819) @@ -183,7 +183,7 @@ efx_mcdi_new_epoch( __in efx_nic_t *enp) { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); - int state; + efsys_lock_state_t state; /* Start a new epoch (allow fresh MCDI requests to succeed) */ EFSYS_LOCK(enp->en_eslp, state); @@ -254,7 +254,7 @@ efx_mcdi_request_start( unsigned int seq; unsigned int xflags; boolean_t new_epoch; - int state; + efsys_lock_state_t state; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_MCDI); @@ -502,7 +502,7 @@ efx_mcdi_request_poll( { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); efx_mcdi_req_t *emrp; - int state; + efsys_lock_state_t state; efx_rc_t rc; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); @@ -570,7 +570,7 @@ efx_mcdi_request_abort( efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); efx_mcdi_req_t *emrp; boolean_t aborted; - int state; + efsys_lock_state_t state; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_MCDI); @@ -756,7 +756,7 @@ efx_mcdi_ev_cpl( efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp; efx_mcdi_req_t *emrp; - int state; + efsys_lock_state_t state; EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_MCDI); EFSYS_ASSERT3U(enp->en_features, &, EFX_FEATURE_MCDI); @@ -867,7 +867,7 @@ efx_mcdi_ev_death( const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp; efx_mcdi_req_t *emrp = NULL; boolean_t ev_cpl; - int state; + efsys_lock_state_t state; /* * The MCDI request (if there is one) has been terminated, either From owner-svn-src-head@freebsd.org Fri Dec 30 12:23:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4040C975B3; Fri, 30 Dec 2016 12:23:03 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B3561B5A; Fri, 30 Dec 2016 12:23:03 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUCN2fD076638; Fri, 30 Dec 2016 12:23:02 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUCN24l076637; Fri, 30 Dec 2016 12:23:02 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201612301223.uBUCN24l076637@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 30 Dec 2016 12:23:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310820 - head/sys/dev/sfxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 12:23:03 -0000 Author: arybchik Date: Fri Dec 30 12:23:02 2016 New Revision: 310820 URL: https://svnweb.freebsd.org/changeset/base/310820 Log: sfxge(4): move queue size checks to after the NIC config has been populated Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8974 Modified: head/sys/dev/sfxge/sfxge.c Modified: head/sys/dev/sfxge/sfxge.c ============================================================================== --- head/sys/dev/sfxge/sfxge.c Fri Dec 30 12:19:40 2016 (r310819) +++ head/sys/dev/sfxge/sfxge.c Fri Dec 30 12:23:02 2016 (r310820) @@ -737,6 +737,16 @@ sfxge_create(struct sfxge_softc *sc) goto fail3; sc->enp = enp; + /* Initialize MCDI to talk to the microcontroller. */ + DBGPRINT(sc->dev, "mcdi_init..."); + if ((error = sfxge_mcdi_init(sc)) != 0) + goto fail4; + + /* Probe the NIC and build the configuration data area. */ + DBGPRINT(sc->dev, "nic_probe..."); + if ((error = efx_nic_probe(enp)) != 0) + goto fail5; + if (!ISP2(sfxge_rx_ring_entries) || (sfxge_rx_ring_entries < EFX_RXQ_MINNDESCS) || (sfxge_rx_ring_entries > EFX_RXQ_MAXNDESCS)) { @@ -759,16 +769,6 @@ sfxge_create(struct sfxge_softc *sc) } sc->txq_entries = sfxge_tx_ring_entries; - /* Initialize MCDI to talk to the microcontroller. */ - DBGPRINT(sc->dev, "mcdi_init..."); - if ((error = sfxge_mcdi_init(sc)) != 0) - goto fail4; - - /* Probe the NIC and build the configuration data area. */ - DBGPRINT(sc->dev, "nic_probe..."); - if ((error = efx_nic_probe(enp)) != 0) - goto fail5; - SYSCTL_ADD_STRING(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "version", CTLFLAG_RD, @@ -861,14 +861,14 @@ fail7: efx_nvram_fini(enp); fail6: +fail_tx_ring_entries: +fail_rx_ring_entries: efx_nic_unprobe(enp); fail5: sfxge_mcdi_fini(sc); fail4: -fail_tx_ring_entries: -fail_rx_ring_entries: sc->enp = NULL; efx_nic_destroy(enp); SFXGE_EFSYS_LOCK_DESTROY(&sc->enp_lock); From owner-svn-src-head@freebsd.org Fri Dec 30 13:04:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC524C97117; Fri, 30 Dec 2016 13:04:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8991710FC; Fri, 30 Dec 2016 13:04:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUD4hYu093177; Fri, 30 Dec 2016 13:04:43 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUD4hBH093176; Fri, 30 Dec 2016 13:04:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612301304.uBUD4hBH093176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 30 Dec 2016 13:04:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310821 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 13:04:44 -0000 Author: kib Date: Fri Dec 30 13:04:43 2016 New Revision: 310821 URL: https://svnweb.freebsd.org/changeset/base/310821 Log: Style. Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Fri Dec 30 12:23:02 2016 (r310820) +++ head/sys/vm/vm_map.c Fri Dec 30 13:04:43 2016 (r310821) @@ -2927,8 +2927,8 @@ vm_map_entry_delete(vm_map_t map, vm_map offidxstart = OFF_TO_IDX(entry->offset); offidxend = offidxstart + count; VM_OBJECT_WLOCK(object); - if (object->ref_count != 1 && - ((object->flags & (OBJ_NOSPLIT|OBJ_ONEMAPPING)) == OBJ_ONEMAPPING || + if (object->ref_count != 1 && ((object->flags & (OBJ_NOSPLIT | + OBJ_ONEMAPPING)) == OBJ_ONEMAPPING || object == kernel_object || object == kmem_object)) { vm_object_collapse(object); @@ -2941,7 +2941,8 @@ vm_map_entry_delete(vm_map_t map, vm_map vm_object_page_remove(object, offidxstart, offidxend, OBJPR_NOTMAPPED); if (object->type == OBJT_SWAP) - swap_pager_freespace(object, offidxstart, count); + swap_pager_freespace(object, offidxstart, + count); if (offidxend >= object->size && offidxstart < object->size) { size1 = object->size; @@ -2949,8 +2950,9 @@ vm_map_entry_delete(vm_map_t map, vm_map if (object->cred != NULL) { size1 -= object->size; KASSERT(object->charge >= ptoa(size1), - ("vm_map_entry_delete: object->charge < 0")); - swap_release_by_cred(ptoa(size1), object->cred); + ("object %p charge < 0", object)); + swap_release_by_cred(ptoa(size1), + object->cred); object->charge -= ptoa(size1); } } @@ -3168,13 +3170,15 @@ vm_map_copy_entry( if ((src_object = src_entry->object.vm_object) != NULL) { VM_OBJECT_WLOCK(src_object); charged = ENTRY_CHARGED(src_entry); - if ((src_object->handle == NULL) && - (src_object->type == OBJT_DEFAULT || - src_object->type == OBJT_SWAP)) { + if (src_object->handle == NULL && + (src_object->type == OBJT_DEFAULT || + src_object->type == OBJT_SWAP)) { vm_object_collapse(src_object); - if ((src_object->flags & (OBJ_NOSPLIT|OBJ_ONEMAPPING)) == OBJ_ONEMAPPING) { + if ((src_object->flags & (OBJ_NOSPLIT | + OBJ_ONEMAPPING)) == OBJ_ONEMAPPING) { vm_object_split(src_entry); - src_object = src_entry->object.vm_object; + src_object = + src_entry->object.vm_object; } } vm_object_reference_locked(src_object); @@ -3201,8 +3205,10 @@ vm_map_copy_entry( *fork_charge += size; } } - src_entry->eflags |= (MAP_ENTRY_COW|MAP_ENTRY_NEEDS_COPY); - dst_entry->eflags |= (MAP_ENTRY_COW|MAP_ENTRY_NEEDS_COPY); + src_entry->eflags |= MAP_ENTRY_COW | + MAP_ENTRY_NEEDS_COPY; + dst_entry->eflags |= MAP_ENTRY_COW | + MAP_ENTRY_NEEDS_COPY; dst_entry->offset = src_entry->offset; if (src_entry->eflags & MAP_ENTRY_VN_WRITECNT) { /* @@ -3825,10 +3831,10 @@ Retry: rv = KERN_NO_SPACE; /* Grow the underlying object if applicable. */ else if (stack_entry->object.vm_object == NULL || - vm_object_coalesce(stack_entry->object.vm_object, - stack_entry->offset, - (vm_size_t)(stack_entry->end - stack_entry->start), - (vm_size_t)grow_amount, cred != NULL)) { + vm_object_coalesce(stack_entry->object.vm_object, + stack_entry->offset, + (vm_size_t)(stack_entry->end - stack_entry->start), + (vm_size_t)grow_amount, cred != NULL)) { map->size += (addr - stack_entry->end); /* Update the current entry. */ stack_entry->end = addr; From owner-svn-src-head@freebsd.org Fri Dec 30 13:39:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32638C97AA5; Fri, 30 Dec 2016 13:39:32 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x244.google.com (mail-io0-x244.google.com [IPv6:2607:f8b0:4001:c06::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EF3CC13B1; Fri, 30 Dec 2016 13:39:31 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x244.google.com with SMTP id n85so21900422ioi.1; Fri, 30 Dec 2016 05:39:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=JrMUF5xdjCdh9hGG6gSG1jJJCjMdrKHg6fTFe0yNotg=; b=qPfxCPzyfd49rxuwWZ+OXoBwMt0GThknd+Xnjxe8iLzs1MvlAgK0c9ULYpiYQyVNtb BwBXA+hXqNFhxQSnSQa3vE+7NNfQZg8jHymdQh3IzJrUP/phE5qPXvmVq4FZV3BwHEVE pK/HqwZ25IO5clFoRlhbWoObwJlEpOsFHGLWgavBB4Zi0g9yO75rz49V7ubQWYAaj2Ml zWTjqTANGWWBMDPwCXvZZl6paw6IgbLlG2aTt5AZeTE0IL09PZOBKsjSCinn/2DQxko/ 6XaJcfxmOmUfn1GV39zhry2oGZ/IE6r+0NFnyRFMv6R0/3We8qXC6YCwj7BZsaULK8b6 cTcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=JrMUF5xdjCdh9hGG6gSG1jJJCjMdrKHg6fTFe0yNotg=; b=NXPZyMPRHcpCfjwQKUQVoPMOStZsFzj3aZCIB4NxN/6Tbkge+KCevtpg3Wi1vdvafm nSE9xwqS2/kU7iP+jo2SyvD2Xlu0T7x6tXju4PSigNCGxS96WTIzf2a9firgAWivJ0pb oPTotFC5KkE97bopYmZ22j6KJqB/fHTyfnmwXvDLgykAnfDJeEfnmeTBD+iPdR06uXhn CZZEkg5zVliY4DqYAwO1D928ft/xRrIqPGGlqzU7x4+ivRZPB2JINdlmFZn/Vom360ST FufK/G2js09FEjsHEX4zxP4YPtY7IGjhh8zDfXXdKChcaao+YSEAIVMZ+2tkhxQBNW1y TlEw== X-Gm-Message-State: AIkVDXI+0EMzE4WWsvHQ3HCBt2lNW+aSBAPcNnfnKlKoKI4VcyeCB5NCnbgNb9tdUFgUtT34R4FjabtZAoSAHA== X-Received: by 10.107.23.134 with SMTP id 128mr31845801iox.162.1483105170113; Fri, 30 Dec 2016 05:39:30 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.175.133 with HTTP; Fri, 30 Dec 2016 05:39:09 -0800 (PST) In-Reply-To: <1A7F0D4F-1F4D-4885-B7E9-F764D4FA72BF@panasas.com> References: <201612292130.uBTLUqus011628@repo.freebsd.org> <1A7F0D4F-1F4D-4885-B7E9-F764D4FA72BF@panasas.com> From: Ed Maste Date: Fri, 30 Dec 2016 08:39:09 -0500 X-Google-Sender-Auth: APl1142Gifjx5M41Mh1GFn15cbY Message-ID: Subject: Re: svn commit: r310789 - head/lib/libpam/static_libpam To: Ravi Pokala Cc: Alexander Kabaev , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 13:39:32 -0000 On 29 December 2016 at 19:59, Ravi Pokala wrote: > > I'm a little confused - the original version had to have had a compile-on= ly step to generate the object first, before running the link-only operatio= n against the object. The new code replaces the link-only operation with a = compile+link operation. Shouldn't the pre-existing compile-only operation b= e removed, since the new compile+link operation supersedes it? Hi Ravi, This change: >> - ${LD} -o ${.TARGET} -r --whole-archive ${.ALLSRC} >> + ${CC} -nostdlib ${CFLAGS} -o ${.TARGET} -r -Wl,--whole-archive ${.= ALLSRC} is not actually compiling, it's just invoking the compiler driver to in turn invoke the linker. The input in ${.ALLSRC} is still a collection of object files. From owner-svn-src-head@freebsd.org Fri Dec 30 14:47:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDF04C97D42; Fri, 30 Dec 2016 14:47:47 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D60F161C; Fri, 30 Dec 2016 14:47:47 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUElkth034739; Fri, 30 Dec 2016 14:47:46 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUElkDI034738; Fri, 30 Dec 2016 14:47:46 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201612301447.uBUElkDI034738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 30 Dec 2016 14:47:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310822 - head/sys/dev/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 14:47:47 -0000 Author: adrian Date: Fri Dec 30 14:47:46 2016 New Revision: 310822 URL: https://svnweb.freebsd.org/changeset/base/310822 Log: [netmap] fix locking regressions * Firmware oriented NICs may need to sleep in their configuration paths. Use RLOCK instead of WLOCK to allow this to again occur. This fixes netmap on cxgbe. * Change the worker lock to a normal mutex rather than a spin lock. Drivers shouldn't be doing netmap work from the fast interrupt handlers, so it's not required to be a spinlock. Submitted by: luigi, Vincenzo Maffione Reviewed by: jhb Modified: head/sys/dev/netmap/netmap_freebsd.c Modified: head/sys/dev/netmap/netmap_freebsd.c ============================================================================== --- head/sys/dev/netmap/netmap_freebsd.c Fri Dec 30 13:04:43 2016 (r310821) +++ head/sys/dev/netmap/netmap_freebsd.c Fri Dec 30 14:47:46 2016 (r310822) @@ -92,7 +92,7 @@ nm_os_selinfo_uninit(NM_SELINFO_T *si) void nm_os_ifnet_lock(void) { - IFNET_WLOCK(); + IFNET_RLOCK(); } void @@ -1090,8 +1090,8 @@ nm_kthread_worker(void *data) continue; } else if (nmk->run) { /* wait on event with one second timeout */ - msleep_spin((void *)(uintptr_t)ctx->cfg.wchan, - &nmk->worker_lock, "nmk_ev", hz); + msleep((void *)(uintptr_t)ctx->cfg.wchan, + &nmk->worker_lock, 0, "nmk_ev", hz); nmk->scheduled++; } mtx_unlock(&nmk->worker_lock); @@ -1122,7 +1122,7 @@ nm_os_kthread_create(struct nm_kthread_c if (!nmk) return NULL; - mtx_init(&nmk->worker_lock, "nm_kthread lock", NULL, MTX_SPIN); + mtx_init(&nmk->worker_lock, "nm_kthread lock", NULL, MTX_DEF); nmk->worker_ctx.worker_fn = cfg->worker_fn; nmk->worker_ctx.worker_private = cfg->worker_private; nmk->worker_ctx.type = cfg->type; From owner-svn-src-head@freebsd.org Fri Dec 30 14:54:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD667C971D9; Fri, 30 Dec 2016 14:54:55 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C9561E6B; Fri, 30 Dec 2016 14:54:55 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUEssW1039068; Fri, 30 Dec 2016 14:54:54 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUEssCb039067; Fri, 30 Dec 2016 14:54:54 GMT (envelope-from des@FreeBSD.org) Message-Id: <201612301454.uBUEssCb039067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Fri, 30 Dec 2016 14:54:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310823 - head/lib/libfetch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 14:54:55 -0000 Author: des Date: Fri Dec 30 14:54:54 2016 New Revision: 310823 URL: https://svnweb.freebsd.org/changeset/base/310823 Log: Fix inverted loop condition which broke multi-line responses to CONNECT. PR: 194483 Submitted by: Miłosz Kaniewski MFC after: 1 week Modified: head/lib/libfetch/http.c Modified: head/lib/libfetch/http.c ============================================================================== --- head/lib/libfetch/http.c Fri Dec 30 14:47:46 2016 (r310822) +++ head/lib/libfetch/http.c Fri Dec 30 14:54:54 2016 (r310823) @@ -1432,7 +1432,7 @@ http_connect(struct url *URL, struct url default: /* ignore */ ; } - } while (h < hdr_end); + } while (h > hdr_end); } if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0 && fetch_ssl(conn, URL, verbose) == -1) { From owner-svn-src-head@freebsd.org Fri Dec 30 16:06:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0A15C9751B; Fri, 30 Dec 2016 16:06:06 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C05FB1DB7; Fri, 30 Dec 2016 16:06:06 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUG65Qa067227; Fri, 30 Dec 2016 16:06:05 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUG65MI067225; Fri, 30 Dec 2016 16:06:05 GMT (envelope-from br@FreeBSD.org) Message-Id: <201612301606.uBUG65MI067225@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 30 Dec 2016 16:06:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310824 - head/sys/dev/xdma X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 16:06:07 -0000 Author: br Date: Fri Dec 30 16:06:05 2016 New Revision: 310824 URL: https://svnweb.freebsd.org/changeset/base/310824 Log: o Fix unlocking. o Fix types for ds_addr/ds_len. Sponsored by: DARPA, AFRL Modified: head/sys/dev/xdma/xdma.c head/sys/dev/xdma/xdma.h Modified: head/sys/dev/xdma/xdma.c ============================================================================== --- head/sys/dev/xdma/xdma.c Fri Dec 30 14:54:54 2016 (r310823) +++ head/sys/dev/xdma/xdma.c Fri Dec 30 16:06:05 2016 (r310824) @@ -412,7 +412,7 @@ xdma_prep_memcpy(xdma_channel_t *xchan, if (ret != 0) { device_printf(xdma->dev, "%s: Can't prepare memcpy transfer.\n", __func__); - XDMA_UNLOCK(); + XCHAN_UNLOCK(xchan); return (-1); } @@ -460,7 +460,8 @@ xdma_prep_cyclic(xdma_channel_t *xchan, if (ret != 0) { device_printf(xdma->dev, "%s: Can't prepare cyclic transfer.\n", __func__); - XDMA_UNLOCK(); + XCHAN_UNLOCK(xchan); + return (-1); } Modified: head/sys/dev/xdma/xdma.h ============================================================================== --- head/sys/dev/xdma/xdma.h Fri Dec 30 14:54:54 2016 (r310823) +++ head/sys/dev/xdma/xdma.h Fri Dec 30 16:06:05 2016 (r310824) @@ -77,8 +77,8 @@ struct xdma_channel_config { typedef struct xdma_channel_config xdma_config_t; struct xdma_descriptor { - uintptr_t ds_addr; - uint32_t ds_len; + bus_addr_t ds_addr; + bus_size_t ds_len; }; typedef struct xdma_descriptor xdma_descriptor_t; From owner-svn-src-head@freebsd.org Fri Dec 30 16:26:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDFD3C97CBE; Fri, 30 Dec 2016 16:26:55 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D81E1DBC; Fri, 30 Dec 2016 16:26:55 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUGQsvr075790; Fri, 30 Dec 2016 16:26:54 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUGQs1w075789; Fri, 30 Dec 2016 16:26:54 GMT (envelope-from br@FreeBSD.org) Message-Id: <201612301626.uBUGQs1w075789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 30 Dec 2016 16:26:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310828 - head/sys/dev/xdma X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 16:26:55 -0000 Author: br Date: Fri Dec 30 16:26:54 2016 New Revision: 310828 URL: https://svnweb.freebsd.org/changeset/base/310828 Log: Add parenthesis. Noticed by: hps Sponsored by: DARPA, AFRL Modified: head/sys/dev/xdma/xdma.c Modified: head/sys/dev/xdma/xdma.c ============================================================================== --- head/sys/dev/xdma/xdma.c Fri Dec 30 16:23:13 2016 (r310827) +++ head/sys/dev/xdma/xdma.c Fri Dec 30 16:26:54 2016 (r310828) @@ -73,9 +73,9 @@ static struct mtx xdma_mtx; /* * Per channel locks. */ -#define XCHAN_LOCK(xchan) mtx_lock(&xchan->mtx_lock) -#define XCHAN_UNLOCK(xchan) mtx_unlock(&xchan->mtx_lock) -#define XCHAN_ASSERT_LOCKED(xchan) mtx_assert(&xchan->mtx_lock, MA_OWNED) +#define XCHAN_LOCK(xchan) mtx_lock(&(xchan)->mtx_lock) +#define XCHAN_UNLOCK(xchan) mtx_unlock(&(xchan)->mtx_lock) +#define XCHAN_ASSERT_LOCKED(xchan) mtx_assert(&(xchan)->mtx_lock, MA_OWNED) /* * Allocate virtual xDMA channel. From owner-svn-src-head@freebsd.org Fri Dec 30 17:12:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 742C2C9726D; Fri, 30 Dec 2016 17:12:42 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4402A11F5; Fri, 30 Dec 2016 17:12:42 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUHCf9w097145; Fri, 30 Dec 2016 17:12:41 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUHCfaW097144; Fri, 30 Dec 2016 17:12:41 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201612301712.uBUHCfaW097144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Fri, 30 Dec 2016 17:12:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310829 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 17:12:42 -0000 Author: kan Date: Fri Dec 30 17:12:41 2016 New Revision: 310829 URL: https://svnweb.freebsd.org/changeset/base/310829 Log: Restore status quo: mips64 does not need subr_sfbuf.c Reported by: br Modified: head/sys/conf/files.mips Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Fri Dec 30 16:26:54 2016 (r310828) +++ head/sys/conf/files.mips Fri Dec 30 17:12:41 2016 (r310829) @@ -52,7 +52,8 @@ kern/kern_clocksource.c standard kern/link_elf_obj.c standard kern/subr_busdma_bufalloc.c standard kern/subr_dummy_vdso_tc.c standard -kern/subr_sfbuf.c standard +kern/subr_sfbuf.c optional mips | mipsel | mipsn32 +kern/subr_sfbuf.c optional mipshf | mipselhf # gcc/clang runtime libkern/ffsl.c standard From owner-svn-src-head@freebsd.org Fri Dec 30 17:37:07 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF676C97A1D; Fri, 30 Dec 2016 17:37:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F3A8130B; Fri, 30 Dec 2016 17:37:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUHb6L7005884; Fri, 30 Dec 2016 17:37:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUHb62e005883; Fri, 30 Dec 2016 17:37:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612301737.uBUHb62e005883@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 30 Dec 2016 17:37:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310834 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 17:37:07 -0000 Author: kib Date: Fri Dec 30 17:37:06 2016 New Revision: 310834 URL: https://svnweb.freebsd.org/changeset/base/310834 Log: Assert that the pages found on the object queue by vm_page_next() and vm_page_prev() have correct ownership. In collaboration with: alc Sponsored by: The FreeBSD Foundation (kib) MFC after: 1 week Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Dec 30 17:36:08 2016 (r310833) +++ head/sys/vm/vm_page.c Fri Dec 30 17:37:06 2016 (r310834) @@ -1328,9 +1328,11 @@ vm_page_next(vm_page_t m) vm_page_t next; VM_OBJECT_ASSERT_LOCKED(m->object); - if ((next = TAILQ_NEXT(m, listq)) != NULL && - next->pindex != m->pindex + 1) - next = NULL; + if ((next = TAILQ_NEXT(m, listq)) != NULL) { + MPASS(next->object == m->object); + if (next->pindex != m->pindex + 1) + next = NULL; + } return (next); } @@ -1346,9 +1348,11 @@ vm_page_prev(vm_page_t m) vm_page_t prev; VM_OBJECT_ASSERT_LOCKED(m->object); - if ((prev = TAILQ_PREV(m, pglist, listq)) != NULL && - prev->pindex != m->pindex - 1) - prev = NULL; + if ((prev = TAILQ_PREV(m, pglist, listq)) != NULL) { + MPASS(prev->object == m->object); + if (prev->pindex != m->pindex - 1) + prev = NULL; + } return (prev); } From owner-svn-src-head@freebsd.org Fri Dec 30 18:00:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5C0AC9759F; Fri, 30 Dec 2016 18:00:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 906D918E1; Fri, 30 Dec 2016 18:00:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUI0V5T014526; Fri, 30 Dec 2016 18:00:31 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUI0VlF014524; Fri, 30 Dec 2016 18:00:31 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201612301800.uBUI0VlF014524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 30 Dec 2016 18:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310840 - in head: lib/clang/libllvm usr.bin/clang X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 18:00:32 -0000 Author: dim Date: Fri Dec 30 18:00:31 2016 New Revision: 310840 URL: https://svnweb.freebsd.org/changeset/base/310840 Log: Reapply 310775, now it also builds correctly if lldb is disabled: Move llvm-objdump from CLANG_EXTRAS to installed by default We currently install three tools from binutils 2.17.50: as, ld, and objdump. Work is underway to migrate to a permissively-licensed tool-chain, with one goal being the retirement of binutils 2.17.50. LLVM's llvm-objdump is intended to be compatible with GNU objdump although it is currently missing some options and may have formatting differences. Enable it by default for testing and further investigation. It may later be changed to install as /usr/bin/objdump, it becomes a fully viable replacement. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D8879 Modified: head/lib/clang/libllvm/Makefile head/usr.bin/clang/Makefile Modified: head/lib/clang/libllvm/Makefile ============================================================================== --- head/lib/clang/libllvm/Makefile Fri Dec 30 17:57:14 2016 (r310839) +++ head/lib/clang/libllvm/Makefile Fri Dec 30 18:00:31 2016 (r310840) @@ -308,24 +308,24 @@ SRCS_MIN+= DebugInfo/CodeView/TypeRecord SRCS_MIN+= DebugInfo/CodeView/TypeRecordBuilder.cpp SRCS_MIN+= DebugInfo/CodeView/TypeStreamMerger.cpp SRCS_MIN+= DebugInfo/CodeView/TypeTableBuilder.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFAcceleratorTable.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFCompileUnit.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFContext.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugAbbrev.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugArangeSet.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugAranges.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugFrame.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugInfoEntry.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugLine.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugLoc.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugMacro.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFDebugRangeList.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFFormValue.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFTypeUnit.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFUnit.cpp -SRCS_EXT+= DebugInfo/DWARF/DWARFUnitIndex.cpp -SRCS_EXT+= DebugInfo/DWARF/SyntaxHighlighting.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFAcceleratorTable.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFCompileUnit.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFContext.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugAbbrev.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugArangeSet.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugAranges.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugFrame.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugInfoEntry.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugLine.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugLoc.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugMacro.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFDebugRangeList.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFFormValue.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFTypeUnit.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFUnit.cpp +SRCS_MIW+= DebugInfo/DWARF/DWARFUnitIndex.cpp +SRCS_MIW+= DebugInfo/DWARF/SyntaxHighlighting.cpp SRCS_EXT+= DebugInfo/PDB/GenericError.cpp SRCS_EXT+= DebugInfo/PDB/PDB.cpp SRCS_EXT+= DebugInfo/PDB/PDBContext.cpp @@ -484,10 +484,10 @@ SRCS_MIN+= MC/MCCodeEmitter.cpp SRCS_MIN+= MC/MCCodeView.cpp SRCS_MIN+= MC/MCContext.cpp SRCS_XDL+= MC/MCDisassembler/Disassembler.cpp -SRCS_XDB+= MC/MCDisassembler/MCDisassembler.cpp -SRCS_XDB+= MC/MCDisassembler/MCExternalSymbolizer.cpp +SRCS_XDW+= MC/MCDisassembler/MCDisassembler.cpp +SRCS_XDW+= MC/MCDisassembler/MCExternalSymbolizer.cpp SRCS_MIN+= MC/MCDisassembler/MCRelocationInfo.cpp -SRCS_XDB+= MC/MCDisassembler/MCSymbolizer.cpp +SRCS_XDW+= MC/MCDisassembler/MCSymbolizer.cpp SRCS_MIN+= MC/MCDwarf.cpp SRCS_MIN+= MC/MCELFObjectTargetWriter.cpp SRCS_MIN+= MC/MCELFStreamer.cpp @@ -698,8 +698,8 @@ SRCS_MIN+= Target/AArch64/AArch64TargetM SRCS_MIN+= Target/AArch64/AArch64TargetObjectFile.cpp SRCS_MIN+= Target/AArch64/AArch64TargetTransformInfo.cpp SRCS_MIN+= Target/AArch64/AsmParser/AArch64AsmParser.cpp -SRCS_XDB+= Target/AArch64/Disassembler/AArch64Disassembler.cpp -SRCS_XDB+= Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp +SRCS_XDW+= Target/AArch64/Disassembler/AArch64Disassembler.cpp +SRCS_XDW+= Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp SRCS_MIN+= Target/AArch64/InstPrinter/AArch64InstPrinter.cpp SRCS_MIN+= Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp SRCS_MIN+= Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp @@ -760,7 +760,7 @@ SRCS_MIN+= Target/ARM/Thumb2InstrInfo.cp SRCS_MIN+= Target/ARM/Thumb2SizeReduction.cpp SRCS_MIN+= Target/ARM/ThumbRegisterInfo.cpp SRCS_MIN+= Target/Mips/AsmParser/MipsAsmParser.cpp -SRCS_XDB+= Target/Mips/Disassembler/MipsDisassembler.cpp +SRCS_XDW+= Target/Mips/Disassembler/MipsDisassembler.cpp SRCS_MIN+= Target/Mips/InstPrinter/MipsInstPrinter.cpp SRCS_MIN+= Target/Mips/MCTargetDesc/MipsABIFlagsSection.cpp SRCS_MIN+= Target/Mips/MCTargetDesc/MipsABIInfo.cpp @@ -849,7 +849,7 @@ SRCS_MIN+= Target/PowerPC/PPCVSXSwapRemo SRCS_MIN+= Target/PowerPC/TargetInfo/PowerPCTargetInfo.cpp SRCS_MIN+= Target/Sparc/AsmParser/SparcAsmParser.cpp SRCS_MIN+= Target/Sparc/DelaySlotFiller.cpp -SRCS_XDB+= Target/Sparc/Disassembler/SparcDisassembler.cpp +SRCS_XDW+= Target/Sparc/Disassembler/SparcDisassembler.cpp SRCS_MIN+= Target/Sparc/InstPrinter/SparcInstPrinter.cpp SRCS_MIN+= Target/Sparc/LeonPasses.cpp SRCS_MIN+= Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp @@ -879,8 +879,8 @@ SRCS_MIN+= Target/TargetRecip.cpp SRCS_MIN+= Target/TargetSubtargetInfo.cpp SRCS_MIN+= Target/X86/AsmParser/X86AsmInstrumentation.cpp SRCS_MIN+= Target/X86/AsmParser/X86AsmParser.cpp -SRCS_XDB+= Target/X86/Disassembler/X86Disassembler.cpp -SRCS_XDB+= Target/X86/Disassembler/X86DisassemblerDecoder.cpp +SRCS_XDW+= Target/X86/Disassembler/X86Disassembler.cpp +SRCS_XDW+= Target/X86/Disassembler/X86DisassemblerDecoder.cpp SRCS_MIN+= Target/X86/InstPrinter/X86ATTInstPrinter.cpp SRCS_MIN+= Target/X86/InstPrinter/X86InstComments.cpp SRCS_MIN+= Target/X86/InstPrinter/X86IntelInstPrinter.cpp @@ -1090,6 +1090,9 @@ SRCS_MIN+= Transforms/Vectorize/SLPVecto SRCS_EXT+= Transforms/Vectorize/Vectorize.cpp SRCS_ALL+= ${SRCS_MIN} +.if !defined(TOOLS_PREFIX) +SRCS_ALL+= ${SRCS_MIW} +.endif .if ${MK_CLANG_EXTRAS} != "no" SRCS_ALL+= ${SRCS_EXT} .endif @@ -1105,6 +1108,9 @@ SRCS_ALL+= ${SRCS_XDB} .if ${MK_CLANG_EXTRAS} != "no" || ${MK_LLDB} != "no" || ${MK_LLD} != "no" SRCS_ALL+= ${SRCS_XDL} .endif +.if ${MK_CLANG_EXTRAS} != "no" || ${MK_LLDB} != "no" || !defined(TOOLS_PREFIX) +SRCS_ALL+= ${SRCS_XDW} +.endif SRCS+= ${SRCS_ALL:O} llvm/IR/Attributes.inc: ${LLVM_SRCS}/include/llvm/IR/Attributes.td Modified: head/usr.bin/clang/Makefile ============================================================================== --- head/usr.bin/clang/Makefile Fri Dec 30 17:57:14 2016 (r310839) +++ head/usr.bin/clang/Makefile Fri Dec 30 18:00:31 2016 (r310840) @@ -7,6 +7,8 @@ SUBDIR+= clang-tblgen SUBDIR+= llvm-tblgen .if !defined(TOOLS_PREFIX) +SUBDIR+= llvm-objdump + .if ${MK_CLANG_EXTRAS} != "no" SUBDIR+= bugpoint SUBDIR+= clang-format @@ -25,7 +27,6 @@ SUBDIR+= llvm-link SUBDIR+= llvm-lto SUBDIR+= llvm-mc SUBDIR+= llvm-nm -SUBDIR+= llvm-objdump SUBDIR+= llvm-pdbdump SUBDIR+= llvm-profdata SUBDIR+= llvm-rtdyld From owner-svn-src-head@freebsd.org Fri Dec 30 18:21:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FCBAC9702C; Fri, 30 Dec 2016 18:21:54 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0C881B36; Fri, 30 Dec 2016 18:21:53 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUILrfw024349; Fri, 30 Dec 2016 18:21:53 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUILrDc024348; Fri, 30 Dec 2016 18:21:53 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201612301821.uBUILrDc024348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 30 Dec 2016 18:21:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310845 - head/sys/boot/i386/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 18:21:54 -0000 Author: tsoome Date: Fri Dec 30 18:21:52 2016 New Revision: 310845 URL: https://svnweb.freebsd.org/changeset/base/310845 Log: boot2 will deadlock if extended keys are used on text input The boot2 family of bootblocks (zfsboot/gptzfsboot) are using separate implementation if keyboard reading code, which has deadlock case when extended key (arrows etc) are pressed. The problem is about avoiding the noise from some systems, generating false key events with scan code 1 and ascii code 00, so the code does attempt to filter such cases out. Unfortunately the extended keys also set ascii 0, and therefore the pressed key event is ignored and the keypress is never read, resulting in infinite loop. This update is moving the check to keyhit() function and is allowing the rest of the code to process the extended keys. Reviewed by: bapt, allanjude Approved by: allanjude (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D8608 Modified: head/sys/boot/i386/common/cons.c Modified: head/sys/boot/i386/common/cons.c ============================================================================== --- head/sys/boot/i386/common/cons.c Fri Dec 30 18:17:44 2016 (r310844) +++ head/sys/boot/i386/common/cons.c Fri Dec 30 18:21:52 2016 (r310845) @@ -65,18 +65,17 @@ int getc(int fn) { - /* - * The extra comparison against zero is an attempt to work around - * what appears to be a bug in QEMU and Bochs. Both emulators - * sometimes report a key-press with scancode one and ascii zero - * when no such key is pressed in reality. As far as I can tell, - * this only happens shortly after a reboot. - */ v86.ctl = V86_FLAGS; v86.addr = 0x16; v86.eax = fn << 8; v86int(); - return fn == 0 ? v86.eax & 0xff : (!V86_ZR(v86.efl) && (v86.eax & 0xff)); + + if (fn == 0) + return (v86.eax); + + if (V86_ZR(v86.efl)) + return (0); + return (v86.eax); } int @@ -106,14 +105,22 @@ getchar(void) int keyhit(unsigned int secs) { - uint32_t t0, t1; + uint32_t t0, t1, c; if (OPT_CHECK(RBX_NOINTR)) return (0); secs *= SECOND; t0 = 0; for (;;) { - if (xgetc(1)) + /* + * The extra comparison is an attempt to work around + * what appears to be a bug in QEMU and Bochs. Both emulators + * sometimes report a key-press with scancode one and ascii zero + * when no such key is pressed in reality. As far as I can tell, + * this only happens shortly after a reboot. + */ + c = xgetc(1); + if (c != 0 && c != 0x0100) return (1); if (secs > 0) { t1 = *(uint32_t *)PTOV(0x46c); @@ -134,9 +141,19 @@ getstr(char *cmdstr, size_t cmdstrsize) s = cmdstr; for (;;) { - switch (c = xgetc(0)) { - case 0: + c = xgetc(0); + + /* Translate some extended codes. */ + switch (c) { + case 0x5300: /* delete */ + c = '\177'; break; + default: + c &= 0xff; + break; + } + + switch (c) { case '\177': case '\b': if (s > cmdstr) { @@ -149,9 +166,11 @@ getstr(char *cmdstr, size_t cmdstrsize) *s = 0; return; default: - if (s - cmdstr < cmdstrsize - 1) - *s++ = c; - putchar(c); + if (c >= 0x20 && c <= 0x7e) { + if (s - cmdstr < cmdstrsize - 1) + *s++ = c; + putchar(c); + } break; } } From owner-svn-src-head@freebsd.org Fri Dec 30 18:24:00 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 134C2C970A0; Fri, 30 Dec 2016 18:24:00 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFF1E1D49; Fri, 30 Dec 2016 18:23:59 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUINxs2026765; Fri, 30 Dec 2016 18:23:59 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUINwCw026758; Fri, 30 Dec 2016 18:23:58 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201612301823.uBUINwCw026758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Fri, 30 Dec 2016 18:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310846 - in head/sys/contrib/ck: . include include/gcc include/gcc/aarch64 include/gcc/arm include/gcc/ppc64 include/gcc/x86_64 src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 18:24:00 -0000 Author: cognet Date: Fri Dec 30 18:23:58 2016 New Revision: 310846 URL: https://svnweb.freebsd.org/changeset/base/310846 Log: Merge CK as of commit 255a47553aa5e8d0bb5f8eec63acac7f4c25a6d8, mostly to make sure we don't use any FP instruction. Added: head/sys/contrib/ck/include/gcc/aarch64/ck_pr_llsc.h - copied unchanged from r310844, vendor-sys/ck/dist/include/gcc/aarch64/ck_pr_llsc.h head/sys/contrib/ck/include/gcc/aarch64/ck_pr_lse.h - copied unchanged from r310844, vendor-sys/ck/dist/include/gcc/aarch64/ck_pr_lse.h Deleted: head/sys/contrib/ck/src/Makefile.in Modified: head/sys/contrib/ck/FREEBSD-Xlist head/sys/contrib/ck/include/ck_md.h head/sys/contrib/ck/include/ck_pr.h head/sys/contrib/ck/include/gcc/aarch64/ck_pr.h head/sys/contrib/ck/include/gcc/arm/ck_pr.h head/sys/contrib/ck/include/gcc/ck_pr.h head/sys/contrib/ck/include/gcc/ppc64/ck_pr.h head/sys/contrib/ck/include/gcc/x86_64/ck_pr.h Directory Properties: head/sys/contrib/ck/ (props changed) Modified: head/sys/contrib/ck/FREEBSD-Xlist ============================================================================== --- head/sys/contrib/ck/FREEBSD-Xlist Fri Dec 30 18:21:52 2016 (r310845) +++ head/sys/contrib/ck/FREEBSD-Xlist Fri Dec 30 18:23:58 2016 (r310846) @@ -8,3 +8,4 @@ */regressions */tools */include/ck_md.h.in +*/src/Makefile.in Modified: head/sys/contrib/ck/include/ck_md.h ============================================================================== --- head/sys/contrib/ck/include/ck_md.h Fri Dec 30 18:21:52 2016 (r310845) +++ head/sys/contrib/ck/include/ck_md.h Fri Dec 30 18:23:58 2016 (r310846) @@ -49,6 +49,10 @@ #define CK_MD_VMA_BITS_UNKNOWN #endif /* CK_MD_VMA_BITS_UNKNOWN */ +#ifndef CK_PR_DISABLE_DOUBLE +#define CK_PR_DISABLE_DOUBLE +#endif /* CK_PR_DISABLE_DOUBLE */ + #ifndef CK_MD_RMO #define CK_MD_RMO #endif /* CK_MD_RMO */ Modified: head/sys/contrib/ck/include/ck_pr.h ============================================================================== --- head/sys/contrib/ck/include/ck_pr.h Fri Dec 30 18:21:52 2016 (r310845) +++ head/sys/contrib/ck/include/ck_pr.h Fri Dec 30 18:23:58 2016 (r310846) @@ -173,7 +173,9 @@ ck_pr_rfo(const void *m) #define ck_pr_store_ptr(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), ptr) #define ck_pr_store_char(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), char) +#ifndef CK_PR_DISABLE_DOUBLE #define ck_pr_store_double(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), double) +#endif #define ck_pr_store_uint(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), uint) #define ck_pr_store_int(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), int) #define ck_pr_store_32(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), 32) @@ -191,7 +193,9 @@ ck_pr_rfo(const void *m) #define CK_PR_LOAD_SAFE(SRC, TYPE) ck_pr_md_load_##TYPE((SRC)) #define ck_pr_load_char(SRC) CK_PR_LOAD_SAFE((SRC), char) +#ifndef CK_PR_DISABLE_DOUBLE #define ck_pr_load_double(SRC) CK_PR_LOAD_SAFE((SRC), double) +#endif #define ck_pr_load_uint(SRC) CK_PR_LOAD_SAFE((SRC), uint) #define ck_pr_load_int(SRC) CK_PR_LOAD_SAFE((SRC), int) #define ck_pr_load_32(SRC) CK_PR_LOAD_SAFE((SRC), 32) @@ -279,7 +283,8 @@ CK_PR_BIN_S(or, int, int, |) #endif /* CK_F_PR_LOAD_INT && CK_F_PR_CAS_INT_VALUE */ -#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) +#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) && \ + !defined(CK_PR_DISABLE_DOUBLE) #ifndef CK_F_PR_ADD_DOUBLE #define CK_F_PR_ADD_DOUBLE @@ -291,7 +296,7 @@ CK_PR_BIN_S(add, double, double, +) CK_PR_BIN_S(sub, double, double, -) #endif /* CK_F_PR_SUB_DOUBLE */ -#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE */ +#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE && !CK_PR_DISABLE_DOUBLE */ #if defined(CK_F_PR_LOAD_UINT) && defined(CK_F_PR_CAS_UINT_VALUE) @@ -679,7 +684,8 @@ CK_PR_UNARY_Z_S(dec, int, int, -, 1) #endif /* CK_F_PR_LOAD_INT && CK_F_PR_CAS_INT_VALUE */ -#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) +#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) && \ + !defined(CK_PR_DISABLE_DOUBLE) #ifndef CK_F_PR_INC_DOUBLE #define CK_F_PR_INC_DOUBLE @@ -691,7 +697,7 @@ CK_PR_UNARY_S(inc, add, double, double) CK_PR_UNARY_S(dec, sub, double, double) #endif /* CK_F_PR_DEC_DOUBLE */ -#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE */ +#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE && !CK_PR_DISABLE_DOUBLE */ #if defined(CK_F_PR_LOAD_UINT) && defined(CK_F_PR_CAS_UINT_VALUE) @@ -918,14 +924,15 @@ CK_PR_N_Z_S(int, int) #endif /* CK_F_PR_LOAD_INT && CK_F_PR_CAS_INT_VALUE */ -#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) +#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) && \ + !defined(CK_PR_DISABLE_DOUBLE) #ifndef CK_F_PR_NEG_DOUBLE #define CK_F_PR_NEG_DOUBLE CK_PR_N_S(neg, double, double, -) #endif /* CK_F_PR_NEG_DOUBLE */ -#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE */ +#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE && !CK_PR_DISABLE_DOUBLE */ #if defined(CK_F_PR_LOAD_UINT) && defined(CK_F_PR_CAS_UINT_VALUE) @@ -1109,7 +1116,8 @@ CK_PR_FAS_S(int, int) #endif /* CK_F_PR_LOAD_INT && CK_F_PR_CAS_INT_VALUE */ -#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) +#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) && \ + !defined(CK_PR_DISABLE_DOUBLE) #ifndef CK_F_PR_FAA_DOUBLE #define CK_F_PR_FAA_DOUBLE @@ -1121,7 +1129,7 @@ CK_PR_FAA_S(double, double) CK_PR_FAS_S(double, double) #endif /* CK_F_PR_FAS_DOUBLE */ -#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE */ +#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE && !CK_PR_DISABLE_DOUBLE */ #if defined(CK_F_PR_LOAD_UINT) && defined(CK_F_PR_CAS_UINT_VALUE) Modified: head/sys/contrib/ck/include/gcc/aarch64/ck_pr.h ============================================================================== --- head/sys/contrib/ck/include/gcc/aarch64/ck_pr.h Fri Dec 30 18:21:52 2016 (r310845) +++ head/sys/contrib/ck/include/gcc/aarch64/ck_pr.h Fri Dec 30 18:23:58 2016 (r310846) @@ -124,7 +124,9 @@ CK_PR_LOAD_S(uint, unsigned int, "ldr") CK_PR_LOAD_S(int, int, "ldr") CK_PR_LOAD_S(short, short, "ldrh") CK_PR_LOAD_S(char, char, "ldrb") +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_LOAD_S_64(double, double, "ldr") +#endif #undef CK_PR_LOAD_S #undef CK_PR_LOAD_S_64 @@ -167,326 +169,59 @@ CK_PR_STORE_S(uint, unsigned int, "str") CK_PR_STORE_S(int, int, "str") CK_PR_STORE_S(short, short, "strh") CK_PR_STORE_S(char, char, "strb") +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_STORE_S_64(double, double, "str") +#endif #undef CK_PR_STORE_S #undef CK_PR_STORE_S_64 #undef CK_PR_STORE #undef CK_PR_STORE_64 -CK_CC_INLINE static bool -ck_pr_cas_64_2_value(uint64_t target[2], uint64_t compare[2], uint64_t set[2], uint64_t value[2]) -{ - uint64_t tmp1, tmp2; - __asm__ __volatile__("1:" - "ldxp %0, %1, [%4];" - "mov %2, %0;" - "mov %3, %1;" - "eor %0, %0, %5;" - "eor %1, %1, %6;" - "orr %1, %0, %1;" - "mov %w0, #0;" - "cbnz %1, 2f;" - "stxp %w0, %7, %8, [%4];" - "cbnz %w0, 1b;" - "mov %w0, #1;" - "2:" - : "=&r" (tmp1), "=&r" (tmp2), "=&r" (value[0]), "=&r" (value[1]) - : "r" (target), "r" (compare[0]), "r" (compare[1]), "r" (set[0]), "r" (set[1])); - - return (tmp1); -} - -CK_CC_INLINE static bool -ck_pr_cas_ptr_2_value(void *target, void *compare, void *set, void *value) -{ - return (ck_pr_cas_64_2_value(CK_CPP_CAST(uint64_t *, target), - CK_CPP_CAST(uint64_t *, compare), - CK_CPP_CAST(uint64_t *, set), - CK_CPP_CAST(uint64_t *, value))); -} - -CK_CC_INLINE static bool -ck_pr_cas_64_2(uint64_t target[2], uint64_t compare[2], uint64_t set[2]) -{ - uint64_t tmp1, tmp2; - __asm__ __volatile__("1:" - "ldxp %0, %1, [%2];" - "eor %0, %0, %3;" - "eor %1, %1, %4;" - "orr %1, %0, %1;" - "mov %w0, #0;" - "cbnz %1, 2f;" - "stxp %w0, %5, %6, [%2];" - "cbnz %w0, 1b;" - "mov %w0, #1;" - "2:" - : "=&r" (tmp1), "=&r" (tmp2) - : "r" (target), "r" (compare[0]), "r" (compare[1]), "r" (set[0]), "r" (set[1])); - - return (tmp1); -} -CK_CC_INLINE static bool -ck_pr_cas_ptr_2(void *target, void *compare, void *set) -{ - return (ck_pr_cas_64_2(CK_CPP_CAST(uint64_t *, target), - CK_CPP_CAST(uint64_t *, compare), - CK_CPP_CAST(uint64_t *, set))); -} - - -#define CK_PR_CAS(N, M, T, W, R) \ - CK_CC_INLINE static bool \ - ck_pr_cas_##N##_value(M *target, T compare, T set, M *value) \ - { \ - T previous; \ - T tmp; \ - __asm__ __volatile__("1:" \ - "ldxr" W " %" R "0, [%2];" \ - "cmp %" R "0, %" R "4;" \ - "b.ne 2f;" \ - "stxr" W " %w1, %" R "3, [%2];" \ - "cbnz %w1, 1b;" \ - "2:" \ - : "=&r" (previous), \ - "=&r" (tmp) \ - : "r" (target), \ - "r" (set), \ - "r" (compare) \ - : "memory", "cc"); \ - *(T *)value = previous; \ - return (previous == compare); \ - } \ - CK_CC_INLINE static bool \ - ck_pr_cas_##N(M *target, T compare, T set) \ - { \ - T previous; \ - T tmp; \ - __asm__ __volatile__( \ - "1:" \ - "ldxr" W " %" R "0, [%2];" \ - "cmp %" R "0, %" R "4;" \ - "b.ne 2f;" \ - "stxr" W " %w1, %" R "3, [%2];" \ - "cbnz %w1, 1b;" \ - "2:" \ - : "=&r" (previous), \ - "=&r" (tmp) \ - : "r" (target), \ - "r" (set), \ - "r" (compare) \ - : "memory", "cc"); \ - return (previous == compare); \ - } - -CK_PR_CAS(ptr, void, void *, "", "") - -#define CK_PR_CAS_S(N, M, W, R) CK_PR_CAS(N, M, M, W, R) -CK_PR_CAS_S(64, uint64_t, "", "") -CK_PR_CAS_S(double, double, "", "") -CK_PR_CAS_S(32, uint32_t, "", "w") -CK_PR_CAS_S(uint, unsigned int, "", "w") -CK_PR_CAS_S(int, int, "", "w") -CK_PR_CAS_S(16, uint16_t, "h", "w") -CK_PR_CAS_S(8, uint8_t, "b", "w") -CK_PR_CAS_S(short, short, "h", "w") -CK_PR_CAS_S(char, char, "b", "w") - - -#undef CK_PR_CAS_S -#undef CK_PR_CAS - -#define CK_PR_FAS(N, M, T, W, R) \ - CK_CC_INLINE static T \ - ck_pr_fas_##N(M *target, T v) \ - { \ - T previous; \ - T tmp; \ - __asm__ __volatile__("1:" \ - "ldxr" W " %" R "0, [%2];" \ - "stxr" W " %w1, %" R "3, [%2];"\ - "cbnz %w1, 1b;" \ - : "=&r" (previous), \ - "=&r" (tmp) \ - : "r" (target), \ - "r" (v) \ - : "memory", "cc"); \ - return (previous); \ - } - -CK_PR_FAS(64, uint64_t, uint64_t, "", "") -CK_PR_FAS(32, uint32_t, uint32_t, "", "w") -CK_PR_FAS(ptr, void, void *, "", "") -CK_PR_FAS(int, int, int, "", "w") -CK_PR_FAS(uint, unsigned int, unsigned int, "", "w") -CK_PR_FAS(16, uint16_t, uint16_t, "h", "w") -CK_PR_FAS(8, uint8_t, uint8_t, "b", "w") -CK_PR_FAS(short, short, short, "h", "w") -CK_PR_FAS(char, char, char, "b", "w") - - -#undef CK_PR_FAS - -#define CK_PR_UNARY(O, N, M, T, I, W, R) \ - CK_CC_INLINE static void \ - ck_pr_##O##_##N(M *target) \ - { \ - T previous = 0; \ - T tmp = 0; \ - __asm__ __volatile__("1:" \ - "ldxr" W " %" R "0, [%2];" \ - I ";" \ - "stxr" W " %w1, %" R "0, [%2];" \ - "cbnz %w1, 1b;" \ - : "=&r" (previous), \ - "=&r" (tmp) \ - : "r" (target) \ - : "memory", "cc"); \ - return; \ - } - -CK_PR_UNARY(inc, ptr, void, void *, "add %0, %0, #1", "", "") -CK_PR_UNARY(dec, ptr, void, void *, "sub %0, %0, #1", "", "") -CK_PR_UNARY(not, ptr, void, void *, "mvn %0, %0", "", "") -CK_PR_UNARY(neg, ptr, void, void *, "neg %0, %0", "", "") -CK_PR_UNARY(inc, 64, uint64_t, uint64_t, "add %0, %0, #1", "", "") -CK_PR_UNARY(dec, 64, uint64_t, uint64_t, "sub %0, %0, #1", "", "") -CK_PR_UNARY(not, 64, uint64_t, uint64_t, "mvn %0, %0", "", "") -CK_PR_UNARY(neg, 64, uint64_t, uint64_t, "neg %0, %0", "", "") - -#define CK_PR_UNARY_S(S, T, W) \ - CK_PR_UNARY(inc, S, T, T, "add %w0, %w0, #1", W, "w") \ - CK_PR_UNARY(dec, S, T, T, "sub %w0, %w0, #1", W, "w") \ - CK_PR_UNARY(not, S, T, T, "mvn %w0, %w0", W, "w") \ - CK_PR_UNARY(neg, S, T, T, "neg %w0, %w0", W, "w") \ - -CK_PR_UNARY_S(32, uint32_t, "") -CK_PR_UNARY_S(uint, unsigned int, "") -CK_PR_UNARY_S(int, int, "") -CK_PR_UNARY_S(16, uint16_t, "h") -CK_PR_UNARY_S(8, uint8_t, "b") -CK_PR_UNARY_S(short, short, "h") -CK_PR_UNARY_S(char, char, "b") - -#undef CK_PR_UNARY_S -#undef CK_PR_UNARY - -#define CK_PR_BINARY(O, N, M, T, I, W, R) \ - CK_CC_INLINE static void \ - ck_pr_##O##_##N(M *target, T delta) \ - { \ - T previous; \ - T tmp; \ - __asm__ __volatile__("1:" \ - "ldxr" W " %" R "0, [%2];"\ - I " %" R "0, %" R "0, %" R "3;" \ - "stxr" W " %w1, %" R "0, [%2];" \ - "cbnz %w1, 1b;" \ - : "=&r" (previous), \ - "=&r" (tmp) \ - : "r" (target), \ - "r" (delta) \ - : "memory", "cc"); \ - return; \ - } - -CK_PR_BINARY(and, ptr, void, uintptr_t, "and", "", "") -CK_PR_BINARY(add, ptr, void, uintptr_t, "add", "", "") -CK_PR_BINARY(or, ptr, void, uintptr_t, "orr", "", "") -CK_PR_BINARY(sub, ptr, void, uintptr_t, "sub", "", "") -CK_PR_BINARY(xor, ptr, void, uintptr_t, "eor", "", "") -CK_PR_BINARY(and, 64, uint64_t, uint64_t, "and", "", "") -CK_PR_BINARY(add, 64, uint64_t, uint64_t, "add", "", "") -CK_PR_BINARY(or, 64, uint64_t, uint64_t, "orr", "", "") -CK_PR_BINARY(sub, 64, uint64_t, uint64_t, "sub", "", "") -CK_PR_BINARY(xor, 64, uint64_t, uint64_t, "eor", "", "") - -#define CK_PR_BINARY_S(S, T, W) \ - CK_PR_BINARY(and, S, T, T, "and", W, "w") \ - CK_PR_BINARY(add, S, T, T, "add", W, "w") \ - CK_PR_BINARY(or, S, T, T, "orr", W, "w") \ - CK_PR_BINARY(sub, S, T, T, "sub", W, "w") \ - CK_PR_BINARY(xor, S, T, T, "eor", W, "w") - -CK_PR_BINARY_S(32, uint32_t, "") -CK_PR_BINARY_S(uint, unsigned int, "") -CK_PR_BINARY_S(int, int, "") -CK_PR_BINARY_S(16, uint16_t, "h") -CK_PR_BINARY_S(8, uint8_t, "b") -CK_PR_BINARY_S(short, short, "h") -CK_PR_BINARY_S(char, char, "b") - -#undef CK_PR_BINARY_S -#undef CK_PR_BINARY - -CK_CC_INLINE static void * -ck_pr_faa_ptr(void *target, uintptr_t delta) -{ - uintptr_t previous, r, tmp; - - __asm__ __volatile__("1:" - "ldxr %0, [%3];" - "add %1, %4, %0;" - "stxr %w2, %1, [%3];" - "cbnz %w2, 1b;" - : "=&r" (previous), - "=&r" (r), - "=&r" (tmp) - : "r" (target), - "r" (delta) - : "memory", "cc"); - - return (void *)(previous); -} - -CK_CC_INLINE static uint64_t -ck_pr_faa_64(uint64_t *target, uint64_t delta) -{ - uint64_t previous, r, tmp; - - __asm__ __volatile__("1:" - "ldxr %0, [%3];" - "add %1, %4, %0;" - "stxr %w2, %1, [%3];" - "cbnz %w2, 1b;" - : "=&r" (previous), - "=&r" (r), - "=&r" (tmp) - : "r" (target), - "r" (delta) - : "memory", "cc"); - - return (previous); -} - -#define CK_PR_FAA(S, T, W) \ - CK_CC_INLINE static T \ - ck_pr_faa_##S(T *target, T delta) \ - { \ - T previous, r, tmp; \ - __asm__ __volatile__("1:" \ - "ldxr" W " %w0, [%3];" \ - "add %w1, %w4, %w0;" \ - "stxr" W " %w2, %w1, [%3];" \ - "cbnz %w2, 1b;" \ - : "=&r" (previous), \ - "=&r" (r), \ - "=&r" (tmp) \ - : "r" (target), \ - "r" (delta) \ - : "memory", "cc"); \ - return (previous); \ - } - -CK_PR_FAA(32, uint32_t, "") -CK_PR_FAA(uint, unsigned int, "") -CK_PR_FAA(int, int, "") -CK_PR_FAA(16, uint16_t, "h") -CK_PR_FAA(8, uint8_t, "b") -CK_PR_FAA(short, short, "h") -CK_PR_FAA(char, char, "b") +#ifdef CK_MD_LSE_ENABLE +#include "ck_pr_lse.h" +#else +#include "ck_pr_llsc.h" +#endif + +/* + * ck_pr_neg_*() functions can only be implemented via LL/SC, as there are no + * LSE alternatives. + */ +#define CK_PR_NEG(N, M, T, W, R) \ + CK_CC_INLINE static void \ + ck_pr_neg_##N(M *target) \ + { \ + T previous = 0; \ + T tmp = 0; \ + __asm__ __volatile__("1:" \ + "ldxr" W " %" R "0, [%2];" \ + "neg %" R "0, %" R "0;" \ + "stxr" W " %w1, %" R "0, [%2];" \ + "cbnz %w1, 1b;" \ + : "=&r" (previous), \ + "=&r" (tmp) \ + : "r" (target) \ + : "memory", "cc"); \ + return; \ + } + +CK_PR_NEG(ptr, void, void *, "", "") +CK_PR_NEG(64, uint64_t, uint64_t, "", "") + +#define CK_PR_NEG_S(S, T, W) \ + CK_PR_NEG(S, T, T, W, "w") \ + +CK_PR_NEG_S(32, uint32_t, "") +CK_PR_NEG_S(uint, unsigned int, "") +CK_PR_NEG_S(int, int, "") +CK_PR_NEG_S(16, uint16_t, "h") +CK_PR_NEG_S(8, uint8_t, "b") +CK_PR_NEG_S(short, short, "h") +CK_PR_NEG_S(char, char, "b") -#undef CK_PR_FAA +#undef CK_PR_NEG_S +#undef CK_PR_NEG #endif /* CK_PR_AARCH64_H */ Copied: head/sys/contrib/ck/include/gcc/aarch64/ck_pr_llsc.h (from r310844, vendor-sys/ck/dist/include/gcc/aarch64/ck_pr_llsc.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/ck/include/gcc/aarch64/ck_pr_llsc.h Fri Dec 30 18:23:58 2016 (r310846, copy of r310844, vendor-sys/ck/dist/include/gcc/aarch64/ck_pr_llsc.h) @@ -0,0 +1,352 @@ +/* + * Copyright 2009-2016 Samy Al Bahra. + * Copyright 2013-2016 Olivier Houchard. + * All rights reserved. + * + * 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 AUTHOR 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 AUTHOR 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. + */ + +#ifndef CK_PR_AARCH64_LLSC_H +#define CK_PR_AARCH64_LLSC_H + +#ifndef CK_PR_H +#error Do not include this file directly, use ck_pr.h +#endif + +CK_CC_INLINE static bool +ck_pr_cas_64_2_value(uint64_t target[2], uint64_t compare[2], uint64_t set[2], uint64_t value[2]) +{ + uint64_t tmp1, tmp2; + + __asm__ __volatile__("1:" + "ldxp %0, %1, [%4];" + "mov %2, %0;" + "mov %3, %1;" + "eor %0, %0, %5;" + "eor %1, %1, %6;" + "orr %1, %0, %1;" + "mov %w0, #0;" + "cbnz %1, 2f;" + "stxp %w0, %7, %8, [%4];" + "cbnz %w0, 1b;" + "mov %w0, #1;" + "2:" + : "=&r" (tmp1), "=&r" (tmp2), "=&r" (value[0]), "=&r" (value[1]) + : "r" (target), "r" (compare[0]), "r" (compare[1]), "r" (set[0]), "r" (set[1]) + : "cc", "memory"); + + return (tmp1); +} + +CK_CC_INLINE static bool +ck_pr_cas_ptr_2_value(void *target, void *compare, void *set, void *value) +{ + return (ck_pr_cas_64_2_value(CK_CPP_CAST(uint64_t *, target), + CK_CPP_CAST(uint64_t *, compare), + CK_CPP_CAST(uint64_t *, set), + CK_CPP_CAST(uint64_t *, value))); +} + +CK_CC_INLINE static bool +ck_pr_cas_64_2(uint64_t target[2], uint64_t compare[2], uint64_t set[2]) +{ + uint64_t tmp1, tmp2; + + __asm__ __volatile__("1:" + "ldxp %0, %1, [%2];" + "eor %0, %0, %3;" + "eor %1, %1, %4;" + "orr %1, %0, %1;" + "mov %w0, #0;" + "cbnz %1, 2f;" + "stxp %w0, %5, %6, [%2];" + "cbnz %w0, 1b;" + "mov %w0, #1;" + "2:" + : "=&r" (tmp1), "=&r" (tmp2) + : "r" (target), "r" (compare[0]), "r" (compare[1]), "r" (set[0]), "r" (set[1]) + : "cc", "memory"); + + return (tmp1); +} +CK_CC_INLINE static bool +ck_pr_cas_ptr_2(void *target, void *compare, void *set) +{ + return (ck_pr_cas_64_2(CK_CPP_CAST(uint64_t *, target), + CK_CPP_CAST(uint64_t *, compare), + CK_CPP_CAST(uint64_t *, set))); +} + + +#define CK_PR_CAS(N, M, T, W, R) \ + CK_CC_INLINE static bool \ + ck_pr_cas_##N##_value(M *target, T compare, T set, M *value) \ + { \ + T previous; \ + T tmp; \ + __asm__ __volatile__("1:" \ + "ldxr" W " %" R "0, [%2];" \ + "cmp %" R "0, %" R "4;" \ + "b.ne 2f;" \ + "stxr" W " %w1, %" R "3, [%2];" \ + "cbnz %w1, 1b;" \ + "2:" \ + : "=&r" (previous), \ + "=&r" (tmp) \ + : "r" (target), \ + "r" (set), \ + "r" (compare) \ + : "memory", "cc"); \ + *(T *)value = previous; \ + return (previous == compare); \ + } \ + CK_CC_INLINE static bool \ + ck_pr_cas_##N(M *target, T compare, T set) \ + { \ + T previous; \ + T tmp; \ + __asm__ __volatile__( \ + "1:" \ + "ldxr" W " %" R "0, [%2];" \ + "cmp %" R "0, %" R "4;" \ + "b.ne 2f;" \ + "stxr" W " %w1, %" R "3, [%2];" \ + "cbnz %w1, 1b;" \ + "2:" \ + : "=&r" (previous), \ + "=&r" (tmp) \ + : "r" (target), \ + "r" (set), \ + "r" (compare) \ + : "memory", "cc"); \ + return (previous == compare); \ + } + +CK_PR_CAS(ptr, void, void *, "", "") + +#define CK_PR_CAS_S(N, M, W, R) CK_PR_CAS(N, M, M, W, R) +CK_PR_CAS_S(64, uint64_t, "", "") +#ifndef CK_PR_DISABLE_DOUBLE +CK_PR_CAS_S(double, double, "", "") +#endif +CK_PR_CAS_S(32, uint32_t, "", "w") +CK_PR_CAS_S(uint, unsigned int, "", "w") +CK_PR_CAS_S(int, int, "", "w") +CK_PR_CAS_S(16, uint16_t, "h", "w") +CK_PR_CAS_S(8, uint8_t, "b", "w") +CK_PR_CAS_S(short, short, "h", "w") +CK_PR_CAS_S(char, char, "b", "w") + + +#undef CK_PR_CAS_S +#undef CK_PR_CAS + +#define CK_PR_FAS(N, M, T, W, R) \ + CK_CC_INLINE static T \ + ck_pr_fas_##N(M *target, T v) \ + { \ + T previous; \ + T tmp; \ + __asm__ __volatile__("1:" \ + "ldxr" W " %" R "0, [%2];" \ + "stxr" W " %w1, %" R "3, [%2];"\ + "cbnz %w1, 1b;" \ + : "=&r" (previous), \ + "=&r" (tmp) \ + : "r" (target), \ + "r" (v) \ + : "memory", "cc"); \ + return (previous); \ + } + +CK_PR_FAS(64, uint64_t, uint64_t, "", "") +CK_PR_FAS(32, uint32_t, uint32_t, "", "w") +CK_PR_FAS(ptr, void, void *, "", "") +CK_PR_FAS(int, int, int, "", "w") +CK_PR_FAS(uint, unsigned int, unsigned int, "", "w") +CK_PR_FAS(16, uint16_t, uint16_t, "h", "w") +CK_PR_FAS(8, uint8_t, uint8_t, "b", "w") +CK_PR_FAS(short, short, short, "h", "w") +CK_PR_FAS(char, char, char, "b", "w") + + +#undef CK_PR_FAS + +#define CK_PR_UNARY(O, N, M, T, I, W, R) \ + CK_CC_INLINE static void \ + ck_pr_##O##_##N(M *target) \ + { \ + T previous = 0; \ + T tmp = 0; \ + __asm__ __volatile__("1:" \ + "ldxr" W " %" R "0, [%2];" \ + I ";" \ + "stxr" W " %w1, %" R "0, [%2];" \ + "cbnz %w1, 1b;" \ + : "=&r" (previous), \ + "=&r" (tmp) \ + : "r" (target) \ + : "memory", "cc"); \ + return; \ + } + +CK_PR_UNARY(inc, ptr, void, void *, "add %0, %0, #1", "", "") +CK_PR_UNARY(dec, ptr, void, void *, "sub %0, %0, #1", "", "") +CK_PR_UNARY(not, ptr, void, void *, "mvn %0, %0", "", "") +CK_PR_UNARY(inc, 64, uint64_t, uint64_t, "add %0, %0, #1", "", "") +CK_PR_UNARY(dec, 64, uint64_t, uint64_t, "sub %0, %0, #1", "", "") +CK_PR_UNARY(not, 64, uint64_t, uint64_t, "mvn %0, %0", "", "") + +#define CK_PR_UNARY_S(S, T, W) \ + CK_PR_UNARY(inc, S, T, T, "add %w0, %w0, #1", W, "w") \ + CK_PR_UNARY(dec, S, T, T, "sub %w0, %w0, #1", W, "w") \ + CK_PR_UNARY(not, S, T, T, "mvn %w0, %w0", W, "w") \ + +CK_PR_UNARY_S(32, uint32_t, "") +CK_PR_UNARY_S(uint, unsigned int, "") +CK_PR_UNARY_S(int, int, "") +CK_PR_UNARY_S(16, uint16_t, "h") +CK_PR_UNARY_S(8, uint8_t, "b") +CK_PR_UNARY_S(short, short, "h") +CK_PR_UNARY_S(char, char, "b") + +#undef CK_PR_UNARY_S +#undef CK_PR_UNARY + +#define CK_PR_BINARY(O, N, M, T, I, W, R) \ + CK_CC_INLINE static void \ + ck_pr_##O##_##N(M *target, T delta) \ + { \ + T previous; \ + T tmp; \ + __asm__ __volatile__("1:" \ + "ldxr" W " %" R "0, [%2];"\ + I " %" R "0, %" R "0, %" R "3;" \ + "stxr" W " %w1, %" R "0, [%2];" \ + "cbnz %w1, 1b;" \ + : "=&r" (previous), \ + "=&r" (tmp) \ + : "r" (target), \ + "r" (delta) \ + : "memory", "cc"); \ + return; \ + } + +CK_PR_BINARY(and, ptr, void, uintptr_t, "and", "", "") +CK_PR_BINARY(add, ptr, void, uintptr_t, "add", "", "") +CK_PR_BINARY(or, ptr, void, uintptr_t, "orr", "", "") +CK_PR_BINARY(sub, ptr, void, uintptr_t, "sub", "", "") +CK_PR_BINARY(xor, ptr, void, uintptr_t, "eor", "", "") +CK_PR_BINARY(and, 64, uint64_t, uint64_t, "and", "", "") +CK_PR_BINARY(add, 64, uint64_t, uint64_t, "add", "", "") +CK_PR_BINARY(or, 64, uint64_t, uint64_t, "orr", "", "") +CK_PR_BINARY(sub, 64, uint64_t, uint64_t, "sub", "", "") +CK_PR_BINARY(xor, 64, uint64_t, uint64_t, "eor", "", "") + +#define CK_PR_BINARY_S(S, T, W) \ + CK_PR_BINARY(and, S, T, T, "and", W, "w") \ + CK_PR_BINARY(add, S, T, T, "add", W, "w") \ + CK_PR_BINARY(or, S, T, T, "orr", W, "w") \ + CK_PR_BINARY(sub, S, T, T, "sub", W, "w") \ + CK_PR_BINARY(xor, S, T, T, "eor", W, "w") + +CK_PR_BINARY_S(32, uint32_t, "") +CK_PR_BINARY_S(uint, unsigned int, "") +CK_PR_BINARY_S(int, int, "") +CK_PR_BINARY_S(16, uint16_t, "h") +CK_PR_BINARY_S(8, uint8_t, "b") +CK_PR_BINARY_S(short, short, "h") +CK_PR_BINARY_S(char, char, "b") + +#undef CK_PR_BINARY_S +#undef CK_PR_BINARY + +CK_CC_INLINE static void * +ck_pr_faa_ptr(void *target, uintptr_t delta) +{ + uintptr_t previous, r, tmp; + + __asm__ __volatile__("1:" + "ldxr %0, [%3];" + "add %1, %4, %0;" + "stxr %w2, %1, [%3];" + "cbnz %w2, 1b;" + : "=&r" (previous), + "=&r" (r), + "=&r" (tmp) + : "r" (target), + "r" (delta) + : "memory", "cc"); + + return (void *)(previous); +} + +CK_CC_INLINE static uint64_t +ck_pr_faa_64(uint64_t *target, uint64_t delta) +{ + uint64_t previous, r, tmp; + + __asm__ __volatile__("1:" + "ldxr %0, [%3];" + "add %1, %4, %0;" + "stxr %w2, %1, [%3];" + "cbnz %w2, 1b;" + : "=&r" (previous), + "=&r" (r), + "=&r" (tmp) + : "r" (target), + "r" (delta) + : "memory", "cc"); + + return (previous); +} + +#define CK_PR_FAA(S, T, W) \ + CK_CC_INLINE static T \ + ck_pr_faa_##S(T *target, T delta) \ + { \ + T previous, r, tmp; \ + __asm__ __volatile__("1:" \ + "ldxr" W " %w0, [%3];" \ + "add %w1, %w4, %w0;" \ + "stxr" W " %w2, %w1, [%3];" \ + "cbnz %w2, 1b;" \ + : "=&r" (previous), \ + "=&r" (r), \ + "=&r" (tmp) \ + : "r" (target), \ + "r" (delta) \ + : "memory", "cc"); \ + return (previous); \ + } + +CK_PR_FAA(32, uint32_t, "") +CK_PR_FAA(uint, unsigned int, "") +CK_PR_FAA(int, int, "") +CK_PR_FAA(16, uint16_t, "h") +CK_PR_FAA(8, uint8_t, "b") +CK_PR_FAA(short, short, "h") +CK_PR_FAA(char, char, "b") + +#undef CK_PR_FAA + +#endif /* CK_PR_AARCH64_LLSC_H */ Copied: head/sys/contrib/ck/include/gcc/aarch64/ck_pr_lse.h (from r310844, vendor-sys/ck/dist/include/gcc/aarch64/ck_pr_lse.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/ck/include/gcc/aarch64/ck_pr_lse.h Fri Dec 30 18:23:58 2016 (r310846, copy of r310844, vendor-sys/ck/dist/include/gcc/aarch64/ck_pr_lse.h) @@ -0,0 +1,298 @@ +/* + * Copyright 2009-2016 Samy Al Bahra. + * Copyright 2013-2016 Olivier Houchard. + * Copyright 2016 Alexey Kopytov. + * All rights reserved. + * + * 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 AUTHOR 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 AUTHOR 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. + */ + +#ifndef CK_PR_AARCH64_LSE_H +#define CK_PR_AARCH64_LSE_H + +#ifndef CK_PR_H +#error Do not include this file directly, use ck_pr.h +#endif + +CK_CC_INLINE static bool +ck_pr_cas_64_2_value(uint64_t target[2], uint64_t compare[2], uint64_t set[2], uint64_t value[2]) +{ + uint64_t tmp1; + uint64_t tmp2; + register uint64_t x0 __asm__ ("x0") = compare[0]; + register uint64_t x1 __asm__ ("x1") = compare[1]; + register uint64_t x2 __asm__ ("x2") = set[0]; + register uint64_t x3 __asm__ ("x3") = set[1]; + + __asm__ __volatile__("casp %0, %1, %4, %5, [%6];" + "eor %2, %0, %7;" + "eor %3, %1, %8;" + "orr %2, %2, %3;" + : "+&r" (x0), "+&r" (x1), "=&r" (tmp1), "=&r" (tmp2) + : "r" (x2), "r" (x3), "r" (target), "r" (compare[0]), "r" (compare[1]) + : "memory"); + + value[0] = x0; + value[1] = x1; + + return (!!tmp1); +} + +CK_CC_INLINE static bool +ck_pr_cas_ptr_2_value(void *target, void *compare, void *set, void *value) +{ + return (ck_pr_cas_64_2_value(CK_CPP_CAST(uint64_t *, target), + CK_CPP_CAST(uint64_t *, compare), + CK_CPP_CAST(uint64_t *, set), + CK_CPP_CAST(uint64_t *, value))); +} + +CK_CC_INLINE static bool +ck_pr_cas_64_2(uint64_t target[2], uint64_t compare[2], uint64_t set[2]) +{ + register uint64_t x0 __asm__ ("x0") = compare[0]; + register uint64_t x1 __asm__ ("x1") = compare[1]; + register uint64_t x2 __asm__ ("x2") = set[0]; + register uint64_t x3 __asm__ ("x3") = set[1]; + + __asm__ __volatile__("casp %0, %1, %2, %3, [%4];" + "eor %0, %0, %5;" + "eor %1, %1, %6;" + "orr %0, %0, %1;" + : "+&r" (x0), "+&r" (x1) + : "r" (x2), "r" (x3), "r" (target), "r" (compare[0]), "r" (compare[1]) + : "memory"); + + return (!!x0); +} +CK_CC_INLINE static bool +ck_pr_cas_ptr_2(void *target, void *compare, void *set) +{ + return (ck_pr_cas_64_2(CK_CPP_CAST(uint64_t *, target), + CK_CPP_CAST(uint64_t *, compare), + CK_CPP_CAST(uint64_t *, set))); +} + + +#define CK_PR_CAS(N, M, T, W, R) \ + CK_CC_INLINE static bool \ + ck_pr_cas_##N##_value(M *target, T compare, T set, M *value) \ + { \ + *(T *)value = compare; \ + __asm__ __volatile__( \ + "cas" W " %" R "0, %" R "2, [%1];" \ + : "+&r" (*(T *)value) \ + : "r" (target), \ + "r" (set) \ + : "memory"); \ + return (*(T *)value == compare); \ + } \ + CK_CC_INLINE static bool \ + ck_pr_cas_##N(M *target, T compare, T set) \ + { \ + T previous = compare; \ + __asm__ __volatile__( \ + "cas" W " %" R "0, %" R "2, [%1];" \ + : "+&r" (previous) \ + : "r" (target), \ + "r" (set) \ + : "memory"); \ + return (previous == compare); \ + } + +CK_PR_CAS(ptr, void, void *, "", "") + +#define CK_PR_CAS_S(N, M, W, R) CK_PR_CAS(N, M, M, W, R) +CK_PR_CAS_S(64, uint64_t, "", "") +#ifndef CK_PR_DISABLE_DOUBLE +CK_PR_CAS_S(double, double, "", "") +#endif +CK_PR_CAS_S(32, uint32_t, "", "w") +CK_PR_CAS_S(uint, unsigned int, "", "w") +CK_PR_CAS_S(int, int, "", "w") +CK_PR_CAS_S(16, uint16_t, "h", "w") +CK_PR_CAS_S(8, uint8_t, "b", "w") +CK_PR_CAS_S(short, short, "h", "w") +CK_PR_CAS_S(char, char, "b", "w") + + +#undef CK_PR_CAS_S +#undef CK_PR_CAS + +#define CK_PR_FAS(N, M, T, W, R) \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Dec 30 18:39:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 927C8C974F0; Fri, 30 Dec 2016 18:39:22 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 72E4715C3; Fri, 30 Dec 2016 18:39:22 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 3725710A746; Fri, 30 Dec 2016 13:39:21 -0500 (EST) From: John Baldwin To: Alexander Kabaev Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310789 - head/lib/libpam/static_libpam Date: Fri, 30 Dec 2016 10:38:26 -0800 Message-ID: <2270028.8V7VsJ8Web@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201612292130.uBTLUqus011628@repo.freebsd.org> References: <201612292130.uBTLUqus011628@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 30 Dec 2016 13:39:21 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 18:39:22 -0000 On Thursday, December 29, 2016 09:30:52 PM Alexander Kabaev wrote: > Author: kan > Date: Thu Dec 29 21:30:52 2016 > New Revision: 310789 > URL: https://svnweb.freebsd.org/changeset/base/310789 > > Log: > Use compiler driver to build relocatable object > > This works better with external toolchains where LD > will not necessarily defailt to emulation we want. > Compiler driver knows better. I think this was the case I had added the XLDFLAGS in my mips cross-building patches for. I'm fine with dropping the XLDFLAGS bits and depending on the compiler driver if we think that is the better solution. > Modified: > head/lib/libpam/static_libpam/Makefile > > Modified: head/lib/libpam/static_libpam/Makefile > ============================================================================== > --- head/lib/libpam/static_libpam/Makefile Thu Dec 29 21:06:31 2016 (r310788) > +++ head/lib/libpam/static_libpam/Makefile Thu Dec 29 21:30:52 2016 (r310789) > @@ -64,6 +64,6 @@ CLEANFILES+= openpam_static.o \ > openpam_static_modules.o > > openpam_static_modules.o: openpam_static.o ${STATIC_MODULES} > - ${LD} -o ${.TARGET} -r --whole-archive ${.ALLSRC} > + ${CC} -nostdlib ${CFLAGS} -o ${.TARGET} -r -Wl,--whole-archive ${.ALLSRC} > > .include "${.CURDIR}/../libpam/Makefile" > -- John Baldwin From owner-svn-src-head@freebsd.org Fri Dec 30 18:46:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96511C976F6; Fri, 30 Dec 2016 18:46:22 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 56DA219FA; Fri, 30 Dec 2016 18:46:22 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUIkLg4035071; Fri, 30 Dec 2016 18:46:21 GMT (envelope-from jpaetzel@FreeBSD.org) Received: (from jpaetzel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUIkLu9035070; Fri, 30 Dec 2016 18:46:21 GMT (envelope-from jpaetzel@FreeBSD.org) Message-Id: <201612301846.uBUIkLu9035070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jpaetzel set sender to jpaetzel@FreeBSD.org using -f From: Josh Paetzel Date: Fri, 30 Dec 2016 18:46:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310847 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 18:46:22 -0000 Author: jpaetzel Date: Fri Dec 30 18:46:21 2016 New Revision: 310847 URL: https://svnweb.freebsd.org/changeset/base/310847 Log: Harden CARP against network loops. If there is a loop in the network a CARP that is in MASTER state will see it's own broadcasts, which will then cause it to assume BACKUP state. When it assumes BACKUP it will stop sending advertisements. In that state it will no longer see advertisements and will assume MASTER... We can't catch all the cases where we are seeing our own CARP broadcast, but we can catch the obvious case. Submitted by: torek Obtained from: FreeNAS MFC after: 2 weeks Sponsored by: iXsystems Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Fri Dec 30 18:23:58 2016 (r310846) +++ head/sys/netinet/ip_carp.c Fri Dec 30 18:46:21 2016 (r310847) @@ -581,27 +581,90 @@ carp6_input(struct mbuf **mp, int *offp, } #endif /* INET6 */ +/* + * This routine should not be necessary at all, but some switches + * (VMWare ESX vswitches) can echo our own packets back at us, + * and we must ignore them or they will cause us to drop out of + * MASTER mode. + * + * We cannot catch all cases of network loops. Instead, what we + * do here is catch any packet that arrives with a carp header + * with a VHID of 0, that comes from an address that is our own. + * These packets are by definition "from us" (even if they are from + * a misconfigured host that is pretending to be us). + * + * The VHID test is outside this mini-function. + */ +static int +carp_source_is_self(struct mbuf *m, struct ifaddr *ifa, sa_family_t af) +{ + struct ip *ip4; + struct in_addr in4; + struct ip6_hdr *ip6; + struct in6_addr in6; + + switch (af) { + case AF_INET: + ip4 = mtod(m, struct ip *); + in4 = ifatoia(ifa)->ia_addr.sin_addr; + return (in4.s_addr == ip4->ip_src.s_addr); + + case AF_INET6: + ip6 = mtod(m, struct ip6_hdr *); + in6 = ifatoia6(ifa)->ia_addr.sin6_addr; + return (memcmp(&in6, &ip6->ip6_src, sizeof(in6)) == 0); + + default: /* how did this happen? */ + break; + } + return (0); +} + static void carp_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af) { struct ifnet *ifp = m->m_pkthdr.rcvif; - struct ifaddr *ifa; + struct ifaddr *ifa, *match; struct carp_softc *sc; uint64_t tmp_counter; struct timeval sc_tv, ch_tv; + int error; - /* verify that the VHID is valid on the receiving interface */ + /* + * Verify that the VHID is valid on the receiving interface. + * + * There should be just one match. If there are none + * the VHID is not valid and we drop the packet. If + * there are multiple VHID matches, take just the first + * one, for compatibility with previous code. While we're + * scanning, check for obvious loops in the network topology + * (these should never happen, and as noted above, we may + * miss real loops; this is just a double-check). + */ IF_ADDR_RLOCK(ifp); - IFNET_FOREACH_IFA(ifp, ifa) - if (ifa->ifa_addr->sa_family == af && - ifa->ifa_carp->sc_vhid == ch->carp_vhid) { - ifa_ref(ifa); - break; - } + error = 0; + match = NULL; + IFNET_FOREACH_IFA(ifp, ifa) { + if (match == NULL && ifa->ifa_carp != NULL && + ifa->ifa_addr->sa_family == af && + ifa->ifa_carp->sc_vhid == ch->carp_vhid) + match = ifa; + if (ch->carp_vhid == 0 && carp_source_is_self(m, ifa, af)) + error = ELOOP; + } + ifa = error ? NULL : match; + if (ifa != NULL) + ifa_ref(ifa); IF_ADDR_RUNLOCK(ifp); if (ifa == NULL) { - CARPSTATS_INC(carps_badvhid); + if (error == ELOOP) { + CARP_DEBUG("dropping looped packet on interface %s\n", + ifp->if_xname); + CARPSTATS_INC(carps_badif); /* ??? */ + } else { + CARPSTATS_INC(carps_badvhid); + } m_freem(m); return; } @@ -787,12 +850,41 @@ carp_send_ad_error(struct carp_softc *sc } } +/* + * Pick the best ifaddr on the given ifp for sending CARP + * advertisements. + * + * "Best" here is defined by ifa_preferred(). This function is much + * much like ifaof_ifpforaddr() except that we just use ifa_preferred(). + * + * (This could be simplified to return the actual address, except that + * it has a different format in AF_INET and AF_INET6.) + */ +static struct ifaddr * +carp_best_ifa(int af, struct ifnet *ifp) +{ + struct ifaddr *ifa, *best; + + if (af >= AF_MAX) + return (NULL); + best = NULL; + IF_ADDR_RLOCK(ifp); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + if (ifa->ifa_addr->sa_family == af && + (best == NULL || ifa_preferred(best, ifa))) + best = ifa; + } + IF_ADDR_RUNLOCK(ifp); + if (best != NULL) + ifa_ref(best); + return (best); +} + static void carp_send_ad_locked(struct carp_softc *sc) { struct carp_header ch; struct timeval tv; - struct sockaddr sa; struct ifaddr *ifa; struct carp_header *ch_ptr; struct mbuf *m; @@ -841,9 +933,7 @@ carp_send_ad_locked(struct carp_softc *s ip->ip_sum = 0; ip_fillid(ip); - bzero(&sa, sizeof(sa)); - sa.sa_family = AF_INET; - ifa = ifaof_ifpforaddr(&sa, sc->sc_carpdev); + ifa = carp_best_ifa(AF_INET, sc->sc_carpdev); if (ifa != NULL) { ip->ip_src.s_addr = ifatoia(ifa)->ia_addr.sin_addr.s_addr; @@ -887,11 +977,9 @@ carp_send_ad_locked(struct carp_softc *s ip6->ip6_vfc |= IPV6_VERSION; ip6->ip6_hlim = CARP_DFLTTL; ip6->ip6_nxt = IPPROTO_CARP; - bzero(&sa, sizeof(sa)); /* set the source address */ - sa.sa_family = AF_INET6; - ifa = ifaof_ifpforaddr(&sa, sc->sc_carpdev); + ifa = carp_best_ifa(AF_INET6, sc->sc_carpdev); if (ifa != NULL) { bcopy(IFA_IN6(ifa), &ip6->ip6_src, sizeof(struct in6_addr)); From owner-svn-src-head@freebsd.org Fri Dec 30 18:55:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FC50C978F5; Fri, 30 Dec 2016 18:55:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 222651F8C; Fri, 30 Dec 2016 18:55:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUItX7d038980; Fri, 30 Dec 2016 18:55:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUItXkt038979; Fri, 30 Dec 2016 18:55:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612301855.uBUItXkt038979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 30 Dec 2016 18:55:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310849 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 18:55:34 -0000 Author: kib Date: Fri Dec 30 18:55:33 2016 New Revision: 310849 URL: https://svnweb.freebsd.org/changeset/base/310849 Log: Fix two similar bugs in the populate vm_fault() code. If pager' populate method succeeded, but other thread raced with us and modified vm_map, we must unbusy all pages busied by the pager, before we retry the whole fault handling. If pager instantiated more pages than fit into the current map entry, we must unbusy the pages which are clipped. Also do some refactoring, clarify comments and use more clear local variable names. Reported and tested by: kargl, subbsd@gmail.com (previous version) Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Fri Dec 30 18:51:56 2016 (r310848) +++ head/sys/vm/vm_fault.c Fri Dec 30 18:55:33 2016 (r310849) @@ -304,13 +304,45 @@ vm_fault_restore_map_lock(struct faultst fs->lookup_still_valid = true; } +static void +vm_fault_populate_check_page(vm_page_t m) +{ + + /* + * Check each page to ensure that the pager is obeying the + * interface: the page must be installed in the object, fully + * valid, and exclusively busied. + */ + MPASS(m != NULL); + MPASS(m->valid == VM_PAGE_BITS_ALL); + MPASS(vm_page_xbusied(m)); +} + +static void +vm_fault_populate_cleanup(vm_object_t object, vm_pindex_t first, + vm_pindex_t last) +{ + vm_page_t m; + vm_pindex_t pidx; + + VM_OBJECT_ASSERT_WLOCKED(object); + MPASS(first <= last); + for (pidx = first, m = vm_page_lookup(object, pidx); + pidx <= last; pidx++, m = vm_page_next(m)) { + vm_fault_populate_check_page(m); + vm_page_lock(m); + vm_page_deactivate(m); + vm_page_unlock(m); + vm_page_xunbusy(m); + } +} static int vm_fault_populate(struct faultstate *fs, vm_offset_t vaddr, vm_prot_t prot, int fault_type, int fault_flags, boolean_t wired, vm_page_t *m_hold) { vm_page_t m; - vm_pindex_t f_first, f_last, pidx; + vm_pindex_t map_first, map_last, pager_first, pager_last, pidx; int rv; MPASS(fs->object == fs->first_object); @@ -319,8 +351,8 @@ vm_fault_populate(struct faultstate *fs, MPASS(fs->first_object->backing_object == NULL); MPASS(fs->lookup_still_valid); - f_first = OFF_TO_IDX(fs->entry->offset); - f_last = OFF_TO_IDX(fs->entry->offset + fs->entry->end - + pager_first = OFF_TO_IDX(fs->entry->offset); + pager_last = OFF_TO_IDX(fs->entry->offset + fs->entry->end - fs->entry->start) - 1; unlock_map(fs); unlock_vp(fs); @@ -334,7 +366,7 @@ vm_fault_populate(struct faultstate *fs, * to the driver. */ rv = vm_pager_populate(fs->first_object, fs->first_pindex, - fault_type, fs->entry->max_protection, &f_first, &f_last); + fault_type, fs->entry->max_protection, &pager_first, &pager_last); VM_OBJECT_ASSERT_WLOCKED(fs->first_object); if (rv == VM_PAGER_BAD) { @@ -351,34 +383,40 @@ vm_fault_populate(struct faultstate *fs, return (KERN_FAILURE); /* AKA SIGSEGV */ /* Ensure that the driver is obeying the interface. */ - MPASS(f_first <= f_last); - MPASS(fs->first_pindex <= f_last); - MPASS(fs->first_pindex >= f_first); - MPASS(f_last < fs->first_object->size); + MPASS(pager_first <= pager_last); + MPASS(fs->first_pindex <= pager_last); + MPASS(fs->first_pindex >= pager_first); + MPASS(pager_last < fs->first_object->size); vm_fault_restore_map_lock(fs); - if (fs->map->timestamp != fs->map_generation) + if (fs->map->timestamp != fs->map_generation) { + vm_fault_populate_cleanup(fs->first_object, pager_first, + pager_last); return (KERN_RESOURCE_SHORTAGE); /* RetryFault */ + } - /* Clip pager response to fit into the vm_map_entry. */ - f_first = MAX(OFF_TO_IDX(fs->entry->offset), f_first); - f_last = MIN(OFF_TO_IDX(fs->entry->end - fs->entry->start + - fs->entry->offset), f_last); - - pidx = f_first; - for (m = vm_page_lookup(fs->first_object, pidx); pidx <= f_last; - pidx++, m = vm_page_next(m)) { - /* - * Check each page to ensure that the driver is - * obeying the interface: the page must be installed - * in the object, fully valid, and exclusively busied. - */ - MPASS(m != NULL); - MPASS(vm_page_xbusied(m)); - MPASS(m->valid == VM_PAGE_BITS_ALL); - MPASS(m->object == fs->first_object); - MPASS(m->pindex == pidx); - + /* + * The map is unchanged after our last unlock. Process the fault. + * + * The range [pager_first, pager_last] that is given to the + * pager is only a hint. The pager may populate any range + * within the object that includes the requested page index. + * In case the pager expanded the range, clip it to fit into + * the map entry. + */ + map_first = MAX(OFF_TO_IDX(fs->entry->offset), pager_first); + if (map_first > pager_first) + vm_fault_populate_cleanup(fs->first_object, pager_first, + map_first - 1); + map_last = MIN(OFF_TO_IDX(fs->entry->end - fs->entry->start + + fs->entry->offset), pager_last); + if (map_last < pager_last) + vm_fault_populate_cleanup(fs->first_object, map_last + 1, + pager_last); + + for (pidx = map_first, m = vm_page_lookup(fs->first_object, pidx); + pidx <= map_last; pidx++, m = vm_page_next(m)) { + vm_fault_populate_check_page(m); vm_fault_dirty(fs->entry, m, prot, fault_type, fault_flags, true); VM_OBJECT_WUNLOCK(fs->first_object); From owner-svn-src-head@freebsd.org Fri Dec 30 19:06:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D00C4C97E09; Fri, 30 Dec 2016 19:06:33 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8672D1809; Fri, 30 Dec 2016 19:06:33 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUJ6WSk043438; Fri, 30 Dec 2016 19:06:32 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUJ6TMl043407; Fri, 30 Dec 2016 19:06:29 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201612301906.uBUJ6TMl043407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 30 Dec 2016 19:06:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310850 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/mips/beri/loader sys/boot/ofw/libofw sys/boot/pc98/libpc98 s... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 19:06:33 -0000 Author: tsoome Date: Fri Dec 30 19:06:29 2016 New Revision: 310850 URL: https://svnweb.freebsd.org/changeset/base/310850 Log: dosfs support in libstand is broken since r298230 Apparently the libstand dosfs optimization is a bit too optimistic and did introduce possible memory corruption. This patch is backing out the bad part and since this results in dosfs reading full blocks now, we can also remove extra offset argument from dv_strategy callback. The analysis of the issue and the backout patch is provided by Mikhail Kupchik. PR: 214423 Submitted by: Mikhail Kupchik Reported by: Mikhail Kupchik Reviewed by: bapt, allanjude Approved by: allanjude (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D8644 Modified: head/lib/libstand/cd9660.c head/lib/libstand/dosfs.c head/lib/libstand/ext2fs.c head/lib/libstand/nandfs.c head/lib/libstand/read.c head/lib/libstand/stand.h head/lib/libstand/ufs.c head/lib/libstand/write.c head/sys/boot/common/bcache.c head/sys/boot/common/bootstrap.h head/sys/boot/common/disk.c head/sys/boot/common/md.c head/sys/boot/efi/libefi/efipart.c head/sys/boot/i386/libfirewire/firewire.c head/sys/boot/i386/libi386/bioscd.c head/sys/boot/i386/libi386/biosdisk.c head/sys/boot/i386/libi386/pxe.c head/sys/boot/mips/beri/loader/beri_disk_cfi.c head/sys/boot/mips/beri/loader/beri_disk_sdcard.c head/sys/boot/ofw/libofw/ofw_disk.c head/sys/boot/pc98/libpc98/bioscd.c head/sys/boot/pc98/libpc98/biosdisk.c head/sys/boot/powerpc/kboot/hostdisk.c head/sys/boot/powerpc/ps3/ps3cdrom.c head/sys/boot/powerpc/ps3/ps3disk.c head/sys/boot/uboot/lib/disk.c head/sys/boot/usb/storage/umass_loader.c head/sys/boot/userboot/userboot/host.c head/sys/boot/userboot/userboot/userboot_disk.c head/sys/boot/zfs/zfs.c Modified: head/lib/libstand/cd9660.c ============================================================================== --- head/lib/libstand/cd9660.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/lib/libstand/cd9660.c Fri Dec 30 19:06:29 2016 (r310850) @@ -143,7 +143,7 @@ susp_lookup_record(struct open_file *f, if (bcmp(sh->type, SUSP_CONTINUATION, 2) == 0) { shc = (ISO_RRIP_CONT *)sh; error = f->f_dev->dv_strategy(f->f_devdata, F_READ, - cdb2devb(isonum_733(shc->location)), 0, + cdb2devb(isonum_733(shc->location)), ISO_DEFAULT_BLOCK_SIZE, susp_buffer, &read); /* Bail if it fails. */ @@ -288,7 +288,7 @@ cd9660_open(const char *path, struct ope for (bno = 16;; bno++) { twiddle(1); rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno), - 0, ISO_DEFAULT_BLOCK_SIZE, buf, &read); + ISO_DEFAULT_BLOCK_SIZE, buf, &read); if (rc) goto out; if (read != ISO_DEFAULT_BLOCK_SIZE) { @@ -322,7 +322,7 @@ cd9660_open(const char *path, struct ope twiddle(1); rc = f->f_dev->dv_strategy (f->f_devdata, F_READ, - cdb2devb(bno + boff), 0, + cdb2devb(bno + boff), ISO_DEFAULT_BLOCK_SIZE, buf, &read); if (rc) @@ -387,7 +387,7 @@ cd9660_open(const char *path, struct ope bno = isonum_733(rec.extent) + isonum_711(rec.ext_attr_length); twiddle(1); rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno), - 0, ISO_DEFAULT_BLOCK_SIZE, buf, &read); + ISO_DEFAULT_BLOCK_SIZE, buf, &read); if (rc) goto out; if (read != ISO_DEFAULT_BLOCK_SIZE) { @@ -444,7 +444,7 @@ buf_read_file(struct open_file *f, char twiddle(16); rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, - cdb2devb(blkno), 0, ISO_DEFAULT_BLOCK_SIZE, + cdb2devb(blkno), ISO_DEFAULT_BLOCK_SIZE, fp->f_buf, &read); if (rc) return (rc); Modified: head/lib/libstand/dosfs.c ============================================================================== --- head/lib/libstand/dosfs.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/lib/libstand/dosfs.c Fri Dec 30 19:06:29 2016 (r310850) @@ -154,7 +154,7 @@ static int fatcnt(DOS_FS *, u_int); static int fatget(DOS_FS *, u_int *); static int fatend(u_int, u_int); static int ioread(DOS_FS *, u_int, void *, u_int); -static int ioget(struct open_file *, daddr_t, size_t, void *, u_int); +static int ioget(struct open_file *, daddr_t, void *, u_int); static void dos_read_fat(DOS_FS *fs, struct open_file *fd) @@ -172,7 +172,7 @@ dos_read_fat(DOS_FS *fs, struct open_fil fat.buf = malloc(secbyt(fs->spf)); if (fat.buf != NULL) { - if (ioget(fd, fs->lsnfat, 0, fat.buf, secbyt(fs->spf)) == 0) { + if (ioget(fd, fs->lsnfat, fat.buf, secbyt(fs->spf)) == 0) { fat.size = fs->spf; fat.unit = dd->d_unit; return; @@ -199,7 +199,7 @@ dos_mount(DOS_FS *fs, struct open_file * fs->fd = fd; if ((err = !(buf = malloc(secbyt(1))) ? errno : 0) || - (err = ioget(fs->fd, 0, 0, buf, secbyt(1))) || + (err = ioget(fs->fd, 0, buf, secbyt(1))) || (err = parsebs(fs, (DOS_BS *)buf))) { if (buf != NULL) free(buf); @@ -619,7 +619,7 @@ lookup(DOS_FS *fs, u_int clus, const cha else return (EINVAL); for (sec = 0; sec < nsec; sec++) { - if ((err = ioget(fs->fd, lsec + sec, 0, dir, secbyt(1)))) + if ((err = ioget(fs->fd, lsec + sec, dir, secbyt(1)))) return (err); for (ent = 0; ent < DEPSEC; ent++) { if (!*dir[ent].de.name) @@ -768,8 +768,7 @@ static int fatget(DOS_FS *fs, u_int *c) { u_char buf[4]; - u_char *s; - u_int x, offset, off, n, nbyte, lsec; + u_int x, offset, n, nbyte; struct devdesc *dd = fs->fd->f_devdata; int err = 0; @@ -783,25 +782,9 @@ fatget(DOS_FS *fs, u_int *c) offset = fatoff(fs->fatsz, *c); nbyte = fs->fatsz != 32 ? 2 : 4; - s = buf; - if ((off = offset & (SECSIZ - 1))) { - offset -= off; - lsec = bytsec(offset); - offset += SECSIZ; - if ((n = SECSIZ - off) > nbyte) - n = nbyte; - memcpy(s, fat.buf + secbyt(lsec) + off, n); - s += n; - nbyte -= n; - } - n = nbyte & (SECSIZ - 1); - if (nbyte -= n) { - memcpy(s, fat.buf + secbyt(bytsec(offset)), nbyte); - offset += nbyte; - s += nbyte; - } - if (n) - memcpy(s, fat.buf + secbyt(bytsec(offset)), n); + if (offset + nbyte > secbyt(fat.size)) + return (EINVAL); + memcpy(buf, fat.buf + offset, nbyte); } x = fs->fatsz != 32 ? cv2(buf) : cv4(buf); @@ -827,28 +810,31 @@ ioread(DOS_FS *fs, u_int offset, void *b char *s; u_int off, n; int err; + u_char local_buf[SECSIZ]; s = buf; if ((off = offset & (SECSIZ - 1))) { offset -= off; if ((n = SECSIZ - off) > nbyte) n = nbyte; - if ((err = ioget(fs->fd, bytsec(offset), off, s, n))) + if ((err = ioget(fs->fd, bytsec(offset), local_buf, sizeof(local_buf)))) return (err); + memcpy(s, local_buf + off, n); offset += SECSIZ; s += n; nbyte -= n; } n = nbyte & (SECSIZ - 1); if (nbyte -= n) { - if ((err = ioget(fs->fd, bytsec(offset), 0, s, nbyte))) + if ((err = ioget(fs->fd, bytsec(offset), s, nbyte))) return (err); offset += nbyte; s += nbyte; } if (n) { - if ((err = ioget(fs->fd, bytsec(offset), 0, s, n))) + if ((err = ioget(fs->fd, bytsec(offset), local_buf, sizeof(local_buf)))) return (err); + memcpy(s, local_buf, n); } return (0); } @@ -857,8 +843,8 @@ ioread(DOS_FS *fs, u_int offset, void *b * Sector-based I/O primitive */ static int -ioget(struct open_file *fd, daddr_t lsec, size_t offset, void *buf, u_int size) +ioget(struct open_file *fd, daddr_t lsec, void *buf, u_int size) { - return ((fd->f_dev->dv_strategy)(fd->f_devdata, F_READ, lsec, offset, + return ((fd->f_dev->dv_strategy)(fd->f_devdata, F_READ, lsec, size, buf, NULL)); } Modified: head/lib/libstand/ext2fs.c ============================================================================== --- head/lib/libstand/ext2fs.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/lib/libstand/ext2fs.c Fri Dec 30 19:06:29 2016 (r310850) @@ -355,7 +355,7 @@ ext2fs_open(const char *upath, struct op fp->f_fs = fs; twiddle(1); error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - EXT2_SBLOCK, 0, EXT2_SBSIZE, (char *)fs, &buf_size); + EXT2_SBLOCK, EXT2_SBSIZE, (char *)fs, &buf_size); if (error) goto out; @@ -397,7 +397,7 @@ ext2fs_open(const char *upath, struct op fp->f_bg = malloc(len); twiddle(1); error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - EXT2_SBLOCK + EXT2_SBSIZE / DEV_BSIZE, 0, len, + EXT2_SBLOCK + EXT2_SBSIZE / DEV_BSIZE, len, (char *)fp->f_bg, &buf_size); if (error) goto out; @@ -509,7 +509,7 @@ ext2fs_open(const char *upath, struct op twiddle(1); error = (f->f_dev->dv_strategy)(f->f_devdata, - F_READ, fsb_to_db(fs, disk_block), 0, + F_READ, fsb_to_db(fs, disk_block), fs->fs_bsize, buf, &buf_size); if (error) goto out; @@ -570,7 +570,7 @@ read_inode(ino_t inumber, struct open_fi buf = malloc(fs->fs_bsize); twiddle(1); error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - ino_to_db(fs, fp->f_bg, inumber), 0, fs->fs_bsize, buf, &rsize); + ino_to_db(fs, fp->f_bg, inumber), fs->fs_bsize, buf, &rsize); if (error) goto out; if (rsize != fs->fs_bsize) { @@ -667,7 +667,7 @@ block_map(struct open_file *f, daddr_t f malloc(fs->fs_bsize); twiddle(1); error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - fsb_to_db(fp->f_fs, ind_block_num), 0, fs->fs_bsize, + fsb_to_db(fp->f_fs, ind_block_num), fs->fs_bsize, fp->f_blk[level], &fp->f_blksize[level]); if (error) return (error); @@ -725,7 +725,7 @@ buf_read_file(struct open_file *f, char } else { twiddle(4); error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - fsb_to_db(fs, disk_block), 0, block_size, + fsb_to_db(fs, disk_block), block_size, fp->f_buf, &fp->f_buf_size); if (error) goto done; Modified: head/lib/libstand/nandfs.c ============================================================================== --- head/lib/libstand/nandfs.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/lib/libstand/nandfs.c Fri Dec 30 19:06:29 2016 (r310850) @@ -1024,7 +1024,7 @@ ioread(struct open_file *f, off_t pos, v buffer = malloc(nsec * bsize); - err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, pos, 0, + err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, pos, nsec * bsize, buffer, NULL); memcpy(buf, (void *)((uintptr_t)buffer + off), length); Modified: head/lib/libstand/read.c ============================================================================== --- head/lib/libstand/read.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/lib/libstand/read.c Fri Dec 30 19:06:29 2016 (r310850) @@ -79,7 +79,7 @@ read(int fd, void *dest, size_t bcount) if (f->f_flags & F_RAW) { twiddle(4); errno = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - btodb(f->f_offset), 0, bcount, dest, &resid); + btodb(f->f_offset), bcount, dest, &resid); if (errno) return (-1); f->f_offset += resid; Modified: head/lib/libstand/stand.h ============================================================================== --- head/lib/libstand/stand.h Fri Dec 30 18:55:33 2016 (r310849) +++ head/lib/libstand/stand.h Fri Dec 30 19:06:29 2016 (r310850) @@ -139,7 +139,7 @@ struct devsw { int dv_type; /* opaque type constant, arch-dependant */ int (*dv_init)(void); /* early probe call */ int (*dv_strategy)(void *devdata, int rw, daddr_t blk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); int (*dv_open)(struct open_file *f, ...); int (*dv_close)(struct open_file *f); int (*dv_ioctl)(struct open_file *f, u_long cmd, void *data); Modified: head/lib/libstand/ufs.c ============================================================================== --- head/lib/libstand/ufs.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/lib/libstand/ufs.c Fri Dec 30 19:06:29 2016 (r310850) @@ -157,7 +157,7 @@ read_inode(inumber, f) buf = malloc(fs->fs_bsize); twiddle(1); rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - fsbtodb(fs, ino_to_fsba(fs, inumber)), 0, fs->fs_bsize, + fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize, buf, &rsize); if (rc) goto out; @@ -267,7 +267,7 @@ block_map(f, file_block, disk_block_p) malloc(fs->fs_bsize); twiddle(1); rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - fsbtodb(fp->f_fs, ind_block_num), 0, + fsbtodb(fp->f_fs, ind_block_num), fs->fs_bsize, fp->f_blk[level], &fp->f_blksize[level]); @@ -348,7 +348,7 @@ buf_write_file(f, buf_p, size_p) twiddle(4); rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - fsbtodb(fs, disk_block), 0, + fsbtodb(fs, disk_block), block_size, fp->f_buf, &fp->f_buf_size); if (rc) return (rc); @@ -367,7 +367,7 @@ buf_write_file(f, buf_p, size_p) twiddle(4); rc = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE, - fsbtodb(fs, disk_block), 0, + fsbtodb(fs, disk_block), block_size, fp->f_buf, &fp->f_buf_size); return (rc); } @@ -408,7 +408,7 @@ buf_read_file(f, buf_p, size_p) } else { twiddle(4); rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - fsbtodb(fs, disk_block), 0, + fsbtodb(fs, disk_block), block_size, fp->f_buf, &fp->f_buf_size); if (rc) return (rc); @@ -521,7 +521,7 @@ ufs_open(upath, f) */ for (i = 0; sblock_try[i] != -1; i++) { rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - sblock_try[i] / DEV_BSIZE, 0, SBLOCKSIZE, + sblock_try[i] / DEV_BSIZE, SBLOCKSIZE, (char *)fs, &buf_size); if (rc) goto out; @@ -651,7 +651,7 @@ ufs_open(upath, f) twiddle(1); rc = (f->f_dev->dv_strategy)(f->f_devdata, - F_READ, fsbtodb(fs, disk_block), 0, + F_READ, fsbtodb(fs, disk_block), fs->fs_bsize, buf, &buf_size); if (rc) goto out; Modified: head/lib/libstand/write.c ============================================================================== --- head/lib/libstand/write.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/lib/libstand/write.c Fri Dec 30 19:06:29 2016 (r310850) @@ -82,7 +82,7 @@ write(fd, dest, bcount) if (f->f_flags & F_RAW) { twiddle(4); errno = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE, - btodb(f->f_offset), 0, bcount, dest, &resid); + btodb(f->f_offset), bcount, dest, &resid); if (errno) return (-1); f->f_offset += resid; Modified: head/sys/boot/common/bcache.c ============================================================================== --- head/sys/boot/common/bcache.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/common/bcache.c Fri Dec 30 19:06:29 2016 (r310850) @@ -182,8 +182,8 @@ bcache_free(void *cache) * cache with the new values. */ static int -write_strategy(void *devdata, int rw, daddr_t blk, size_t offset, - size_t size, char *buf, size_t *rsize) +write_strategy(void *devdata, int rw, daddr_t blk, size_t size, + char *buf, size_t *rsize) { struct bcache_devdata *dd = (struct bcache_devdata *)devdata; struct bcache *bc = dd->dv_cache; @@ -197,7 +197,7 @@ write_strategy(void *devdata, int rw, da } /* Write the blocks */ - return (dd->dv_strategy(dd->dv_devdata, rw, blk, offset, size, buf, rsize)); + return (dd->dv_strategy(dd->dv_devdata, rw, blk, size, buf, rsize)); } /* @@ -206,8 +206,8 @@ write_strategy(void *devdata, int rw, da * device I/O and then use the I/O results to populate the cache. */ static int -read_strategy(void *devdata, int rw, daddr_t blk, size_t offset, - size_t size, char *buf, size_t *rsize) +read_strategy(void *devdata, int rw, daddr_t blk, size_t size, + char *buf, size_t *rsize) { struct bcache_devdata *dd = (struct bcache_devdata *)devdata; struct bcache *bc = dd->dv_cache; @@ -225,7 +225,7 @@ read_strategy(void *devdata, int rw, dad *rsize = 0; nblk = size / bcache_blksize; - if ((nblk == 0 && size != 0) || offset != 0) + if (nblk == 0 && size != 0) nblk++; result = 0; complete = 1; @@ -246,8 +246,7 @@ read_strategy(void *devdata, int rw, dad if (complete) { /* whole set was in cache, return it */ if (bc->ra < BCACHE_READAHEAD) bc->ra <<= 1; /* increase read ahead */ - bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)) + offset, - buf, size); + bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)), buf, size); goto done; } @@ -282,7 +281,7 @@ read_strategy(void *devdata, int rw, dad * in either case we should return the data in bcache and only * return error if there is no data. */ - result = dd->dv_strategy(dd->dv_devdata, rw, p_blk, 0, + result = dd->dv_strategy(dd->dv_devdata, rw, p_blk, p_size * bcache_blksize, p_buf, &r_size); r_size /= bcache_blksize; @@ -307,8 +306,7 @@ read_strategy(void *devdata, int rw, dad size = i * bcache_blksize; if (size != 0) { - bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)) + offset, - buf, size); + bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)), buf, size); result = 0; } @@ -323,8 +321,8 @@ read_strategy(void *devdata, int rw, dad * directly to the disk. XXX tune this. */ int -bcache_strategy(void *devdata, int rw, daddr_t blk, size_t offset, - size_t size, char *buf, size_t *rsize) +bcache_strategy(void *devdata, int rw, daddr_t blk, size_t size, + char *buf, size_t *rsize) { struct bcache_devdata *dd = (struct bcache_devdata *)devdata; struct bcache *bc = dd->dv_cache; @@ -339,23 +337,16 @@ bcache_strategy(void *devdata, int rw, d /* bypass large requests, or when the cache is inactive */ if (bc == NULL || - (offset == 0 && ((size * 2 / bcache_blksize) > bcache_nblks))) { + ((size * 2 / bcache_blksize) > bcache_nblks)) { DEBUG("bypass %d from %d", size / bcache_blksize, blk); bcache_bypasses++; - return (dd->dv_strategy(dd->dv_devdata, rw, blk, offset, size, buf, - rsize)); - } - - /* normalize offset */ - while (offset >= bcache_blksize) { - blk++; - offset -= bcache_blksize; + return (dd->dv_strategy(dd->dv_devdata, rw, blk, size, buf, rsize)); } switch (rw) { case F_READ: nblk = size / bcache_blksize; - if (offset || (size != 0 && nblk == 0)) + if (size != 0 && nblk == 0) nblk++; /* read at least one block */ ret = 0; @@ -366,14 +357,10 @@ bcache_strategy(void *devdata, int rw, d if (size <= bcache_blksize) csize = size; - else { + else csize = cblk * bcache_blksize; - if (offset) - csize -= (bcache_blksize - offset); - } - ret = read_strategy(devdata, rw, blk, offset, - csize, buf+total, &isize); + ret = read_strategy(devdata, rw, blk, csize, buf+total, &isize); /* * we may have error from read ahead, if we have read some data @@ -384,8 +371,7 @@ bcache_strategy(void *devdata, int rw, d ret = 0; break; } - blk += (offset+isize) / bcache_blksize; - offset = 0; + blk += isize / bcache_blksize; total += isize; size -= isize; nblk = size / bcache_blksize; @@ -396,7 +382,7 @@ bcache_strategy(void *devdata, int rw, d return (ret); case F_WRITE: - return write_strategy(devdata, rw, blk, offset, size, buf, rsize); + return write_strategy(devdata, rw, blk, size, buf, rsize); } return -1; } Modified: head/sys/boot/common/bootstrap.h ============================================================================== --- head/sys/boot/common/bootstrap.h Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/common/bootstrap.h Fri Dec 30 19:06:29 2016 (r310850) @@ -77,8 +77,8 @@ void bcache_init(u_int nblks, size_t bsi void bcache_add_dev(int); void *bcache_allocate(void); void bcache_free(void *); -int bcache_strategy(void *devdata, int rw, daddr_t blk, size_t offset, - size_t size, char *buf, size_t *rsize); +int bcache_strategy(void *devdata, int rw, daddr_t blk, size_t size, + char *buf, size_t *rsize); /* * Disk block cache @@ -86,7 +86,7 @@ int bcache_strategy(void *devdata, int r struct bcache_devdata { int (*dv_strategy)(void *devdata, int rw, daddr_t blk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); void *dv_devdata; void *dv_cache; }; Modified: head/sys/boot/common/disk.c ============================================================================== --- head/sys/boot/common/disk.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/common/disk.c Fri Dec 30 19:06:29 2016 (r310850) @@ -178,7 +178,7 @@ ptblread(void *d, void *buf, size_t bloc dev = (struct disk_devdesc *)d; od = (struct open_disk *)dev->d_opendata; - return (dev->d_dev->dv_strategy(dev, F_READ, offset, 0, + return (dev->d_dev->dv_strategy(dev, F_READ, offset, blocks * od->sectorsize, (char *)buf, NULL)); } @@ -244,7 +244,7 @@ disk_read(struct disk_devdesc *dev, void int ret; od = (struct open_disk *)dev->d_opendata; - ret = dev->d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset, 0, + ret = dev->d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset, blocks * od->sectorsize, buf, NULL); return (ret); @@ -257,7 +257,7 @@ disk_write(struct disk_devdesc *dev, voi int ret; od = (struct open_disk *)dev->d_opendata; - ret = dev->d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset, 0, + ret = dev->d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset, blocks * od->sectorsize, buf, NULL); return (ret); Modified: head/sys/boot/common/md.c ============================================================================== --- head/sys/boot/common/md.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/common/md.c Fri Dec 30 19:06:29 2016 (r310850) @@ -60,7 +60,7 @@ static struct { /* devsw I/F */ static int md_init(void); -static int md_strategy(void *, int, daddr_t, size_t, size_t, char *, size_t *); +static int md_strategy(void *, int, daddr_t, size_t, char *, size_t *); static int md_open(struct open_file *, ...); static int md_close(struct open_file *); static int md_print(int); @@ -84,7 +84,7 @@ md_init(void) } static int -md_strategy(void *devdata, int rw, daddr_t blk, size_t offset, size_t size, +md_strategy(void *devdata, int rw, daddr_t blk, size_t size, char *buf, size_t *rsize) { struct devdesc *dev = (struct devdesc *)devdata; Modified: head/sys/boot/efi/libefi/efipart.c ============================================================================== --- head/sys/boot/efi/libefi/efipart.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/efi/libefi/efipart.c Fri Dec 30 19:06:29 2016 (r310850) @@ -41,10 +41,8 @@ __FBSDID("$FreeBSD$"); static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL; static int efipart_init(void); -static int efipart_strategy(void *, int, daddr_t, size_t, size_t, char *, - size_t *); -static int efipart_realstrategy(void *, int, daddr_t, size_t, size_t, char *, - size_t *); +static int efipart_strategy(void *, int, daddr_t, size_t, char *, size_t *); +static int efipart_realstrategy(void *, int, daddr_t, size_t, char *, size_t *); static int efipart_open(struct open_file *, ...); static int efipart_close(struct open_file *); static int efipart_print(int); @@ -289,8 +287,8 @@ efipart_readwrite(EFI_BLOCK_IO *blkio, i } static int -efipart_strategy(void *devdata, int rw, daddr_t blk, size_t offset, - size_t size, char *buf, size_t *rsize) +efipart_strategy(void *devdata, int rw, daddr_t blk, size_t size, + char *buf, size_t *rsize) { struct bcache_devdata bcd; struct devdesc *dev; @@ -299,13 +297,12 @@ efipart_strategy(void *devdata, int rw, bcd.dv_strategy = efipart_realstrategy; bcd.dv_devdata = devdata; bcd.dv_cache = PD(dev).pd_bcache; - return (bcache_strategy(&bcd, rw, blk, offset, size, - buf, rsize)); + return (bcache_strategy(&bcd, rw, blk, size, buf, rsize)); } static int -efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t offset, - size_t size, char *buf, size_t *rsize) +efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t size, + char *buf, size_t *rsize) { struct devdesc *dev = (struct devdesc *)devdata; EFI_BLOCK_IO *blkio; Modified: head/sys/boot/i386/libfirewire/firewire.c ============================================================================== --- head/sys/boot/i386/libfirewire/firewire.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/i386/libfirewire/firewire.c Fri Dec 30 19:06:29 2016 (r310850) @@ -66,7 +66,7 @@ struct crom_src_buf { static int fw_init(void); static int fw_strategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int fw_open(struct open_file *f, ...); static int fw_close(struct open_file *f); static int fw_print(int verbose); @@ -210,7 +210,7 @@ fw_cleanup() } static int -fw_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, +fw_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { return (EIO); Modified: head/sys/boot/i386/libi386/bioscd.c ============================================================================== --- head/sys/boot/i386/libi386/bioscd.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/i386/libi386/bioscd.c Fri Dec 30 19:06:29 2016 (r310850) @@ -95,9 +95,9 @@ static int nbcinfo = 0; static int bc_read(int unit, daddr_t dblk, int blks, caddr_t dest); static int bc_init(void); static int bc_strategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int bc_realstrategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int bc_open(struct open_file *f, ...); static int bc_close(struct open_file *f); static int bc_print(int verbose); @@ -237,7 +237,7 @@ bc_close(struct open_file *f) } static int -bc_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, +bc_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { struct bcache_devdata bcd; @@ -248,11 +248,11 @@ bc_strategy(void *devdata, int rw, daddr bcd.dv_devdata = devdata; bcd.dv_cache = BC(dev).bc_bcache; - return (bcache_strategy(&bcd, rw, dblk, offset, size, buf, rsize)); + return (bcache_strategy(&bcd, rw, dblk, size, buf, rsize)); } static int -bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, +bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { struct i386_devdesc *dev; Modified: head/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- head/sys/boot/i386/libi386/biosdisk.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/i386/libi386/biosdisk.c Fri Dec 30 19:06:29 2016 (r310850) @@ -128,10 +128,10 @@ static int bd_write(struct disk_devdesc static int bd_int13probe(struct bdinfo *bd); static int bd_init(void); -static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t offset, - size_t size, char *buf, size_t *rsize); -static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, size_t offset, - size_t size, char *buf, size_t *rsize); +static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t size, + char *buf, size_t *rsize); +static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, size_t size, + char *buf, size_t *rsize); static int bd_open(struct open_file *f, ...); static int bd_close(struct open_file *f); static int bd_ioctl(struct open_file *f, u_long cmd, void *data); @@ -502,7 +502,7 @@ bd_ioctl(struct open_file *f, u_long cmd } static int -bd_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, +bd_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { struct bcache_devdata bcd; @@ -512,12 +512,12 @@ bd_strategy(void *devdata, int rw, daddr bcd.dv_strategy = bd_realstrategy; bcd.dv_devdata = devdata; bcd.dv_cache = BD(dev).bd_bcache; - return (bcache_strategy(&bcd, rw, dblk + dev->d_offset, offset, + return (bcache_strategy(&bcd, rw, dblk + dev->d_offset, size, buf, rsize)); } static int -bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, +bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { struct disk_devdesc *dev = (struct disk_devdesc *)devdata; Modified: head/sys/boot/i386/libi386/pxe.c ============================================================================== --- head/sys/boot/i386/libi386/pxe.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/i386/libi386/pxe.c Fri Dec 30 19:06:29 2016 (r310850) @@ -72,7 +72,7 @@ static void bangpxe_call(int func); static int pxe_init(void); static int pxe_strategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int pxe_open(struct open_file *f, ...); static int pxe_close(struct open_file *f); static int pxe_print(int verbose); @@ -247,8 +247,8 @@ pxe_init(void) static int -pxe_strategy(void *devdata, int flag, daddr_t dblk, size_t offset, size_t size, - char *buf, size_t *rsize) +pxe_strategy(void *devdata, int flag, daddr_t dblk, size_t size, + char *buf, size_t *rsize) { return (EIO); } Modified: head/sys/boot/mips/beri/loader/beri_disk_cfi.c ============================================================================== --- head/sys/boot/mips/beri/loader/beri_disk_cfi.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/mips/beri/loader/beri_disk_cfi.c Fri Dec 30 19:06:29 2016 (r310850) @@ -45,7 +45,7 @@ static int beri_cfi_disk_init(void); static int beri_cfi_disk_open(struct open_file *, ...); static int beri_cfi_disk_close(struct open_file *); static void beri_cfi_disk_cleanup(void); -static int beri_cfi_disk_strategy(void *, int, daddr_t, size_t, size_t, +static int beri_cfi_disk_strategy(void *, int, daddr_t, size_t, char *, size_t *); static int beri_cfi_disk_print(int); @@ -69,8 +69,8 @@ beri_cfi_disk_init(void) } static int -beri_cfi_disk_strategy(void *devdata, int flag, daddr_t dblk, size_t offset, - size_t size, char *buf, size_t *rsizep) +beri_cfi_disk_strategy(void *devdata, int flag, daddr_t dblk, size_t size, + char *buf, size_t *rsizep) { int error; Modified: head/sys/boot/mips/beri/loader/beri_disk_sdcard.c ============================================================================== --- head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Fri Dec 30 19:06:29 2016 (r310850) @@ -45,7 +45,7 @@ static int beri_sdcard_disk_init(void); static int beri_sdcard_disk_open(struct open_file *, ...); static int beri_sdcard_disk_close(struct open_file *); static void beri_sdcard_disk_cleanup(void); -static int beri_sdcard_disk_strategy(void *, int, daddr_t, size_t, size_t, +static int beri_sdcard_disk_strategy(void *, int, daddr_t, size_t, char *, size_t *); static int beri_sdcard_disk_print(int); @@ -69,8 +69,8 @@ beri_sdcard_disk_init(void) } static int -beri_sdcard_disk_strategy(void *devdata, int flag, daddr_t dblk, size_t offset, - size_t size, char *buf, size_t *rsizep) +beri_sdcard_disk_strategy(void *devdata, int flag, daddr_t dblk, size_t size, + char *buf, size_t *rsizep) { int error; Modified: head/sys/boot/ofw/libofw/ofw_disk.c ============================================================================== --- head/sys/boot/ofw/libofw/ofw_disk.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/ofw/libofw/ofw_disk.c Fri Dec 30 19:06:29 2016 (r310850) @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); static int ofwd_init(void); static int ofwd_strategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int ofwd_open(struct open_file *f, ...); static int ofwd_close(struct open_file *f); static int ofwd_ioctl(struct open_file *f, u_long cmd, void *data); @@ -83,8 +83,8 @@ ofwd_init(void) } static int -ofwd_strategy(void *devdata, int flag __unused, daddr_t dblk, size_t offset, - size_t size, char *buf, size_t *rsize) +ofwd_strategy(void *devdata, int flag __unused, daddr_t dblk, size_t size, + char *buf, size_t *rsize) { struct ofw_devdesc *dp = (struct ofw_devdesc *)devdata; daddr_t pos; Modified: head/sys/boot/pc98/libpc98/bioscd.c ============================================================================== --- head/sys/boot/pc98/libpc98/bioscd.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/pc98/libpc98/bioscd.c Fri Dec 30 19:06:29 2016 (r310850) @@ -94,9 +94,9 @@ static int nbcinfo = 0; static int bc_read(int unit, daddr_t dblk, int blks, caddr_t dest); static int bc_init(void); static int bc_strategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int bc_realstrategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int bc_open(struct open_file *f, ...); static int bc_close(struct open_file *f); static int bc_print(int verbose); @@ -233,7 +233,7 @@ bc_close(struct open_file *f) } static int -bc_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, +bc_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { struct bcache_devdata bcd; @@ -244,11 +244,11 @@ bc_strategy(void *devdata, int rw, daddr bcd.dv_devdata = devdata; bcd.dv_cache = BC(dev).bc_bcache; - return (bcache_strategy(&bcd, rw, dblk, offset, size, buf, rsize)); + return (bcache_strategy(&bcd, rw, dblk, size, buf, rsize)); } static int -bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, +bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { struct i386_devdesc *dev; Modified: head/sys/boot/pc98/libpc98/biosdisk.c ============================================================================== --- head/sys/boot/pc98/libpc98/biosdisk.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/pc98/libpc98/biosdisk.c Fri Dec 30 19:06:29 2016 (r310850) @@ -118,9 +118,9 @@ static int bd_printbsdslice(struct open_ static int bd_init(void); static int bd_strategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int bd_open(struct open_file *f, ...); static int bd_close(struct open_file *f); static int bd_print(int verbose); @@ -746,7 +746,7 @@ bd_closedisk(struct open_disk *od) } static int -bd_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, +bd_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { struct bcache_devdata bcd; @@ -756,12 +756,11 @@ bd_strategy(void *devdata, int rw, daddr bcd.dv_strategy = bd_realstrategy; bcd.dv_devdata = devdata; bcd.dv_cache = BD(dev).bd_bcache; - return(bcache_strategy(&bcd, rw, dblk+od->od_boff, offset, - size, buf, rsize)); + return(bcache_strategy(&bcd, rw, dblk+od->od_boff, size, buf, rsize)); } static int -bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset, +bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { struct open_disk *od = (struct open_disk *)(((struct i386_devdesc *)devdata)->d_kind.biosdisk.data); Modified: head/sys/boot/powerpc/kboot/hostdisk.c ============================================================================== --- head/sys/boot/powerpc/kboot/hostdisk.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/powerpc/kboot/hostdisk.c Fri Dec 30 19:06:29 2016 (r310850) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); static int hostdisk_init(void); static int hostdisk_strategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int hostdisk_open(struct open_file *f, ...); static int hostdisk_close(struct open_file *f); static int hostdisk_ioctl(struct open_file *f, u_long cmd, void *data); @@ -58,8 +58,8 @@ hostdisk_init(void) } static int -hostdisk_strategy(void *devdata, int flag, daddr_t dblk, size_t offset, - size_t size, char *buf, size_t *rsize) +hostdisk_strategy(void *devdata, int flag, daddr_t dblk, size_t size, + char *buf, size_t *rsize) { struct devdesc *desc = devdata; daddr_t pos; Modified: head/sys/boot/powerpc/ps3/ps3cdrom.c ============================================================================== --- head/sys/boot/powerpc/ps3/ps3cdrom.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/powerpc/ps3/ps3cdrom.c Fri Dec 30 19:06:29 2016 (r310850) @@ -46,7 +46,7 @@ static int ps3cdrom_init(void); static int ps3cdrom_strategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int ps3cdrom_open(struct open_file *f, ...); static int ps3cdrom_close(struct open_file *f); static int ps3cdrom_print(int verbose); @@ -76,7 +76,7 @@ static int ps3cdrom_init(void) } static int ps3cdrom_strategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize) + size_t size, char *buf, size_t *rsize) { struct ps3_devdesc *dev = (struct ps3_devdesc *) devdata; int err; Modified: head/sys/boot/powerpc/ps3/ps3disk.c ============================================================================== --- head/sys/boot/powerpc/ps3/ps3disk.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/powerpc/ps3/ps3disk.c Fri Dec 30 19:06:29 2016 (r310850) @@ -58,7 +58,7 @@ static void ps3disk_uuid_letoh(uuid_t *u static int ps3disk_init(void); static int ps3disk_strategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int ps3disk_open(struct open_file *f, ...); static int ps3disk_close(struct open_file *f); static int ps3disk_print(int verbose); @@ -109,7 +109,7 @@ static int ps3disk_init(void) } static int ps3disk_strategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize) + size_t size, char *buf, size_t *rsize) { struct ps3_devdesc *dev = (struct ps3_devdesc *) devdata; struct open_dev *od = (struct open_dev *) dev->d_disk.data; Modified: head/sys/boot/uboot/lib/disk.c ============================================================================== --- head/sys/boot/uboot/lib/disk.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/uboot/lib/disk.c Fri Dec 30 19:06:29 2016 (r310850) @@ -73,8 +73,7 @@ static int stor_readdev(struct disk_devd /* devsw I/F */ static int stor_init(void); -static int stor_strategy(void *, int, daddr_t, size_t, size_t, char *, - size_t *); +static int stor_strategy(void *, int, daddr_t, size_t, char *, size_t *); static int stor_open(struct open_file *, ...); static int stor_close(struct open_file *); static int stor_ioctl(struct open_file *f, u_long cmd, void *data); @@ -144,7 +143,7 @@ stor_cleanup(void) } static int -stor_strategy(void *devdata, int rw, daddr_t blk, size_t offset, size_t size, +stor_strategy(void *devdata, int rw, daddr_t blk, size_t size, char *buf, size_t *rsize) { struct disk_devdesc *dev = (struct disk_devdesc *)devdata; Modified: head/sys/boot/usb/storage/umass_loader.c ============================================================================== --- head/sys/boot/usb/storage/umass_loader.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/usb/storage/umass_loader.c Fri Dec 30 19:06:29 2016 (r310850) @@ -48,8 +48,7 @@ static int umass_disk_open(struct open_f static int umass_disk_close(struct open_file *); static void umass_disk_cleanup(void); static int umass_disk_ioctl(struct open_file *, u_long, void *); -static int umass_disk_strategy(void *, int, daddr_t, size_t, size_t, char *, - size_t *); +static int umass_disk_strategy(void *, int, daddr_t, size_t, char *, size_t *); static int umass_disk_print(int); struct devsw umass_disk = { @@ -85,8 +84,8 @@ umass_disk_init(void) } static int -umass_disk_strategy(void *devdata, int flag, daddr_t dblk, size_t offset, - size_t size, char *buf, size_t *rsizep) +umass_disk_strategy(void *devdata, int flag, daddr_t dblk, size_t size, + char *buf, size_t *rsizep) { if (umass_uaa.device == NULL) return (ENXIO); Modified: head/sys/boot/userboot/userboot/host.c ============================================================================== --- head/sys/boot/userboot/userboot/host.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/userboot/userboot/host.c Fri Dec 30 19:06:29 2016 (r310850) @@ -171,8 +171,8 @@ host_dev_close(struct open_file *f) } static int -host_dev_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, - size_t size, char *buf, size_t *rsize) +host_dev_strategy(void *devdata, int rw, daddr_t dblk, size_t size, + char *buf, size_t *rsize) { return (ENOSYS); Modified: head/sys/boot/userboot/userboot/userboot_disk.c ============================================================================== --- head/sys/boot/userboot/userboot/userboot_disk.c Fri Dec 30 18:55:33 2016 (r310849) +++ head/sys/boot/userboot/userboot/userboot_disk.c Fri Dec 30 19:06:29 2016 (r310850) @@ -54,9 +54,9 @@ static struct userdisk_info *ud_info; static int userdisk_init(void); static void userdisk_cleanup(void); static int userdisk_strategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int userdisk_realstrategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int userdisk_open(struct open_file *f, ...); static int userdisk_close(struct open_file *f); static int userdisk_ioctl(struct open_file *f, u_long cmd, void *data); @@ -189,8 +189,8 @@ userdisk_close(struct open_file *f) } static int -userdisk_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, - size_t size, char *buf, size_t *rsize) +userdisk_strategy(void *devdata, int rw, daddr_t dblk, size_t size, + char *buf, size_t *rsize) { struct bcache_devdata bcd; struct disk_devdesc *dev; @@ -199,13 +199,13 @@ userdisk_strategy(void *devdata, int rw, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Dec 30 20:00:43 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10EEDC9766D; Fri, 30 Dec 2016 20:00:43 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4C9D1DD5; Fri, 30 Dec 2016 20:00:42 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUK0gZS069187; Fri, 30 Dec 2016 20:00:42 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUK0gFK069186; Fri, 30 Dec 2016 20:00:42 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201612302000.uBUK0gFK069186@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 30 Dec 2016 20:00:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310853 - head/lib/libstand X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 20:00:43 -0000 Author: tsoome Date: Fri Dec 30 20:00:41 2016 New Revision: 310853 URL: https://svnweb.freebsd.org/changeset/base/310853 Log: loader: nandfs calls strategy with one extra argument. The strategy argument cleanup in r310850 did miss another call to strategy(), and left it with extra argument. Reviewed by: allanjude Approved by: allanjude (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D9003 Modified: head/lib/libstand/nandfs.c Modified: head/lib/libstand/nandfs.c ============================================================================== --- head/lib/libstand/nandfs.c Fri Dec 30 19:55:04 2016 (r310852) +++ head/lib/libstand/nandfs.c Fri Dec 30 20:00:41 2016 (r310853) @@ -1045,7 +1045,7 @@ nandfs_probe_sectorsize(struct open_file for (i = 512; i < (16 * 1024); i <<= 1) { NANDFS_DEBUG("%d ", i); - err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, 0, 0, i, + err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, 0, i, buffer, NULL); if (err == 0) { From owner-svn-src-head@freebsd.org Fri Dec 30 20:16:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0654C97BAE; Fri, 30 Dec 2016 20:16:10 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF93E14BC; Fri, 30 Dec 2016 20:16:10 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUKG94t076782; Fri, 30 Dec 2016 20:16:09 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUKG9Di076781; Fri, 30 Dec 2016 20:16:09 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201612302016.uBUKG9Di076781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Fri, 30 Dec 2016 20:16:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310854 - head/sys/boot/fdt/dts/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 20:16:11 -0000 Author: jmcneill Date: Fri Dec 30 20:16:09 2016 New Revision: 310854 URL: https://svnweb.freebsd.org/changeset/base/310854 Log: Add missing reg property to usbphy node. MFC after: 1 week Modified: head/sys/boot/fdt/dts/arm/a83t.dtsi Modified: head/sys/boot/fdt/dts/arm/a83t.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/a83t.dtsi Fri Dec 30 20:00:41 2016 (r310853) +++ head/sys/boot/fdt/dts/arm/a83t.dtsi Fri Dec 30 20:16:09 2016 (r310854) @@ -176,6 +176,9 @@ usbphy: phy@01c19400 { compatible = "allwinner,sun8i-a83t-usb-phy"; + reg = <0x01c19400 0x2c>, + <0x01c1a800 0x4>, + <0x01c1a800 0x4>; clocks = <&usb_clk 8>, <&usb_clk 9>, <&usb_clk 10>, From owner-svn-src-head@freebsd.org Fri Dec 30 20:34:48 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC85AC984C8; Fri, 30 Dec 2016 20:34:48 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from st11p00im-asmtp004.me.com (st11p00im-asmtp004.me.com [17.172.80.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2986127C; Fri, 30 Dec 2016 20:34:48 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.st11p00im-asmtp004.me.com by st11p00im-asmtp004.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OJ000N00JJJIR00@st11p00im-asmtp004.me.com>; Fri, 30 Dec 2016 19:34:41 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=4d515a; t=1483126481; bh=mDjEU4W4XaCOcPUfmRQ77sfklHMrSJLSimHeMlsGWAI=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=a0N2I+Tl7e6441mxk8CNgo0qnemoddhuiXiB3pU9iED+f+u4y1yw7jE9JgaLBlMTR x4tPKknxODlGkog7BJ7KMdLgv5ofd0Pbsd7rjIJICsLFid3lm5y45WPeRECl8iTF4a rOs/v8Z+PkbZSrBHQn8HpPIHyrioAzF+DoZnJDs6dPBRfpZOOq8/yio9zJlsly3iv+ b2fUcoieGKCwKgfIN29BR5rZ1c9k+zzghvVUGUSssD43QitFAfhep8qOkX7saIsT/U I9qE40M4JARG00Flj8qilc0sqK/DsbBK9q4XQNl77lbvu1f1AC4wj3FAQrlNZAEMFj 2R89oRTTUYdsA== Received: from [10.0.0.7] (c-73-6-177-70.hsd1.tx.comcast.net [73.6.177.70]) by st11p00im-asmtp004.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OJ0000VMJPQJJ20@st11p00im-asmtp004.me.com>; Fri, 30 Dec 2016 19:34:40 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-30_14:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1603290000 definitions=main-1612300305 User-Agent: Microsoft-MacOutlook/f.1d.0.161209 Date: Fri, 30 Dec 2016 13:34:38 -0600 Subject: Re: svn commit: r310789 - head/lib/libpam/static_libpam From: Ravi Pokala Sender: "Pokala, Ravi" To: Ed Maste Cc: Alexander Kabaev , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-id: Thread-topic: svn commit: r310789 - head/lib/libpam/static_libpam References: <201612292130.uBTLUqus011628@repo.freebsd.org> <1A7F0D4F-1F4D-4885-B7E9-F764D4FA72BF@panasas.com> In-reply-to: MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 20:34:49 -0000 -----Original Message----- > From: on behalf of Ed Maste > Date: 2016-12-30, Friday at 07:39 > To: Ravi Pokala > Cc: Alexander Kabaev , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" > Subject: Re: svn commit: r310789 - head/lib/libpam/static_libpam > > On 29 December 2016 at 19:59, Ravi Pokala wrote: >> >> I'm a little confused - the original version had to have had a compile-only step to generate the object first, before running the link-only operation against the object. The new code replaces the link-only operation with a compile+link operation. Shouldn't the pre-existing compile-only operation be removed, since the new compile+link operation supersedes it? > > Hi Ravi, > > This change: > >>> - ${LD} -o ${.TARGET} -r --whole-archive ${.ALLSRC} >>> + ${CC} -nostdlib ${CFLAGS} -o ${.TARGET} -r -Wl,--whole-archive ${.ALLSRC} > > is not actually compiling, it's just invoking the compiler driver to > in turn invoke the linker. The input in ${.ALLSRC} is still a > collection of object files. Ahhh! My knowledge of `make' is terrible, so I thought ${.ALLSRC} must have been referring to actual source files in some non-obvious way. I also thought some special flag would be needed when passing an object file to the compiler, rather than a source file. Combine those two, and there was my problem. Thanks for clarifying! -Ravi (rpokala@) From owner-svn-src-head@freebsd.org Fri Dec 30 21:00:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73C48C98F44; Fri, 30 Dec 2016 21:00:46 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 419401B4C; Fri, 30 Dec 2016 21:00:46 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUL0juU094219; Fri, 30 Dec 2016 21:00:45 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUL0jjC094218; Fri, 30 Dec 2016 21:00:45 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201612302100.uBUL0jjC094218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Fri, 30 Dec 2016 21:00:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310863 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 21:00:46 -0000 Author: pstef Date: Fri Dec 30 21:00:45 2016 New Revision: 310863 URL: https://svnweb.freebsd.org/changeset/base/310863 Log: indent(1): Avoid out of bounds access of array ps.paren_indents ps.p_l_follow can't be allowed to grow beyond maximum index of paren_indents. Approved by: pfg (mentor) Modified: head/usr.bin/indent/indent.c Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Fri Dec 30 20:48:22 2016 (r310862) +++ head/usr.bin/indent/indent.c Fri Dec 30 21:00:45 2016 (r310863) @@ -525,7 +525,12 @@ check_type: break; case lparen: /* got a '(' or '[' */ - ++ps.p_l_follow; /* count parens to make Healy happy */ + /* count parens to make Healy happy */ + if (++ps.p_l_follow == nitems(ps.paren_indents)) { + diag3(0, "Reached internal limit of %d unclosed parens", + nitems(ps.paren_indents)); + ps.p_l_follow--; + } if (ps.want_blank && *token != '[' && (ps.last_token != ident || proc_calls_space || /* offsetof (1) is never allowed a space; sizeof (2) gets From owner-svn-src-head@freebsd.org Fri Dec 30 21:33:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A29C1C988CB; Fri, 30 Dec 2016 21:33:02 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 679971DCE; Fri, 30 Dec 2016 21:33:02 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBULX1kK010092; Fri, 30 Dec 2016 21:33:01 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBULX1YA010091; Fri, 30 Dec 2016 21:33:01 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612302133.uBULX1YA010091@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 30 Dec 2016 21:33:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310864 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 21:33:02 -0000 Author: ngie Date: Fri Dec 30 21:33:01 2016 New Revision: 310864 URL: https://svnweb.freebsd.org/changeset/base/310864 Log: Unbreak ip_carp with WITHOUT_INET6 enabled by conditionalizing all IPv6 structs under the INET6 #ifdef. Similarly (even though it doesn't seem to affect the build), conditionalize all IPv4 structs under the INET #ifdef This also unbreaks the LINT-NOINET6 tinderbox target on amd64; I have not verified other MACHINE/TARGET pairs (e.g. armv6/arm). MFC after: 2 weeks X-MFC with: r310847 Pointyhat to: jpaetzel Reported by: O. Hartmann Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Fri Dec 30 21:00:45 2016 (r310863) +++ head/sys/netinet/ip_carp.c Fri Dec 30 21:33:01 2016 (r310864) @@ -598,23 +598,29 @@ carp6_input(struct mbuf **mp, int *offp, static int carp_source_is_self(struct mbuf *m, struct ifaddr *ifa, sa_family_t af) { +#ifdef INET struct ip *ip4; struct in_addr in4; +#endif +#ifdef INET6 struct ip6_hdr *ip6; struct in6_addr in6; +#endif switch (af) { +#ifdef INET case AF_INET: ip4 = mtod(m, struct ip *); in4 = ifatoia(ifa)->ia_addr.sin_addr; return (in4.s_addr == ip4->ip_src.s_addr); - +#endif +#ifdef INET6 case AF_INET6: ip6 = mtod(m, struct ip6_hdr *); in6 = ifatoia6(ifa)->ia_addr.sin6_addr; return (memcmp(&in6, &ip6->ip6_src, sizeof(in6)) == 0); - - default: /* how did this happen? */ +#endif + default: break; } return (0); From owner-svn-src-head@freebsd.org Fri Dec 30 21:41:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25A92C98D08; Fri, 30 Dec 2016 21:41:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E9415158A; Fri, 30 Dec 2016 21:41:02 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBULf22E010794; Fri, 30 Dec 2016 21:41:02 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBULf2Mk010793; Fri, 30 Dec 2016 21:41:02 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612302141.uBULf2Mk010793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 30 Dec 2016 21:41:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310865 - head/contrib/bsnmp/snmp_mibII X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 21:41:03 -0000 Author: ngie Date: Fri Dec 30 21:41:01 2016 New Revision: 310865 URL: https://svnweb.freebsd.org/changeset/base/310865 Log: Fix whitespace in a comment and fixing a spelling error in a comment MFC after: 3 days Modified: head/contrib/bsnmp/snmp_mibII/mibII.c Modified: head/contrib/bsnmp/snmp_mibII/mibII.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII.c Fri Dec 30 21:33:01 2016 (r310864) +++ head/contrib/bsnmp/snmp_mibII/mibII.c Fri Dec 30 21:41:01 2016 (r310865) @@ -1308,8 +1308,7 @@ update_ifa_info(void) /* * Update arp table - * -*/ + */ void mib_arp_update(void) { @@ -1351,7 +1350,7 @@ mib_arp_update(void) /* - * Intput on the routing socket. + * Input on the routing socket. */ static void route_input(int fd, void *udata __unused) From owner-svn-src-head@freebsd.org Fri Dec 30 21:53:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6574FC971D5; Fri, 30 Dec 2016 21:53:11 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3303B103F; Fri, 30 Dec 2016 21:53:11 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x242.google.com with SMTP id i5so23169593pgh.2; Fri, 30 Dec 2016 13:53:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=jnTYEn7PqRLVYRNettPKkBew/BXMsmOe8eiBzrQeRvQ=; b=APakOPdtAyuzZJT9YV1PFSq1sTa7/6gJJq2mqoWoqxgp//Ee+x4yUDVY038sjcZoXN cMNoqbgLfc4vKfe0cRQ+TqZVSxagO8DFoJsPp7ZEijIpDAuCXLbDSUoqZu2RoN1kLE59 9WVT3q4s1nLhZpWzXUHXisOlYVgOvdm5eAZKhZoMX83ta+Nue36I8CJNKjqbyC4/Zk8Z WYpBmJMaBlabZFEvgSY7s+gbSHEJMwJ9A+n1Z7ySMXWj2HNJ4DJxpOcy6svt11NG5V+q nu8VjrC4dV/xnpfUfNxMCqZ8Q664yk1xoPz/c0u926zwtSrFmPQS5pZkfxtsehCwYUYq /CpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=jnTYEn7PqRLVYRNettPKkBew/BXMsmOe8eiBzrQeRvQ=; b=FApiSjkwNlNKpofbiL9LwXm7IOGF2d5+v9PP2y0lHbaBd+YahqaYgva+GTlYyVO0+e v4o2pCNymihE0JaL5Q1Uq5NEiMFI9YroeWvKM7MiXjVijl1CTEvsnJB86fkKd2K8Hqq6 7FAEUkQ/w/KFCNlBYH+ll6PWqm/gXd96WQhvzTGaxC3LTVFd1t0hHq1wP/FRExI5pAl4 YqKFRPCsDGcGcdIZMAqj6W7ujj1SqbW6knWOAbI2ubgFeuOT0Esd896ljlOGp89/W30G /Kz1ClUFNZbZYyk4zNMHJXZnhrREAt4YuGvcsbrBQB03M2NRcEod+ZA/5yv+tcPdvBx9 r+mA== X-Gm-Message-State: AIkVDXIktKRB8cC1hThTPQpQ79ACI1VL/mJt40J1Kqo9rqbP31pF54PTkiPyxgsbiHkzXw== X-Received: by 10.98.55.131 with SMTP id e125mr45126530pfa.58.1483134790625; Fri, 30 Dec 2016 13:53:10 -0800 (PST) Received: from [192.168.20.12] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id m19sm7434531pfk.72.2016.12.30.13.53.09 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Dec 2016 13:53:09 -0800 (PST) Subject: Re: svn commit: r310864 - head/sys/netinet Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_916A96D5-9467-4891-84C7-DEFCB3F72453"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201612302133.uBULX1YA010091@repo.freebsd.org> Date: Fri, 30 Dec 2016 13:53:09 -0800 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <320706A4-1CA3-4ECB-81F6-D29B9ECB15B9@gmail.com> References: <201612302133.uBULX1YA010091@repo.freebsd.org> To: Ngie Cooper X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 21:53:11 -0000 --Apple-Mail=_916A96D5-9467-4891-84C7-DEFCB3F72453 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Dec 30, 2016, at 13:33, Ngie Cooper wrote: >=20 > Author: ngie > Date: Fri Dec 30 21:33:01 2016 > New Revision: 310864 > URL: https://svnweb.freebsd.org/changeset/base/310864 >=20 > Log: > Unbreak ip_carp with WITHOUT_INET6 enabled by conditionalizing all = IPv6 > structs under the INET6 #ifdef. Similarly (even though it doesn't = seem > to affect the build), conditionalize all IPv4 structs under the INET > #ifdef >=20 > This also unbreaks the LINT-NOINET6 tinderbox target on amd64; I have = not > verified other MACHINE/TARGET pairs (e.g. armv6/arm). Quick note (mostly for myself): I=E2=80=99m running "make = tinderbox=E2=80=9D to address this concern and see if I can spot other = issues. Cheers, -Ngie --Apple-Mail=_916A96D5-9467-4891-84C7-DEFCB3F72453 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJYZtdFAAoJEPWDqSZpMIYVzsIQALIMsrmdQKWMsmhkv8QivTUJ fO8ZhMIv8c85zO6FdoioZoaMWS4N2mQSUbsMUQ6CHmqYtErVamtZSQS7Z5j7kqxy yMXLjhUFSntFCjmBBS8pSrpt0XBy8JVy0PHuU3+W4ZyJGBcHZyOAcWcsWQHW+zrH GqJCQKDWi6pps8yFakiI3dgD4W2w9PqcwpgO71Of0sOdgrdXLktHmBWk6Ls6lj/6 ysloZVwEK44rhofWnOtNUTJenbGph3oixGlfaWDoP97DpNsrJ6TuEhCIiWBrR558 2deaklUNOJWaPk0ZMWpJqatZgBpeidn8nkaWpDDG0kvKkhAwhxyFYKv7w7nb0fUD SzLieCvo7vH20t3ErWDMHBsexA5UWg8RmiwsMnHP03i1p1o4BhDdEQQtHu9+7pfX rPepEQn/NlTXOCfp5kW1Wo1ynohN7JI7ppNudEWSekExCVX+6Vk0fH6TNB7NJ+Df U9YXcdB8GSjWJPptNLLcqBap+cLuY88E3y9iCLa47srNhzOr+EDTc3Q4UBjAsFkw zcYmZrXb91F7iM+XJ0AyrfHWUBmw5ZwB9lxxE8HbckGzKHTcqSxnfyLynqbhE4K6 x0Wjw6yxT5913SImuZatjnfZn4w5OajjWoMFuTgMcXiAhIz+xOZHEri+SgGQ0Pqw 5REpQW4sdheKS1BqZF1s =i90V -----END PGP SIGNATURE----- --Apple-Mail=_916A96D5-9467-4891-84C7-DEFCB3F72453-- From owner-svn-src-head@freebsd.org Fri Dec 30 22:00:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2873C973B3; Fri, 30 Dec 2016 22:00:57 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6F74D165A; Fri, 30 Dec 2016 22:00:57 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x242.google.com with SMTP id n5so23187530pgh.3; Fri, 30 Dec 2016 14:00:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=yKGMFJ0yUhaA2SM3LkX7h1vCjYr6rler1Exvkw0in34=; b=OjwJPiDg1xmNUTckZ/uriBs+yM0yEFa3dTGBXi+htqSB0RByK6OBC3Y4HZXrEglPPE K4i2XsRiCJl2TrHyqtA3G2KC1PLI41eGe2NKdZ7vVNbiCKifxgvCp+WK8/RbU8Cd84do sr4dVdJnpXgMfNKheDjIvNzwAKPGTqdk80jbY6mk7kZPzyzECTIV+FBTDSl7kArc3nmr PfKgABQKj58ZqSYnTzQV762IYuYF2oxIhvl7EBKuxnM5pI2Lid+GH88z6K/hl8WKZhN0 Ba1EWyrjYjKBS8JE3GYnRtyylcYmbAryFF/C986W3J+8DQMBIKBFtYUixH2vFk2DfPhi lQQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=yKGMFJ0yUhaA2SM3LkX7h1vCjYr6rler1Exvkw0in34=; b=UOPfTcNzG89HY7RP5vlPaGxbQcJMyqMVGwPLiRSOVHEUBggOyaI653GLRnmfeh9h+H toZg+PLjMDSPyxwQ2OrsmcO9zzoTB66LImC+V+rImsf3Xq5+eaaHkV9tW2TCQ0Zy4kNU nQ8vj9qxsEqGsdMM+vyLojaFfXdvIt/Cjshx+CGL8Fzge7siGlTROvobzS0caS2KKvRh ioHe6BrWaeiTZ+yABa5Ve39CICb3W3ctdOAApt+HXnA7+nTrBN6o8IVbBKTm/mlscXf1 wyu2XlUA8msPL69NAaEmdSli0MfJxfSk0jVm1uhSn35sp4q+wQEGSSEpSI0W6cJ9kwGE rePw== X-Gm-Message-State: AIkVDXIM3v0VXixSKvPvp/ebdzpAAnJEfXZXizV4gqBmTv1OAdt8qID8uzjeSsRSDQfQ1A== X-Received: by 10.99.47.7 with SMTP id v7mr89616403pgv.39.1483135256900; Fri, 30 Dec 2016 14:00:56 -0800 (PST) Received: from [192.168.20.12] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id i76sm114710681pfk.89.2016.12.30.14.00.56 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Dec 2016 14:00:56 -0800 (PST) Subject: Re: svn commit: r310864 - head/sys/netinet Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_96D41712-ABF4-4162-8CA1-C39FF5FD4D1A"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <320706A4-1CA3-4ECB-81F6-D29B9ECB15B9@gmail.com> Date: Fri, 30 Dec 2016 14:00:55 -0800 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201612302133.uBULX1YA010091@repo.freebsd.org> <320706A4-1CA3-4ECB-81F6-D29B9ECB15B9@gmail.com> To: Ngie Cooper X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 22:00:57 -0000 --Apple-Mail=_96D41712-ABF4-4162-8CA1-C39FF5FD4D1A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Dec 30, 2016, at 13:53, Ngie Cooper (yaneurabeya) = wrote: >=20 >>=20 >> On Dec 30, 2016, at 13:33, Ngie Cooper wrote: >>=20 >> Author: ngie >> Date: Fri Dec 30 21:33:01 2016 >> New Revision: 310864 >> URL: https://svnweb.freebsd.org/changeset/base/310864 >>=20 >> Log: >> Unbreak ip_carp with WITHOUT_INET6 enabled by conditionalizing all = IPv6 >> structs under the INET6 #ifdef. Similarly (even though it doesn't = seem >> to affect the build), conditionalize all IPv4 structs under the INET >> #ifdef >>=20 >> This also unbreaks the LINT-NOINET6 tinderbox target on amd64; I have = not >> verified other MACHINE/TARGET pairs (e.g. armv6/arm). >=20 > Quick note (mostly for myself): I=E2=80=99m running "make = tinderbox=E2=80=9D to address this concern and see if I can spot other = issues. > Cheers, I realized looking at the code that unfortunately it=E2=80=99s still = broken when both IPv4/IPv6 are disabled :/. -Ngie --Apple-Mail=_96D41712-ABF4-4162-8CA1-C39FF5FD4D1A Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJYZtkXAAoJEPWDqSZpMIYVP0kQALq8Irx5jJPTt9MhlOxkUFUZ 6gF6efsTtzO1S5JFXjmRQRGGftleWOzD1j97eLZCxo9VHt7GOct3MbjBH+dFPNU3 NS/JXSfnsa3ilbU+wcyhgS9pr+4rhWbW26jCntJN42cEAiHX3ePkmWSVqkDAm/MM f4aWyLaRKMFhzYE832qgX/CALXwV2qMnxMAgT8f5jbSGK3GjsMQQEcQC3GLqU4VB e1KHEbqQIObfBy81+FLRnVrrotCJDq4AhYSBaM1eCg3owES1JWC3m65t8gAi+Pdj nAtr/oRl3A/3F/RHB+45BaCsiwq8tvjNlcCZbCSK293xO7f8HqiM0Sf67eUJoHHn QBbAFcSbdqUp50nguNGcMhbkBTqq+nkZ+lXSibsxo2gfanjBVlpZxzkLZyjpDEk0 qEGrIi4hTi9d5dRuYwxplF8VT1KJMWtKKM5A8jCjVgFmTqxelbfRiVc9Vq1cgG3+ if88PRm7kZe+4xRyrowT0ovM4gjCXtNwjtR8PMUsF9wMpn9fGFiBnO+7TGuYtetf FOVvmQoEIDO43xp/4qkXM2ej4K+YrzjrfAFzreDyFrch5hWuft+3ZYoCyABqY/kX 9M54hNFrWHIN2SOqNSnRX4Tfx07OcFZKNuW+EHlo8ImICxu2hZEM+wGZ19n3WOeF QVBwk7KEq2ck6wSxXNb2 =nHwR -----END PGP SIGNATURE----- --Apple-Mail=_96D41712-ABF4-4162-8CA1-C39FF5FD4D1A-- From owner-svn-src-head@freebsd.org Fri Dec 30 22:18:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 036A7C979E7; Fri, 30 Dec 2016 22:18:24 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94C541F06; Fri, 30 Dec 2016 22:18:23 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUMIM86027173; Fri, 30 Dec 2016 22:18:22 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUMIMZZ027169; Fri, 30 Dec 2016 22:18:22 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201612302218.uBUMIMZZ027169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Fri, 30 Dec 2016 22:18:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310866 - in head: . contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 22:18:24 -0000 Author: mm Date: Fri Dec 30 22:18:22 2016 New Revision: 310866 URL: https://svnweb.freebsd.org/changeset/base/310866 Log: MFV r310796, r310797: Sync libarchive with vendor. Vendor changes (relevant to FreeBSD): PR #771: Add NFSv4 ACL support to pax and restricted pax NFSv4 ACL information may now be stored to and restored from tar archives. ACL must be non-trivial and supported by the underlying filesystem, e.g. natively by ZFS or by UFS with the NFSv4 ACL enable flag set. MFC after: 2 weeks Relnotes: yes Added: head/contrib/libarchive/libarchive/test/test_acl_pax_nfs4.tar.uu - copied unchanged from r310796, vendor/libarchive/dist/libarchive/test/test_acl_pax_nfs4.tar.uu head/contrib/libarchive/libarchive/test/test_acl_pax_posix1e.tar.uu - copied unchanged from r310796, vendor/libarchive/dist/libarchive/test/test_acl_pax_posix1e.tar.uu head/contrib/libarchive/libarchive/test/test_acl_text.c - copied unchanged from r310796, vendor/libarchive/dist/libarchive/test/test_acl_text.c head/contrib/libarchive/libarchive/test/test_compat_star_acl.c - copied unchanged from r310796, vendor/libarchive/dist/libarchive/test/test_compat_star_acl.c head/contrib/libarchive/libarchive/test/test_compat_star_acl_nfs4.tar.uu - copied unchanged from r310796, vendor/libarchive/dist/libarchive/test/test_compat_star_acl_nfs4.tar.uu Deleted: head/contrib/libarchive/libarchive/test/test_acl_pax.tar.uu head/contrib/libarchive/libarchive/test/test_compat_star_acl_posix1e.c Modified: head/ObsoleteFiles.inc head/contrib/libarchive/NEWS head/contrib/libarchive/libarchive/archive_acl.c head/contrib/libarchive/libarchive/archive_acl_private.h head/contrib/libarchive/libarchive/archive_entry.c head/contrib/libarchive/libarchive/archive_entry.h head/contrib/libarchive/libarchive/archive_entry_acl.3 head/contrib/libarchive/libarchive/archive_entry_locale.h head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c head/contrib/libarchive/libarchive/archive_read_support_format_tar.c head/contrib/libarchive/libarchive/archive_write_set_format_pax.c head/contrib/libarchive/libarchive/libarchive-formats.5 head/contrib/libarchive/libarchive/tar.5 head/contrib/libarchive/libarchive/test/main.c head/contrib/libarchive/libarchive/test/test.h head/contrib/libarchive/libarchive/test/test_acl_freebsd_nfs4.c head/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c head/contrib/libarchive/libarchive/test/test_acl_nfs4.c head/contrib/libarchive/libarchive/test/test_acl_pax.c head/contrib/libarchive/libarchive/test/test_acl_posix1e.c head/lib/libarchive/tests/Makefile Directory Properties: head/contrib/libarchive/ (props changed) Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Fri Dec 30 21:41:01 2016 (r310865) +++ head/ObsoleteFiles.inc Fri Dec 30 22:18:22 2016 (r310866) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20161230: libarchive ACL pax test renamed to test_acl_pax_posix1e.tar.uu +OLD_FILES+=usr/tests/lib/libarchive/test_acl_pax.tar.uu # 20161217: new clang import which bumps version from 3.9.0 to 3.9.1. OLD_FILES+=usr/lib/clang/3.9.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/3.9.0/include/sanitizer/asan_interface.h Modified: head/contrib/libarchive/NEWS ============================================================================== --- head/contrib/libarchive/NEWS Fri Dec 30 21:41:01 2016 (r310865) +++ head/contrib/libarchive/NEWS Fri Dec 30 22:18:22 2016 (r310866) @@ -1,3 +1,6 @@ +Dec 27, 2016: NFSv4 ACL read and write support for pax + Deprecated functions: archive_entry_acl_text(), archive_entry_acl_text_w() + Oct 26, 2016: Remove liblzmadec support Oct 23, 2016: libarchive 3.2.2 released Modified: head/contrib/libarchive/libarchive/archive_acl.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_acl.c Fri Dec 30 21:41:01 2016 (r310865) +++ head/contrib/libarchive/libarchive/archive_acl.c Fri Dec 30 22:18:22 2016 (r310866) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003-2010 Tim Kientzle + * Copyright (c) 2016 Martin Matuska * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,23 +56,31 @@ static struct archive_acl_entry *acl_new static int archive_acl_add_entry_len_l(struct archive_acl *acl, int type, int permset, int tag, int id, const char *name, size_t len, struct archive_string_conv *sc); +static int archive_acl_text_want_type(struct archive_acl *acl, int flags); +static ssize_t archive_acl_text_len(struct archive_acl *acl, int want_type, + int flags, int wide, struct archive *a, + struct archive_string_conv *sc); static int isint_w(const wchar_t *start, const wchar_t *end, int *result); static int ismode_w(const wchar_t *start, const wchar_t *end, int *result); +static int is_nfs4_flags_w(const wchar_t *start, const wchar_t *end, + int *result); +static int is_nfs4_perms_w(const wchar_t *start, const wchar_t *end, + int *result); static void next_field_w(const wchar_t **wp, const wchar_t **start, const wchar_t **end, wchar_t *sep); -static int prefix_w(const wchar_t *start, const wchar_t *end, - const wchar_t *test); -static void append_entry_w(wchar_t **wp, const wchar_t *prefix, int tag, - const wchar_t *wname, int perm, int id); +static void append_entry_w(wchar_t **wp, const wchar_t *prefix, int type, + int tag, int flags, const wchar_t *wname, int perm, int id); static void append_id_w(wchar_t **wp, int id); static int isint(const char *start, const char *end, int *result); static int ismode(const char *start, const char *end, int *result); +static int is_nfs4_flags(const char *start, const char *end, + int *result); +static int is_nfs4_perms(const char *start, const char *end, + int *result); static void next_field(const char **p, const char **start, const char **end, char *sep); -static int prefix_c(const char *start, const char *end, - const char *test); -static void append_entry(char **p, const char *prefix, int tag, - const char *name, int perm, int id); +static void append_entry(char **p, const char *prefix, int type, + int tag, int flags, const char *name, int perm, int id); static void append_id(char **p, int id); void @@ -375,8 +384,8 @@ archive_acl_reset(struct archive_acl *ac * standard permissions and include them in the returned list. */ int -archive_acl_next(struct archive *a, struct archive_acl *acl, int want_type, int *type, - int *permset, int *tag, int *id, const char **name) +archive_acl_next(struct archive *a, struct archive_acl *acl, int want_type, + int *type, int *permset, int *tag, int *id, const char **name) { *name = NULL; *id = -1; @@ -441,130 +450,273 @@ archive_acl_next(struct archive *a, stru } /* - * Generate a text version of the ACL. The flags parameter controls - * the style of the generated ACL. + * Determine what type of ACL do we want */ -const wchar_t * -archive_acl_text_w(struct archive *a, struct archive_acl *acl, int flags) +static int +archive_acl_text_want_type(struct archive_acl *acl, int flags) { - int count; - size_t length; - const wchar_t *wname; - const wchar_t *prefix; - wchar_t separator; - struct archive_acl_entry *ap; - int id, r; - wchar_t *wp; + int want_type; - if (acl->acl_text_w != NULL) { - free (acl->acl_text_w); - acl->acl_text_w = NULL; + /* Check if ACL is NFSv4 */ + if ((acl->acl_types & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) { + /* NFSv4 should never mix with POSIX.1e */ + if ((acl->acl_types & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) + return (0); + else + return (ARCHIVE_ENTRY_ACL_TYPE_NFS4); } - separator = L','; + /* Now deal with POSIX.1e ACLs */ + + want_type = 0; + if ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) + want_type |= ARCHIVE_ENTRY_ACL_TYPE_ACCESS; + if ((flags & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) + want_type |= ARCHIVE_ENTRY_ACL_TYPE_DEFAULT; + + /* By default we want both access and default ACLs */ + if (want_type == 0) + return (ARCHIVE_ENTRY_ACL_TYPE_POSIX1E); + + return (want_type); +} + +/* + * Calculate ACL text string length + */ +static ssize_t +archive_acl_text_len(struct archive_acl *acl, int want_type, int flags, + int wide, struct archive *a, struct archive_string_conv *sc) { + struct archive_acl_entry *ap; + const char *name; + const wchar_t *wname; + int count, idlen, tmp, r; + ssize_t length; + size_t len; + count = 0; length = 0; - ap = acl->acl_head; - while (ap != NULL) { - if ((ap->type & flags) != 0) { - count++; - if ((flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) && - (ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT)) - length += 8; /* "default:" */ - length += 5; /* tag name */ - length += 1; /* colon */ - r = archive_mstring_get_wcs(a, &ap->name, &wname); - if (r == 0 && wname != NULL) - length += wcslen(wname); - else if (r < 0 && errno == ENOMEM) - return (NULL); - else - length += sizeof(uid_t) * 3 + 1; - length ++; /* colon */ + for (ap = acl->acl_head; ap != NULL; ap = ap->next) { + if ((ap->type & want_type) == 0) + continue; + /* + * Filemode-mapping ACL entries are stored exclusively in + * ap->mode so they should not be in the list + */ + if ((ap->type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS) + && (ap->tag == ARCHIVE_ENTRY_ACL_USER_OBJ + || ap->tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ + || ap->tag == ARCHIVE_ENTRY_ACL_OTHER)) + continue; + count++; + if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0 + && (ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) + length += 8; /* "default:" */ + switch (ap->tag) { + case ARCHIVE_ENTRY_ACL_USER_OBJ: + if (want_type == ARCHIVE_ENTRY_ACL_TYPE_NFS4) { + length += 6; /* "owner@" */ + break; + } + /* FALLTHROUGH */ + case ARCHIVE_ENTRY_ACL_USER: + case ARCHIVE_ENTRY_ACL_MASK: + length += 4; /* "user", "mask" */ + break; + case ARCHIVE_ENTRY_ACL_GROUP_OBJ: + if (want_type == ARCHIVE_ENTRY_ACL_TYPE_NFS4) { + length += 6; /* "group@" */ + break; + } + /* FALLTHROUGH */ + case ARCHIVE_ENTRY_ACL_GROUP: + case ARCHIVE_ENTRY_ACL_OTHER: + length += 5; /* "group", "other" */ + break; + case ARCHIVE_ENTRY_ACL_EVERYONE: + length += 9; /* "everyone@" */ + break; + } + length += 1; /* colon after tag */ + if (ap->tag == ARCHIVE_ENTRY_ACL_USER || + ap->tag == ARCHIVE_ENTRY_ACL_GROUP) { + if (wide) { + r = archive_mstring_get_wcs(a, &ap->name, + &wname); + if (r == 0 && wname != NULL) + length += wcslen(wname); + else if (r < 0 && errno == ENOMEM) + return (0); + else + length += sizeof(uid_t) * 3 + 1; + } else { + r = archive_mstring_get_mbs_l(&ap->name, &name, + &len, sc); + if (r != 0) + return (0); + if (len > 0 && name != NULL) + length += len; + else + length += sizeof(uid_t) * 3 + 1; + } + length += 1; /* colon after user or group name */ + } else if (want_type != ARCHIVE_ENTRY_ACL_TYPE_NFS4) + length += 1; /* 2nd colon empty user,group or other */ + + if (((flags & ARCHIVE_ENTRY_ACL_STYLE_SOLARIS) != 0) + && ((want_type & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) + && (ap->tag == ARCHIVE_ENTRY_ACL_OTHER + || ap->tag == ARCHIVE_ENTRY_ACL_MASK)) { + /* Solaris has no colon after other: and mask: */ + length = length - 1; + } + + if (want_type == ARCHIVE_ENTRY_ACL_TYPE_NFS4) { + /* rwxpdDaARWcCos:fdinSFI:deny */ + length += 27; + if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_DENY) == 0) + length += 1; /* allow, alarm, audit */ + } else length += 3; /* rwx */ + + if ((ap->tag == ARCHIVE_ENTRY_ACL_USER || + ap->tag == ARCHIVE_ENTRY_ACL_GROUP) && + (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) != 0) { length += 1; /* colon */ - length += max(sizeof(uid_t), sizeof(gid_t)) * 3 + 1; - length ++; /* newline */ + /* ID digit count */ + idlen = 1; + tmp = ap->id; + while (tmp > 9) { + tmp = tmp / 10; + idlen++; + } + length += idlen; } - ap = ap->next; + length ++; /* entry separator */ } - if (count > 0 && ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0)) { - length += 10; /* "user::rwx\n" */ - length += 11; /* "group::rwx\n" */ - length += 11; /* "other::rwx\n" */ - } + /* Add filemode-mapping access entries to the length */ + if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { + if ((flags & ARCHIVE_ENTRY_ACL_STYLE_SOLARIS) != 0) { + /* "user::rwx\ngroup::rwx\nother:rwx\n" */ + length += 31; + } else { + /* "user::rwx\ngroup::rwx\nother::rwx\n" */ + length += 32; + } + } else if (count == 0) + return (0); + + /* The terminating character is included in count */ + return (length); +} - if (count == 0) +/* + * Generate a wide text version of the ACL. The flags parameter controls + * the type and style of the generated ACL. + */ +wchar_t * +archive_acl_to_text_w(struct archive_acl *acl, ssize_t *text_len, int flags, + struct archive *a) +{ + int count; + ssize_t length; + size_t len; + const wchar_t *wname; + const wchar_t *prefix; + wchar_t separator; + struct archive_acl_entry *ap; + int id, r, want_type; + wchar_t *wp, *ws; + + want_type = archive_acl_text_want_type(acl, flags); + + /* Both NFSv4 and POSIX.1 types found */ + if (want_type == 0) return (NULL); + if (want_type == ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) + flags |= ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT; + + length = archive_acl_text_len(acl, want_type, flags, 1, a, NULL); + + if (length == 0) + return (NULL); + + if (flags & ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA) + separator = L','; + else + separator = L'\n'; + /* Now, allocate the string and actually populate it. */ - wp = acl->acl_text_w = (wchar_t *)malloc(length * sizeof(wchar_t)); - if (wp == NULL) + wp = ws = (wchar_t *)malloc(length * sizeof(wchar_t)); + if (wp == NULL) { + if (errno == ENOMEM) + __archive_errx(1, "No memory"); return (NULL); + } count = 0; - if ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { - append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_USER_OBJ, NULL, + + if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { + append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_USER_OBJ, flags, NULL, acl->mode & 0700, -1); - *wp++ = ','; - append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_GROUP_OBJ, NULL, + *wp++ = separator; + append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_GROUP_OBJ, flags, NULL, acl->mode & 0070, -1); - *wp++ = ','; - append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_OTHER, NULL, + *wp++ = separator; + append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_OTHER, flags, NULL, acl->mode & 0007, -1); count += 3; - - ap = acl->acl_head; - while (ap != NULL) { - if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { - r = archive_mstring_get_wcs(a, &ap->name, &wname); - if (r == 0) { - *wp++ = separator; - if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) - id = ap->id; - else - id = -1; - append_entry_w(&wp, NULL, ap->tag, wname, - ap->permset, id); - count++; - } else if (r < 0 && errno == ENOMEM) - return (NULL); - } - ap = ap->next; - } } - - if ((flags & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) { - if (flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) + for (ap = acl->acl_head; ap != NULL; ap = ap->next) { + if ((ap->type & want_type) == 0) + continue; + /* + * Filemode-mapping ACL entries are stored exclusively in + * ap->mode so they should not be in the list + */ + if ((ap->type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS) + && (ap->tag == ARCHIVE_ENTRY_ACL_USER_OBJ + || ap->tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ + || ap->tag == ARCHIVE_ENTRY_ACL_OTHER)) + continue; + if (ap->type == ARCHIVE_ENTRY_ACL_TYPE_DEFAULT && + (flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) != 0) prefix = L"default:"; else prefix = NULL; - ap = acl->acl_head; - count = 0; - while (ap != NULL) { - if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) { - r = archive_mstring_get_wcs(a, &ap->name, &wname); - if (r == 0) { - if (count > 0) - *wp++ = separator; - if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) - id = ap->id; - else - id = -1; - append_entry_w(&wp, prefix, ap->tag, - wname, ap->permset, id); - count ++; - } else if (r < 0 && errno == ENOMEM) - return (NULL); - } - ap = ap->next; - } + r = archive_mstring_get_wcs(a, &ap->name, &wname); + if (r == 0) { + if (count > 0) + *wp++ = separator; + if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) + id = ap->id; + else + id = -1; + append_entry_w(&wp, prefix, ap->type, ap->tag, flags, + wname, ap->permset, id); + count++; + } else if (r < 0 && errno == ENOMEM) + return (NULL); } - return (acl->acl_text_w); -} + /* Add terminating character */ + *wp++ = L'\0'; + + len = wcslen(ws); + if ((ssize_t)len > (length - 1)) + __archive_errx(1, "Buffer overrun"); + + if (text_len != NULL) + *text_len = len; + + return (ws); +} static void append_id_w(wchar_t **wp, int id) @@ -577,8 +729,8 @@ append_id_w(wchar_t **wp, int id) } static void -append_entry_w(wchar_t **wp, const wchar_t *prefix, int tag, - const wchar_t *wname, int perm, int id) +append_entry_w(wchar_t **wp, const wchar_t *prefix, int type, + int tag, int flags, const wchar_t *wname, int perm, int id) { if (prefix != NULL) { wcscpy(*wp, prefix); @@ -588,6 +740,10 @@ append_entry_w(wchar_t **wp, const wchar case ARCHIVE_ENTRY_ACL_USER_OBJ: wname = NULL; id = -1; + if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) { + wcscpy(*wp, L"owner@"); + break; + } /* FALLTHROUGH */ case ARCHIVE_ENTRY_ACL_USER: wcscpy(*wp, L"user"); @@ -595,6 +751,10 @@ append_entry_w(wchar_t **wp, const wchar case ARCHIVE_ENTRY_ACL_GROUP_OBJ: wname = NULL; id = -1; + if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) { + wcscpy(*wp, L"group@"); + break; + } /* FALLTHROUGH */ case ARCHIVE_ENTRY_ACL_GROUP: wcscpy(*wp, L"group"); @@ -609,154 +769,209 @@ append_entry_w(wchar_t **wp, const wchar wname = NULL; id = -1; break; + case ARCHIVE_ENTRY_ACL_EVERYONE: + wcscpy(*wp, L"everyone@"); + wname = NULL; + id = -1; + break; } *wp += wcslen(*wp); *(*wp)++ = L':'; - if (wname != NULL) { - wcscpy(*wp, wname); + if (((type & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) || + tag == ARCHIVE_ENTRY_ACL_USER || + tag == ARCHIVE_ENTRY_ACL_GROUP) { + if (wname != NULL) { + wcscpy(*wp, wname); + *wp += wcslen(*wp); + } else if (tag == ARCHIVE_ENTRY_ACL_USER + || tag == ARCHIVE_ENTRY_ACL_GROUP) { + append_id_w(wp, id); + id = -1; + } + /* Solaris style has no second colon after other and mask */ + if (((flags & ARCHIVE_ENTRY_ACL_STYLE_SOLARIS) == 0) + || (tag != ARCHIVE_ENTRY_ACL_OTHER + && tag != ARCHIVE_ENTRY_ACL_MASK)) + *(*wp)++ = L':'; + } + if ((type & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) { + /* POSIX.1e ACL perms */ + *(*wp)++ = (perm & 0444) ? L'r' : L'-'; + *(*wp)++ = (perm & 0222) ? L'w' : L'-'; + *(*wp)++ = (perm & 0111) ? L'x' : L'-'; + } else { + /* NFS4 ACL perms */ + *(*wp)++ = (perm & (ARCHIVE_ENTRY_ACL_READ_DATA | + ARCHIVE_ENTRY_ACL_LIST_DIRECTORY)) ? L'r' : L'-'; + *(*wp)++ = (perm & (ARCHIVE_ENTRY_ACL_WRITE_DATA | + ARCHIVE_ENTRY_ACL_ADD_FILE)) ? L'w' : L'-'; + *(*wp)++ = (perm & ARCHIVE_ENTRY_ACL_EXECUTE) ? L'x' : L'-'; + *(*wp)++ = (perm & (ARCHIVE_ENTRY_ACL_APPEND_DATA | + ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY)) ? L'p' : L'-'; + *(*wp)++ = (perm & ARCHIVE_ENTRY_ACL_DELETE) ? L'd' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_DELETE_CHILD) ? L'D' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES) ? L'a' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES) ? L'A' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS) ? L'R' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS) ? L'W' : L'-'; + *(*wp)++ = (perm & ARCHIVE_ENTRY_ACL_READ_ACL) ? L'c' : L'-'; + *(*wp)++ = (perm & ARCHIVE_ENTRY_ACL_WRITE_ACL) ? L'C' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_WRITE_OWNER) ? L'o' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_SYNCHRONIZE) ? L's' : L'-'; + *(*wp)++ = L':'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT) ? L'f' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT) ? L'd' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY) ? L'i' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT) ? L'n' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS) ? L'S' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS) ? L'F' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_INHERITED) ? L'I' : L'-'; + *(*wp)++ = L':'; + switch (type) { + case ARCHIVE_ENTRY_ACL_TYPE_ALLOW: + wcscpy(*wp, L"allow"); + break; + case ARCHIVE_ENTRY_ACL_TYPE_DENY: + wcscpy(*wp, L"deny"); + break; + case ARCHIVE_ENTRY_ACL_TYPE_AUDIT: + wcscpy(*wp, L"audit"); + break; + case ARCHIVE_ENTRY_ACL_TYPE_ALARM: + wcscpy(*wp, L"alarm"); + break; + default: + break; + } *wp += wcslen(*wp); - } else if (tag == ARCHIVE_ENTRY_ACL_USER - || tag == ARCHIVE_ENTRY_ACL_GROUP) { - append_id_w(wp, id); - id = -1; } - *(*wp)++ = L':'; - *(*wp)++ = (perm & 0444) ? L'r' : L'-'; - *(*wp)++ = (perm & 0222) ? L'w' : L'-'; - *(*wp)++ = (perm & 0111) ? L'x' : L'-'; if (id != -1) { *(*wp)++ = L':'; append_id_w(wp, id); } - **wp = L'\0'; } -int -archive_acl_text_l(struct archive_acl *acl, int flags, - const char **acl_text, size_t *acl_text_len, +/* + * Generate a text version of the ACL. The flags parameter controls + * the type and style of the generated ACL. + */ +char * +archive_acl_to_text_l(struct archive_acl *acl, ssize_t *text_len, int flags, struct archive_string_conv *sc) { int count; - size_t length; + ssize_t length; + size_t len; const char *name; const char *prefix; char separator; struct archive_acl_entry *ap; - size_t len; - int id, r; - char *p; + int id, r, want_type; + char *p, *s; - if (acl->acl_text != NULL) { - free (acl->acl_text); - acl->acl_text = NULL; - } + want_type = archive_acl_text_want_type(acl, flags); - *acl_text = NULL; - if (acl_text_len != NULL) - *acl_text_len = 0; - separator = ','; - count = 0; - length = 0; - ap = acl->acl_head; - while (ap != NULL) { - if ((ap->type & flags) != 0) { - count++; - if ((flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) && - (ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT)) - length += 8; /* "default:" */ - length += 5; /* tag name */ - length += 1; /* colon */ - r = archive_mstring_get_mbs_l( - &ap->name, &name, &len, sc); - if (r != 0) - return (-1); - if (len > 0 && name != NULL) - length += len; - else - length += sizeof(uid_t) * 3 + 1; - length ++; /* colon */ - length += 3; /* rwx */ - length += 1; /* colon */ - length += max(sizeof(uid_t), sizeof(gid_t)) * 3 + 1; - length ++; /* newline */ - } - ap = ap->next; - } + /* Both NFSv4 and POSIX.1 types found */ + if (want_type == 0) + return (NULL); - if (count > 0 && ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0)) { - length += 10; /* "user::rwx\n" */ - length += 11; /* "group::rwx\n" */ - length += 11; /* "other::rwx\n" */ - } + if (want_type == ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) + flags |= ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT; - if (count == 0) - return (0); + length = archive_acl_text_len(acl, want_type, flags, 0, NULL, sc); + + if (length == 0) + return (NULL); + + if (flags & ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA) + separator = ','; + else + separator = '\n'; /* Now, allocate the string and actually populate it. */ - p = acl->acl_text = (char *)malloc(length); - if (p == NULL) - return (-1); + p = s = (char *)malloc(length * sizeof(char)); + if (p == NULL) { + if (errno == ENOMEM) + __archive_errx(1, "No memory"); + return (NULL); + } count = 0; - if ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { - append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_USER_OBJ, NULL, + + if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { + append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_USER_OBJ, flags, NULL, acl->mode & 0700, -1); - *p++ = ','; - append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_GROUP_OBJ, NULL, + *p++ = separator; + append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_GROUP_OBJ, flags, NULL, acl->mode & 0070, -1); - *p++ = ','; - append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_OTHER, NULL, + *p++ = separator; + append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_OTHER, flags, NULL, acl->mode & 0007, -1); count += 3; - - for (ap = acl->acl_head; ap != NULL; ap = ap->next) { - if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) == 0) - continue; - r = archive_mstring_get_mbs_l( - &ap->name, &name, &len, sc); - if (r != 0) - return (-1); - *p++ = separator; - if (name == NULL || (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)) { - id = ap->id; - } else { - id = -1; - } - append_entry(&p, NULL, ap->tag, name, - ap->permset, id); - count++; - } } - - if ((flags & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) { - if (flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) + for (ap = acl->acl_head; ap != NULL; ap = ap->next) { + if ((ap->type & want_type) == 0) + continue; + /* + * Filemode-mapping ACL entries are stored exclusively in + * ap->mode so they should not be in the list + */ + if ((ap->type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS) + && (ap->tag == ARCHIVE_ENTRY_ACL_USER_OBJ + || ap->tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ + || ap->tag == ARCHIVE_ENTRY_ACL_OTHER)) + continue; + if (ap->type == ARCHIVE_ENTRY_ACL_TYPE_DEFAULT && + (flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) != 0) prefix = "default:"; else prefix = NULL; - count = 0; - for (ap = acl->acl_head; ap != NULL; ap = ap->next) { - if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) == 0) - continue; - r = archive_mstring_get_mbs_l( - &ap->name, &name, &len, sc); - if (r != 0) - return (-1); - if (count > 0) - *p++ = separator; - if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) - id = ap->id; - else - id = -1; - append_entry(&p, prefix, ap->tag, - name, ap->permset, id); - count ++; + r = archive_mstring_get_mbs_l( + &ap->name, &name, &len, sc); + if (r != 0) + return (NULL); + if (count > 0) + *p++ = separator; + if (name == NULL || + (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)) { + id = ap->id; + } else { + id = -1; } + append_entry(&p, prefix, ap->type, ap->tag, flags, name, + ap->permset, id); + count++; } - *acl_text = acl->acl_text; - if (acl_text_len != NULL) - *acl_text_len = strlen(acl->acl_text); - return (0); + /* Add terminating character */ + *p++ = '\0'; + + len = strlen(s); + + if ((ssize_t)len > (length - 1)) + __archive_errx(1, "Buffer overrun"); + + if (text_len != NULL) + *text_len = len; + + return (s); } static void @@ -770,8 +985,8 @@ append_id(char **p, int id) } static void -append_entry(char **p, const char *prefix, int tag, - const char *name, int perm, int id) +append_entry(char **p, const char *prefix, int type, + int tag, int flags, const char *name, int perm, int id) { if (prefix != NULL) { strcpy(*p, prefix); @@ -781,6 +996,10 @@ append_entry(char **p, const char *prefi case ARCHIVE_ENTRY_ACL_USER_OBJ: name = NULL; id = -1; + if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) { + strcpy(*p, "owner@"); + break; + } /* FALLTHROUGH */ case ARCHIVE_ENTRY_ACL_USER: strcpy(*p, "user"); @@ -788,6 +1007,10 @@ append_entry(char **p, const char *prefi case ARCHIVE_ENTRY_ACL_GROUP_OBJ: name = NULL; id = -1; + if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) { + strcpy(*p, "group@"); + break; + } /* FALLTHROUGH */ case ARCHIVE_ENTRY_ACL_GROUP: strcpy(*p, "group"); @@ -802,48 +1025,146 @@ append_entry(char **p, const char *prefi name = NULL; id = -1; break; + case ARCHIVE_ENTRY_ACL_EVERYONE: + strcpy(*p, "everyone@"); + name = NULL; + id = -1; + break; } *p += strlen(*p); *(*p)++ = ':'; - if (name != NULL) { - strcpy(*p, name); + if (((type & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) || + tag == ARCHIVE_ENTRY_ACL_USER || + tag == ARCHIVE_ENTRY_ACL_GROUP) { + if (name != NULL) { + strcpy(*p, name); + *p += strlen(*p); + } else if (tag == ARCHIVE_ENTRY_ACL_USER + || tag == ARCHIVE_ENTRY_ACL_GROUP) { + append_id(p, id); + id = -1; + } + /* Solaris style has no second colon after other and mask */ + if (((flags & ARCHIVE_ENTRY_ACL_STYLE_SOLARIS) == 0) + || (tag != ARCHIVE_ENTRY_ACL_OTHER + && tag != ARCHIVE_ENTRY_ACL_MASK)) + *(*p)++ = ':'; + } + if ((type & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) { + /* POSIX.1e ACL perms */ + *(*p)++ = (perm & 0444) ? 'r' : '-'; + *(*p)++ = (perm & 0222) ? 'w' : '-'; + *(*p)++ = (perm & 0111) ? 'x' : '-'; + } else { + /* NFS4 ACL perms */ + *(*p)++ = (perm & (ARCHIVE_ENTRY_ACL_READ_DATA | + ARCHIVE_ENTRY_ACL_LIST_DIRECTORY)) ? 'r' : '-'; + *(*p)++ = (perm & (ARCHIVE_ENTRY_ACL_WRITE_DATA | + ARCHIVE_ENTRY_ACL_ADD_FILE)) ? 'w' : '-'; + *(*p)++ = (perm & (ARCHIVE_ENTRY_ACL_EXECUTE)) ? 'x' : '-'; + *(*p)++ = (perm & (ARCHIVE_ENTRY_ACL_APPEND_DATA | + ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY)) ? 'p' : '-'; + *(*p)++ = (perm & ARCHIVE_ENTRY_ACL_DELETE) ? 'd' : '-'; + *(*p)++ = (perm & ARCHIVE_ENTRY_ACL_DELETE_CHILD) ? 'D' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES) ? 'a' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES) ? 'A' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS) ? 'R' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS) ? 'W' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_READ_ACL) ? 'c' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_WRITE_ACL) ? 'C' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_WRITE_OWNER) ? 'o' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_SYNCHRONIZE) ? 's' : '-'; + *(*p)++ = ':'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT) ? 'f' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT) ? 'd' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY) ? 'i' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT) ? 'n' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS) ? 'S' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS) ? 'F' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_INHERITED) ? 'I' : '-'; + *(*p)++ = ':'; + switch (type) { + case ARCHIVE_ENTRY_ACL_TYPE_ALLOW: + strcpy(*p, "allow"); + break; + case ARCHIVE_ENTRY_ACL_TYPE_DENY: + strcpy(*p, "deny"); + break; + case ARCHIVE_ENTRY_ACL_TYPE_AUDIT: + strcpy(*p, "audit"); + break; + case ARCHIVE_ENTRY_ACL_TYPE_ALARM: + strcpy(*p, "alarm"); + break; + } *p += strlen(*p); - } else if (tag == ARCHIVE_ENTRY_ACL_USER - || tag == ARCHIVE_ENTRY_ACL_GROUP) { - append_id(p, id); - id = -1; } - *(*p)++ = ':'; - *(*p)++ = (perm & 0444) ? 'r' : '-'; - *(*p)++ = (perm & 0222) ? 'w' : '-'; - *(*p)++ = (perm & 0111) ? 'x' : '-'; if (id != -1) { *(*p)++ = ':'; append_id(p, id); } - **p = '\0'; } /* - * Parse a textual ACL. This automatically recognizes and supports - * extensions described above. The 'type' argument is used to - * indicate the type that should be used for any entries not - * explicitly marked as "default:". + * Parse a wide ACL text string. + * + * The want_type argument may be one of the following: + * ARCHIVE_ENTRY_ACL_TYPE_ACCESS - text is a POSIX.1e ACL of type ACCESS + * ARCHIVE_ENTRY_ACL_TYPE_DEFAULT - text is a POSIX.1e ACL of type DEFAULT + * ARCHIVE_ENTRY_ACL_TYPE_NFS4 - text is as a NFSv4 ACL + * + * POSIX.1e ACL entries prefixed with "default:" are treated as + * ARCHIVE_ENTRY_ACL_TYPE_DEFAULT unless type is ARCHIVE_ENTRY_ACL_TYPE_NFS4 */ int -archive_acl_parse_w(struct archive_acl *acl, - const wchar_t *text, int default_type) +archive_acl_from_text_w(struct archive_acl *acl, const wchar_t *text, + int want_type) { struct { const wchar_t *start; const wchar_t *end; - } field[4], name; + } field[6], name; - int fields, n; - int type, tag, permset, id; + const wchar_t *s, *st; + + int numfields, fields, n, r, ret; + int type, types, tag, permset, id; + size_t len; wchar_t sep; - while (text != NULL && *text != L'\0') { + ret = ARCHIVE_OK; + types = 0; + + switch (want_type) { + case ARCHIVE_ENTRY_ACL_TYPE_POSIX1E: + want_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS; + case ARCHIVE_ENTRY_ACL_TYPE_ACCESS: + case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT: + numfields = 5; + break; + case ARCHIVE_ENTRY_ACL_TYPE_NFS4: + numfields = 6; + break; + default: + return (ARCHIVE_FATAL); + } + + while (text != NULL && *text != L'\0') { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Dec 30 22:24:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00583C97CC9; Fri, 30 Dec 2016 22:24:04 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBF1714A2; Fri, 30 Dec 2016 22:24:03 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUMO3pY031422; Fri, 30 Dec 2016 22:24:03 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUMO1nZ031411; Fri, 30 Dec 2016 22:24:01 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201612302224.uBUMO1nZ031411@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Fri, 30 Dec 2016 22:24:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310867 - in head/sys: dev/rtwn dev/rtwn/rtl8812a dev/rtwn/rtl8821a dev/rtwn/rtl8821a/usb modules/rtwn_usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 22:24:04 -0000 Author: avos Date: Fri Dec 30 22:24:01 2016 New Revision: 310867 URL: https://svnweb.freebsd.org/changeset/base/310867 Log: rtwn: add (untested) radar detection support for RTL8821AU (disabled by default). To enable it, dev.rtwn.%d.radar_detection tunable need to be set to a nonzero value. Tested with RTL8821AU, AP mode (no radar events were seen - so, I have no idea if it is really correct / working) Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D8903 Added: head/sys/dev/rtwn/rtl8821a/usb/r21au_dfs.c (contents, props changed) Modified: head/sys/dev/rtwn/if_rtwn.c head/sys/dev/rtwn/if_rtwn_beacon.c head/sys/dev/rtwn/if_rtwn_beacon.h head/sys/dev/rtwn/if_rtwn_debug.h head/sys/dev/rtwn/if_rtwnvar.h head/sys/dev/rtwn/rtl8812a/r12a_var.h head/sys/dev/rtwn/rtl8821a/r21a_init.c head/sys/dev/rtwn/rtl8821a/usb/r21au.h head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c head/sys/modules/rtwn_usb/Makefile Modified: head/sys/dev/rtwn/if_rtwn.c ============================================================================== --- head/sys/dev/rtwn/if_rtwn.c Fri Dec 30 22:18:22 2016 (r310866) +++ head/sys/dev/rtwn/if_rtwn.c Fri Dec 30 22:24:01 2016 (r310867) @@ -580,6 +580,8 @@ rtwn_vap_create(struct ieee80211com *ic, vap->iv_ampdu_density = IEEE80211_HTCAP_MPDUDENSITY_16; vap->iv_ampdu_rxmax = IEEE80211_HTCAP_MAXRXAMPDU_64K; + TIMEOUT_TASK_INIT(taskqueue_thread, &uvp->tx_beacon_csa, 0, + rtwn_tx_beacon_csa, vap); if (opmode == IEEE80211_M_IBSS) { uvp->recv_mgmt = vap->iv_recv_mgmt; vap->iv_recv_mgmt = rtwn_adhoc_recv_mgmt; @@ -1067,9 +1069,26 @@ rtwn_newstate(struct ieee80211vap *vap, } else early_newstate = 0; + if (ostate == IEEE80211_S_CSA) { + taskqueue_cancel_timeout(taskqueue_thread, + &uvp->tx_beacon_csa, NULL); + + /* + * In multi-vap case second counter may not be cleared + * properly. + */ + vap->iv_csa_count = 0; + } IEEE80211_UNLOCK(ic); RTWN_LOCK(sc); - if (ostate == IEEE80211_S_RUN) { + + if (ostate == IEEE80211_S_CSA) { + /* Unblock all queues (multi-vap case). */ + rtwn_write_1(sc, R92C_TXPAUSE, 0); + } + + if ((ostate == IEEE80211_S_RUN && nstate != IEEE80211_S_CSA) || + ostate == IEEE80211_S_CSA) { sc->vaps_running--; /* Set media status to 'No Link'. */ @@ -1141,6 +1160,11 @@ rtwn_newstate(struct ieee80211vap *vap, sc->vaps_running++; break; + case IEEE80211_S_CSA: + /* Block all Tx queues (except beacon queue). */ + rtwn_setbits_1(sc, R92C_TXPAUSE, 0, + R92C_TX_QUEUE_AC | R92C_TX_QUEUE_MGT | R92C_TX_QUEUE_HIGH); + break; default: break; } Modified: head/sys/dev/rtwn/if_rtwn_beacon.c ============================================================================== --- head/sys/dev/rtwn/if_rtwn_beacon.c Fri Dec 30 22:18:22 2016 (r310866) +++ head/sys/dev/rtwn/if_rtwn_beacon.c Fri Dec 30 22:24:01 2016 (r310867) @@ -160,7 +160,8 @@ rtwn_tx_beacon(struct rtwn_softc *sc, st void rtwn_update_beacon(struct ieee80211vap *vap, int item) { - struct rtwn_softc *sc = vap->iv_ic->ic_softc; + struct ieee80211com *ic = vap->iv_ic; + struct rtwn_softc *sc = ic->ic_softc; struct rtwn_vap *uvp = RTWN_VAP(vap); struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; struct ieee80211_node *ni = vap->iv_bss; @@ -176,21 +177,71 @@ rtwn_update_beacon(struct ieee80211vap * return; } } - rtwn_beacon_update_begin(sc, vap); - RTWN_UNLOCK(sc); - if (item == IEEE80211_BEACON_TIM) + RTWN_DPRINTF(sc, RTWN_DEBUG_BEACON, + "%s: vap id %d, iv_csa_count %d, ic_csa_count %d, item %d\n", + __func__, uvp->id, vap->iv_csa_count, ic->ic_csa_count, item); + + switch (item) { + case IEEE80211_BEACON_CSA: + if (vap->iv_csa_count != ic->ic_csa_count) { + /* + * XXX two APs with different beacon intervals + * are not handled properly. + */ + /* XXX check TBTT? */ + taskqueue_enqueue_timeout(taskqueue_thread, + &uvp->tx_beacon_csa, + msecs_to_ticks(ni->ni_intval)); + } + break; + case IEEE80211_BEACON_TIM: mcast = 1; /* XXX */ + break; + default: + break; + } setbit(bo->bo_flags, item); + + rtwn_beacon_update_begin(sc, vap); + RTWN_UNLOCK(sc); + ieee80211_beacon_update(ni, uvp->bcn_mbuf, mcast); + /* XXX clear manually */ + clrbit(bo->bo_flags, IEEE80211_BEACON_CSA); + RTWN_LOCK(sc); rtwn_tx_beacon(sc, uvp); rtwn_beacon_update_end(sc, vap); RTWN_UNLOCK(sc); } +void +rtwn_tx_beacon_csa(void *arg, int npending __unused) +{ + struct ieee80211vap *vap = arg; + struct ieee80211com *ic = vap->iv_ic; + struct rtwn_softc *sc = ic->ic_softc; + struct rtwn_vap *rvp = RTWN_VAP(vap); + + KASSERT (rvp->id == 0 || rvp->id == 1, + ("wrong port id %d\n", rvp->id)); + + IEEE80211_LOCK(ic); + if (ic->ic_flags & IEEE80211_F_CSAPENDING) { + RTWN_DPRINTF(sc, RTWN_DEBUG_BEACON, + "%s: vap id %d, iv_csa_count %d, ic_csa_count %d\n", + __func__, rvp->id, vap->iv_csa_count, ic->ic_csa_count); + + rtwn_update_beacon(vap, IEEE80211_BEACON_CSA); + } + IEEE80211_UNLOCK(ic); + + (void) rvp; +} + int rtwn_tx_beacon_check(struct rtwn_softc *sc, struct rtwn_vap *uvp) { Modified: head/sys/dev/rtwn/if_rtwn_beacon.h ============================================================================== --- head/sys/dev/rtwn/if_rtwn_beacon.h Fri Dec 30 22:18:22 2016 (r310866) +++ head/sys/dev/rtwn/if_rtwn_beacon.h Fri Dec 30 22:24:01 2016 (r310867) @@ -22,6 +22,7 @@ void rtwn_switch_bcnq(struct rtwn_softc *, int); int rtwn_setup_beacon(struct rtwn_softc *, struct ieee80211_node *); void rtwn_update_beacon(struct ieee80211vap *, int); +void rtwn_tx_beacon_csa(void *arg, int); int rtwn_tx_beacon_check(struct rtwn_softc *, struct rtwn_vap *); #endif /* IF_RTWN_BEACON_H */ Modified: head/sys/dev/rtwn/if_rtwn_debug.h ============================================================================== --- head/sys/dev/rtwn/if_rtwn_debug.h Fri Dec 30 22:18:22 2016 (r310866) +++ head/sys/dev/rtwn/if_rtwn_debug.h Fri Dec 30 22:24:01 2016 (r310867) @@ -44,6 +44,7 @@ enum { RTWN_DEBUG_RSSI = 0x00004000, /* dump RSSI lookups */ RTWN_DEBUG_RESET = 0x00008000, /* initialization progress */ RTWN_DEBUG_CALIB = 0x00010000, /* calibration progress */ + RTWN_DEBUG_RADAR = 0x00020000, /* radar detection status */ RTWN_DEBUG_ANY = 0xffffffff }; Modified: head/sys/dev/rtwn/if_rtwnvar.h ============================================================================== --- head/sys/dev/rtwn/if_rtwnvar.h Fri Dec 30 22:18:22 2016 (r310866) +++ head/sys/dev/rtwn/if_rtwnvar.h Fri Dec 30 22:24:01 2016 (r310867) @@ -109,6 +109,7 @@ struct rtwn_vap { struct rtwn_tx_buf bcn_desc; struct mbuf *bcn_mbuf; + struct timeout_task tx_beacon_csa; struct callout tsf_sync_adhoc; struct task tsf_sync_adhoc_task; Modified: head/sys/dev/rtwn/rtl8812a/r12a_var.h ============================================================================== --- head/sys/dev/rtwn/rtl8812a/r12a_var.h Fri Dec 30 22:18:22 2016 (r310866) +++ head/sys/dev/rtwn/rtl8812a/r12a_var.h Fri Dec 30 22:24:01 2016 (r310867) @@ -39,6 +39,10 @@ struct r12a_softc { #define R12A_RXCKSUM_EN 0x01 #define R12A_RXCKSUM6_EN 0x02 #define R12A_IQK_RUNNING 0x04 +#define R12A_RADAR_ENABLED 0x08 + + int rs_radar; + struct timeout_task rs_chan_check; /* ROM variables */ int ext_pa_2g:1, @@ -77,6 +81,11 @@ struct r12a_softc { int sc_ant; + int (*rs_newstate[RTWN_PORT_COUNT])(struct ieee80211vap *, + enum ieee80211_state, int); + void (*rs_scan_start)(struct ieee80211com *); + void (*rs_scan_end)(struct ieee80211com *); + void (*rs_crystalcap_write)(struct rtwn_softc *); void (*rs_fix_spur)(struct rtwn_softc *, struct ieee80211_channel *); Modified: head/sys/dev/rtwn/rtl8821a/r21a_init.c ============================================================================== --- head/sys/dev/rtwn/rtl8821a/r21a_init.c Fri Dec 30 22:18:22 2016 (r310866) +++ head/sys/dev/rtwn/rtl8821a/r21a_init.c Fri Dec 30 22:24:01 2016 (r310867) @@ -280,7 +280,7 @@ r21a_power_off(struct rtwn_softc *sc) /* Enable GPIO9 as EXT WAKEUP. */ rtwn_setbits_1(sc, R92C_GPIO_INTM + 2, 0, 0x01); - rs->rs_flags &= ~R12A_IQK_RUNNING; + rs->rs_flags &= ~(R12A_IQK_RUNNING | R12A_RADAR_ENABLED); } int Modified: head/sys/dev/rtwn/rtl8821a/usb/r21au.h ============================================================================== --- head/sys/dev/rtwn/rtl8821a/usb/r21au.h Fri Dec 30 22:18:22 2016 (r310866) +++ head/sys/dev/rtwn/rtl8821a/usb/r21au.h Fri Dec 30 22:24:01 2016 (r310867) @@ -39,4 +39,10 @@ void r21au_init_tx_agg(struct rtwn_softc *); void r21au_init_burstlen(struct rtwn_softc *); +/* r21au_dfs.c */ +void r21au_chan_check(void *, int); +int r21au_newstate(struct ieee80211vap *, enum ieee80211_state, int); +void r21au_scan_start(struct ieee80211com *); +void r21au_scan_end(struct ieee80211com *); + #endif /* RTL8821AU_H */ Modified: head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c ============================================================================== --- head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c Fri Dec 30 22:18:22 2016 (r310866) +++ head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c Fri Dec 30 22:24:01 2016 (r310867) @@ -76,6 +76,7 @@ void r21au_attach(struct rtwn_usb_softc static void r21a_postattach(struct rtwn_softc *sc) { + struct ieee80211com *ic = &sc->sc_ic; struct r12a_softc *rs = sc->sc_priv; if (rs->board_type == R92C_BOARD_TYPE_MINICARD || @@ -85,18 +86,52 @@ r21a_postattach(struct rtwn_softc *sc) else sc->sc_set_led = r21a_set_led; - sc->sc_ic.ic_ioctl = r12a_ioctl_net; + TIMEOUT_TASK_INIT(taskqueue_thread, &rs->rs_chan_check, 0, + r21au_chan_check, sc); + + /* RXCKSUM */ + ic->ic_ioctl = r12a_ioctl_net; + /* DFS */ + rs->rs_scan_start = ic->ic_scan_start; + ic->ic_scan_start = r21au_scan_start; + rs->rs_scan_end = ic->ic_scan_end; + ic->ic_scan_end = r21au_scan_end; +} + +static void +r21au_vap_preattach(struct rtwn_softc *sc, struct ieee80211vap *vap) +{ + struct rtwn_vap *rvp = RTWN_VAP(vap); + struct r12a_softc *rs = sc->sc_priv; + + r12a_vap_preattach(sc, vap); + + /* Install DFS newstate handler (non-monitor vaps only). */ + if (rvp->id != RTWN_VAP_ID_INVALID) { + KASSERT(rvp->id >= 0 && rvp->id <= nitems(rs->rs_newstate), + ("%s: wrong vap id %d\n", __func__, rvp->id)); + + rs->rs_newstate[rvp->id] = vap->iv_newstate; + vap->iv_newstate = r21au_newstate; + } } static void r21a_attach_private(struct rtwn_softc *sc) { + struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev); + struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev); struct r12a_softc *rs; rs = malloc(sizeof(struct r12a_softc), M_RTWN_PRIV, M_WAITOK | M_ZERO); rs->rs_flags = R12A_RXCKSUM_EN | R12A_RXCKSUM6_EN; + rs->rs_radar = 0; + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "radar_detection", CTLFLAG_RDTUN, &rs->rs_radar, + rs->rs_radar, "Enable radar detection (untested)"); + rs->rs_fix_spur = rtwn_nop_softc_chan; rs->rs_set_band_2ghz = r21a_set_band_2ghz; rs->rs_set_band_5ghz = r21a_set_band_5ghz; @@ -119,7 +154,13 @@ r21a_attach_private(struct rtwn_softc *s static void r21au_adj_devcaps(struct rtwn_softc *sc) { - /* TODO: DFS, LDPC etc */ + struct ieee80211com *ic = &sc->sc_ic; + struct r12a_softc *rs = sc->sc_priv; + + if (rs->rs_radar != 0) + ic->ic_caps |= IEEE80211_C_DFS; + + /* TODO: LDPC etc */ } void @@ -163,7 +204,7 @@ r21au_attach(struct rtwn_usb_softc *uc) sc->sc_iq_calib = r12a_iq_calib; sc->sc_read_chipid_vendor = rtwn_nop_softc_uint32; sc->sc_adj_devcaps = r21au_adj_devcaps; - sc->sc_vap_preattach = r12a_vap_preattach; + sc->sc_vap_preattach = r21au_vap_preattach; sc->sc_postattach = r21a_postattach; sc->sc_detach_private = r12a_detach_private; #ifndef RTWN_WITHOUT_UCODE Added: head/sys/dev/rtwn/rtl8821a/usb/r21au_dfs.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/rtwn/rtl8821a/usb/r21au_dfs.c Fri Dec 30 22:24:01 2016 (r310867) @@ -0,0 +1,280 @@ +/*- + * Copyright (c) 2016 Andriy Voskoboinyk + * All rights reserved. + * + * 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 AUTHOR 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 AUTHOR 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 +__FBSDID("$FreeBSD$"); + +#include "opt_wlan.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#include + +#include +#include + + +#define R21AU_RADAR_CHECK_PERIOD (2 * hz) + +static void +r21au_dfs_radar_disable(struct rtwn_softc *sc) +{ + rtwn_bb_setbits(sc, 0x924, 0x00008000, 0); +} + +static int +r21au_dfs_radar_is_enabled(struct rtwn_softc *sc) +{ + return !!(rtwn_bb_read(sc, 0x924) & 0x00008000); +} + +static int +r21au_dfs_radar_reset(struct rtwn_softc *sc) +{ + int error; + + error = rtwn_bb_setbits(sc, 0x924, 0x00008000, 0); + if (error != 0) + return (error); + + return (rtwn_bb_setbits(sc, 0x924, 0, 0x00008000)); +} + +static int +r21au_dfs_radar_enable(struct rtwn_softc *sc) +{ +#define RTWN_CHK(res) do { \ + if (res != 0) \ + return (EIO); \ +} while(0) + + RTWN_ASSERT_LOCKED(sc); + + RTWN_CHK(rtwn_bb_setbits(sc, 0x814, 0x3fffffff, 0x04cc4d10)); + RTWN_CHK(rtwn_bb_setbits(sc, R12A_BW_INDICATION, 0xff, 0x06)); + RTWN_CHK(rtwn_bb_write(sc, 0x918, 0x1c16ecdf)); + RTWN_CHK(rtwn_bb_write(sc, 0x924, 0x0152a400)); + RTWN_CHK(rtwn_bb_write(sc, 0x91c, 0x0fa21a20)); + RTWN_CHK(rtwn_bb_write(sc, 0x920, 0xe0f57204)); + + return (r21au_dfs_radar_reset(sc)); + +#undef RTWN_CHK +} + +static int +r21au_dfs_radar_is_detected(struct rtwn_softc *sc) +{ + return !!(rtwn_bb_read(sc, 0xf98) & 0x00020000); +} + +void +r21au_chan_check(void *arg, int npending __unused) +{ + struct rtwn_softc *sc = arg; + struct r12a_softc *rs = sc->sc_priv; + struct ieee80211com *ic = &sc->sc_ic; + + RTWN_LOCK(sc); +#ifdef DIAGNOSTIC + RTWN_DPRINTF(sc, RTWN_DEBUG_STATE, + "%s: periodical radar detection task\n", __func__); +#endif + + if (!r21au_dfs_radar_is_enabled(sc)) { + if (rs->rs_flags & R12A_RADAR_ENABLED) { + /* should not happen */ + device_printf(sc->sc_dev, + "%s: radar detection was turned off " + "unexpectedly, resetting...\n", __func__); + + /* XXX something more appropriate? */ + ieee80211_restart_all(ic); + } + RTWN_UNLOCK(sc); + return; + } + + if (r21au_dfs_radar_is_detected(sc)) { + r21au_dfs_radar_reset(sc); + + RTWN_DPRINTF(sc, RTWN_DEBUG_RADAR, "%s: got radar event\n", + __func__); + + RTWN_UNLOCK(sc); + IEEE80211_LOCK(ic); + + ieee80211_dfs_notify_radar(ic, ic->ic_curchan); + + IEEE80211_UNLOCK(ic); + RTWN_LOCK(sc); + } + + if (rs->rs_flags & R12A_RADAR_ENABLED) { + taskqueue_enqueue_timeout(taskqueue_thread, + &rs->rs_chan_check, R21AU_RADAR_CHECK_PERIOD); + } + RTWN_UNLOCK(sc); +} + +int +r21au_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) +{ + struct ieee80211com *ic = vap->iv_ic; + struct rtwn_softc *sc = ic->ic_softc; + struct rtwn_vap *rvp = RTWN_VAP(vap); + struct r12a_softc *rs = sc->sc_priv; + int error; + + KASSERT(rvp->id == 0 || rvp->id == 1, + ("%s: unexpected vap id %d\n", __func__, rvp->id)); + + IEEE80211_UNLOCK(ic); + RTWN_LOCK(sc); + + error = 0; + if (nstate == IEEE80211_S_CAC && + !(rs->rs_flags & R12A_RADAR_ENABLED)) { + error = r21au_dfs_radar_enable(sc); + if (error != 0) { + device_printf(sc->sc_dev, + "%s: cannot enable radar detection\n", __func__); + goto fail; + } + rs->rs_flags |= R12A_RADAR_ENABLED; + + RTWN_DPRINTF(sc, RTWN_DEBUG_RADAR, + "%s: radar detection was enabled\n", __func__); + + taskqueue_enqueue_timeout(taskqueue_thread, + &rs->rs_chan_check, R21AU_RADAR_CHECK_PERIOD); + } + + if ((nstate < IEEE80211_S_CAC || nstate == IEEE80211_S_CSA) && + (rs->rs_flags & R12A_RADAR_ENABLED) && + (sc->vaps[!rvp->id] == NULL || + sc->vaps[!rvp->id]->vap.iv_state < IEEE80211_S_CAC || + sc->vaps[!rvp->id]->vap.iv_state == IEEE80211_S_CSA)) { + taskqueue_cancel_timeout(taskqueue_thread, &rs->rs_chan_check, + NULL); + + rs->rs_flags &= ~R12A_RADAR_ENABLED; + r21au_dfs_radar_disable(sc); + + RTWN_DPRINTF(sc, RTWN_DEBUG_RADAR, + "%s: radar detection was disabled\n", __func__); + } + +fail: + RTWN_UNLOCK(sc); + IEEE80211_LOCK(ic); + + if (error != 0) + return (error); + + return (rs->rs_newstate[rvp->id](vap, nstate, arg)); +} + +void +r21au_scan_start(struct ieee80211com *ic) +{ + struct rtwn_softc *sc = ic->ic_softc; + struct r12a_softc *rs = sc->sc_priv; + + RTWN_LOCK(sc); + if (rs->rs_flags & R12A_RADAR_ENABLED) { + RTWN_UNLOCK(sc); + while (taskqueue_cancel_timeout(taskqueue_thread, + &rs->rs_chan_check, NULL) != 0) { + taskqueue_drain_timeout(taskqueue_thread, + &rs->rs_chan_check); + } + RTWN_LOCK(sc); + + r21au_dfs_radar_disable(sc); + RTWN_DPRINTF(sc, RTWN_DEBUG_RADAR, + "%s: radar detection was (temporarily) disabled\n", + __func__); + } + RTWN_UNLOCK(sc); + + rs->rs_scan_start(ic); +} + +void +r21au_scan_end(struct ieee80211com *ic) +{ + struct rtwn_softc *sc = ic->ic_softc; + struct r12a_softc *rs = sc->sc_priv; + int error; + + RTWN_LOCK(sc); + if (rs->rs_flags & R12A_RADAR_ENABLED) { + error = r21au_dfs_radar_enable(sc); + if (error != 0) { + device_printf(sc->sc_dev, + "%s: cannot re-enable radar detection\n", + __func__); + + /* XXX */ + ieee80211_restart_all(ic); + RTWN_UNLOCK(sc); + return; + } + RTWN_DPRINTF(sc, RTWN_DEBUG_RADAR, + "%s: radar detection was re-enabled\n", __func__); + + taskqueue_enqueue_timeout(taskqueue_thread, + &rs->rs_chan_check, R21AU_RADAR_CHECK_PERIOD); + } + RTWN_UNLOCK(sc); + + rs->rs_scan_end(ic); +} Modified: head/sys/modules/rtwn_usb/Makefile ============================================================================== --- head/sys/modules/rtwn_usb/Makefile Fri Dec 30 22:18:22 2016 (r310866) +++ head/sys/modules/rtwn_usb/Makefile Fri Dec 30 22:24:01 2016 (r310867) @@ -25,7 +25,7 @@ SRCS += r12au_attach.c r12au_init.c r12a r12au.h r12au_reg.h r12au_tx_desc.h .PATH: ${.CURDIR}/../../dev/rtwn/rtl8821a/usb -SRCS += r21au_attach.c r21au_init.c \ +SRCS += r21au_attach.c r21au_init.c r21au_dfs.c \ r21au.h r21au_reg.h opt_rtwn.h: From owner-svn-src-head@freebsd.org Fri Dec 30 22:54:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4515BC98575; Fri, 30 Dec 2016 22:54:11 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04B971231; Fri, 30 Dec 2016 22:54:10 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUMsAKO043621; Fri, 30 Dec 2016 22:54:10 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUMs8fc043607; Fri, 30 Dec 2016 22:54:08 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201612302254.uBUMs8fc043607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Fri, 30 Dec 2016 22:54:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310868 - in head/contrib/libarchive: cpio libarchive libarchive/test X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 22:54:11 -0000 Author: mm Date: Fri Dec 30 22:54:08 2016 New Revision: 310868 URL: https://svnweb.freebsd.org/changeset/base/310868 Log: MFV r310798: Sync libarchive with vendor. Vendor bugfixes (relevant to FreeBSD): PR #843: Fix memory leak of struct archive_entry in cpio/cpio.c PR #851: Spelling fixes Fix two protoypes in manual page archive_read_disk.3 MFC after: 2 weeks Modified: head/contrib/libarchive/cpio/cpio.c head/contrib/libarchive/libarchive/archive_match.c head/contrib/libarchive/libarchive/archive_rb.c head/contrib/libarchive/libarchive/archive_read_disk.3 head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c head/contrib/libarchive/libarchive/archive_write_disk_posix.c head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c head/contrib/libarchive/libarchive/archive_write_set_format_warc.c head/contrib/libarchive/libarchive/archive_write_set_format_xar.c head/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c head/contrib/libarchive/libarchive/test/test_read_format_7zip.c head/contrib/libarchive/libarchive/test/test_read_format_isorr_bz2.c head/contrib/libarchive/libarchive/test/test_read_format_zip_filename.c head/contrib/libarchive/libarchive/test/test_write_format_iso9660.c head/contrib/libarchive/libarchive/test/test_write_format_iso9660_zisofs.c Directory Properties: head/contrib/libarchive/ (props changed) Modified: head/contrib/libarchive/cpio/cpio.c ============================================================================== --- head/contrib/libarchive/cpio/cpio.c Fri Dec 30 22:24:01 2016 (r310867) +++ head/contrib/libarchive/cpio/cpio.c Fri Dec 30 22:54:08 2016 (r310868) @@ -703,6 +703,7 @@ file_to_archive(struct cpio *cpio, const lafe_warnc(0, "%s", archive_error_string(cpio->archive_read_disk)); if (r <= ARCHIVE_FAILED) { + archive_entry_free(entry); cpio->return_value = 1; return (r); } Modified: head/contrib/libarchive/libarchive/archive_match.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_match.c Fri Dec 30 22:24:01 2016 (r310867) +++ head/contrib/libarchive/libarchive/archive_match.c Fri Dec 30 22:54:08 2016 (r310868) @@ -471,7 +471,7 @@ archive_match_path_excluded(struct archi } /* - * Utilty functions to get statistic information for inclusion patterns. + * Utility functions to get statistic information for inclusion patterns. */ int archive_match_path_unmatched_inclusions(struct archive *_a) @@ -1270,7 +1270,7 @@ set_timefilter_pathname_wcs(struct archi #endif /* _WIN32 && !__CYGWIN__ */ /* - * Call back funtions for archive_rb. + * Call back functions for archive_rb. */ static int cmp_node_mbs(const struct archive_rb_node *n1, @@ -1405,7 +1405,7 @@ add_entry(struct archive_match *a, int f &(a->exclusion_tree), pathname); /* - * We always overwrite comparison condision. + * We always overwrite comparison condition. * If you do not want to overwrite it, you should not * call archive_match_exclude_entry(). We cannot know * what behavior you really expect since overwriting @@ -1481,7 +1481,7 @@ time_excluded(struct archive_match *a, s if (nsec == a->older_ctime_nsec && (a->older_ctime_filter & ARCHIVE_MATCH_EQUAL) == 0) - return (1); /* Eeual, skip it. */ + return (1); /* Equal, skip it. */ } } if (a->newer_mtime_filter) { @@ -1513,7 +1513,7 @@ time_excluded(struct archive_match *a, s } } - /* If there is no excluson list, include the file. */ + /* If there is no exclusion list, include the file. */ if (a->exclusion_entry_list.count == 0) return (0); @@ -1700,7 +1700,7 @@ add_owner_id(struct archive_match *a, st break; } - /* Add oowner id. */ + /* Add owner id. */ if (i == ids->count) ids->ids[ids->count++] = id; else if (ids->ids[i] != id) { Modified: head/contrib/libarchive/libarchive/archive_rb.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_rb.c Fri Dec 30 22:24:01 2016 (r310867) +++ head/contrib/libarchive/libarchive/archive_rb.c Fri Dec 30 22:54:08 2016 (r310868) @@ -312,7 +312,7 @@ __archive_rb_tree_insert_rebalance(struc father = RB_FATHER(self); if (RB_BLACK_P(father)) { /* - * If our greatgrandpa is black, we're done. + * If our great-grandpa is black, we're done. */ return; } Modified: head/contrib/libarchive/libarchive/archive_read_disk.3 ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk.3 Fri Dec 30 22:24:01 2016 (r310867) +++ head/contrib/libarchive/libarchive/archive_read_disk.3 Fri Dec 30 22:54:08 2016 (r310868) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 2, 2012 +.Dd December 30, 2016 .Dt ARCHIVE_READ_DISK 3 .Os .Sh NAME @@ -54,9 +54,9 @@ Streaming Archive Library (libarchive, - .Fn archive_read_disk_set_symlink_physical "struct archive *" .Ft int .Fn archive_read_disk_set_symlink_hybrid "struct archive *" -.Ft int +.Ft const char * .Fn archive_read_disk_gname "struct archive *" "gid_t" -.Ft int +.Ft const char * .Fn archive_read_disk_uname "struct archive *" "uid_t" .Ft int .Fo archive_read_disk_set_gname_lookup Modified: head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c Fri Dec 30 22:24:01 2016 (r310867) +++ head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c Fri Dec 30 22:54:08 2016 (r310868) @@ -374,7 +374,7 @@ struct iso9660 { size_t utf16be_path_len; unsigned char *utf16be_previous_path; size_t utf16be_previous_path_len; - /* Null buufer used in bidder to improve its performance. */ + /* Null buffer used in bidder to improve its performance. */ unsigned char null[2048]; }; @@ -1199,7 +1199,7 @@ archive_read_format_iso9660_read_header( archive_string_conversion_from_charset( &(a->archive), "UTF-16BE", 1); if (iso9660->sconv_utf16be == NULL) - /* Coundn't allocate memory */ + /* Couldn't allocate memory */ return (ARCHIVE_FATAL); } if (iso9660->utf16be_path == NULL) { @@ -2407,7 +2407,7 @@ read_CE(struct archive_read *a, struct i return (ARCHIVE_FATAL); } while (heap->cnt && heap->reqs[0].offset == iso9660->current_position); - /* NOTE: Do not move this consume's code to fron of + /* NOTE: Do not move this consume's code to front of * do-while loop. Registration of nested CE extension * might cause error because of current position. */ __archive_read_consume(a, step); @@ -2729,7 +2729,7 @@ next_cache_entry(struct archive_read *a, if (file == NULL) { /* * If directory entries all which are descendant of - * rr_moved are stil remaning, expose their. + * rr_moved are still remaining, expose their. */ if (iso9660->re_files.first != NULL && iso9660->rr_moved != NULL && @@ -2852,7 +2852,7 @@ next_cache_entry(struct archive_read *a, empty_files.last = &empty_files.first; /* Collect files which has the same file serial number. * Peek pending_files so that file which number is different - * is not put bak. */ + * is not put back. */ while (iso9660->pending_files.used > 0 && (iso9660->pending_files.files[0]->number == -1 || iso9660->pending_files.files[0]->number == number)) { @@ -2860,7 +2860,7 @@ next_cache_entry(struct archive_read *a, /* This file has the same offset * but it's wrong offset which empty files * and symlink files have. - * NOTE: This wrong offse was recorded by + * NOTE: This wrong offset was recorded by * old mkisofs utility. If ISO images is * created by latest mkisofs, this does not * happen. Modified: head/contrib/libarchive/libarchive/archive_write_disk_posix.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_disk_posix.c Fri Dec 30 22:24:01 2016 (r310867) +++ head/contrib/libarchive/libarchive/archive_write_disk_posix.c Fri Dec 30 22:54:08 2016 (r310868) @@ -308,7 +308,7 @@ struct archive_write_disk { #define MAXIMUM_DIR_MODE 0775 /* - * Maxinum uncompressed size of a decmpfs block. + * Maximum uncompressed size of a decmpfs block. */ #define MAX_DECMPFS_BLOCK_SIZE (64 * 1024) /* @@ -323,7 +323,7 @@ struct archive_write_disk { #define RSRC_F_SIZE 50 /* Size of Resource fork footer. */ /* Size to write compressed data to resource fork. */ #define COMPRESSED_W_SIZE (64 * 1024) -/* decmpfs difinitions. */ +/* decmpfs definitions. */ #define MAX_DECMPFS_XATTR_SIZE 3802 #ifndef DECMPFS_XATTR_NAME #define DECMPFS_XATTR_NAME "com.apple.decmpfs" @@ -632,9 +632,9 @@ _archive_write_disk_header(struct archiv /* * NOTE: UF_COMPRESSED is ignored even if the filesystem * supports HFS+ Compression because the file should - * have at least an extended attriute "com.apple.decmpfs" + * have at least an extended attribute "com.apple.decmpfs" * before the flag is set to indicate that the file have - * been compressed. If hte filesystem does not support + * been compressed. If the filesystem does not support * HFS+ Compression the system call will fail. */ if (a->fd < 0 || fchflags(a->fd, UF_COMPRESSED) != 0) @@ -1247,7 +1247,7 @@ hfs_drive_compressor(struct archive_writ ret = hfs_write_compressed_data(a, bytes_used + rsrc_size); a->compressed_buffer_remaining = a->compressed_buffer_size; - /* If the compressed size is not enouph smaller than + /* If the compressed size is not enough smaller than * the uncompressed size. cancel HFS+ compression. * TODO: study a behavior of ditto utility and improve * the condition to fall back into no HFS+ compression. */ @@ -1352,7 +1352,7 @@ hfs_write_decmpfs_block(struct archive_w (uint32_t *)(a->resource_fork + RSRC_H_SIZE); /* Set the block count to the resource fork. */ archive_le32enc(a->decmpfs_block_info++, block_count); - /* Get the position where we are goint to set compressed + /* Get the position where we are going to set compressed * data. */ a->compressed_rsrc_position = RSRC_H_SIZE + 4 + (block_count * 8); @@ -1425,7 +1425,7 @@ hfs_write_data_block(struct archive_writ bytes_to_write = size; /* Seek if necessary to the specified offset. */ if (a->offset < a->fd_offset) { - /* Can't support backword move. */ + /* Can't support backward move. */ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Seek failed"); return (ARCHIVE_FATAL); Modified: head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c Fri Dec 30 22:24:01 2016 (r310867) +++ head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c Fri Dec 30 22:54:08 2016 (r310868) @@ -161,7 +161,7 @@ struct isofile { /* Used for managing struct isofile list. */ struct isofile *allnext; struct isofile *datanext; - /* Used for managing a hardlined struct isofile list. */ + /* Used for managing a hardlinked struct isofile list. */ struct isofile *hlnext; struct isofile *hardlink_target; @@ -528,7 +528,7 @@ struct iso_option { * - allow more then 8 depths of directory trees; * - disable a version number to a File Name; * - disable a forced period to the tail of a File Name; - * - the maxinum length of files and directories is raised to 193. + * - the maximum length of files and directories is raised to 193. * if rockridge option is disabled, raised to 207. */ unsigned int iso_level:3; @@ -626,7 +626,7 @@ struct iso_option { * : NOTE Our rockridge=useful option does not set a zero * : to uid and gid, you should use application * : option such as --gid,--gname,--uid and --uname - * : badtar options instead. + * : bsdtar options instead. * Type : boolean/string * Default: Enabled as rockridge=useful * COMPAT : mkisofs -r / -R @@ -660,7 +660,7 @@ struct iso_option { * : for making zisofs. * : When the file size is less than one Logical Block * : size, that file will not zisofs'ed since it does - * : reduece an ISO-image size. + * : reduce an ISO-image size. * : * : When you specify option 'boot=', that * : 'boot-image' file won't be converted to zisofs file. @@ -703,7 +703,7 @@ struct iso9660 { } all_file_list; /* A list of struct isofile entries which have its - * contents and are not a directory, a hardlined file + * contents and are not a directory, a hardlinked file * and a symlink file. */ struct { struct isofile *first; @@ -1907,9 +1907,9 @@ iso9660_close(struct archive_write *a) iso9660->primary.rootent); if (ret < 0) return (ret); - /* Make sure we have UTF-16BE convertors. - * if there is no file entry, convertors are still - * uninitilized. */ + /* Make sure we have UTF-16BE converters. + * if there is no file entry, converters are still + * uninitialized. */ if (iso9660->sconv_to_utf16be == NULL) { iso9660->sconv_to_utf16be = archive_string_conversion_to_charset( @@ -2959,7 +2959,7 @@ set_directory_record_rr(unsigned char *b gid = archive_entry_gid(file->entry); if (iso9660->opt.rr == OPT_RR_USEFUL) { /* - * This action is simular mkisofs -r option + * This action is similar to mkisofs -r option * but our rockridge=useful option does not * set a zero to uid and gid. */ @@ -3108,7 +3108,7 @@ set_directory_record_rr(unsigned char *b /* * flg len * +----+----+ - * | 02 | 00 | CURREENT component. + * | 02 | 00 | CURRENT component. * +----+----+ (".") */ if (nc != NULL) { @@ -3947,7 +3947,7 @@ write_VD(struct archive_write *a, struct "Abstract File", 0, D_CHAR); if (r != ARCHIVE_OK) return (r); - /* Bibliongraphic File Identifier */ + /* Bibliographic File Identifier */ r = set_file_identifier(bp, 777, 813, vdc, a, vdd, &(iso9660->bibliographic_file_identifier), "Bibliongraphic File", 0, D_CHAR); @@ -6135,7 +6135,7 @@ isoent_gen_iso9660_identifier(struct arc off = ffmax - extlen; if (off == 0) { /* A dot('.') character - * does't place to the first + * doesn't place to the first * byte of identifier. */ off ++; extlen --; @@ -7149,7 +7149,7 @@ isoent_create_boot_catalog(struct archiv iso9660->el_torito.catalog = isoent; /* - * Get a boot medai type. + * Get a boot media type. */ switch (iso9660->opt.boot_type) { default: Modified: head/contrib/libarchive/libarchive/archive_write_set_format_warc.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_warc.c Fri Dec 30 22:24:01 2016 (r310867) +++ head/contrib/libarchive/libarchive/archive_write_set_format_warc.c Fri Dec 30 22:54:08 2016 (r310868) @@ -79,7 +79,7 @@ typedef enum { WT_RVIS, /* conversion, unsupported */ WT_CONV, - /* continutation, unsupported at the moment */ + /* continuation, unsupported at the moment */ WT_CONT, /* invalid type */ LAST_WT Modified: head/contrib/libarchive/libarchive/archive_write_set_format_xar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_xar.c Fri Dec 30 22:24:01 2016 (r310867) +++ head/contrib/libarchive/libarchive/archive_write_set_format_xar.c Fri Dec 30 22:54:08 2016 (r310868) @@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$"); * - When writing an XML element , * which is a file type a symbolic link is referencing is always marked * as "broken". Xar utility uses stat(2) to get the file type, but, in - * libarcive format writer, we should not use it; if it is needed, we + * libarchive format writer, we should not use it; if it is needed, we * should get about it at archive_read_disk.c. * - It is possible to appear both and elements. * Xar utility generates on BSD platform and on Linux @@ -1227,7 +1227,7 @@ make_file_entry(struct archive_write *a, case AE_IFLNK: /* * xar utility has checked a file type, which - * a symblic-link file has referenced. + * a symbolic-link file has referenced. * For example: * ../ref/ * The symlink target file is "../ref/" and its @@ -1237,8 +1237,8 @@ make_file_entry(struct archive_write *a, * The symlink target file is "../f" and its * file type is a regular file. * - * But our implemention cannot do it, and then we - * always record that a attribute "type" is "borken", + * But our implementation cannot do it, and then we + * always record that a attribute "type" is "broken", * for example: * foo/bar * It means "foo/bar" is not reachable. @@ -1544,7 +1544,7 @@ make_toc(struct archive_write *a) } /* - * Start recoding TOC + * Start recording TOC */ r = xmlTextWriterStartElement(writer, BAD_CAST("xar")); if (r < 0) { @@ -2484,7 +2484,7 @@ file_connect_hardlink_files(struct xar * archive_entry_set_nlink(target->entry, hl->nlink); if (hl->nlink > 1) /* It means this file is a hardlink - * targe itself. */ + * target itself. */ target->hardlink_target = target; for (nf = target->hlnext; nf != NULL; nf = nf->hlnext) { Modified: head/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c Fri Dec 30 22:24:01 2016 (r310867) +++ head/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c Fri Dec 30 22:54:08 2016 (r310868) @@ -283,7 +283,7 @@ DEFINE_TEST(test_acl_freebsd_posix1e_res } /* - * Verify ACL reaed-from-disk. This test is FreeBSD-specific. + * Verify ACL read-from-disk. This test is FreeBSD-specific. */ DEFINE_TEST(test_acl_freebsd_posix1e_read) { Modified: head/contrib/libarchive/libarchive/test/test_read_format_7zip.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_read_format_7zip.c Fri Dec 30 22:24:01 2016 (r310867) +++ head/contrib/libarchive/libarchive/test/test_read_format_7zip.c Fri Dec 30 22:54:08 2016 (r310868) @@ -688,7 +688,7 @@ test_symname() assertEqualInt(32, archive_read_data(a, buff, sizeof(buff))); assertEqualMem(buff, "hellohellohello\nhellohellohello\n", 32); - /* Verify symbolic-linke symlinkfile. */ + /* Verify symbolic-link symlinkfile. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualInt((AE_IFLNK | 0755), archive_entry_mode(ae)); assertEqualString("symlinkfile", archive_entry_pathname(ae)); Modified: head/contrib/libarchive/libarchive/test/test_read_format_isorr_bz2.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_read_format_isorr_bz2.c Fri Dec 30 22:24:01 2016 (r310867) +++ head/contrib/libarchive/libarchive/test/test_read_format_isorr_bz2.c Fri Dec 30 22:54:08 2016 (r310868) @@ -26,7 +26,7 @@ __FBSDID("$FreeBSD$"); /* -PLEASE use old cdrtools; mkisofs verion is 2.01. +PLEASE use old cdrtools; mkisofs version is 2.01. This version mkisofs made wrong "SL" System Use Entry of RRIP. Execute the following command to rebuild the data for this program: Modified: head/contrib/libarchive/libarchive/test/test_read_format_zip_filename.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_read_format_zip_filename.c Fri Dec 30 22:24:01 2016 (r310867) +++ head/contrib/libarchive/libarchive/test/test_read_format_zip_filename.c Fri Dec 30 22:54:08 2016 (r310868) @@ -1116,7 +1116,7 @@ cleanup: * - the filename of second file is stored in UTF-8. * * Whenever hdrcharset option is specified, we will correctly read the - * filename of sencod file, which is stored in UTF-8. + * filename of second file, which is stored in UTF-8. */ DEFINE_TEST(test_read_format_zip_filename_KOI8R_UTF8_2) Modified: head/contrib/libarchive/libarchive/test/test_write_format_iso9660.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_write_format_iso9660.c Fri Dec 30 22:24:01 2016 (r310867) +++ head/contrib/libarchive/libarchive/test/test_write_format_iso9660.c Fri Dec 30 22:54:08 2016 (r310868) @@ -719,7 +719,7 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualInt(5, archive_entry_ctime(ae)); assert(archive_entry_mtime_is_set(ae)); assertEqualInt(5, archive_entry_mtime(ae)); - /* Trim lngname to 64 characters. */ + /* Trim longname to 64 characters. */ longname[64] = '\0'; assertEqualString(longname, archive_entry_pathname(ae)); assert((AE_IFREG | 0400) == archive_entry_mode(ae)); Modified: head/contrib/libarchive/libarchive/test/test_write_format_iso9660_zisofs.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_write_format_iso9660_zisofs.c Fri Dec 30 22:24:01 2016 (r310867) +++ head/contrib/libarchive/libarchive/test/test_write_format_iso9660_zisofs.c Fri Dec 30 22:54:08 2016 (r310868) @@ -25,7 +25,7 @@ #include "test.h" /* - * Check that a "zisofs" ISO 9660 imaeg is correctly created. + * Check that a "zisofs" ISO 9660 image is correctly created. */ static const unsigned char primary_id[] = { From owner-svn-src-head@freebsd.org Fri Dec 30 23:05:07 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E19F5C9878A; Fri, 30 Dec 2016 23:05:07 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8DF2218BC; Fri, 30 Dec 2016 23:05:07 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUN562k047757; Fri, 30 Dec 2016 23:05:06 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUN5640047755; Fri, 30 Dec 2016 23:05:06 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201612302305.uBUN5640047755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Fri, 30 Dec 2016 23:05:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310870 - head/contrib/libarchive/libarchive X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 23:05:08 -0000 Author: mm Date: Fri Dec 30 23:05:06 2016 New Revision: 310870 URL: https://svnweb.freebsd.org/changeset/base/310870 Log: MFV r310869: Sync libarchive with vendor. Vendor bugfixes: Use __LA_DEPRECATED macro with functions deprecated in 379867e (r310796) MFC after: 2 weeks X-MFC with: r310866 Modified: head/contrib/libarchive/libarchive/archive_entry.h head/contrib/libarchive/libarchive/archive_entry_locale.h Directory Properties: head/contrib/libarchive/ (props changed) Modified: head/contrib/libarchive/libarchive/archive_entry.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry.h Fri Dec 30 23:00:00 2016 (r310869) +++ head/contrib/libarchive/libarchive/archive_entry.h Fri Dec 30 23:05:06 2016 (r310870) @@ -105,6 +105,12 @@ typedef int64_t la_int64_t; # define __LA_DECL #endif +#if defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >= 1 +# define __LA_DEPRECATED __attribute__((deprecated)) +#else +# define __LA_DEPRECATED +#endif + #ifdef __cplusplus extern "C" { #endif @@ -529,9 +535,9 @@ __LA_DECL int archive_entry_acl_from_tex /* Deprecated functions */ __LA_DECL const wchar_t *archive_entry_acl_text_w(struct archive_entry *, - int /* flags */) __attribute__ ((deprecated)); + int /* flags */) __LA_DEPRECATED; __LA_DECL const char *archive_entry_acl_text(struct archive_entry *, - int /* flags */) __attribute__ ((deprecated)); + int /* flags */) __LA_DEPRECATED; /* Return bitmask of ACL types in an archive entry */ __LA_DECL int archive_entry_acl_types(struct archive_entry *); Modified: head/contrib/libarchive/libarchive/archive_entry_locale.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_locale.h Fri Dec 30 23:00:00 2016 (r310869) +++ head/contrib/libarchive/libarchive/archive_entry_locale.h Fri Dec 30 23:05:06 2016 (r310870) @@ -63,8 +63,7 @@ int _archive_entry_uname_l(struct archiv const char **, size_t *, struct archive_string_conv *); #define archive_entry_acl_text_l _archive_entry_acl_text_l int _archive_entry_acl_text_l(struct archive_entry *, int, -const char **, size_t *, struct archive_string_conv *) -__attribute__ ((deprecated)); +const char **, size_t *, struct archive_string_conv *) __LA_DEPRECATED; #define archive_entry_acl_to_text_l _archive_entry_acl_to_text_l char *_archive_entry_acl_to_text_l(struct archive_entry *, ssize_t *, int, struct archive_string_conv *); From owner-svn-src-head@freebsd.org Fri Dec 30 23:41:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8FEBC9803E; Fri, 30 Dec 2016 23:41:34 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8B6219D1; Fri, 30 Dec 2016 23:41:34 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUNfXrO060889; Fri, 30 Dec 2016 23:41:33 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUNfXJo060888; Fri, 30 Dec 2016 23:41:33 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201612302341.uBUNfXJo060888@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 30 Dec 2016 23:41:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310872 - head/usr.bin/sdiff X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 23:41:35 -0000 Author: bapt Date: Fri Dec 30 23:41:33 2016 New Revision: 310872 URL: https://svnweb.freebsd.org/changeset/base/310872 Log: Make sdiff --left-column work as expected MFC after: 3 days Modified: head/usr.bin/sdiff/sdiff.c Modified: head/usr.bin/sdiff/sdiff.c ============================================================================== --- head/usr.bin/sdiff/sdiff.c Fri Dec 30 23:14:18 2016 (r310871) +++ head/usr.bin/sdiff/sdiff.c Fri Dec 30 23:41:33 2016 (r310872) @@ -87,7 +87,6 @@ enum { UNIDIR_OPT, STRIPCR_OPT, HORIZ_OPT, - LEFTC_OPT, SUPCL_OPT, LF_OPT, /* the following groupings must be in sequence */ @@ -109,7 +108,6 @@ enum { static struct option longopts[] = { /* options only processed in sdiff */ - { "left-column", no_argument, NULL, LEFTC_OPT }, { "suppress-common-lines", no_argument, NULL, 's' }, { "width", required_argument, NULL, 'w' }, @@ -129,6 +127,7 @@ static struct option longopts[] = { { "ignore-tab-expansion", no_argument, NULL, 'E' }, { "ignore-matching-lines", required_argument, NULL, 'I' }, { "ignore-case", no_argument, NULL, 'i' }, + { "left-column", no_argument, NULL, 'l' }, { "expand-tabs", no_argument, NULL, 't' }, { "speed-large-files", no_argument, NULL, 'H' }, { "ignore-all-space", no_argument, NULL, 'W' }, From owner-svn-src-head@freebsd.org Fri Dec 30 23:44:40 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71D9FC98260; Fri, 30 Dec 2016 23:44:40 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 416F41E12; Fri, 30 Dec 2016 23:44:40 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUNidLv063907; Fri, 30 Dec 2016 23:44:39 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUNidMT063906; Fri, 30 Dec 2016 23:44:39 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612302344.uBUNidMT063906@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 30 Dec 2016 23:44:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310873 - head/contrib/bsnmp/snmp_mibII X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 23:44:40 -0000 Author: ngie Date: Fri Dec 30 23:44:39 2016 New Revision: 310873 URL: https://svnweb.freebsd.org/changeset/base/310873 Log: Guard against use-after-free after calling mibif_free(..) Set variables to NULL after calling free. Also, remove unnecessary if (x != NULL) checks before calling free(x) MFC after: 1 week Modified: head/contrib/bsnmp/snmp_mibII/mibII.c Modified: head/contrib/bsnmp/snmp_mibII/mibII.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII.c Fri Dec 30 23:41:33 2016 (r310872) +++ head/contrib/bsnmp/snmp_mibII/mibII.c Fri Dec 30 23:44:39 2016 (r310873) @@ -707,10 +707,11 @@ mibif_free(struct mibif *ifp) } free(ifp->private); - if (ifp->physaddr != NULL) - free(ifp->physaddr); - if (ifp->specmib != NULL) - free(ifp->specmib); + ifp->private = NULL; + free(ifp->physaddr); + ifp->physaddr = NULL; + free(ifp->specmib); + ifp->specmib = NULL; STAILQ_FOREACH(map, &mibindexmap_list, link) if (map->mibif == ifp) { @@ -745,8 +746,8 @@ mibif_free(struct mibif *ifp) at = at1; } - free(ifp); + ifp = NULL; mib_if_number--; mib_iftable_last_change = this_tick; } From owner-svn-src-head@freebsd.org Fri Dec 30 23:46:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45793C982D7; Fri, 30 Dec 2016 23:46:12 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 152C41F9B; Fri, 30 Dec 2016 23:46:12 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBUNkB1i064009; Fri, 30 Dec 2016 23:46:11 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBUNkBOC064008; Fri, 30 Dec 2016 23:46:11 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201612302346.uBUNkBOC064008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 30 Dec 2016 23:46:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310874 - head/usr.bin/sdiff X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 23:46:12 -0000 Author: bapt Date: Fri Dec 30 23:46:11 2016 New Revision: 310874 URL: https://svnweb.freebsd.org/changeset/base/310874 Log: Remove extra entries from the option enum MFC after: 3 days Modified: head/usr.bin/sdiff/sdiff.c Modified: head/usr.bin/sdiff/sdiff.c ============================================================================== --- head/usr.bin/sdiff/sdiff.c Fri Dec 30 23:44:39 2016 (r310873) +++ head/usr.bin/sdiff/sdiff.c Fri Dec 30 23:46:11 2016 (r310874) @@ -82,28 +82,9 @@ enum { NORMAL_OPT, FCASE_SENSITIVE_OPT, FCASE_IGNORE_OPT, - FROMFILE_OPT, - TOFILE_OPT, - UNIDIR_OPT, STRIPCR_OPT, - HORIZ_OPT, - SUPCL_OPT, - LF_OPT, - /* the following groupings must be in sequence */ - OLDGF_OPT, - NEWGF_OPT, - UNCGF_OPT, - CHGF_OPT, - OLDLF_OPT, - NEWLF_OPT, - UNCLF_OPT, - /* end order-sensitive enums */ TSIZE_OPT, - HLINES_OPT, - LFILES_OPT, DIFFPROG_OPT, - - NOOP_OPT, }; static struct option longopts[] = { From owner-svn-src-head@freebsd.org Sat Dec 31 00:39:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA664C96563; Sat, 31 Dec 2016 00:39:58 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A81A01E00; Sat, 31 Dec 2016 00:39:58 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x243.google.com with SMTP id n5so23496694pgh.3; Fri, 30 Dec 2016 16:39:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=o4T6MGMla19560tAROQ8tHybV5f3HeNw2DRSklpdTIc=; b=aUG0cacRQ3JH9qolnCKqX6PQnxD77ISdSArkdzQrPbUG8V2BRwsQEvzYPw2f3xlgID vlYVmdi73TTvrOCb4Q+/GO+3mB2sAFnIH6JOSoXpJLtXDct6qhjuTrcL0OKL8Jh5HRIG UMFx8BX0J4TzEQEQtftzyfRVmMW6KzLZ369w7flYL9l2nYe2yGhNKhDbF0nOz+KKO6Zy +RNyEMYezwp3GohvqFAQ7C3mYcLGiTaWHA1SGP70W6S+Tz+klSn95QuUd78lzPHxcfhB M65Cc+d6bNNV5vCsE1zlcV0QSFjEQhYycsxxnHh0BVrQhxS+HsjKnA6hfnxf2xnwQ+i1 AuBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=o4T6MGMla19560tAROQ8tHybV5f3HeNw2DRSklpdTIc=; b=trfsJYi/LohVObONARgd5yEYEdHL08gAc03V4TbQkzRhiaiAjyQP9Q32+EuByNJwU2 4KC86O/DuDR2vfHXhPmHC1tG9g0xUDuChqM59FIKlN6yuyvyUobPFr07JdwgJRK5UEV7 DLtRRtBNoLmKajSJT694m1ptjpb6Dx2kAuehhe5T6zs5vJT+VcbDAFfCeCaQzso0KdjV ML0BmXIeI1BJZt8TvoKAskWsJ+sfx27ipVzYOYPGDlPZXNzIEa7UWY6Jf9SULJztywUX sbki+AGdCYGcN9bGLIrz1lVpMrBy9ZGevB5bTUgcmRV1azvE/Xji7+3pu4xNmTnvtCUg J9mA== X-Gm-Message-State: AIkVDXJY1AS/N44R/ZESxZ5ZsWVX2dXIonMzfJAb0fZuFNmoOAzxbqN9uGrD6k/1HTN6UA== X-Received: by 10.99.22.65 with SMTP id 1mr89247148pgw.70.1483144798029; Fri, 30 Dec 2016 16:39:58 -0800 (PST) Received: from [192.168.20.12] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id p64sm115117955pfi.88.2016.12.30.16.39.57 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Dec 2016 16:39:57 -0800 (PST) Subject: Re: svn commit: r310729 - head/contrib/bsnmp/lib Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_5578E5E5-03ED-4982-ACDA-6D15CBB48014"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201612290020.uBT0K31s082221@repo.freebsd.org> Date: Fri, 30 Dec 2016 16:39:56 -0800 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <711B3082-13F3-4893-917A-F158986F9863@gmail.com> References: <201612290020.uBT0K31s082221@repo.freebsd.org> To: Ngie Cooper X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 00:39:59 -0000 --Apple-Mail=_5578E5E5-03ED-4982-ACDA-6D15CBB48014 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Dec 28, 2016, at 16:20, Ngie Cooper wrote: >=20 > Author: ngie > Date: Thu Dec 29 00:20:03 2016 > New Revision: 310729 > URL: https://svnweb.freebsd.org/changeset/base/310729 >=20 > Log: > Prevent improper memory accesses after calling snmp_pdu_free and = snmp_value_free >=20 > snmp_pdu_free: set pdu->nbindings to 0 to limit the damage that > could happen if a pdu was reused after calling the function, and > as both stack and heap allocation types are used in contrib/bsnmp > and usr.sbin/bsnmpd. >=20 > snmp_value_free: NULL out value->v.octetstring.octets after calling > free on it to prevent a double-free from occurring. This commit identified a bug in the bsnmptools implementation: % bsnmpwalk -s 172.16.45.130:161 sysDescr.0 =3D fbsd12 3045910434 FreeBSD 12.0-CURRENT Bus error (core dumped) --Apple-Mail=_5578E5E5-03ED-4982-ACDA-6D15CBB48014 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJYZv5cAAoJEPWDqSZpMIYVDnYQALjA5RX/zVZBGzglX7ZhUyVG PwmpkxqZbhz+FruFScUSUGz8RAqgtIICrB8DNg/1uhMCdx3NGia0pddHU4HpbI5T kiMpiT76QC65jxImMas1LpgGrWUGCOTZACH7f2EKarT71niah6bm4yHo+QP2hDv+ HkpoYcHA9U+3Lfulf8lZ94rBdy6sGEZi16BmI473U3S93/OKDGkScF+2T5oy7143 RL47XC3L/jgrcPl66IwnU4fWp7H+xkCY26LsLaifVnPT7SWiEgy9fkmJNRHQvRow GCfB5AJwxs8mfQeY7+NPzFob8YpG5GO2POlPxNeYciDsRvCpBSolf4No7bQyTW4l mia71KQHw/NEKyfMf/b6twW/grXm10IpkG2F/BUplyQiegaiFQukHJIdf+KAITQH qbrikPQQNB3BUAnPMWqjuUXl5hxnd53qv1hmF8UpzMb4Rzpu7YaGlMhX0xHH5RWC r9X8Jsoxqz2RDZEv+py2J7OdrO4L5zu+3Tq094b3hcxn3+PdX6Md6gzRc3s4Y8fX umE3meO5q+lYBB/qZerS6P5JdyaPARTCBSU5dDsdJAmG1gDgT1SCdCU9dqIFL9Dz kYGMDB0adB3hogbrnYljfJHZnslX9sKJzXg11TzUh1zYiIH7z+ehGd/yG1HSzx4M UAl4Y/aHGu00k61Kl4mF =/sft -----END PGP SIGNATURE----- --Apple-Mail=_5578E5E5-03ED-4982-ACDA-6D15CBB48014-- From owner-svn-src-head@freebsd.org Sat Dec 31 02:18:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D272C97747; Sat, 31 Dec 2016 02:18:09 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3CACC1732; Sat, 31 Dec 2016 02:18:09 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBV2I8ke025323; Sat, 31 Dec 2016 02:18:08 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBV2I89a025322; Sat, 31 Dec 2016 02:18:08 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201612310218.uBV2I89a025322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Sat, 31 Dec 2016 02:18:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310886 - head/sys/arm/ti/am335x X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 02:18:09 -0000 Author: loos Date: Sat Dec 31 02:18:08 2016 New Revision: 310886 URL: https://svnweb.freebsd.org/changeset/base/310886 Log: Fixes the sensor initialization, always reset the digital outputs to start. Obtained from: pfSense MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/arm/ti/am335x/am335x_scm.c Modified: head/sys/arm/ti/am335x/am335x_scm.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_scm.c Sat Dec 31 02:02:42 2016 (r310885) +++ head/sys/arm/ti/am335x/am335x_scm.c Sat Dec 31 02:18:08 2016 (r310886) @@ -110,11 +110,14 @@ am335x_scm_attach(device_t dev) struct sysctl_oid_list *tree; uint32_t reg; - /* Set ADC to continous mode, clear output reset. */ - reg = SCM_BGAP_CLRZ | SCM_BGAP_CONTCONV; - ti_scm_reg_write_4(SCM_BGAP_CTRL, reg); - /* Flush write. */ + /* Reset the digital outputs. */ + ti_scm_reg_write_4(SCM_BGAP_CTRL, 0); + ti_scm_reg_read_4(SCM_BGAP_CTRL, ®); + DELAY(500); + /* Set continous mode. */ + ti_scm_reg_write_4(SCM_BGAP_CTRL, SCM_BGAP_CONTCONV); ti_scm_reg_read_4(SCM_BGAP_CTRL, ®); + DELAY(500); /* Start the ADC conversion. */ reg = SCM_BGAP_CLRZ | SCM_BGAP_CONTCONV | SCM_BGAP_SOC; ti_scm_reg_write_4(SCM_BGAP_CTRL, reg); From owner-svn-src-head@freebsd.org Sat Dec 31 02:23:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67E7BC97BF3; Sat, 31 Dec 2016 02:23:16 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 377BF1DD3; Sat, 31 Dec 2016 02:23:16 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBV2NFad029470; Sat, 31 Dec 2016 02:23:15 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBV2NF25029469; Sat, 31 Dec 2016 02:23:15 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201612310223.uBV2NF25029469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Sat, 31 Dec 2016 02:23:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310887 - head/sys/dev/rccgpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 02:23:16 -0000 Author: loos Date: Sat Dec 31 02:23:15 2016 New Revision: 310887 URL: https://svnweb.freebsd.org/changeset/base/310887 Log: Fix rcc_gpio_modify_bits(). Obviously (1 << 0) is not the same as 0. Pointy hat to: loos MFC after: 3 days Modified: head/sys/dev/rccgpio/rccgpio.c Modified: head/sys/dev/rccgpio/rccgpio.c ============================================================================== --- head/sys/dev/rccgpio/rccgpio.c Sat Dec 31 02:18:08 2016 (r310886) +++ head/sys/dev/rccgpio/rccgpio.c Sat Dec 31 02:23:15 2016 (r310887) @@ -57,12 +57,12 @@ struct rcc_gpio_pin { }; static struct rcc_gpio_pin rcc_pins[] = { - { .pin = 11, .name = "reset switch", .caps = GPIO_PIN_INPUT }, - { .pin = 15, .name = "red LED", .caps = GPIO_PIN_OUTPUT }, - { .pin = 17, .name = "green LED", .caps = GPIO_PIN_OUTPUT }, + { .pin = (1 << 11), .name = "reset switch", .caps = GPIO_PIN_INPUT }, + { .pin = (1 << 15), .name = "red LED", .caps = GPIO_PIN_OUTPUT }, + { .pin = (1 << 17), .name = "green LED", .caps = GPIO_PIN_OUTPUT }, #if 0 - { .pin = 16, .name = "HD1 LED", .caps = GPIO_PIN_OUTPUT }, - { .pin = 18, .name = "HD2 LED", .caps = GPIO_PIN_OUTPUT }, + { .pin = (1 << 16), .name = "HD1 LED", .caps = GPIO_PIN_OUTPUT }, + { .pin = (1 << 18), .name = "HD2 LED", .caps = GPIO_PIN_OUTPUT }, #endif }; @@ -87,14 +87,14 @@ struct rcc_gpio_softc { static void rcc_gpio_modify_bits(struct rcc_gpio_softc *sc, uint32_t reg, uint32_t mask, - uint32_t bit) + uint32_t writebits) { uint32_t value; RCC_GPIO_LOCK(sc); value = RCC_READ(sc, reg); - value &= ~(1 << mask); - value |= (1 << bit); + value &= ~mask; + value |= writebits; RCC_WRITE(sc, reg, value); RCC_GPIO_UNLOCK(sc); } From owner-svn-src-head@freebsd.org Sat Dec 31 03:07:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76982C96AE0; Sat, 31 Dec 2016 03:07:49 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 271C015FE; Sat, 31 Dec 2016 03:07:49 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBV37mKf046768; Sat, 31 Dec 2016 03:07:48 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBV37miu046767; Sat, 31 Dec 2016 03:07:48 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612310307.uBV37miu046767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 31 Dec 2016 03:07:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310888 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 03:07:49 -0000 Author: hrs Date: Sat Dec 31 03:07:48 2016 New Revision: 310888 URL: https://svnweb.freebsd.org/changeset/base/310888 Log: Retry to open an F_PIPE process when it dies unexpectedly. Reported by: Eugene Grosbein PR: 215335 Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Sat Dec 31 02:23:15 2016 (r310887) +++ head/usr.sbin/syslogd/syslogd.c Sat Dec 31 03:07:48 2016 (r310888) @@ -368,9 +368,19 @@ close_filed(struct filed *f) if (f == NULL || f->f_file == -1) return; + switch (f->f_type) { + case F_FILE: + case F_TTY: + case F_CONSOLE: + case F_FORW: + f->f_type = F_UNUSED; + break; + case F_PIPE: + f->fu_pipe_pid = 0; + break; + } (void)close(f->f_file); f->f_file = -1; - f->f_type = F_UNUSED; } static int @@ -1378,18 +1388,15 @@ fprintlog(struct filed *f, int flags, co if (f->fu_pipe_pid == 0) { if ((f->f_file = p_open(f->fu_pipe_pname, &f->fu_pipe_pid)) < 0) { - f->f_type = F_UNUSED; logerror(f->fu_pipe_pname); break; } } if (writev(f->f_file, iov, nitems(iov)) < 0) { int e = errno; + + deadq_enter(f->fu_pipe_pid, f->fu_pipe_pname); close_filed(f); - if (f->fu_pipe_pid > 0) - deadq_enter(f->fu_pipe_pid, - f->fu_pipe_pname); - f->fu_pipe_pid = 0; errno = e; logerror(f->fu_pipe_pname); } @@ -1520,7 +1527,6 @@ reapchild(int signo __unused) if (f->f_type == F_PIPE && f->fu_pipe_pid == pid) { close_filed(f); - f->fu_pipe_pid = 0; log_deadchild(pid, status, f->fu_pipe_pname); break; } @@ -1619,10 +1625,8 @@ die(int signo) /* flush any pending output */ if (f->f_prevcount) fprintlog(f, 0, (char *)NULL); - if (f->f_type == F_PIPE && f->fu_pipe_pid > 0) { + if (f->f_type == F_PIPE && f->fu_pipe_pid > 0) close_filed(f); - f->fu_pipe_pid = 0; - } } Initialized = was_initialized; if (signo) { @@ -1851,12 +1855,8 @@ init(int signo) close_filed(f); break; case F_PIPE: - if (f->fu_pipe_pid > 0) { - close_filed(f); - deadq_enter(f->fu_pipe_pid, - f->fu_pipe_pname); - } - f->fu_pipe_pid = 0; + deadq_enter(f->fu_pipe_pid, f->fu_pipe_pname); + close_filed(f); break; } } @@ -2753,6 +2753,8 @@ deadq_enter(pid_t pid, const char *name) struct deadq_entry *dq; int status; + if (pid == 0) + return; /* * Be paranoid, if we can't signal the process, don't enter it * into the dead queue (perhaps it's already dead). If possible, From owner-svn-src-head@freebsd.org Sat Dec 31 06:07:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5896AC98DD8; Sat, 31 Dec 2016 06:07:49 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 285A51F5D; Sat, 31 Dec 2016 06:07:49 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBV67mjn019148; Sat, 31 Dec 2016 06:07:48 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBV67mVO019147; Sat, 31 Dec 2016 06:07:48 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201612310607.uBV67mVO019147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Sat, 31 Dec 2016 06:07:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310889 - head/tools/build/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 06:07:49 -0000 Author: jkim Date: Sat Dec 31 06:07:48 2016 New Revision: 310889 URL: https://svnweb.freebsd.org/changeset/base/310889 Log: Do not remove llvm-objdump. It is installed by default since r310840. Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Sat Dec 31 03:07:48 2016 (r310888) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Sat Dec 31 06:07:48 2016 (r310889) @@ -1484,7 +1484,6 @@ OLD_FILES+=usr/bin/llvm-link OLD_FILES+=usr/bin/llvm-lto OLD_FILES+=usr/bin/llvm-mc OLD_FILES+=usr/bin/llvm-nm -OLD_FILES+=usr/bin/llvm-objdump OLD_FILES+=usr/bin/llvm-pdbdump OLD_FILES+=usr/bin/llvm-rtdyld OLD_FILES+=usr/bin/llvm-symbolizer From owner-svn-src-head@freebsd.org Sat Dec 31 06:23:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44B61C98400; Sat, 31 Dec 2016 06:23:06 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F4D617D0; Sat, 31 Dec 2016 06:23:06 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBV6N5EH026842; Sat, 31 Dec 2016 06:23:05 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBV6N5W6026841; Sat, 31 Dec 2016 06:23:05 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612310623.uBV6N5W6026841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 31 Dec 2016 06:23:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310890 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 06:23:06 -0000 Author: hrs Date: Sat Dec 31 06:23:05 2016 New Revision: 310890 URL: https://svnweb.freebsd.org/changeset/base/310890 Log: Replace two fat signal handlers with function calls in the main I/O multiplex loop. select() now watches a pipe which is written by the new skinny signal handlers and the received signals are handled inside the loop sequencially. This eliminates a complex signal mask to guarantee async-signal safety. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Sat Dec 31 06:07:48 2016 (r310889) +++ head/usr.sbin/syslogd/syslogd.c Sat Dec 31 06:23:05 2016 (r310890) @@ -321,8 +321,9 @@ static int LogFacPri; /* Put facility an static int KeepKernFac; /* Keep remotely logged kernel facility */ static int needdofsync = 0; /* Are any file(s) waiting to be fsynced? */ static struct pidfh *pfh; +static int sigp[2]; /* Pipe to catch a signal during select(). */ -static volatile sig_atomic_t MarkSet, WantDie; +static volatile sig_atomic_t MarkSet, WantDie, WantInitialize, WantReapchild; static int allowaddr(char *); static int addfile(struct filed *); @@ -340,6 +341,7 @@ static void dofsync(void); static void domark(int); static void fprintlog(struct filed *, int, const char *); static void init(int); +static void init_sh(int); static void logerror(const char *); static void logmsg(int, const char *, const char *, int); static void log_deadchild(pid_t, int, const char *); @@ -347,11 +349,13 @@ static void markit(void); static int socksetup(struct peer *); static int socklist_recv_file(struct socklist *); static int socklist_recv_sock(struct socklist *); +static int socklist_recv_signal(struct socklist *); static int skip_message(const char *, const char *, int); static void printline(const char *, char *, int); static void printsys(char *); static int p_open(const char *, pid_t *); static void reapchild(int); +static void reapchild_sh(int); static const char *ttymsg_check(struct iovec *, int, char *, int); static void usage(void); static int validate(struct sockaddr *, const char *); @@ -435,7 +439,6 @@ main(int argc, char *argv[]) struct timeval tv, *tvp; struct peer *pe; struct socklist *sl; - sigset_t mask; pid_t ppid = 1, spid; char *p; @@ -578,6 +581,17 @@ main(int argc, char *argv[]) if ((argc -= optind) != 0) usage(); + /* Pipe to catch a signal during select(). */ + s = pipe2(sigp, O_NONBLOCK); + if (s < 0) { + err(1, "cannot open a pipe for signals"); + } else { + addsock(NULL, 0, &(struct socklist){ + .sl_socket = sigp[1], + .sl_recv = socklist_recv_signal + }); + } + /* Listen by default: /dev/klog. */ s = open(_PATH_KLOG, O_RDONLY|O_NONBLOCK, 0); if (s < 0) { @@ -632,19 +646,8 @@ main(int argc, char *argv[]) (void)signal(SIGTERM, dodie); (void)signal(SIGINT, Debug ? dodie : SIG_IGN); (void)signal(SIGQUIT, Debug ? dodie : SIG_IGN); - /* - * We don't want the SIGCHLD and SIGHUP handlers to interfere - * with each other; they are likely candidates for being called - * simultaneously (SIGHUP closes pipe descriptor, process dies, - * SIGCHLD happens). - */ - sigemptyset(&mask); - sigaddset(&mask, SIGHUP); - (void)sigaction(SIGCHLD, &(struct sigaction){ - .sa_handler = reapchild, - .sa_mask = mask, - .sa_flags = SA_RESTART - }, NULL); + (void)signal(SIGHUP, init_sh); + (void)signal(SIGCHLD, reapchild_sh); (void)signal(SIGALRM, domark); (void)signal(SIGPIPE, SIG_IGN); /* We'll catch EPIPE instead. */ (void)alarm(TIMERINTVL); @@ -654,16 +657,6 @@ main(int argc, char *argv[]) dprintf("off & running....\n"); - init(0); - /* prevent SIGHUP and SIGCHLD handlers from running in parallel */ - sigemptyset(&mask); - sigaddset(&mask, SIGCHLD); - (void)sigaction(SIGHUP, &(struct sigaction){ - .sa_handler = init, - .sa_mask = mask, - .sa_flags = SA_RESTART - }, NULL); - tvp = &tv; tv.tv_sec = tv.tv_usec = 0; @@ -677,6 +670,12 @@ main(int argc, char *argv[]) errx(1, "calloc fd_set"); for (;;) { + if (Initialized == 0) + init(0); + else if (WantInitialize) + init(WantInitialize); + if (WantReapchild) + reapchild(WantReapchild); if (MarkSet) markit(); if (WantDie) @@ -716,6 +715,19 @@ main(int argc, char *argv[]) } static int +socklist_recv_signal(struct socklist *sl __unused) +{ + ssize_t len; + static char buf[BUFSIZ]; + + /* Clear an wake-up signal by reading dummy data. */ + while ((len = read(sigp[0], buf, sizeof(buf))) > 0) + ; + + return (0); +} + +static int socklist_recv_sock(struct socklist *sl) { struct sockaddr_storage ss; @@ -987,7 +999,7 @@ static void logmsg(int pri, const char *msg, const char *from, int flags) { struct filed *f; - int i, fac, msglen, omask, prilev; + int i, fac, msglen, prilev; const char *timestamp; char prog[NAME_MAX+1]; char buf[MAXLINE+1]; @@ -995,8 +1007,6 @@ logmsg(int pri, const char *msg, const c dprintf("logmsg: pri %o, flags %x, from %s, msg %s\n", pri, flags, from, msg); - omask = sigblock(sigmask(SIGHUP)|sigmask(SIGALRM)); - /* * Check to see if msg looks non-standard. */ @@ -1027,10 +1037,8 @@ logmsg(int pri, const char *msg, const c fac = LOG_FAC(pri); /* Check maximum facility number. */ - if (fac > LOG_NFACILITIES) { - (void)sigsetmask(omask); + if (fac > LOG_NFACILITIES) return; - } prilev = LOG_PRI(pri); @@ -1067,7 +1075,6 @@ logmsg(int pri, const char *msg, const c close(f->f_file); f->f_file = -1; } - (void)sigsetmask(omask); return; } STAILQ_FOREACH(f, &fhead, next) { @@ -1139,7 +1146,6 @@ logmsg(int pri, const char *msg, const c } } } - (void)sigsetmask(omask); } static void @@ -1507,6 +1513,17 @@ ttymsg_check(struct iovec *iov, int iovc } static void +reapchild_sh(int signo) +{ + static char buf[BUFSIZ]; + + WantReapchild = signo; + /* Send an wake-up signal to the select() loop. */ + read(sigp[0], buf, sizeof(buf)); + write(sigp[1], &signo, sizeof(signo)); +} + +static void reapchild(int signo __unused) { int status; @@ -1514,10 +1531,6 @@ reapchild(int signo __unused) struct filed *f; while ((pid = wait3(&status, WNOHANG, (struct rusage *)NULL)) > 0) { - if (!Initialized) - /* Don't tell while we are initting. */ - continue; - /* First, look if it's a process from the dead queue. */ if (deadq_removebypid(pid)) continue; @@ -1532,6 +1545,7 @@ reapchild(int signo __unused) } } } + WantReapchild = 0; } /* @@ -1541,7 +1555,6 @@ static const char * cvthname(struct sockaddr *f) { int error, hl; - sigset_t omask, nmask; static char hname[NI_MAXHOST], ip[NI_MAXHOST]; dprintf("cvthname(%d) len = %d\n", f->sa_family, f->sa_len); @@ -1556,12 +1569,8 @@ cvthname(struct sockaddr *f) if (!resolve) return (ip); - sigemptyset(&nmask); - sigaddset(&nmask, SIGHUP); - sigprocmask(SIG_BLOCK, &nmask, &omask); error = getnameinfo(f, f->sa_len, hname, sizeof(hname), NULL, 0, NI_NAMEREQD); - sigprocmask(SIG_SETMASK, &omask, NULL); if (error) { dprintf("Host name for your address (%s) unknown\n", ip); return (ip); @@ -1616,11 +1625,8 @@ die(int signo) { struct filed *f; struct socklist *sl; - int was_initialized; char buf[100]; - was_initialized = Initialized; - Initialized = 0; /* Don't log SIGCHLDs. */ STAILQ_FOREACH(f, &fhead, next) { /* flush any pending output */ if (f->f_prevcount) @@ -1628,7 +1634,6 @@ die(int signo) if (f->f_type == F_PIPE && f->fu_pipe_pid > 0) close_filed(f); } - Initialized = was_initialized; if (signo) { dprintf("syslogd: exiting on signal %d\n", signo); (void)snprintf(buf, sizeof(buf), "exiting on signal %d", signo); @@ -1793,6 +1798,17 @@ readconfigfile(FILE *cf, int allow_inclu * INIT -- Initialize syslogd from configuration table */ static void +init_sh(int signo) +{ + static char buf[BUFSIZ]; + + WantInitialize = signo; + /* Send an wake-up signal to the select() loop. */ + read(sigp[0], buf, sizeof(buf)); + write(sigp[1], &signo, sizeof(signo)); +} + +static void init(int signo) { int i; @@ -1804,6 +1820,7 @@ init(int signo) char bootfileMsg[LINE_MAX]; dprintf("init\n"); + WantInitialize = 0; /* * Load hostname (may have changed). @@ -2669,7 +2686,6 @@ p_open(const char *prog, pid_t *rpid) { int pfd[2], nulldesc; pid_t pid; - sigset_t omask, mask; char *argv[4]; /* sh -c cmd NULL */ char errmsg[200]; @@ -2679,17 +2695,13 @@ p_open(const char *prog, pid_t *rpid) /* we are royally screwed anyway */ return (-1); - sigemptyset(&mask); - sigaddset(&mask, SIGALRM); - sigaddset(&mask, SIGHUP); - sigprocmask(SIG_BLOCK, &mask, &omask); switch ((pid = fork())) { case -1: - sigprocmask(SIG_SETMASK, &omask, 0); close(nulldesc); return (-1); case 0: + (void)setsid(); /* Avoid catching SIGHUPs. */ argv[0] = strdup("sh"); argv[1] = strdup("-c"); argv[2] = strdup(prog); @@ -2700,19 +2712,11 @@ p_open(const char *prog, pid_t *rpid) } alarm(0); - (void)setsid(); /* Avoid catching SIGHUPs. */ - /* - * Throw away pending signals, and reset signal - * behaviour to standard values. - */ - signal(SIGALRM, SIG_IGN); - signal(SIGHUP, SIG_IGN); - sigprocmask(SIG_SETMASK, &omask, 0); - signal(SIGPIPE, SIG_DFL); - signal(SIGQUIT, SIG_DFL); - signal(SIGALRM, SIG_DFL); - signal(SIGHUP, SIG_DFL); + /* Restore signals marked as SIG_IGN. */ + (void)signal(SIGINT, SIG_DFL); + (void)signal(SIGQUIT, SIG_DFL); + (void)signal(SIGPIPE, SIG_DFL); dup2(pfd[0], STDIN_FILENO); dup2(nulldesc, STDOUT_FILENO); @@ -2722,8 +2726,6 @@ p_open(const char *prog, pid_t *rpid) (void)execvp(_PATH_BSHELL, argv); _exit(255); } - - sigprocmask(SIG_SETMASK, &omask, 0); close(nulldesc); close(pfd[0]); /* From owner-svn-src-head@freebsd.org Sat Dec 31 07:50:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D10F0C98E05; Sat, 31 Dec 2016 07:50:15 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91DA0183A; Sat, 31 Dec 2016 07:50:15 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBV7oE1u058861; Sat, 31 Dec 2016 07:50:14 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBV7oEG6058859; Sat, 31 Dec 2016 07:50:14 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201612310750.uBV7oEG6058859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 31 Dec 2016 07:50:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310891 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 07:50:15 -0000 Author: adrian Date: Sat Dec 31 07:50:14 2016 New Revision: 310891 URL: https://svnweb.freebsd.org/changeset/base/310891 Log: [net80211] add placeholders for the VHT action frame handling. Upcoming vht support will register send/receive action handlers. Modified: head/sys/net80211/ieee80211.h head/sys/net80211/ieee80211_action.c Modified: head/sys/net80211/ieee80211.h ============================================================================== --- head/sys/net80211/ieee80211.h Sat Dec 31 06:23:05 2016 (r310890) +++ head/sys/net80211/ieee80211.h Sat Dec 31 07:50:14 2016 (r310891) @@ -382,7 +382,7 @@ struct ieee80211_action { #define IEEE80211_ACTION_CAT_MESH 13 /* Mesh */ #define IEEE80211_ACTION_CAT_SELF_PROT 15 /* Self-protected */ /* 16 - 125 reserved */ -#define IEEE80211_ACTION_VHT 21 +#define IEEE80211_ACTION_CAT_VHT 21 #define IEEE80211_ACTION_CAT_VENDOR 127 /* Vendor Specific */ #define IEEE80211_ACTION_HT_TXCHWIDTH 0 /* recommended xmit chan width*/ Modified: head/sys/net80211/ieee80211_action.c ============================================================================== --- head/sys/net80211/ieee80211_action.c Sat Dec 31 06:23:05 2016 (r310890) +++ head/sys/net80211/ieee80211_action.c Sat Dec 31 07:50:14 2016 (r310891) @@ -79,6 +79,10 @@ static ieee80211_send_action_func *vendo send_inval, send_inval, send_inval, send_inval, }; +static ieee80211_send_action_func *vht_send_action[3] = { + send_inval, send_inval, send_inval, +}; + int ieee80211_send_action_register(int cat, int act, ieee80211_send_action_func *f) { @@ -108,6 +112,11 @@ ieee80211_send_action_register(int cat, break; vendor_send_action[act] = f; return 0; + case IEEE80211_ACTION_CAT_VHT: + if (act >= nitems(vht_send_action)) + break; + vht_send_action[act] = f; + return 0; } return EINVAL; } @@ -144,6 +153,10 @@ ieee80211_send_action(struct ieee80211_n if (act < nitems(vendor_send_action)) f = vendor_send_action[act]; break; + case IEEE80211_ACTION_CAT_VHT: + if (act < nitems(vht_send_action)) + f = vht_send_action[act]; + break; } return f(ni, cat, act, sa); } @@ -177,6 +190,10 @@ static ieee80211_recv_action_func *vendo recv_inval, recv_inval, recv_inval, recv_inval, }; +static ieee80211_recv_action_func *vht_recv_action[3] = { + recv_inval, recv_inval, recv_inval +}; + int ieee80211_recv_action_register(int cat, int act, ieee80211_recv_action_func *f) { @@ -206,6 +223,11 @@ ieee80211_recv_action_register(int cat, break; vendor_recv_action[act] = f; return 0; + case IEEE80211_ACTION_CAT_VHT: + if (act >= nitems(vht_recv_action)) + break; + vht_recv_action[act] = f; + return 0; } return EINVAL; } @@ -256,6 +278,10 @@ ieee80211_recv_action(struct ieee80211_n if (ia->ia_action < nitems(vendor_recv_action)) f = vendor_recv_action[ia->ia_action]; break; + case IEEE80211_ACTION_CAT_VHT: + if (ia->ia_action < nitems(vht_recv_action)) + f = vht_recv_action[ia->ia_action]; + break; } return f(ni, wh, frm, efrm); } From owner-svn-src-head@freebsd.org Sat Dec 31 09:43:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0180BC98C54; Sat, 31 Dec 2016 09:43:37 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C21271348; Sat, 31 Dec 2016 09:43:36 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBV9hZWS007050; Sat, 31 Dec 2016 09:43:35 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBV9hZNk007049; Sat, 31 Dec 2016 09:43:35 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612310943.uBV9hZNk007049@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 31 Dec 2016 09:43:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310892 - head/usr.sbin/bsnmpd/tools/bsnmptools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 09:43:37 -0000 Author: ngie Date: Sat Dec 31 09:43:35 2016 New Revision: 310892 URL: https://svnweb.freebsd.org/changeset/base/310892 Log: Don't call snmp_pdu_free(..) until finished with the pdu and when ready to allocate a new one via snmp_pdu_create(..) This fixes bsnmpwalk, so it no longer crashes after r310729 X-MFC with: r310729 MFC after: 12 days Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c ============================================================================== --- head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Sat Dec 31 07:50:14 2016 (r310891) +++ head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Sat Dec 31 09:43:35 2016 (r310892) @@ -498,7 +498,6 @@ snmptool_walk(struct snmp_toolinfo *snmp } outputs += rc; - snmp_pdu_free(&resp); if ((u_int)rc < resp.nbindings) break; @@ -518,8 +517,6 @@ snmptool_walk(struct snmp_toolinfo *snmp snmp_output_err_resp(snmptoolctx, &resp); else snmp_output_resp(snmptoolctx, &(resp), NULL); - - snmp_pdu_free(&resp); } else warn("Snmp dialog"); } @@ -529,6 +526,8 @@ snmptool_walk(struct snmp_toolinfo *snmp break; } + snmp_pdu_free(&resp); + snmp_pdu_create(&req, op); } From owner-svn-src-head@freebsd.org Sat Dec 31 09:52:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61245C98E53; Sat, 31 Dec 2016 09:52:01 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2846D168A; Sat, 31 Dec 2016 09:52:01 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBV9q0qD010866; Sat, 31 Dec 2016 09:52:00 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBV9q05k010865; Sat, 31 Dec 2016 09:52:00 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612310952.uBV9q05k010865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 31 Dec 2016 09:52:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310893 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 09:52:01 -0000 Author: hrs Date: Sat Dec 31 09:52:00 2016 New Revision: 310893 URL: https://svnweb.freebsd.org/changeset/base/310893 Log: Remove extra NULL-check before free(3). Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Sat Dec 31 09:43:35 2016 (r310892) +++ head/usr.sbin/syslogd/syslogd.c Sat Dec 31 09:52:00 2016 (r310893) @@ -710,8 +710,7 @@ main(int argc, char *argv[]) (*sl->sl_recv)(sl); } } - if (fdsr) - free(fdsr); + free(fdsr); } static int From owner-svn-src-head@freebsd.org Sat Dec 31 10:01:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB053C96072; Sat, 31 Dec 2016 10:01:26 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 648B71AFA; Sat, 31 Dec 2016 10:01:26 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVA1PiD012648; Sat, 31 Dec 2016 10:01:25 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVA1P8Y012647; Sat, 31 Dec 2016 10:01:25 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612311001.uBVA1P8Y012647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 31 Dec 2016 10:01:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310894 - head/usr.sbin/bsnmpd/tools/bsnmptools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 10:01:26 -0000 Author: ngie Date: Sat Dec 31 10:01:25 2016 New Revision: 310894 URL: https://svnweb.freebsd.org/changeset/base/310894 Log: snmp_pdu_free the right object at the right time in snmptool_walk r310892 was on the right track, but unfortunately it was resolving the problem incorrectly and accidentally leaking memory in the process. - Call snmp_pdu_free on req before calling snmp_pdu_create on it at the bottom of the outer while loop - Call snmp_pdu_free on resp after calling snmpwalk_nextpdu_create in the inner loop MFC after: 12 days X-MFC with: r310729, r310892 Reported by: valgrind Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c ============================================================================== --- head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Sat Dec 31 09:52:00 2016 (r310893) +++ head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Sat Dec 31 10:01:25 2016 (r310894) @@ -422,6 +422,7 @@ snmptool_get(struct snmp_toolinfo *snmpt snmp_pdu_create(&req, GET_PDUTYPE(snmptoolctx)); } + snmp_pdu_free(&req); snmp_pdu_free(&resp); return (0); @@ -507,6 +508,7 @@ snmptool_walk(struct snmp_toolinfo *snmp if (op == SNMP_PDU_GETBULK) snmpget_fix_getbulk(&req, GET_MAXREP(snmptoolctx), GET_NONREP(snmptoolctx)); + snmp_pdu_free(&resp); } /* Just in case our root was a leaf. */ @@ -517,6 +519,7 @@ snmptool_walk(struct snmp_toolinfo *snmp snmp_output_err_resp(snmptoolctx, &resp); else snmp_output_resp(snmptoolctx, &(resp), NULL); + snmp_pdu_free(&resp); } else warn("Snmp dialog"); } @@ -526,11 +529,13 @@ snmptool_walk(struct snmp_toolinfo *snmp break; } - snmp_pdu_free(&resp); - + snmp_pdu_free(&req); snmp_pdu_create(&req, op); } + snmp_pdu_free(&req); + snmp_pdu_free(&resp); + if (rc == 0) return (0); else From owner-svn-src-head@freebsd.org Sat Dec 31 10:37:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02458C96F7D; Sat, 31 Dec 2016 10:37:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2FAF1977; Sat, 31 Dec 2016 10:37:57 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVAbuSl028144; Sat, 31 Dec 2016 10:37:56 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVAbuCB028143; Sat, 31 Dec 2016 10:37:56 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201612311037.uBVAbuCB028143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 31 Dec 2016 10:37:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310907 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 10:37:58 -0000 Author: mjg Date: Sat Dec 31 10:37:56 2016 New Revision: 310907 URL: https://svnweb.freebsd.org/changeset/base/310907 Log: Use vrefact in vnode_pager_alloc. Modified: head/sys/vm/vnode_pager.c Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Sat Dec 31 10:37:50 2016 (r310906) +++ head/sys/vm/vnode_pager.c Sat Dec 31 10:37:56 2016 (r310907) @@ -265,7 +265,7 @@ retry: #endif VM_OBJECT_WUNLOCK(object); } - vref(vp); + vrefact(vp); return (object); } From owner-svn-src-head@freebsd.org Sat Dec 31 11:03:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5266C97C94; Sat, 31 Dec 2016 11:03:35 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7DC981893; Sat, 31 Dec 2016 11:03:35 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVB3Yak040927; Sat, 31 Dec 2016 11:03:34 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVB3Yb7040923; Sat, 31 Dec 2016 11:03:34 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612311103.uBVB3Yb7040923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 31 Dec 2016 11:03:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310921 - head/usr.sbin/inetd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 11:03:35 -0000 Author: hrs Date: Sat Dec 31 11:03:34 2016 New Revision: 310921 URL: https://svnweb.freebsd.org/changeset/base/310921 Log: - Add static for symbols which need not to be exported. - Clean up warnings to the WARNS=6 level. Modified: head/usr.sbin/inetd/builtins.c head/usr.sbin/inetd/inetd.c head/usr.sbin/inetd/inetd.h Modified: head/usr.sbin/inetd/builtins.c ============================================================================== --- head/usr.sbin/inetd/builtins.c Sat Dec 31 11:02:33 2016 (r310920) +++ head/usr.sbin/inetd/builtins.c Sat Dec 31 11:03:34 2016 (r310921) @@ -52,25 +52,24 @@ __FBSDID("$FreeBSD$"); #include "inetd.h" -void chargen_dg(int, struct servtab *); -void chargen_stream(int, struct servtab *); -void daytime_dg(int, struct servtab *); -void daytime_stream(int, struct servtab *); -void discard_dg(int, struct servtab *); -void discard_stream(int, struct servtab *); -void echo_dg(int, struct servtab *); -void echo_stream(int, struct servtab *); +static void chargen_dg(int, struct servtab *); +static void chargen_stream(int, struct servtab *); +static void daytime_dg(int, struct servtab *); +static void daytime_stream(int, struct servtab *); +static void discard_dg(int, struct servtab *); +static void discard_stream(int, struct servtab *); +static void echo_dg(int, struct servtab *); +static void echo_stream(int, struct servtab *); static int get_line(int, char *, int); -void iderror(int, int, int, const char *); -void ident_stream(int, struct servtab *); -void initring(void); -uint32_t machtime(void); -void machtime_dg(int, struct servtab *); -void machtime_stream(int, struct servtab *); - -char ring[128]; -char *endring; +static void iderror(int, int, int, const char *); +static void ident_stream(int, struct servtab *); +static void initring(void); +static uint32_t machtime(void); +static void machtime_dg(int, struct servtab *); +static void machtime_stream(int, struct servtab *); +static char ring[128]; +static char *endring; struct biltin biltins[] = { /* Echo received data */ @@ -105,7 +104,7 @@ struct biltin biltins[] = { * any regard for input. */ -void +static void initring(void) { int i; @@ -122,7 +121,7 @@ initring(void) * characters chosen from the range 0 to 512. We send LINESIZ+2. */ /* ARGSUSED */ -void +static void chargen_dg(int s, struct servtab *sep) { struct sockaddr_storage ss; @@ -159,7 +158,7 @@ chargen_dg(int s, struct servtab *sep) /* Character generator */ /* ARGSUSED */ -void +static void chargen_stream(int s, struct servtab *sep) { int len; @@ -196,7 +195,7 @@ chargen_stream(int s, struct servtab *se /* Return human-readable time of day */ /* ARGSUSED */ -void +static void daytime_dg(int s, struct servtab *sep) { char buffer[256]; @@ -221,7 +220,7 @@ daytime_dg(int s, struct servtab *sep) /* Return human-readable time of day */ /* ARGSUSED */ -void +static void daytime_stream(int s, struct servtab *sep __unused) { char buffer[256]; @@ -240,7 +239,7 @@ daytime_stream(int s, struct servtab *se /* Discard service -- ignore data */ /* ARGSUSED */ -void +static void discard_dg(int s, struct servtab *sep __unused) { char buffer[BUFSIZE]; @@ -250,7 +249,7 @@ discard_dg(int s, struct servtab *sep __ /* Discard service -- ignore data */ /* ARGSUSED */ -void +static void discard_stream(int s, struct servtab *sep) { int ret; @@ -273,7 +272,7 @@ discard_stream(int s, struct servtab *se /* Echo service -- echo data back */ /* ARGSUSED */ -void +static void echo_dg(int s, struct servtab *sep) { char buffer[65536]; /* Should be sizeof(max datagram). */ @@ -294,7 +293,7 @@ echo_dg(int s, struct servtab *sep) /* Echo service -- echo data back */ /* ARGSUSED */ -void +static void echo_stream(int s, struct servtab *sep) { char buffer[BUFSIZE]; @@ -322,7 +321,7 @@ echo_stream(int s, struct servtab *sep) /* Generic ident_stream error-sending func */ /* ARGSUSED */ -void +static void iderror(int lport, int fport, int s, const char *er) { char *p; @@ -340,7 +339,7 @@ iderror(int lport, int fport, int s, con /* Ident service (AKA "auth") */ /* ARGSUSED */ -void +static void ident_stream(int s, struct servtab *sep) { struct utsname un; @@ -688,7 +687,7 @@ printit: * some seventy years Bell Labs was asleep. */ -uint32_t +static uint32_t machtime(void) { @@ -698,7 +697,7 @@ machtime(void) } /* ARGSUSED */ -void +static void machtime_dg(int s, struct servtab *sep) { uint32_t result; @@ -719,7 +718,7 @@ machtime_dg(int s, struct servtab *sep) } /* ARGSUSED */ -void +static void machtime_stream(int s, struct servtab *sep __unused) { uint32_t result; Modified: head/usr.sbin/inetd/inetd.c ============================================================================== --- head/usr.sbin/inetd/inetd.c Sat Dec 31 11:02:33 2016 (r310920) +++ head/usr.sbin/inetd/inetd.c Sat Dec 31 11:03:34 2016 (r310921) @@ -204,30 +204,36 @@ __FBSDID("$FreeBSD$"); #define SIGBLOCK (sigmask(SIGCHLD)|sigmask(SIGHUP)|sigmask(SIGALRM)) -void close_sep(struct servtab *); -void flag_signal(int); -void flag_config(int); -void config(void); -int cpmip(const struct servtab *, int); -void endconfig(void); -struct servtab *enter(struct servtab *); -void freeconfig(struct servtab *); -struct servtab *getconfigent(void); -int matchservent(const char *, const char *, const char *); -char *nextline(FILE *); -void addchild(struct servtab *, int); -void flag_reapchild(int); -void reapchild(void); -void enable(struct servtab *); -void disable(struct servtab *); -void flag_retry(int); -void retry(void); -int setconfig(void); -void setup(struct servtab *); +#define satosin(sa) ((struct sockaddr_in *)(void *)sa) +#define csatosin(sa) ((const struct sockaddr_in *)(const void *)sa) +#ifdef INET6 +#define satosin6(sa) ((struct sockaddr_in6 *)(void *)sa) +#define csatosin6(sa) ((const struct sockaddr_in6 *)(const void *)sa) +#endif +static void close_sep(struct servtab *); +static void flag_signal(int); +static void flag_config(int); +static void config(void); +static int cpmip(const struct servtab *, int); +static void endconfig(void); +static struct servtab *enter(struct servtab *); +static void freeconfig(struct servtab *); +static struct servtab *getconfigent(void); +static int matchservent(const char *, const char *, const char *); +static char *nextline(FILE *); +static void addchild(struct servtab *, int); +static void flag_reapchild(int); +static void reapchild(void); +static void enable(struct servtab *); +static void disable(struct servtab *); +static void flag_retry(int); +static void retry(void); +static int setconfig(void); +static void setup(struct servtab *); #ifdef IPSEC -void ipsecsetup(struct servtab *); +static void ipsecsetup(struct servtab *); #endif -void unregisterrpc(register struct servtab *sep); +static void unregisterrpc(register struct servtab *sep); static struct conninfo *search_conn(struct servtab *sep, int ctrl); static int room_conn(struct servtab *sep, struct conninfo *conn); static void addchild_conn(struct conninfo *conn, pid_t pid); @@ -238,51 +244,55 @@ static void free_connlist(struct servtab static void free_proc(struct procinfo *); static struct procinfo *search_proc(pid_t pid, int add); static int hashval(char *p, int len); +static char *skip(char **); +static char *sskip(char **); +static char *newstr(const char *); +static void print_service(const char *, const struct servtab *); +/* tcpd.h */ int allow_severity; int deny_severity; -int wrap_ex = 0; -int wrap_bi = 0; + +static int wrap_ex = 0; +static int wrap_bi = 0; int debug = 0; -int dolog = 0; -int maxsock; /* highest-numbered descriptor */ -fd_set allsock; -int options; -int timingout; -int toomany = TOOMANY; -int maxchild = MAXCHILD; -int maxcpm = MAXCPM; -int maxperip = MAXPERIP; -struct servent *sp; -struct rpcent *rpc; -char *hostname = NULL; -struct sockaddr_in *bind_sa4; -int v4bind_ok = 0; +static int dolog = 0; +static int maxsock; /* highest-numbered descriptor */ +static fd_set allsock; +static int options; +static int timingout; +static int toomany = TOOMANY; +static int maxchild = MAXCHILD; +static int maxcpm = MAXCPM; +static int maxperip = MAXPERIP; +static struct servent *sp; +static struct rpcent *rpc; +static char *hostname = NULL; +static struct sockaddr_in *bind_sa4; +static int v4bind_ok = 0; #ifdef INET6 -struct sockaddr_in6 *bind_sa6; -int v6bind_ok = 0; +static struct sockaddr_in6 *bind_sa6; +static int v6bind_ok = 0; #endif -int signalpipe[2]; +static int signalpipe[2]; #ifdef SANITY_CHECK -int nsock; +static int nsock; #endif -uid_t euid; -gid_t egid; -mode_t mask; +static uid_t euid; +static gid_t egid; +static mode_t mask; -struct servtab *servtab; +struct servtab *servtab; -extern struct biltin biltins[]; +static const char *CONFIG = _PATH_INETDCONF; +static const char *pid_file = _PATH_INETDPID; +static struct pidfh *pfh = NULL; -const char *CONFIG = _PATH_INETDCONF; -const char *pid_file = _PATH_INETDPID; -struct pidfh *pfh = NULL; - -struct netconfig *udpconf, *tcpconf, *udp6conf, *tcp6conf; +static struct netconfig *udpconf, *tcpconf, *udp6conf, *tcp6conf; static LIST_HEAD(, procinfo) proctable[PERIPSIZE]; -int +static int getvalue(const char *arg, int *value, const char *whine) { int tmp; @@ -306,7 +316,7 @@ whichaf(struct request_info *req) if (sa == NULL) return AF_UNSPEC; if (sa->sa_family == AF_INET6 && - IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)sa)->sin6_addr)) + IN6_IS_ADDR_V4MAPPED(&satosin6(sa)->sin6_addr)) return AF_INET; return sa->sa_family; } @@ -413,7 +423,7 @@ main(int argc, char **argv) case AF_INET: if (v4bind_ok) continue; - bind_sa4 = (struct sockaddr_in *)res->ai_addr; + bind_sa4 = satosin(res->ai_addr); /* init port num in case servname is dummy */ bind_sa4->sin_port = 0; v4bind_ok = 1; @@ -422,7 +432,7 @@ main(int argc, char **argv) case AF_INET6: if (v6bind_ok) continue; - bind_sa6 = (struct sockaddr_in6 *)res->ai_addr; + bind_sa6 = satosin6(res->ai_addr); /* init port num in case servname is dummy */ bind_sa6->sin6_port = 0; v6bind_ok = 1; @@ -879,7 +889,7 @@ main(int argc, char **argv) * Add a signal flag to the signal flag queue for later handling */ -void +static void flag_signal(int c) { char ch = c; @@ -895,7 +905,7 @@ flag_signal(int c) * limit on children, then stop accepting incoming requests. */ -void +static void addchild(struct servtab *sep, pid_t pid) { if (sep->se_maxchild <= 0) @@ -916,13 +926,13 @@ addchild(struct servtab *sep, pid_t pid) * Some child process has exited. See if it's on somebody's list. */ -void +static void flag_reapchild(int signo __unused) { flag_signal('C'); } -void +static void reapchild(void) { int k, status; @@ -960,13 +970,13 @@ reapchild(void) } } -void +static void flag_config(int signo __unused) { flag_signal('H'); } -void +static void config(void) { struct servtab *sep, *new, **sepp; @@ -1174,7 +1184,7 @@ config(void) (void) sigsetmask(omask); } -void +static void unregisterrpc(struct servtab *sep) { u_int i; @@ -1229,13 +1239,13 @@ unregisterrpc(struct servtab *sep) (void) sigsetmask(omask); } -void +static void flag_retry(int signo __unused) { flag_signal('A'); } -void +static void retry(void) { struct servtab *sep; @@ -1246,7 +1256,7 @@ retry(void) setup(sep); } -void +static void setup(struct servtab *sep) { int on = 1; @@ -1369,7 +1379,7 @@ setsockopt(fd, SOL_SOCKET, opt, (char *) } #ifdef IPSEC -void +static void ipsecsetup(struct servtab *sep) { char *buf; @@ -1443,7 +1453,7 @@ ipsecsetup(struct servtab *sep) /* * Finish with a service and its socket. */ -void +static void close_sep(struct servtab *sep) { if (sep->se_fd >= 0) { @@ -1456,7 +1466,7 @@ close_sep(struct servtab *sep) sep->se_numchild = 0; /* forget about any existing children */ } -int +static int matchservent(const char *name1, const char *name2, const char *proto) { char **alias, *p; @@ -1480,7 +1490,7 @@ matchservent(const char *name1, const ch return(0); } -struct servtab * +static struct servtab * enter(struct servtab *cp) { struct servtab *sep; @@ -1500,7 +1510,7 @@ enter(struct servtab *cp) return (sep); } -void +static void enable(struct servtab *sep) { if (debug) @@ -1529,7 +1539,7 @@ enable(struct servtab *sep) maxsock = sep->se_fd; } -void +static void disable(struct servtab *sep) { if (debug) @@ -1562,11 +1572,11 @@ disable(struct servtab *sep) maxsock--; } -FILE *fconfig = NULL; -struct servtab serv; -char line[LINE_MAX]; +static FILE *fconfig = NULL; +static struct servtab serv; +static char line[LINE_MAX]; -int +static int setconfig(void) { @@ -1578,7 +1588,7 @@ setconfig(void) return (fconfig != NULL); } -void +static void endconfig(void) { if (fconfig) { @@ -1587,7 +1597,7 @@ endconfig(void) } } -struct servtab * +static struct servtab * getconfigent(void) { struct servtab *sep = &serv; @@ -1965,7 +1975,7 @@ more: return (sep); } -void +static void freeconfig(struct servtab *cp) { int i; @@ -2001,7 +2011,7 @@ freeconfig(struct servtab *cp) * Safe skip - if skip returns null, log a syntax error in the * configuration file and exit. */ -char * +static char * sskip(char **cpp) { char *cp; @@ -2014,7 +2024,7 @@ sskip(char **cpp) return (cp); } -char * +static char * skip(char **cpp) { char *cp = *cpp; @@ -2050,7 +2060,7 @@ again: return (start); } -char * +static char * nextline(FILE *fd) { char *cp; @@ -2063,7 +2073,7 @@ nextline(FILE *fd) return (line); } -char * +static char * newstr(const char *cp) { char *cr; @@ -2103,13 +2113,13 @@ check_loop(const struct sockaddr *sa, co switch (se2->se_family) { case AF_INET: - if (((const struct sockaddr_in *)sa)->sin_port == + if (csatosin(sa)->sin_port == se2->se_ctrladdr4.sin_port) goto isloop; continue; #ifdef INET6 case AF_INET6: - if (((const struct sockaddr_in6 *)sa)->sin6_port == + if (csatosin6(sa)->sin6_port == se2->se_ctrladdr6.sin6_port) goto isloop; continue; @@ -2133,7 +2143,7 @@ check_loop(const struct sockaddr *sa, co * print_service: * Dump relevant information to stderr */ -void +static void print_service(const char *action, const struct servtab *sep) { fprintf(stderr, @@ -2181,9 +2191,9 @@ typedef struct CHash { CTime ch_Times[CHTSIZE]; } CHash; -CHash CHashAry[CPMHSIZE]; +static CHash CHashAry[CPMHSIZE]; -int +static int cpmip(const struct servtab *sep, int ctrl) { struct sockaddr_storage rss; Modified: head/usr.sbin/inetd/inetd.h ============================================================================== --- head/usr.sbin/inetd/inetd.h Sat Dec 31 11:02:33 2016 (r310920) +++ head/usr.sbin/inetd/inetd.h Sat Dec 31 11:03:34 2016 (r310921) @@ -123,12 +123,7 @@ struct servtab { #define se_reset se_flags.se_reset int check_loop(const struct sockaddr *, const struct servtab *sep); -int getvalue(const char *, int *, const char *); -char *newstr(const char *); void inetd_setproctitle(const char *, int); -void print_service(const char *, const struct servtab *); -char *sskip(char **); -char *skip(char **); struct servtab *tcpmux(int); extern int debug; @@ -143,3 +138,4 @@ struct biltin { int bi_maxchild; /* max number of children, -1=default */ bi_fn_t *bi_fn; /* function which performs it */ }; +extern struct biltin biltins[]; From owner-svn-src-head@freebsd.org Sat Dec 31 11:07:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98194C97F20; Sat, 31 Dec 2016 11:07:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67A9E1ECA; Sat, 31 Dec 2016 11:07:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVB7XCT041317; Sat, 31 Dec 2016 11:07:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVB7Xl8041316; Sat, 31 Dec 2016 11:07:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612311107.uBVB7Xl8041316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 31 Dec 2016 11:07:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310925 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 11:07:34 -0000 Author: kib Date: Sat Dec 31 11:07:33 2016 New Revision: 310925 URL: https://svnweb.freebsd.org/changeset/base/310925 Log: Remove unused declaration. The setconf() implementation was removed by r52778 Nov 1 1999. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/sys/conf.h Modified: head/sys/sys/conf.h ============================================================================== --- head/sys/sys/conf.h Sat Dec 31 11:06:19 2016 (r310924) +++ head/sys/sys/conf.h Sat Dec 31 11:07:33 2016 (r310925) @@ -285,7 +285,6 @@ int make_dev_physpath_alias(int _flags, const char *_physpath); void dev_lock(void); void dev_unlock(void); -void setconf(void); #ifdef KLD_MODULE #define MAKEDEV_ETERNAL_KLD 0 From owner-svn-src-head@freebsd.org Sat Dec 31 11:13:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8E9AC99494; Sat, 31 Dec 2016 11:13:01 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83DBB1B35; Sat, 31 Dec 2016 11:13:01 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVBD0EH045389; Sat, 31 Dec 2016 11:13:00 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVBD0i9045388; Sat, 31 Dec 2016 11:13:00 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612311113.uBVBD0i9045388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 31 Dec 2016 11:13:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310931 - head/contrib/bsnmp/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 11:13:01 -0000 Author: ngie Date: Sat Dec 31 11:13:00 2016 New Revision: 310931 URL: https://svnweb.freebsd.org/changeset/base/310931 Log: Use strdup in snmp_parse_server(..) when possible instead of malloc+strcpy This simplifies the code and mutes a Coverity warning about sc->cport being improperly allocated Reported by: Coverity CID: 1018247 MFC after: 1 week Modified: head/contrib/bsnmp/lib/snmpclient.c Modified: head/contrib/bsnmp/lib/snmpclient.c ============================================================================== --- head/contrib/bsnmp/lib/snmpclient.c Sat Dec 31 11:12:26 2016 (r310930) +++ head/contrib/bsnmp/lib/snmpclient.c Sat Dec 31 11:13:00 2016 (r310931) @@ -1937,20 +1937,18 @@ snmp_parse_server(struct snmp_client *sc } /* port */ free(sc->cport); - if ((sc->cport = malloc(strlen(p + 1) + 1)) == NULL) { + if ((sc->cport = strdup(p + 1)) == NULL) { seterr(sc, "%s", strerror(errno)); return (-1); } - strcpy(sc->cport, p + 1); } else if (p > s) { /* host */ free(sc->chost); - if ((sc->chost = malloc(strlen(s) + 1)) == NULL) { + if ((sc->chost = strdup(strlen(s))) == NULL) { seterr(sc, "%s", strerror(errno)); return (-1); } - strcpy(sc->chost, s); } return (0); } From owner-svn-src-head@freebsd.org Sat Dec 31 11:24:13 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6511FC99BA3; Sat, 31 Dec 2016 11:24:13 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34C971F4F; Sat, 31 Dec 2016 11:24:13 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVBOCGn050300; Sat, 31 Dec 2016 11:24:12 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVBOCBe050299; Sat, 31 Dec 2016 11:24:12 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612311124.uBVBOCBe050299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 31 Dec 2016 11:24:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310942 - head/contrib/bsnmp/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 11:24:13 -0000 Author: ngie Date: Sat Dec 31 11:24:12 2016 New Revision: 310942 URL: https://svnweb.freebsd.org/changeset/base/310942 Log: Unbreak the build by passing the string to strdup, not its length MFC after: 1 week X-MFC with: r310931 Pointyhat to: ngie Modified: head/contrib/bsnmp/lib/snmpclient.c Modified: head/contrib/bsnmp/lib/snmpclient.c ============================================================================== --- head/contrib/bsnmp/lib/snmpclient.c Sat Dec 31 11:23:43 2016 (r310941) +++ head/contrib/bsnmp/lib/snmpclient.c Sat Dec 31 11:24:12 2016 (r310942) @@ -1945,7 +1945,7 @@ snmp_parse_server(struct snmp_client *sc } else if (p > s) { /* host */ free(sc->chost); - if ((sc->chost = strdup(strlen(s))) == NULL) { + if ((sc->chost = strdup(s)) == NULL) { seterr(sc, "%s", strerror(errno)); return (-1); } From owner-svn-src-head@freebsd.org Sat Dec 31 11:50:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF717C9941A; Sat, 31 Dec 2016 11:50:37 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89C861252; Sat, 31 Dec 2016 11:50:37 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVBoaTx058858; Sat, 31 Dec 2016 11:50:36 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVBoaCj058856; Sat, 31 Dec 2016 11:50:36 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612311150.uBVBoaCj058856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 31 Dec 2016 11:50:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310950 - head/contrib/bsnmp/snmp_mibII X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 11:50:37 -0000 Author: ngie Date: Sat Dec 31 11:50:36 2016 New Revision: 310950 URL: https://svnweb.freebsd.org/changeset/base/310950 Log: MIB-II: use strlcpy when copying interface names to .ifr_name .ifra_name is assumed to be NUL terminated; using strlcpy(3) ensures that it's indeed NUL terminated whereas strncpy does not. Tested and verified as follows with a combination of ifconfig, snmpget, and snmpset: % ifconfig create lo1 127.0.0.2/8 % SNMPARGS="-v 3 -n '' -u bsnmp -A bsnmptest -l authPriv -a sha -x des -X bsnmptest localhost" % snmpget $SNMPARGS IF-MIB::ifAdminStatus.4 IF-MIB::ifAdminStatus.4 = INTEGER: up(1) % snmpset $SNMPARGS IF-MIB::ifAdminStatus.4 i 2 IF-MIB::ifAdminStatus.4 = INTEGER: down(2) % snmpget $SNMPARGS IF-MIB::ifAdminStatus.4 IF-MIB::ifAdminStatus.4 = INTEGER: down(2) % snmpset $SNMPARGS IF-MIB::ifAdminStatus.4 i 1 IF-MIB::ifAdminStatus.4 = INTEGER: up(1) % snmpget $SNMPARGS IF-MIB::ifAdminStatus.4 IF-MIB::ifAdminStatus.4 = INTEGER: up(1) MFC after: 2 weeks Reported by: Coverity CID: 1009652-1009656, 1349850 Modified: head/contrib/bsnmp/snmp_mibII/mibII.c head/contrib/bsnmp/snmp_mibII/mibII_interfaces.c Modified: head/contrib/bsnmp/snmp_mibII/mibII.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII.c Sat Dec 31 11:42:57 2016 (r310949) +++ head/contrib/bsnmp/snmp_mibII/mibII.c Sat Dec 31 11:50:36 2016 (r310950) @@ -265,7 +265,7 @@ mib_if_admin(struct mibif *ifp, int up) { struct ifreq ifr; - strncpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name)); + strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name)); if (ioctl(mib_netsock, SIOCGIFFLAGS, &ifr) == -1) { syslog(LOG_ERR, "SIOCGIFFLAGS(%s): %m", ifp->name); return (-1); @@ -515,7 +515,7 @@ mib_fetch_ifmib(struct mibif *ifp) } out: - strncpy(irr.ifr_name, ifp->name, sizeof(irr.ifr_name)); + strlcpy(irr.ifr_name, ifp->name, sizeof(irr.ifr_name)); irr.ifr_buffer.buffer = MIBIF_PRIV(ifp)->alias; irr.ifr_buffer.length = sizeof(MIBIF_PRIV(ifp)->alias); if (ioctl(mib_netsock, SIOCGIFDESCR, &irr) == -1) { @@ -1384,7 +1384,7 @@ siocaifaddr(char *ifname, struct in_addr struct sockaddr_in *sa; memset(&addreq, 0, sizeof(addreq)); - strncpy(addreq.ifra_name, ifname, sizeof(addreq.ifra_name)); + strlcpy(addreq.ifra_name, ifname, sizeof(addreq.ifra_name)); sa = (struct sockaddr_in *)(void *)&addreq.ifra_addr; sa->sin_family = AF_INET; @@ -1414,7 +1414,7 @@ siocdifaddr(const char *ifname, struct i struct sockaddr_in *sa; memset(&delreq, 0, sizeof(delreq)); - strncpy(delreq.ifr_name, ifname, sizeof(delreq.ifr_name)); + strlcpy(delreq.ifr_name, ifname, sizeof(delreq.ifr_name)); sa = (struct sockaddr_in *)(void *)&delreq.ifr_addr; sa->sin_family = AF_INET; sa->sin_len = sizeof(*sa); @@ -1433,7 +1433,7 @@ verify_ifa(const char *name, struct mibi struct sockaddr_in *sa; memset(&req, 0, sizeof(req)); - strncpy(req.ifr_name, name, sizeof(req.ifr_name)); + strlcpy(req.ifr_name, name, sizeof(req.ifr_name)); sa = (struct sockaddr_in *)(void *)&req.ifr_addr; sa->sin_family = AF_INET; sa->sin_len = sizeof(*sa); Modified: head/contrib/bsnmp/snmp_mibII/mibII_interfaces.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII_interfaces.c Sat Dec 31 11:42:57 2016 (r310949) +++ head/contrib/bsnmp/snmp_mibII/mibII_interfaces.c Sat Dec 31 11:50:36 2016 (r310950) @@ -77,7 +77,7 @@ ifchange_func(struct snmp_context *ctx _ switch (op) { case SNMP_DEPOP_COMMIT: - strncpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name)); + strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name)); if (ioctl(mib_netsock, SIOCGIFFLAGS, &ifr) == -1) { syslog(LOG_ERR, "GIFFLAGS(%s): %m", ifp->name); return (SNMP_ERR_GENERR); @@ -95,7 +95,7 @@ ifchange_func(struct snmp_context *ctx _ ifc->rb |= IFRB_FLAGS; } if (ifc->rb & IFRB_FLAGS) { - strncpy(ifr1.ifr_name, ifp->name, sizeof(ifr1.ifr_name)); + strlcpy(ifr1.ifr_name, ifp->name, sizeof(ifr1.ifr_name)); if (ioctl(mib_netsock, SIOCGIFFLAGS, &ifr1) == -1) { syslog(LOG_ERR, "GIFFLAGS(%s): %m", ifp->name); return (SNMP_ERR_GENERR); @@ -116,7 +116,7 @@ ifchange_func(struct snmp_context *ctx _ case SNMP_DEPOP_ROLLBACK: if (ifc->rb & IFRB_FLAGS) { - strncpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name)); + strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name)); ifr.ifr_flags = ifc->rb_flags; if (ioctl(mib_netsock, SIOCSIFFLAGS, &ifr) == -1) { syslog(LOG_ERR, "SIFFLAGS(%s): %m", ifp->name); From owner-svn-src-head@freebsd.org Sat Dec 31 12:03:27 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23B3AC99D91; Sat, 31 Dec 2016 12:03:27 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E76FC13AB; Sat, 31 Dec 2016 12:03:26 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVC3Qv5067500; Sat, 31 Dec 2016 12:03:26 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVC3Q8M067499; Sat, 31 Dec 2016 12:03:26 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612311203.uBVC3Q8M067499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 31 Dec 2016 12:03:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310952 - head/contrib/bsnmp/snmp_mibII X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 12:03:27 -0000 Author: ngie Date: Sat Dec 31 12:03:25 2016 New Revision: 310952 URL: https://svnweb.freebsd.org/changeset/base/310952 Log: MIB-II: use strlcpy instead of strcpy when copying {descr,name} This is of course to avoid buffer overruns The remaining strcpy instance in the module needs to be audited for correctness MFC after: 1 week Reported by: Coverity CID: 1006827, 1006828 Modified: head/contrib/bsnmp/snmp_mibII/mibII.c Modified: head/contrib/bsnmp/snmp_mibII/mibII.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII.c Sat Dec 31 11:57:37 2016 (r310951) +++ head/contrib/bsnmp/snmp_mibII/mibII.c Sat Dec 31 12:03:25 2016 (r310952) @@ -204,7 +204,7 @@ mib_if_set_dyn(const char *name) return; if ((d = malloc(sizeof(*d))) == NULL) err(1, NULL); - strcpy(d->name, name); + strlcpy(d->name, name, sizeof(d->name)); SLIST_INSERT_HEAD(&mibdynif_list, d, link); } @@ -774,8 +774,8 @@ mibif_create(u_int sysindex, const char memset(ifp->private, 0, sizeof(struct mibif_private)); ifp->sysindex = sysindex; - strcpy(ifp->name, name); - strcpy(ifp->descr, name); + strlcpy(ifp->name, name, sizeof(ifp->name)); + strlcpy(ifp->descr, name, sizeof(ifp->descr)); ifp->spec_oid = oid_zeroDotZero; map = NULL; From owner-svn-src-head@freebsd.org Sat Dec 31 12:14:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9466DC983EE; Sat, 31 Dec 2016 12:14:26 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63E981C6D; Sat, 31 Dec 2016 12:14:26 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVCEPsb071710; Sat, 31 Dec 2016 12:14:25 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVCEPIY071709; Sat, 31 Dec 2016 12:14:25 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612311214.uBVCEPIY071709@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 31 Dec 2016 12:14:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310954 - head/usr.sbin/bsnmpd/tools/libbsnmptools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 12:14:26 -0000 Author: ngie Date: Sat Dec 31 12:14:25 2016 New Revision: 310954 URL: https://svnweb.freebsd.org/changeset/base/310954 Log: Set value->v.octetstring.len to a correct value on malloc success/failure The previous code always set value->v.octetstring.len to len, regardless of the result from the malloc call. This misleads the caller on malloc failure. Set .len to len on success and 0 on failure. MFC after: 1 week Reported by: Coverity CID: 1007590 Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c ============================================================================== --- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Sat Dec 31 12:06:27 2016 (r310953) +++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Sat Dec 31 12:14:25 2016 (r310954) @@ -266,13 +266,13 @@ parse_octetstring(struct snmp_value *val return (-1); } - value->v.octetstring.len = len; - - if((value->v.octetstring.octets = malloc(len)) == NULL) { + if ((value->v.octetstring.octets = malloc(len)) == NULL) { + value->v.octetstring.len = 0; syslog(LOG_ERR, "malloc failed: %s", strerror(errno)); return (-1); } + value->v.octetstring.len = len; memcpy(value->v.octetstring.octets, val, len); value->syntax = SNMP_SYNTAX_OCTETSTRING; From owner-svn-src-head@freebsd.org Sat Dec 31 12:18:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C438EC985BC; Sat, 31 Dec 2016 12:18:18 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 93F1E1037; Sat, 31 Dec 2016 12:18:18 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVCIHwf072043; Sat, 31 Dec 2016 12:18:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVCIHlm072042; Sat, 31 Dec 2016 12:18:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612311218.uBVCIHlm072042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 31 Dec 2016 12:18:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310957 - head/contrib/bsnmp/snmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 12:18:18 -0000 Author: ngie Date: Sat Dec 31 12:18:17 2016 New Revision: 310957 URL: https://svnweb.freebsd.org/changeset/base/310957 Log: Use strlcpy when copying `com` to pdu->community to avoid potential buffer overruns MFC after: 1 week Reported by: Coverity CID: 1006823, 1006824 Modified: head/contrib/bsnmp/snmpd/trap.c Modified: head/contrib/bsnmp/snmpd/trap.c ============================================================================== --- head/contrib/bsnmp/snmpd/trap.c Sat Dec 31 12:16:21 2016 (r310956) +++ head/contrib/bsnmp/snmpd/trap.c Sat Dec 31 12:18:17 2016 (r310957) @@ -422,7 +422,7 @@ snmp_create_v1_trap(struct snmp_pdu *pdu const struct asn_oid *trap_oid) { memset(pdu, 0, sizeof(*pdu)); - strcpy(pdu->community, com); + strlcpy(pdu->community, com, sizeof(pdu->community)); pdu->version = SNMP_V1; pdu->type = SNMP_PDU_TRAP; @@ -439,7 +439,7 @@ snmp_create_v2_trap(struct snmp_pdu *pdu const struct asn_oid *trap_oid) { memset(pdu, 0, sizeof(*pdu)); - strcpy(pdu->community, com); + strlcpy(pdu->community, com, sizeof(pdu->community)); pdu->version = SNMP_V2c; pdu->type = SNMP_PDU_TRAP2; From owner-svn-src-head@freebsd.org Sat Dec 31 12:30:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1D73C98DF8; Sat, 31 Dec 2016 12:30:15 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0F071A70; Sat, 31 Dec 2016 12:30:15 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVCUE2Q076017; Sat, 31 Dec 2016 12:30:14 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVCUE3g076016; Sat, 31 Dec 2016 12:30:14 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612311230.uBVCUE3g076016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 31 Dec 2016 12:30:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310958 - head/contrib/bsnmp/snmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 12:30:16 -0000 Author: ngie Date: Sat Dec 31 12:30:14 2016 New Revision: 310958 URL: https://svnweb.freebsd.org/changeset/base/310958 Log: Initialize ret to SNMPD_INPUT_OK at the top of snmp_input_start(..) to avoid returning an uninitialized value There are some really complicated, snakey if-statements combined with switch statements that could result in an invalid value being returned as `ret` MFC after: 1 week Reported by: Coverity CID: 1006551 Modified: head/contrib/bsnmp/snmpd/main.c Modified: head/contrib/bsnmp/snmpd/main.c ============================================================================== --- head/contrib/bsnmp/snmpd/main.c Sat Dec 31 12:18:17 2016 (r310957) +++ head/contrib/bsnmp/snmpd/main.c Sat Dec 31 12:30:14 2016 (r310958) @@ -492,6 +492,8 @@ snmp_input_start(const u_char *buf, size b.asn_cptr = buf; b.asn_len = len; + ret = SNMPD_INPUT_OK; + /* look whether we have enough bytes for the entire PDU. */ switch (sret = snmp_pdu_snoop(&b)) { @@ -520,8 +522,6 @@ snmp_input_start(const u_char *buf, size } code = snmp_pdu_decode_scoped(&b, pdu, ip); - ret = SNMPD_INPUT_OK; - decoded: snmpd_stats.inPkts++; From owner-svn-src-head@freebsd.org Sat Dec 31 12:37:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1AE4C9802B; Sat, 31 Dec 2016 12:37:54 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B13FE1FED; Sat, 31 Dec 2016 12:37:54 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVCbrH5080042; Sat, 31 Dec 2016 12:37:53 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVCbrd6080041; Sat, 31 Dec 2016 12:37:53 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612311237.uBVCbrd6080041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 31 Dec 2016 12:37:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310960 - head/contrib/bsnmp/snmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 12:37:55 -0000 Author: ngie Date: Sat Dec 31 12:37:53 2016 New Revision: 310960 URL: https://svnweb.freebsd.org/changeset/base/310960 Log: Similar to r310954, set .len to 0 on malloc failure and to `len` only on success MFC after: 1 week Modified: head/contrib/bsnmp/snmpd/export.c Modified: head/contrib/bsnmp/snmpd/export.c ============================================================================== --- head/contrib/bsnmp/snmpd/export.c Sat Dec 31 12:32:50 2016 (r310959) +++ head/contrib/bsnmp/snmpd/export.c Sat Dec 31 12:37:53 2016 (r310960) @@ -114,9 +114,11 @@ string_get(struct snmp_value *value, con } if (len == -1) len = strlen(ptr); - value->v.octetstring.len = (u_long)len; - if ((value->v.octetstring.octets = malloc((size_t)len)) == NULL) + if ((value->v.octetstring.octets = malloc((size_t)len)) == NULL) { + value->v.octetstring.len = 0; return (SNMP_ERR_RES_UNAVAIL); + } + value->v.octetstring.len = (u_long)len; memcpy(value->v.octetstring.octets, ptr, (size_t)len); return (SNMP_ERR_NOERROR); } @@ -138,9 +140,11 @@ string_get_max(struct snmp_value *value, len = strlen(ptr); if ((size_t)len > maxlen) len = maxlen; - value->v.octetstring.len = (u_long)len; - if ((value->v.octetstring.octets = malloc((size_t)len)) == NULL) + if ((value->v.octetstring.octets = malloc((size_t)len)) == NULL) { + value->v.octetstring.len = 0; return (SNMP_ERR_RES_UNAVAIL); + } + value->v.octetstring.len = (u_long)len; memcpy(value->v.octetstring.octets, ptr, (size_t)len); return (SNMP_ERR_NOERROR); } From owner-svn-src-head@freebsd.org Sat Dec 31 12:39:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 356F4C98108; Sat, 31 Dec 2016 12:39:17 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05131116F; Sat, 31 Dec 2016 12:39:16 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVCdGej080150; Sat, 31 Dec 2016 12:39:16 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVCdG1V080149; Sat, 31 Dec 2016 12:39:16 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201612311239.uBVCdG1V080149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sat, 31 Dec 2016 12:39:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310961 - head/sbin/sysctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 12:39:17 -0000 Author: avos Date: Sat Dec 31 12:39:15 2016 New Revision: 310961 URL: https://svnweb.freebsd.org/changeset/base/310961 Log: sysctl(8): fix typename for uint32_t. MFC after: 5 days. Modified: head/sbin/sysctl/sysctl.c Modified: head/sbin/sysctl/sysctl.c ============================================================================== --- head/sbin/sysctl/sysctl.c Sat Dec 31 12:37:53 2016 (r310960) +++ head/sbin/sysctl/sysctl.c Sat Dec 31 12:39:15 2016 (r310961) @@ -114,7 +114,7 @@ static const char *ctl_typename[CTLTYPE+ [CTLTYPE_ULONG] = "unsigned long", [CTLTYPE_U8] = "uint8_t", [CTLTYPE_U16] = "uint16_t", - [CTLTYPE_U32] = "uint16_t", + [CTLTYPE_U32] = "uint32_t", [CTLTYPE_U64] = "uint64_t", [CTLTYPE_S8] = "int8_t", [CTLTYPE_S16] = "int16_t", From owner-svn-src-head@freebsd.org Sat Dec 31 12:41:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B400C98318; Sat, 31 Dec 2016 12:41:44 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0AF4216F9; Sat, 31 Dec 2016 12:41:43 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVCfhI5083258; Sat, 31 Dec 2016 12:41:43 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVCfhCT083256; Sat, 31 Dec 2016 12:41:43 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201612311241.uBVCfhCT083256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 31 Dec 2016 12:41:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310963 - in head: . sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 12:41:44 -0000 Author: bapt Date: Sat Dec 31 12:41:42 2016 New Revision: 310963 URL: https://svnweb.freebsd.org/changeset/base/310963 Log: Bump copyright year. Happy New Year 2017! Modified: head/COPYRIGHT head/sys/sys/copyright.h Modified: head/COPYRIGHT ============================================================================== --- head/COPYRIGHT Sat Dec 31 12:39:34 2016 (r310962) +++ head/COPYRIGHT Sat Dec 31 12:41:42 2016 (r310963) @@ -4,7 +4,7 @@ The compilation of software known as FreeBSD is distributed under the following terms: -Copyright (c) 1992-2016 The FreeBSD Project. All rights reserved. +Copyright (c) 1992-2017 The FreeBSD Project. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: head/sys/sys/copyright.h ============================================================================== --- head/sys/sys/copyright.h Sat Dec 31 12:39:34 2016 (r310962) +++ head/sys/sys/copyright.h Sat Dec 31 12:41:42 2016 (r310963) @@ -34,7 +34,7 @@ /* FreeBSD */ #define COPYRIGHT_FreeBSD \ - "Copyright (c) 1992-2016 The FreeBSD Project.\n" + "Copyright (c) 1992-2017 The FreeBSD Project.\n" /* Foundation */ #define TRADEMARK_Foundation \ From owner-svn-src-head@freebsd.org Sat Dec 31 13:10:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C00FC98F75; Sat, 31 Dec 2016 13:10:08 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3DA51CB1; Sat, 31 Dec 2016 13:10:07 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVDA71a092781; Sat, 31 Dec 2016 13:10:07 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVDA7Ah092780; Sat, 31 Dec 2016 13:10:07 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201612311310.uBVDA7Ah092780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sat, 31 Dec 2016 13:10:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310972 - head/sys/boot/fdt/dts/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 13:10:08 -0000 Author: jmcneill Date: Sat Dec 31 13:10:06 2016 New Revision: 310972 URL: https://svnweb.freebsd.org/changeset/base/310972 Log: Fix a typo in the third address of the reg property for the usbphy node. MFC after: 1 week Modified: head/sys/boot/fdt/dts/arm/a83t.dtsi Modified: head/sys/boot/fdt/dts/arm/a83t.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/a83t.dtsi Sat Dec 31 13:07:09 2016 (r310971) +++ head/sys/boot/fdt/dts/arm/a83t.dtsi Sat Dec 31 13:10:06 2016 (r310972) @@ -178,7 +178,7 @@ compatible = "allwinner,sun8i-a83t-usb-phy"; reg = <0x01c19400 0x2c>, <0x01c1a800 0x4>, - <0x01c1a800 0x4>; + <0x01c1b800 0x4>; clocks = <&usb_clk 8>, <&usb_clk 9>, <&usb_clk 10>, From owner-svn-src-head@freebsd.org Sat Dec 31 13:15:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48859C99228; Sat, 31 Dec 2016 13:15:53 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09405134D; Sat, 31 Dec 2016 13:15:52 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVDFqIi096849; Sat, 31 Dec 2016 13:15:52 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVDFqYl096848; Sat, 31 Dec 2016 13:15:52 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612311315.uBVDFqYl096848@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 31 Dec 2016 13:15:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310974 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 13:15:53 -0000 Author: hrs Date: Sat Dec 31 13:15:52 2016 New Revision: 310974 URL: https://svnweb.freebsd.org/changeset/base/310974 Log: - Use more descriptive names for variables. - Set O_CLOEXEC to the signal pipe and /dev/klog. - Use a single signal handler to catch both SIGHUP and SIGCHLD. - Fix a bug which did FD_SET() the writer-end of the pipe. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Sat Dec 31 13:10:08 2016 (r310973) +++ head/usr.sbin/syslogd/syslogd.c Sat Dec 31 13:15:52 2016 (r310974) @@ -321,7 +321,7 @@ static int LogFacPri; /* Put facility an static int KeepKernFac; /* Keep remotely logged kernel facility */ static int needdofsync = 0; /* Are any file(s) waiting to be fsynced? */ static struct pidfh *pfh; -static int sigp[2]; /* Pipe to catch a signal during select(). */ +static int sigpipe[2]; /* Pipe to catch a signal during select(). */ static volatile sig_atomic_t MarkSet, WantDie, WantInitialize, WantReapchild; @@ -341,7 +341,6 @@ static void dofsync(void); static void domark(int); static void fprintlog(struct filed *, int, const char *); static void init(int); -static void init_sh(int); static void logerror(const char *); static void logmsg(int, const char *, const char *, int); static void log_deadchild(pid_t, int, const char *); @@ -350,12 +349,12 @@ static int socksetup(struct peer *); static int socklist_recv_file(struct socklist *); static int socklist_recv_sock(struct socklist *); static int socklist_recv_signal(struct socklist *); +static void sighandler(int); static int skip_message(const char *, const char *, int); static void printline(const char *, char *, int); static void printsys(char *); static int p_open(const char *, pid_t *); static void reapchild(int); -static void reapchild_sh(int); static const char *ttymsg_check(struct iovec *, int, char *, int); static void usage(void); static int validate(struct sockaddr *, const char *); @@ -582,18 +581,18 @@ main(int argc, char *argv[]) usage(); /* Pipe to catch a signal during select(). */ - s = pipe2(sigp, O_NONBLOCK); + s = pipe2(sigpipe, O_CLOEXEC); if (s < 0) { err(1, "cannot open a pipe for signals"); } else { addsock(NULL, 0, &(struct socklist){ - .sl_socket = sigp[1], + .sl_socket = sigpipe[0], .sl_recv = socklist_recv_signal }); } /* Listen by default: /dev/klog. */ - s = open(_PATH_KLOG, O_RDONLY|O_NONBLOCK, 0); + s = open(_PATH_KLOG, O_RDONLY | O_NONBLOCK | O_CLOEXEC, 0); if (s < 0) { dprintf("can't open %s (%d)\n", _PATH_KLOG, errno); } else { @@ -646,8 +645,8 @@ main(int argc, char *argv[]) (void)signal(SIGTERM, dodie); (void)signal(SIGINT, Debug ? dodie : SIG_IGN); (void)signal(SIGQUIT, Debug ? dodie : SIG_IGN); - (void)signal(SIGHUP, init_sh); - (void)signal(SIGCHLD, reapchild_sh); + (void)signal(SIGHUP, sighandler); + (void)signal(SIGCHLD, sighandler); (void)signal(SIGALRM, domark); (void)signal(SIGPIPE, SIG_IGN); /* We'll catch EPIPE instead. */ (void)alarm(TIMERINTVL); @@ -717,12 +716,31 @@ static int socklist_recv_signal(struct socklist *sl __unused) { ssize_t len; - static char buf[BUFSIZ]; - - /* Clear an wake-up signal by reading dummy data. */ - while ((len = read(sigp[0], buf, sizeof(buf))) > 0) - ; + int i, nsig, signo; + if (ioctl(sigpipe[0], FIONREAD, &i) != 0) { + logerror("ioctl(FIONREAD)"); + err(1, "signal pipe read failed"); + } + nsig = i / sizeof(signo); + dprintf("# of received signals = %d\n", nsig); + for (i = 0; i < nsig; i++) { + len = read(sigpipe[0], &signo, sizeof(signo)); + if (len != sizeof(signo)) { + logerror("signal pipe read failed"); + err(1, "signal pipe read failed"); + } + dprintf("Received signal: %d from fd=%d\n", signo, + sigpipe[0]); + switch (signo) { + case SIGHUP: + WantInitialize = 1; + break; + case SIGCHLD: + WantReapchild = 1; + break; + } + } return (0); } @@ -1512,17 +1530,6 @@ ttymsg_check(struct iovec *iov, int iovc } static void -reapchild_sh(int signo) -{ - static char buf[BUFSIZ]; - - WantReapchild = signo; - /* Send an wake-up signal to the select() loop. */ - read(sigp[0], buf, sizeof(buf)); - write(sigp[1], &signo, sizeof(signo)); -} - -static void reapchild(int signo __unused) { int status; @@ -1793,20 +1800,17 @@ readconfigfile(FILE *cf, int allow_inclu } } -/* - * INIT -- Initialize syslogd from configuration table - */ static void -init_sh(int signo) +sighandler(int signo) { - static char buf[BUFSIZ]; - WantInitialize = signo; /* Send an wake-up signal to the select() loop. */ - read(sigp[0], buf, sizeof(buf)); - write(sigp[1], &signo, sizeof(signo)); + write(sigpipe[1], &signo, sizeof(signo)); } +/* + * INIT -- Initialize syslogd from configuration table + */ static void init(int signo) { From owner-svn-src-head@freebsd.org Sat Dec 31 15:30:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42B7EC98727; Sat, 31 Dec 2016 15:30:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E4B321D96; Sat, 31 Dec 2016 15:30:01 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVFU1xA052270; Sat, 31 Dec 2016 15:30:01 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVFU1ST052269; Sat, 31 Dec 2016 15:30:01 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201612311530.uBVFU1ST052269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 31 Dec 2016 15:30:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310976 - head/lib/libc/locale X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 15:30:02 -0000 Author: pfg Date: Sat Dec 31 15:30:00 2016 New Revision: 310976 URL: https://svnweb.freebsd.org/changeset/base/310976 Log: Move __hidden attribute towards the end of the declaration. Apple had them at the start but moving them to the end is better for faster reading and fits better what is done in other FreeBSD headers. MFC after: 5 days Modified: head/lib/libc/locale/mblocal.h Modified: head/lib/libc/locale/mblocal.h ============================================================================== --- head/lib/libc/locale/mblocal.h Sat Dec 31 13:23:28 2016 (r310975) +++ head/lib/libc/locale/mblocal.h Sat Dec 31 15:30:00 2016 (r310976) @@ -65,18 +65,18 @@ extern struct xlocale_ctype __xlocale_gl /* * Rune initialization function prototypes. */ -__hidden int _none_init(struct xlocale_ctype *, _RuneLocale *); -__hidden int _ascii_init(struct xlocale_ctype *, _RuneLocale *); -__hidden int _UTF8_init(struct xlocale_ctype *, _RuneLocale *); -__hidden int _EUC_CN_init(struct xlocale_ctype *, _RuneLocale *); -__hidden int _EUC_JP_init(struct xlocale_ctype *, _RuneLocale *); -__hidden int _EUC_KR_init(struct xlocale_ctype *, _RuneLocale *); -__hidden int _EUC_TW_init(struct xlocale_ctype *, _RuneLocale *); -__hidden int _GB18030_init(struct xlocale_ctype *, _RuneLocale *); -__hidden int _GB2312_init(struct xlocale_ctype *, _RuneLocale *); -__hidden int _GBK_init(struct xlocale_ctype *, _RuneLocale *); -__hidden int _BIG5_init(struct xlocale_ctype *, _RuneLocale *); -__hidden int _MSKanji_init(struct xlocale_ctype *, _RuneLocale *); +int _none_init(struct xlocale_ctype *, _RuneLocale *) __hidden; +int _UTF8_init(struct xlocale_ctype *, _RuneLocale *) __hidden; +int _EUC_CN_init(struct xlocale_ctype *, _RuneLocale *) __hidden; +int _EUC_JP_init(struct xlocale_ctype *, _RuneLocale *) __hidden; +int _EUC_KR_init(struct xlocale_ctype *, _RuneLocale *) __hidden; +int _EUC_TW_init(struct xlocale_ctype *, _RuneLocale *) __hidden; +int _GB18030_init(struct xlocale_ctype *, _RuneLocale *) __hidden; +int _GB2312_init(struct xlocale_ctype *, _RuneLocale *) __hidden; +int _GBK_init(struct xlocale_ctype *, _RuneLocale *) __hidden; +int _BIG5_init(struct xlocale_ctype *, _RuneLocale *) __hidden; +int _MSKanji_init(struct xlocale_ctype *, _RuneLocale *) __hidden; +int _ascii_init(struct xlocale_ctype *, _RuneLocale *) __hidden; typedef size_t (*mbrtowc_pfn_t)(wchar_t * __restrict, const char * __restrict, size_t, mbstate_t * __restrict); From owner-svn-src-head@freebsd.org Sat Dec 31 15:58:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0DD2C99147; Sat, 31 Dec 2016 15:58:16 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7FB211BC6; Sat, 31 Dec 2016 15:58:16 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVFwF4T064429; Sat, 31 Dec 2016 15:58:15 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVFwFN2064428; Sat, 31 Dec 2016 15:58:15 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201612311558.uBVFwFN2064428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 31 Dec 2016 15:58:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310977 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 15:58:16 -0000 Author: pfg Date: Sat Dec 31 15:58:15 2016 New Revision: 310977 URL: https://svnweb.freebsd.org/changeset/base/310977 Log: Addition of clang nullability qualifiers. Add two new qualifiers for use by the static checkers: _Nonnull The _Nonnull nullability qualifier indicates that null is not a meaningful value for a value of the _Nonnull pointer type. _Nullable The _Nullable nullability qualifier indicates that a value of the _Nullable pointer type can be null. These were introduced in Clang 3.7. For more information, see: http://clang.llvm.org/docs/AttributeReference.html#nonnull We add these now without using them so that the GCC ports have time to pick up the header change. Hinted by: Android Bionic libc [1] Also seen in: Apple's Libc-1158.20.4 [1] https://github.com/android/platform_bionic/commit/baa2a973bd776a51bb05a8590ab05d86eea7b321 Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Sat Dec 31 15:30:00 2016 (r310976) +++ head/sys/sys/cdefs.h Sat Dec 31 15:58:15 2016 (r310977) @@ -804,6 +804,14 @@ #endif /* + * Nullability qualifiers: currently only supported by Clang. + */ +#if !(defined(__clang__) && __has_feature(nullability)) +#define _Nonnull +#define _Nullable +#endif + +/* * Type Safety Checking * * Clang provides additional attributes to enable checking type safety From owner-svn-src-head@freebsd.org Sat Dec 31 19:30:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8EA5DC990CC; Sat, 31 Dec 2016 19:30:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5727E17B3; Sat, 31 Dec 2016 19:30:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVJUMml053330; Sat, 31 Dec 2016 19:30:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVJUM9g053329; Sat, 31 Dec 2016 19:30:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612311930.uBVJUM9g053329@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 31 Dec 2016 19:30:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310982 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 19:30:23 -0000 Author: kib Date: Sat Dec 31 19:30:22 2016 New Revision: 310982 URL: https://svnweb.freebsd.org/changeset/base/310982 Log: Ansify vm/vm_pager.c. Style. Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/vm_pager.c Modified: head/sys/vm/vm_pager.c ============================================================================== --- head/sys/vm/vm_pager.c Sat Dec 31 17:05:09 2016 (r310981) +++ head/sys/vm/vm_pager.c Sat Dec 31 19:30:22 2016 (r310982) @@ -109,43 +109,35 @@ static vm_object_t dead_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t off, struct ucred *cred) { - return NULL; + + return (NULL); } static void -dead_pager_putpages(object, m, count, flags, rtvals) - vm_object_t object; - vm_page_t *m; - int count; - int flags; - int *rtvals; +dead_pager_putpages(vm_object_t object, vm_page_t *m, int count, + int flags, int *rtvals) { int i; - for (i = 0; i < count; i++) { + for (i = 0; i < count; i++) rtvals[i] = VM_PAGER_AGAIN; - } } static int -dead_pager_haspage(object, pindex, prev, next) - vm_object_t object; - vm_pindex_t pindex; - int *prev; - int *next; +dead_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *prev, int *next) { - if (prev) + + if (prev != NULL) *prev = 0; - if (next) + if (next != NULL) *next = 0; - return FALSE; + return (FALSE); } static void -dead_pager_dealloc(object) - vm_object_t object; +dead_pager_dealloc(vm_object_t object) { - return; + } static struct pagerops deadpagerops = { @@ -181,7 +173,7 @@ static int bswneeded; vm_offset_t swapbkva; /* swap buffers kva */ void -vm_pager_init() +vm_pager_init(void) { struct pagerops **pgops; @@ -191,11 +183,11 @@ vm_pager_init() */ for (pgops = pagertab; pgops < &pagertab[nitems(pagertab)]; pgops++) if ((*pgops)->pgo_init != NULL) - (*(*pgops)->pgo_init) (); + (*(*pgops)->pgo_init)(); } void -vm_pager_bufferinit() +vm_pager_bufferinit(void) { struct buf *bp; int i; @@ -232,7 +224,7 @@ vm_pager_allocate(objtype_t type, void * ops = pagertab[type]; if (ops) - ret = (*ops->pgo_alloc) (handle, size, prot, off, cred); + ret = (*ops->pgo_alloc)(handle, size, prot, off, cred); else ret = NULL; return (ret); @@ -242,8 +234,7 @@ vm_pager_allocate(objtype_t type, void * * The object must be locked. */ void -vm_pager_deallocate(object) - vm_object_t object; +vm_pager_deallocate(vm_object_t object) { VM_OBJECT_ASSERT_WLOCKED(object); @@ -366,12 +357,13 @@ vm_pager_object_lookup(struct pagerlst * static void initpbuf(struct buf *bp) { + KASSERT(bp->b_bufobj == NULL, ("initpbuf with bufobj")); KASSERT(bp->b_vp == NULL, ("initpbuf with vp")); bp->b_rcred = NOCRED; bp->b_wcred = NOCRED; bp->b_qindex = 0; /* On no queue (QUEUE_NONE) */ - bp->b_kvabase = (caddr_t) (MAXPHYS * (bp - swbuf)) + swapbkva; + bp->b_kvabase = (caddr_t)(MAXPHYS * (bp - swbuf)) + swapbkva; bp->b_data = bp->b_kvabase; bp->b_kvasize = MAXPHYS; bp->b_flags = 0; @@ -404,9 +396,8 @@ getpbuf(int *pfreecnt) struct buf *bp; mtx_lock(&pbuf_mtx); - for (;;) { - if (pfreecnt) { + if (pfreecnt != NULL) { while (*pfreecnt == 0) { msleep(pfreecnt, &pbuf_mtx, PVM, "wswbuf0", 0); } @@ -424,9 +415,8 @@ getpbuf(int *pfreecnt) if (pfreecnt) --*pfreecnt; mtx_unlock(&pbuf_mtx); - initpbuf(bp); - return bp; + return (bp); } /* @@ -446,14 +436,10 @@ trypbuf(int *pfreecnt) return NULL; } TAILQ_REMOVE(&bswlist, bp, b_freelist); - --*pfreecnt; - mtx_unlock(&pbuf_mtx); - initpbuf(bp); - - return bp; + return (bp); } /* From owner-svn-src-head@freebsd.org Sat Dec 31 19:59:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1176BC99819; Sat, 31 Dec 2016 19:59:33 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E049F1757; Sat, 31 Dec 2016 19:59:32 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVJxW6e066431; Sat, 31 Dec 2016 19:59:32 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVJxW5Z066430; Sat, 31 Dec 2016 19:59:32 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201612311959.uBVJxW5Z066430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 31 Dec 2016 19:59:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310983 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 19:59:33 -0000 Author: mjg Date: Sat Dec 31 19:59:31 2016 New Revision: 310983 URL: https://svnweb.freebsd.org/changeset/base/310983 Log: vfs: switch nodes_created, recycles_count and free_owe_inact to counter(9) Reviewed by: kib Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sat Dec 31 19:30:22 2016 (r310982) +++ head/sys/kern/vfs_subr.c Sat Dec 31 19:59:31 2016 (r310983) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -124,9 +125,9 @@ static unsigned long numvnodes; SYSCTL_ULONG(_vfs, OID_AUTO, numvnodes, CTLFLAG_RD, &numvnodes, 0, "Number of vnodes in existence"); -static u_long vnodes_created; -SYSCTL_ULONG(_vfs, OID_AUTO, vnodes_created, CTLFLAG_RD, &vnodes_created, - 0, "Number of vnodes created by getnewvnode"); +static counter_u64_t vnodes_created; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, vnodes_created, CTLFLAG_RD, &vnodes_created, + "Number of vnodes created by getnewvnode"); static u_long mnt_free_list_batch = 128; SYSCTL_ULONG(_vfs, OID_AUTO, mnt_free_list_batch, CTLFLAG_RW, @@ -180,8 +181,8 @@ static u_long freevnodes; SYSCTL_ULONG(_vfs, OID_AUTO, freevnodes, CTLFLAG_RD, &freevnodes, 0, "Number of \"free\" vnodes"); -static u_long recycles_count; -SYSCTL_ULONG(_vfs, OID_AUTO, recycles, CTLFLAG_RD, &recycles_count, 0, +static counter_u64_t recycles_count; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, recycles, CTLFLAG_RD, &recycles_count, "Number of vnodes recycled to meet vnode cache targets"); /* @@ -193,8 +194,8 @@ static int reassignbufcalls; SYSCTL_INT(_vfs, OID_AUTO, reassignbufcalls, CTLFLAG_RW, &reassignbufcalls, 0, "Number of calls to reassignbuf"); -static u_long free_owe_inact; -SYSCTL_ULONG(_vfs, OID_AUTO, free_owe_inact, CTLFLAG_RD, &free_owe_inact, 0, +static counter_u64_t free_owe_inact; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, free_owe_inact, CTLFLAG_RD, &free_owe_inact, "Number of times free vnodes kept on active list due to VFS " "owing inactivation"); @@ -476,6 +477,11 @@ vntblinit(void *dummy __unused) NULL, NULL, pctrie_zone_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE | UMA_ZONE_VM); uma_prealloc(buf_trie_zone, nbuf); + + vnodes_created = counter_u64_alloc(M_WAITOK); + recycles_count = counter_u64_alloc(M_WAITOK); + free_owe_inact = counter_u64_alloc(M_WAITOK); + /* * Initialize the filesystem syncer. */ @@ -922,7 +928,7 @@ vlrureclaim(struct mount *mp, int reclai } KASSERT((vp->v_iflag & VI_DOOMED) == 0, ("VI_DOOMED unexpectedly detected in vlrureclaim()")); - atomic_add_long(&recycles_count, 1); + counter_u64_add(recycles_count, 1); vgonel(vp); VOP_UNLOCK(vp, 0); vdropl(vp); @@ -1287,7 +1293,7 @@ vtryrecycle(struct vnode *vp) return (EBUSY); } if ((vp->v_iflag & VI_DOOMED) == 0) { - atomic_add_long(&recycles_count, 1); + counter_u64_add(recycles_count, 1); vgonel(vp); } VOP_UNLOCK(vp, LK_INTERLOCK); @@ -1446,7 +1452,7 @@ getnewvnode(const char *tag, struct moun atomic_add_long(&numvnodes, 1); mtx_unlock(&vnode_free_list_mtx); alloc: - atomic_add_long(&vnodes_created, 1); + counter_u64_add(vnodes_created, 1); vp = (struct vnode *) uma_zalloc(vnode_zone, M_WAITOK); /* * Locks are given the generic name "vnode" when created. @@ -2938,7 +2944,7 @@ _vdrop(struct vnode *vp, bool locked) mtx_unlock(&mp->mnt_listmtx); } else { VI_UNLOCK(vp); - atomic_add_long(&free_owe_inact, 1); + counter_u64_add(free_owe_inact, 1); } return; } From owner-svn-src-head@freebsd.org Sat Dec 31 21:00:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D9A4C99F63; Sat, 31 Dec 2016 21:00:10 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D7AF71BBE; Sat, 31 Dec 2016 21:00:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVL09ea092356; Sat, 31 Dec 2016 21:00:09 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVL09RR092355; Sat, 31 Dec 2016 21:00:09 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612312100.uBVL09RR092355@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 31 Dec 2016 21:00:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310984 - head/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 21:00:10 -0000 Author: ngie Date: Sat Dec 31 21:00:08 2016 New Revision: 310984 URL: https://svnweb.freebsd.org/changeset/base/310984 Log: Use calloc instead of malloc + memset(.., 0, ..) MFC after: 1 week Modified: head/lib/libc/net/getaddrinfo.c Modified: head/lib/libc/net/getaddrinfo.c ============================================================================== --- head/lib/libc/net/getaddrinfo.c Sat Dec 31 19:59:31 2016 (r310983) +++ head/lib/libc/net/getaddrinfo.c Sat Dec 31 21:00:08 2016 (r310984) @@ -691,9 +691,8 @@ reorder(struct addrinfo *sentinel) return(n); /* allocate a temporary array for sort and initialization of it. */ - if ((aio = malloc(sizeof(*aio) * n)) == NULL) + if ((aio = calloc(1, sizeof(*aio) * n)) == NULL) return(n); /* give up reordering */ - memset(aio, 0, sizeof(*aio) * n); /* retrieve address selection policy from the kernel */ TAILQ_INIT(&policyhead); @@ -1449,9 +1448,8 @@ copy_ai(const struct addrinfo *pai) size_t l; l = sizeof(*ai) + pai->ai_addrlen; - if ((ai = (struct addrinfo *)malloc(l)) == NULL) + if ((ai = calloc(1, l)) == NULL) return NULL; - memset(ai, 0, l); memcpy(ai, pai, sizeof(*ai)); ai->ai_addr = (struct sockaddr *)(void *)(ai + 1); memcpy(ai->ai_addr, pai->ai_addr, pai->ai_addrlen); @@ -1874,8 +1872,7 @@ addrinfo_unmarshal_func(char *buffer, si size = new_ai.ai_addrlen + sizeof(struct addrinfo) + _ALIGNBYTES; - sentinel = (struct addrinfo *)malloc(size); - memset(sentinel, 0, size); + sentinel = calloc(1, size); memcpy(sentinel, &new_ai, sizeof(struct addrinfo)); sentinel->ai_addr = (struct sockaddr *)_ALIGN((char *)sentinel + @@ -1888,8 +1885,7 @@ addrinfo_unmarshal_func(char *buffer, si memcpy(&size, p, sizeof(size_t)); p += sizeof(size_t); - sentinel->ai_canonname = (char *)malloc(size + 1); - memset(sentinel->ai_canonname, 0, size + 1); + sentinel->ai_canonname = calloc(1, size + 1); memcpy(sentinel->ai_canonname, p, size); p += size; From owner-svn-src-head@freebsd.org Sat Dec 31 21:32:00 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 426A6C98B85; Sat, 31 Dec 2016 21:32:00 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0474A1FFD; Sat, 31 Dec 2016 21:31:59 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVLVx1h006464; Sat, 31 Dec 2016 21:31:59 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVLVxm1006463; Sat, 31 Dec 2016 21:31:59 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201612312131.uBVLVxm1006463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 31 Dec 2016 21:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310985 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 21:32:00 -0000 Author: asomers Date: Sat Dec 31 21:31:58 2016 New Revision: 310985 URL: https://svnweb.freebsd.org/changeset/base/310985 Log: Update ObsoleteFiles.inc for r310803 MFC after: 26 days X-MFC-with: 310803 Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sat Dec 31 21:00:08 2016 (r310984) +++ head/ObsoleteFiles.inc Sat Dec 31 21:31:58 2016 (r310985) @@ -40,6 +40,10 @@ # 20161230: libarchive ACL pax test renamed to test_acl_pax_posix1e.tar.uu OLD_FILES+=usr/tests/lib/libarchive/test_acl_pax.tar.uu +# 20161229: Three files from gnop tests consolidated into one +OLD_FILES+=usr/tests/sys/geom/class/nop/1_test.sh +OLD_FILES+=usr/tests/sys/geom/class/nop/2_test.sh +OLD_FILES+=usr/tests/sys/geom/class/nop/conf.sh # 20161217: new clang import which bumps version from 3.9.0 to 3.9.1. OLD_FILES+=usr/lib/clang/3.9.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/3.9.0/include/sanitizer/asan_interface.h From owner-svn-src-head@freebsd.org Sat Dec 31 21:53:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3FB9C991DB for ; Sat, 31 Dec 2016 21:53:28 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm18-vm4.bullet.mail.ne1.yahoo.com (nm18-vm4.bullet.mail.ne1.yahoo.com [98.138.91.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A05BD1A5A for ; Sat, 31 Dec 2016 21:53:28 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1483220854; bh=qXwSUOenAlZFXP6FC3OdnBIxW7YqJun8RvJxGNR+sVw=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=Vku45nlNjTK7NRJE+d483mQMPHekd/4ECpA/V9qdswWTH16Jd04AjLlsRUPZWOJDQUNotD3654qKJyto1dfB1w7T3tbsUqG2hjLsn+OnY9K9g+uBziQVFq3zKwO6Tf3zkTrfh5frjbeQBf/3huWr4EFtasIfVcXRxpglWFhBqZTeRIwxE1QIx0CHPPkeRXetUyN1XqMsAuxECovNkfi3fFiL4rovnE6KLv3lo60/N+4YF44pNoK5TTO8saAyCi0G7nxBOrdraYU0zF5eDUMYo4G69XuUz8EoRJ/x+ehYCq32E9ZpyVH06uvukVi91ZtCJwAl9iMEEWn+B9amGEjFJQ== Received: from [98.138.101.132] by nm18.bullet.mail.ne1.yahoo.com with NNFMP; 31 Dec 2016 21:47:34 -0000 Received: from [98.138.226.60] by tm20.bullet.mail.ne1.yahoo.com with NNFMP; 31 Dec 2016 21:47:34 -0000 Received: from [127.0.0.1] by smtp211.mail.ne1.yahoo.com with NNFMP; 31 Dec 2016 21:47:34 -0000 X-Yahoo-Newman-Id: 781880.51902.bm@smtp211.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: V5qqPpgVM1ldGjN9zesSHKC.eeFKehDvS9kI7EwbId5jnpN 8BwfBGxdJ3gcTmeTGjtI9ennozgGvmhZrKKvxq52kG7kmFhhHN5UJHd_bUCN mB69gmB6wXFnKz82ZrangKWHiCyz1fM93N8PplGn2h2OwaWhQY.R9nozKtOi r41h3MVT9enrpe.TW0gZWV5Yj0rtk2V6Ni37qI7GlToAdtBcztuZLzjih27G _N2LHcrCg2Ud4OljWWiMCPbfgyOyRBg78k3FVSLDocWa0Nax12REMd_YXXay h7BV7cXFl13oo.AXw7B4_x4LwBmONChWJ0fV1TvO0fytyvh.Ts5tpOxE_dgv xr5ueoJEfmAwZUtOsUN0DYXt4GxxsANvE0b6PVZ5995Hg_MyzSahvtKBW9FD fnruSge_d6HjIUlQkJ4yHCx4EbOLu8bcx_vsTAPtSSkk3_xQXTuaVDkPOOCH Fm6bD1b1XidP3sNwInNnlLPMyAzUP3XVAaFpMfYvTMI1a6f7Lkg5RoXuk38S xKnGoQ1WgRSx7MLgNE2wTPruJDPSYfN50XzsercibajE5Fgc- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r310984 - head/lib/libc/net To: Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201612312100.uBVL09RR092355@repo.freebsd.org> From: Pedro Giffuni Message-ID: <7914bb49-6bef-6bbd-5574-ceb29f318c01@FreeBSD.org> Date: Sat, 31 Dec 2016 16:49:10 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <201612312100.uBVL09RR092355@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 21:53:28 -0000 On 12/31/16 16:00, Ngie Cooper wrote: > Author: ngie > Date: Sat Dec 31 21:00:08 2016 > New Revision: 310984 > URL: https://svnweb.freebsd.org/changeset/base/310984 > > Log: > Use calloc instead of malloc + memset(.., 0, ..) > > MFC after: 1 week > > Modified: > head/lib/libc/net/getaddrinfo.c > > Modified: head/lib/libc/net/getaddrinfo.c > ============================================================================== > --- head/lib/libc/net/getaddrinfo.c Sat Dec 31 19:59:31 2016 (r310983) > +++ head/lib/libc/net/getaddrinfo.c Sat Dec 31 21:00:08 2016 (r310984) > @@ -691,9 +691,8 @@ reorder(struct addrinfo *sentinel) > return(n); > > /* allocate a temporary array for sort and initialization of it. */ > - if ((aio = malloc(sizeof(*aio) * n)) == NULL) > + if ((aio = calloc(1, sizeof(*aio) * n)) == NULL) > return(n); /* give up reordering */ This should be calloc(n, sizeof(*aio))) FWIW, the other cases are not very useful. Generally, replacing any malloc(x) with a calloc(1, x) doesn't bring any advantage as it won't catch any overflow. Pedro. From owner-svn-src-head@freebsd.org Sat Dec 31 21:55:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE466C99275; Sat, 31 Dec 2016 21:55:20 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9B2B91BF2; Sat, 31 Dec 2016 21:55:20 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x241.google.com with SMTP id b1so26068446pgc.1; Sat, 31 Dec 2016 13:55:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=wsWAGr4eBsz7wc2bE2N2dknFL63WapGdi5S6yr9O+o0=; b=S5nPI5uyH3NsscTvdsPjO0TP2s7t7KZqqKmKpwFeXOYWdhINPSedWDZK6rNKPMiZqM zXAly3JW6w1G+rFUuGTWD8hsK7P2V+t7I1zoYcYb1M43xdVf0jTBS+56BLldEo+WG0dM 77sQzZEmUhpKmO/PYIYOB/u61wmD1jL/ZDc2WkkufyKyV5Uyypcf50EaCCqTfJo79KW+ 0YcA5s1nltjLe0molgKHitwTOBZQEgUQJtbnzl+ZrnD2bBwTyTTpf80OescoziByxcoa jStpJ+QtIP75aPWrIXdRuPWVTv91NUJWgkaM8nVl5E6HEJLGUC5NuC8Yx+ws2XIEV256 Q72g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=wsWAGr4eBsz7wc2bE2N2dknFL63WapGdi5S6yr9O+o0=; b=PLxFLX+DSpj96efZfLTr8KjkJZZXctIYwmk+s6mEPetio1oVh6jRX8VV2Ol6L+ABDw DmHcsAtAO2v+5RlODCNCb46CVPBNtsV43wxXv2ObRY1U0PgcRMFr3xb42apP0a9aDlM/ RS785b7woLEoNYPaQywGxnlMcd8E7KTmKUSlXrNJ2bwKCU/G5HktygPu/xsr9f/vC/mv 1R+mX0n+cc2tiwo9MJZMIyvjTrrGHpZbqlEl/JzIbeMRMcSPISx/jaJNjGXojKGr/BeF a3a5GkodUVLQJXAZAcyuiDqI1WK0y3FJj/62z4dQk6KlGzyaTlcaaC/3kL6kOYNR4P2n LRtg== X-Gm-Message-State: AIkVDXKDw8AlUsYmn+O4FpVcIUtNNgs6h+lzJs2LqVjyhI+n7K8Dw4vIDcx6Kc/gKtv/XQ== X-Received: by 10.98.36.134 with SMTP id k6mr40691007pfk.3.1483221319507; Sat, 31 Dec 2016 13:55:19 -0800 (PST) Received: from [192.168.20.12] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id 65sm121744263pfn.12.2016.12.31.13.55.18 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 31 Dec 2016 13:55:18 -0800 (PST) Subject: Re: svn commit: r310984 - head/lib/libc/net Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_867E2280-4CAE-477F-8AD1-C825FC4B1A12"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <7914bb49-6bef-6bbd-5574-ceb29f318c01@FreeBSD.org> Date: Sat, 31 Dec 2016 13:55:18 -0800 Cc: Ngie Cooper , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <371A5B4E-0766-49F4-9115-13598B3E74FF@gmail.com> References: <201612312100.uBVL09RR092355@repo.freebsd.org> <7914bb49-6bef-6bbd-5574-ceb29f318c01@FreeBSD.org> To: Pedro Giffuni X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 21:55:20 -0000 --Apple-Mail=_867E2280-4CAE-477F-8AD1-C825FC4B1A12 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Dec 31, 2016, at 13:49, Pedro Giffuni wrote: >=20 >=20 >=20 > On 12/31/16 16:00, Ngie Cooper wrote: >> Author: ngie >> Date: Sat Dec 31 21:00:08 2016 >> New Revision: 310984 >> URL: https://svnweb.freebsd.org/changeset/base/310984 >>=20 >> Log: >> Use calloc instead of malloc + memset(.., 0, ..) >>=20 >> MFC after: 1 week >>=20 >> Modified: >> head/lib/libc/net/getaddrinfo.c >>=20 >> Modified: head/lib/libc/net/getaddrinfo.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/lib/libc/net/getaddrinfo.c Sat Dec 31 19:59:31 2016 = (r310983) >> +++ head/lib/libc/net/getaddrinfo.c Sat Dec 31 21:00:08 2016 = (r310984) >> @@ -691,9 +691,8 @@ reorder(struct addrinfo *sentinel) >> return(n); >>=20 >> /* allocate a temporary array for sort and initialization of it. = */ >> - if ((aio =3D malloc(sizeof(*aio) * n)) =3D=3D NULL) >> + if ((aio =3D calloc(1, sizeof(*aio) * n)) =3D=3D NULL) >> return(n); /* give up reordering */ >=20 > This should be calloc(n, sizeof(*aio))) >=20 > FWIW, the other cases are not very useful. > Generally, replacing any malloc(x) with a calloc(1, x) doesn't bring = any advantage as it won't catch any overflow. Yeah, that would have been better. The goal was to reduce complexity. I found some memory leaks with = valgrind with bsnmp* last night involving getaddrinfo that I=E2=80=99m = trying to chase down, and I noticed these while =E2=80=9Cin the = neighborhood=E2=80=9D. Thanks! -Ngie --Apple-Mail=_867E2280-4CAE-477F-8AD1-C825FC4B1A12 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJYaClGAAoJEPWDqSZpMIYV1E8QAKvomvKcUWo7fD1sF5t4YU7N jX6jwiOgzgr9y1Ur34xETJTaHaFCjV5+xa5mQCdKQv4E2LPbwjUfH1qHH9P0DDFX KgP34vgYiahrBJcUwpeYhNPXhl+i2gLQ1Tnu2G8gbOzGnf0nWKTgoZ56c0ZAE3zW OEdn4AU9KBeeNliuEc8j54Z6HxGq8biqm6ymS6ZHHGBRjlIHdT5FFIXscIKQW1eD 3H6pX+8ZNfu+OkWQMJbT2lkMswJRBFYC8hYrqUqZbk8etaj9gABaZ2szIyNbTq+x LYtK3qEirXyfcHEYmlrzBuItI73J3hymyGyWRog3M7Pfw2jZ151ACmwtDWcbT4er tBoooYqHRSLB67GB2MI1tWXYDQUnBnuYgm4oKxwxyGo5zHp+UdLWGE9ChPx5LjwF /hQeUF43EpUnT21Pgq/qWuFNHyOd+TeOT0kgch/pvkUD8L5/Q0/jYpexDvcKmJQr ndxYov/KY4IVkmCwiih0POVd44VaPqTUlIal7POIGWgfR9HK/izSX3Lx+5GnY5Qr 7gepw4gxLROuDEK+r834XeNY8zcfV7eGie10P6enB0zfZ3Qh2a9YNSZZSfZZkNaZ KB0DUDqWtBnBaKRsI8tU6tuXNZTlpYP1AN/PklBzj6gCnyFlHAEU96tAY+KBdj4K 3C75vbRrfti5cHoIBoRi =IcFw -----END PGP SIGNATURE----- --Apple-Mail=_867E2280-4CAE-477F-8AD1-C825FC4B1A12-- From owner-svn-src-head@freebsd.org Sat Dec 31 22:18:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD4DCC99957; Sat, 31 Dec 2016 22:18:34 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81AF0171E; Sat, 31 Dec 2016 22:18:34 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVMIXtD024992; Sat, 31 Dec 2016 22:18:33 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVMIXQo024991; Sat, 31 Dec 2016 22:18:33 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612312218.uBVMIXQo024991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 31 Dec 2016 22:18:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310986 - head/usr.sbin/bsnmpd/tools/libbsnmptools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 22:18:34 -0000 Author: ngie Date: Sat Dec 31 22:18:33 2016 New Revision: 310986 URL: https://svnweb.freebsd.org/changeset/base/310986 Log: snmp_output_resp: style(9): sort variables by alignment MFC after: 3 days Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c ============================================================================== --- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Sat Dec 31 21:31:58 2016 (r310985) +++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Sat Dec 31 22:18:33 2016 (r310986) @@ -2034,10 +2034,10 @@ int32_t snmp_output_resp(struct snmp_toolinfo *snmptoolctx, struct snmp_pdu *pdu, struct asn_oid *root) { - int32_t error; + struct snmp_object object; char p[ASN_OIDSTRLEN]; + int32_t error; uint32_t i; - struct snmp_object object; i = error = 0; while (i < pdu->nbindings) { From owner-svn-src-head@freebsd.org Sat Dec 31 22:46:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62D40C9912D; Sat, 31 Dec 2016 22:46:18 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D588149A; Sat, 31 Dec 2016 22:46:18 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVMkH7a037026; Sat, 31 Dec 2016 22:46:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVMkHff037025; Sat, 31 Dec 2016 22:46:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612312246.uBVMkHff037025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 31 Dec 2016 22:46:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310987 - head/usr.sbin/bsnmpd/tools/libbsnmptools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 22:46:18 -0000 Author: ngie Date: Sat Dec 31 22:46:17 2016 New Revision: 310987 URL: https://svnweb.freebsd.org/changeset/base/310987 Log: snmp_output_err_resp, snmp_output_resp: allocate `object` using calloc, not on the stack Some of the callers try to determine whether or not `object` is valid by testing the value for NULL, which will never be true if it's a stack value, so in order to be clear and correct down the call stack, use a heap allocated object. This also addresses a Coverity issue by initializing all of `object` via calloc MFC after: 1 week Reported by: Coverity CID: 1006392 Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c ============================================================================== --- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Sat Dec 31 22:18:33 2016 (r310986) +++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Sat Dec 31 22:46:17 2016 (r310987) @@ -2003,20 +2003,25 @@ snmp_output_object(struct snmp_toolinfo void snmp_output_err_resp(struct snmp_toolinfo *snmptoolctx, struct snmp_pdu *pdu) { + struct snmp_object *object; char buf[ASN_OIDSTRLEN]; - struct snmp_object object; if (pdu == NULL || (pdu->error_index > (int32_t) pdu->nbindings)) { - fprintf(stdout,"Invalid error index in PDU\n"); + fprintf(stdout, "Invalid error index in PDU\n"); + return; + } + + if ((object = calloc(1, sizeof(struct snmp_object))) != NULL) { + fprintf(stdout, "calloc: %s", strerror(errno)); return; } fprintf(stdout, "Agent %s:%s returned error \n", snmp_client.chost, snmp_client.cport); - if (!ISSET_NUMERIC(snmptoolctx) && (snmp_fill_object(snmptoolctx, &object, + if (!ISSET_NUMERIC(snmptoolctx) && (snmp_fill_object(snmptoolctx, object, &(pdu->bindings[pdu->error_index - 1])) > 0)) - snmp_output_object(snmptoolctx, &object); + snmp_output_object(snmptoolctx, object); else { asn_oid2str_r(&(pdu->bindings[pdu->error_index - 1].var), buf); fprintf(stdout,"%s", buf); @@ -2028,17 +2033,23 @@ snmp_output_err_resp(struct snmp_toolinf fprintf(stdout, "%s\n", error_strings[pdu->error_status].str); else fprintf(stdout,"%s\n", error_strings[SNMP_ERR_UNKNOWN].str); + + free(object); + object = NULL; } int32_t snmp_output_resp(struct snmp_toolinfo *snmptoolctx, struct snmp_pdu *pdu, struct asn_oid *root) { - struct snmp_object object; + struct snmp_object *object; char p[ASN_OIDSTRLEN]; int32_t error; uint32_t i; + if ((object = calloc(1, sizeof(struct snmp_object))) == NULL) + return (-1); + i = error = 0; while (i < pdu->nbindings) { if (root != NULL && !(asn_is_suboid(root, @@ -2047,18 +2058,22 @@ snmp_output_resp(struct snmp_toolinfo *s if (GET_OUTPUT(snmptoolctx) != OUTPUT_QUIET) { if (!ISSET_NUMERIC(snmptoolctx) && - (snmp_fill_object(snmptoolctx, &object, + (snmp_fill_object(snmptoolctx, object, &(pdu->bindings[i])) > 0)) - snmp_output_object(snmptoolctx, &object); + snmp_output_object(snmptoolctx, object); else { asn_oid2str_r(&(pdu->bindings[i].var), p); fprintf(stdout, "%s", p); } } - error |= snmp_output_numval(snmptoolctx, &(pdu->bindings[i]), object.info); + error |= snmp_output_numval(snmptoolctx, &(pdu->bindings[i]), + object->info); i++; } + free(object); + object = NULL; + if (error) return (-1); From owner-svn-src-head@freebsd.org Sat Dec 31 23:20:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A882FC99B06; Sat, 31 Dec 2016 23:20:58 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 750441282; Sat, 31 Dec 2016 23:20:58 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVNKvZe049457; Sat, 31 Dec 2016 23:20:57 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVNKvTF049456; Sat, 31 Dec 2016 23:20:57 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612312320.uBVNKvTF049456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 31 Dec 2016 23:20:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310988 - head/contrib/bsnmp/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 23:20:58 -0000 Author: ngie Date: Sat Dec 31 23:20:57 2016 New Revision: 310988 URL: https://svnweb.freebsd.org/changeset/base/310988 Log: snmp_discover_engine: fix up req/resp (PDU object) handling a bit - Call snmp_pdu_free on req and resp when done with the objects - Call snmp_pdu_free on req before calling snmp_pdu_create on it again MFC after: 1 week Modified: head/contrib/bsnmp/lib/snmpclient.c Modified: head/contrib/bsnmp/lib/snmpclient.c ============================================================================== --- head/contrib/bsnmp/lib/snmpclient.c Sat Dec 31 22:46:17 2016 (r310987) +++ head/contrib/bsnmp/lib/snmpclient.c Sat Dec 31 23:20:57 2016 (r310988) @@ -1793,12 +1793,14 @@ snmp_discover_engine(char *passwd) return (0); } + snmp_pdu_free(&req); + snmp_pdu_create(&req, SNMP_PDU_GET); req.engine.engine_boots = 0; req.engine.engine_time = 0; if (snmp_dialog(&req, &resp) == -1) - return (-1); + return (-1); if (resp.version != req.version) { seterr(&snmp_client, "wrong version"); @@ -1813,6 +1815,9 @@ snmp_discover_engine(char *passwd) snmp_client.engine.engine_boots = resp.engine.engine_boots; snmp_client.engine.engine_time = resp.engine.engine_time; + snmp_pdu_free(&req); + snmp_pdu_free(&resp); + return (0); }