From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 11:22:23 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C9CE106566C; Sun, 19 Sep 2010 11:22:23 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49EB88FC1C; Sun, 19 Sep 2010 11:22:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JBMNhn000101; Sun, 19 Sep 2010 11:22:23 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JBMNc3099995; Sun, 19 Sep 2010 11:22:23 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201009191122.o8JBMNc3099995@svn.freebsd.org> From: Brian Somers Date: Sun, 19 Sep 2010 11:22:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212849 - in stable/7: bin/pax tools/regression/bin tools/regression/bin/pax tools/tools/nanobsd X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 11:22:23 -0000 Author: brian Date: Sun Sep 19 11:22:22 2010 New Revision: 212849 URL: http://svn.freebsd.org/changeset/base/212849 Log: MFC r211864,211963,211964,211965, don't mis-handle path names of 101 characters beginning with '/'. Added: stable/7/tools/regression/bin/Makefile - copied unchanged from r211964, head/tools/regression/bin/Makefile stable/7/tools/regression/bin/pax/ - copied from r211963, head/tools/regression/bin/pax/ Modified: stable/7/bin/pax/pax.1 stable/7/bin/pax/tar.c stable/7/tools/regression/bin/pax/Makefile Directory Properties: stable/7/bin/pax/ (props changed) stable/7/tools/ (props changed) stable/7/tools/build/ (props changed) stable/7/tools/build/options/ (props changed) stable/7/tools/debugscripts/ (props changed) stable/7/tools/regression/atm/ (props changed) stable/7/tools/regression/bin/sh/ (props changed) stable/7/tools/regression/file/ (props changed) stable/7/tools/regression/file/flock/ (props changed) stable/7/tools/regression/usr.bin/ (props changed) stable/7/tools/regression/usr.bin/jot/ (props changed) stable/7/tools/regression/usr.bin/tr/ (props changed) stable/7/tools/sched/ (props changed) stable/7/tools/test/ (props changed) stable/7/tools/tools/aac/ (props changed) stable/7/tools/tools/crypto/ (props changed) stable/7/tools/tools/editing/ (props changed) stable/7/tools/tools/nanobsd/ (props changed) stable/7/tools/tools/nanobsd/FlashDevice.sub (props changed) stable/7/tools/tools/nanobsd/nanobsd.sh (props changed) stable/7/tools/tools/usb/ (props changed) Modified: stable/7/bin/pax/pax.1 ============================================================================== --- stable/7/bin/pax/pax.1 Sun Sep 19 11:16:49 2010 (r212848) +++ stable/7/bin/pax/pax.1 Sun Sep 19 11:22:22 2010 (r212849) @@ -33,7 +33,7 @@ .\" @(#)pax.1 8.4 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd July 3, 2004 +.Dd August 29, 2010 .Dt PAX 1 .Os .Sh NAME @@ -748,7 +748,9 @@ The extended tar interchange format spec .St -p1003.2 standard. The default blocksize for this format is 10240 bytes. -Pathnames stored by this format must be 250 characters or less in length. +Pathnames stored by this format must be 255 characters or less in length. +The directory part may be at most 155 characters and each path component +must be less than 100 characters. .El .Pp The Modified: stable/7/bin/pax/tar.c ============================================================================== --- stable/7/bin/pax/tar.c Sun Sep 19 11:16:49 2010 (r212848) +++ stable/7/bin/pax/tar.c Sun Sep 19 11:22:22 2010 (r212849) @@ -1086,7 +1086,7 @@ name_split(char *name, int len) */ if (len <= TNMSZ) return(name); - if (len > (TPFSZ + TNMSZ + 1)) + if (len > TPFSZ + TNMSZ) return(NULL); /* @@ -1095,7 +1095,7 @@ name_split(char *name, int len) * to find the biggest piece to fit in the name field (or the smallest * prefix we can find) */ - start = name + len - TNMSZ - 1; + start = name + len - TNMSZ; while ((*start != '\0') && (*start != '/')) ++start; Copied: stable/7/tools/regression/bin/Makefile (from r211964, head/tools/regression/bin/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/tools/regression/bin/Makefile Sun Sep 19 11:22:22 2010 (r212849, copy of r211964, head/tools/regression/bin/Makefile) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= date mv pax sh + +.include Modified: stable/7/tools/regression/bin/pax/Makefile ============================================================================== --- head/tools/regression/bin/pax/Makefile Sun Aug 29 11:56:56 2010 (r211963) +++ stable/7/tools/regression/bin/pax/Makefile Sun Sep 19 11:22:22 2010 (r212849) @@ -1,6 +1,6 @@ # $FreeBSD$ -test: +all test: prove -vmw regress.t clean: From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 13:42:05 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B88C3106566B; Sun, 19 Sep 2010 13:42:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 658C58FC08; Sun, 19 Sep 2010 13:42:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JDg5q2003471; Sun, 19 Sep 2010 13:42:05 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JDg5io003469; Sun, 19 Sep 2010 13:42:05 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191342.o8JDg5io003469@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 13:42:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212857 - stable/7/sys/dev/hptmv X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 13:42:05 -0000 Author: mav Date: Sun Sep 19 13:42:05 2010 New Revision: 212857 URL: http://svn.freebsd.org/changeset/base/212857 Log: MFC r194900: Remove unused ATAPI definitions, conflicting with ata.h. Modified: stable/7/sys/dev/hptmv/atapi.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/hptmv/atapi.h ============================================================================== --- stable/7/sys/dev/hptmv/atapi.h Sun Sep 19 12:54:18 2010 (r212856) +++ stable/7/sys/dev/hptmv/atapi.h Sun Sep 19 13:42:05 2010 (r212857) @@ -180,200 +180,6 @@ typedef struct _IDE_REGISTERS_2 { #define MSNS_WRITE_PROTECT 0x40 #define MSNS_READ_PROTECT 0x80 -/*************************************************************************** - * ATAPI IO Register File - ***************************************************************************/ - -/* - * ATAPI register definition - */ - -typedef struct _ATAPI_REGISTERS_1 { - USHORT Data; - UCHAR InterruptReason; /* Atapi Phase Port */ - UCHAR Unused1; - UCHAR ByteCountLow; /* Byte Count LSB */ - UCHAR ByteCountHigh; /* Byte Count MSB */ - UCHAR DriveSelect; - UCHAR Command; -} ATAPI_REGISTERS_1, *PATAPI_REGISTERS_1; - -/* - * Atapi Error Status - */ -#define IDE_ERROR_END_OF_MEDIA IDE_ERROR_TRACK0_NOT_FOUND -#define IDE_ERROR_ILLEGAL_LENGTH IDE_ERROR_ADDRESS_NOT_FOUND - -/* - * ATAPI interrupt reasons - */ -#define ATAPI_IR_COD 0x01 -#define ATAPI_IR_IO 0x02 - -/* sense key */ -#define ATAPI_SENSE_NO_SENSE 0x00 -#define ATAPI_SENSE_RECOVERED_ERROR 0x01 -#define ATAPI_SENSE_NOT_READY 0x02 -#define ATAPI_SENSE_MEDIUM_ERROR 0x03 -#define ATAPI_SENSE_HARDWARE_ERROR 0x04 -#define ATAPI_SENSE_ILLEGAL_REQUEST 0x05 -#define ATAPI_SENSE_UNIT_ATTENTION 0x06 -#define ATAPI_SENSE_DATA_PROTECT 0x07 -#define ATAPI_SENSE_BLANK_CHECK 0x08 -#define ATAPI_SENSE_UNIQUE 0x09 -#define ATAPI_SENSE_COPY_ABORTED 0x0A -#define ATAPI_SENSE_ABORTED_COMMAND 0x0B -#define ATAPI_SENSE_EQUAL 0x0C -#define ATAPI_SENSE_VOL_OVERFLOW 0x0D -#define ATAPI_SENSE_MISCOMPARE 0x0E -#define ATAPI_SENSE_RESERVED 0x0F - -/* Additional Sense codes */ -#define ATAPI_ASC_NO_SENSE 0x00 -#define ATAPI_ASC_LUN_NOT_READY 0x04 -#define ATAPI_ASC_TRACK_ERROR 0x14 -#define ATAPI_ASC_SEEK_ERROR 0x15 -#define ATAPI_ASC_REC_DATA_NOECC 0x17 -#define ATAPI_ASC_REC_DATA_ECC 0x18 -#define ATAPI_ASC_ILLEGAL_COMMAND 0x20 -#define ATAPI_ASC_ILLEGAL_BLOCK 0x21 -#define ATAPI_ASC_INVALID_CDB 0x24 -#define ATAPI_ASC_INVALID_LUN 0x25 -#define ATAPI_ASC_PROTECT 0x27 -#define ATAPI_ASC_MEDIUM_CHANGED 0x28 -#define ATAPI_ASC_BUS_RESET 0x29 -#define ATAPI_ASC_NO_MEDIA_IN_DEVICE 0x3a -#define ATAPI_ASC_MUSIC_AREA 0xA0 -#define ATAPI_ASC_DATA_AREA 0xA1 -#define ATAPI_ASC_VOLUME_OVERFLOW 0xA7 - -/* - * IDE command definitions ( for ATAPI ) - */ - -#define IDE_COMMAND_ATAPI_RESET 0x08 /* Atapi Software Reset command */ -#define IDE_COMMAND_ATAPI_PACKET 0xA0 /* Atapi Identify command */ -#define IDE_COMMAND_ATAPI_IDENTIFY 0xA1 /* Atapi Packet Command */ - - -/* - * ATAPI command definitions - */ - -#define ATAPI_TEST_UNIT_READY 0x00 -#define ATAPI_REZERO_UNIT 0x01 -#define ATAPI_REQUEST_SENSE 0x03 -#define ATAPI_FORMAT_UNIT6 0x04 -#define ATAPI_FORMAT_UNIT 0x24 -#define ATAPI_INQUIRY 0x12 -#define ATAPI_MODE_SELECT 0x15 -#define ATAPI_RELEASE6 0x17 -#define ATAPI_MODE_SENSE 0x1A -#define ATAPI_START_STOP_UNIT 0x1B -#define ATAPI_LOAD_UNLOAD 0x1B -#define ATAPI_RECEIVE_DIAGNOSTIC 0x1C -#define ATAPI_SEND_DIAGNOSTIC 0x1D -#define ATAPI_MEDIUM_REMOVAL 0x1E -#define ATAPI_READ_FORMAT_CAPACITY 0x23 -#define ATAPI_READ_CAPACITY 0x25 -#define ATAPI_READ 0x28 -#define ATAPI_WRITE 0x2A -#define ATAPI_SEEK 0x2B -#define ATAPI_ERASE 0x2C -#define ATAPI_VERIFY 0x2F -#define ATAPI_WRITE_VERIFY 0x2E -#define ATAPI_SYNCHRONIZE_CACHE 0x35 -#define ATAPI_LOCK_CACHE 0x36 -#define ATAPI_COMPARE 0x39 -#define ATAPI_WRITE_BUFFER 0x3B -#define ATAPI_READ_DATA_BUFF 0x3C -#define ATAPI_READ_SUB_CHANNEL 0x42 -#define ATAPI_READ_TOC 0x43 -#define ATAPI_READ_HEADER 0x44 -#define ATAPI_PLAY_AUDIO10 0x45 -#define ATAPI_GET_CONFIGURATION 0x46 -#define ATAPI_PLAY_AUDIO_MSF 0x47 -#define ATAPI_GET_EVENT_STATUS_NOTIFICATION 0x4A -#define ATAPI_PAUSE_RESUME 0x4B -#define ATAPI_LOG_SELECT 0x4C -#define ATAPI_LOG_SENSE 0x4D -#define ATAPI_STOP_PLAY_SCAN 0x4E -#define ATAPI_READ_DISK_INFORMATION 0x51 -#define ATAPI_READ_TRACK_INFORMATION 0x52 -#define ATAPI_RESERVE_TRACK_RZONE 0x53 -#define ATAPI_SEND_OPC_INFORMATION 0x54 -#define ATAPI_MODE_SELECT10 0x55 -#define ATAPI_RELEASE10 0x57 -#define ATAPI_REPAIR_ZONE 0x58 -#define ATAPI_MODE_SENSE10 0x5A -#define ATAPI_CLOSE_TRACK_SESSION 0x5B -#define ATAPI_READ_BUFFER_CAPACITY 0x5C -#define ATAPI_SEND_CUE_SHEET 0x5D -#define ATAPI_BLANK_COMMAND 0xA1 /*Provide the ability to erase any part of a CD-RW disc.*/ -#define ATAPI_SEND_EVENT 0xA2 /* add for DVD */ -#define ATAPI_SEND_KEY 0xA3 /* add for DVD */ -#define ATAPI_REPORT_KEY 0xA4 -#define ATAPI_PLAY_AUDIO 0xA5 -#define ATAPI_LOAD_UNLOAD_MEDIUM 0xA6 -#define ATAPI_SET_READ_AHEAD 0xA7 -#define ATAPI_READ12 0xA8 -#define ATAPI_READ_DVD_STRUCTURE 0xAD -#define ATAPI_WRITE12 0xAA -#define ATAPI_GET_PERFORM_NOTIFICATION 0xAC /* add for DVD-RW */ -#define ATAPI_SET_STREAM 0xB6 /* add for DVD-RW */ -#define ATAPI_READ_CD_MSF 0xB9 -#define ATAPI_SCAN 0xBA -#define ATAPI_SET_SPEED 0xBB /* no payload */ -#define ATAPI_MECHANISM_STATUS 0xBD -#define ATAPI_READ_CD 0xBE -#define ATAPI_SEND_DVD_STRUCTURE 0xBF -#define ATAPI_SET_CDRW_SPEED 0xDA /*WindowsXP need*/ - -#define MODE_DSP_WRITE_PROTECT 0x80 - - -/*************************************************************************** - * ATAPI IO Register File - ***************************************************************************/ - - -typedef struct _ATAPI_REGISTERS_2 { - UCHAR AlternateStatus; -} ATAPI_REGISTERS_2, *PATAPI_REGISTERS_2; - - -/*************************************************************************** - * ATAPI packets - ***************************************************************************/ -typedef struct _ATAPI_SENSE_DATA { -#ifdef __BIG_ENDIAN_BITFIELD - UCHAR Valid:1; - UCHAR ErrorCode:7; - UCHAR SegmentNumber; - UCHAR FileMark:1; - UCHAR EndOfMedia:1; - UCHAR IncorrectLength:1; - UCHAR Reserved:1; - UCHAR SenseKey:4; -#else - UCHAR ErrorCode:7; - UCHAR Valid:1; - UCHAR SegmentNumber; - UCHAR SenseKey:4; - UCHAR Reserved:1; - UCHAR IncorrectLength:1; - UCHAR EndOfMedia:1; - UCHAR FileMark:1; -#endif - UCHAR Information[4]; - UCHAR AdditionalSenseLength; - UCHAR CommandSpecificInformation[4]; - UCHAR AdditionalSenseCode; - UCHAR AdditionalSenseCodeQualifier; - UCHAR FieldReplaceableUnitCode; - UCHAR SenseKeySpecific[3]; -} ATAPI_SENSE_DATA, *PATAPI_SENSE_DATA; - /* * IDENTIFY data */ @@ -580,6 +386,3 @@ typedef enum _DISK_MODE #pragma pack() #endif - - - From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 13:44:47 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 328E7106566B; Sun, 19 Sep 2010 13:44:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 215F18FC0C; Sun, 19 Sep 2010 13:44:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JDilEE003585; Sun, 19 Sep 2010 13:44:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JDilpg003583; Sun, 19 Sep 2010 13:44:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191344.o8JDilpg003583@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 13:44:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212858 - stable/7/sys/dev/hptmv X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 13:44:47 -0000 Author: mav Date: Sun Sep 19 13:44:46 2010 New Revision: 212858 URL: http://svn.freebsd.org/changeset/base/212858 Log: MFC r209341: Report transport type in XPT_PATH_INQ. Modified: stable/7/sys/dev/hptmv/entry.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/hptmv/entry.c ============================================================================== --- stable/7/sys/dev/hptmv/entry.c Sun Sep 19 13:42:05 2010 (r212857) +++ stable/7/sys/dev/hptmv/entry.c Sun Sep 19 13:44:46 2010 (r212858) @@ -2420,6 +2420,10 @@ hpt_action(struct cam_sim *sim, union cc strncpy(cpi->hba_vid, "HPT ", HBA_IDLEN); strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(sim); + cpi->transport = XPORT_SPI; + cpi->transport_version = 2; + cpi->protocol = PROTO_SCSI; + cpi->protocol_version = SCSI_REV_2; cpi->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); break; From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 13:49:02 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 664A7106564A; Sun, 19 Sep 2010 13:49:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 529E68FC0A; Sun, 19 Sep 2010 13:49:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JDn2LS003774; Sun, 19 Sep 2010 13:49:02 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JDn2sq003772; Sun, 19 Sep 2010 13:49:02 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191349.o8JDn2sq003772@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 13:49:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212859 - stable/7/sys/dev/hptiop X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 13:49:02 -0000 Author: mav Date: Sun Sep 19 13:49:02 2010 New Revision: 212859 URL: http://svn.freebsd.org/changeset/base/212859 Log: MFC r209340: Report transport type in XPT_PATH_INQ. Modified: stable/7/sys/dev/hptiop/hptiop.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/hptiop/hptiop.c ============================================================================== --- stable/7/sys/dev/hptiop/hptiop.c Sun Sep 19 13:44:46 2010 (r212858) +++ stable/7/sys/dev/hptiop/hptiop.c Sun Sep 19 13:49:02 2010 (r212859) @@ -1836,6 +1836,10 @@ scsi_done: strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strncpy(cpi->hba_vid, "HPT ", HBA_IDLEN); strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); + cpi->transport = XPORT_SPI; + cpi->transport_version = 2; + cpi->protocol = PROTO_SCSI; + cpi->protocol_version = SCSI_REV_2; cpi->ccb_h.status = CAM_REQ_CMP; break; } From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 18:55:48 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6135410656C1; Sun, 19 Sep 2010 18:55:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 349C98FC15; Sun, 19 Sep 2010 18:55:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JItmW4011710; Sun, 19 Sep 2010 18:55:48 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JItm37011709; Sun, 19 Sep 2010 18:55:48 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191855.o8JItm37011709@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 18:55:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212869 - in stable/7: sbin/atacontrol sys sys/cddl/contrib/opensolaris sys/contrib/dev/acpica sys/contrib/pf X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 18:55:48 -0000 Author: mav Date: Sun Sep 19 18:55:47 2010 New Revision: 212869 URL: http://svn.freebsd.org/changeset/base/212869 Log: Mark r172606, r174682, r177298 as merged. Modified: Directory Properties: stable/7/sbin/atacontrol/ (props changed) stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 19:02:14 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86A85106566B; Sun, 19 Sep 2010 19:02:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 754FC8FC0C; Sun, 19 Sep 2010 19:02:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJ2EhZ011936; Sun, 19 Sep 2010 19:02:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJ2EfA011934; Sun, 19 Sep 2010 19:02:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191902.o8JJ2EfA011934@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 19:02:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212870 - stable/7/sys/sys X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 19:02:14 -0000 Author: mav Date: Sun Sep 19 19:02:14 2010 New Revision: 212870 URL: http://svn.freebsd.org/changeset/base/212870 Log: MFC r194902, r197540, r198587, r198865: Define some ATA IDENTIFY fields and bits. Modified: stable/7/sys/sys/ata.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sys/ata.h ============================================================================== --- stable/7/sys/sys/ata.h Sun Sep 19 18:55:47 2010 (r212869) +++ stable/7/sys/sys/ata.h Sun Sep 19 19:02:14 2010 (r212870) @@ -67,6 +67,8 @@ struct ata_params { /*049*/ u_int16_t capabilities1; #define ATA_SUPPORT_DMA 0x0100 #define ATA_SUPPORT_LBA 0x0200 +#define ATA_SUPPORT_IORDY 0x0400 +#define ATA_SUPPORT_IORDYDIS 0x0800 #define ATA_SUPPORT_OVERLAP 0x4000 /*050*/ u_int16_t capabilities2; @@ -108,19 +110,31 @@ struct ata_params { /*075*/ u_int16_t queue; #define ATA_QUEUE_LEN(x) ((x) & 0x001f) - u_int16_t satacapabilities; +/*76*/ u_int16_t satacapabilities; #define ATA_SATA_GEN1 0x0002 #define ATA_SATA_GEN2 0x0004 +#define ATA_SATA_GEN3 0x0008 #define ATA_SUPPORT_NCQ 0x0100 #define ATA_SUPPORT_IFPWRMNGTRCV 0x0200 - - u_int16_t reserved77; - u_int16_t satasupport; +#define ATA_SUPPORT_PHYEVENTCNT 0x0400 +#define ATA_SUPPORT_NCQ_UNLOAD 0x0800 +#define ATA_SUPPORT_NCQ_PRIO 0x1000 +#define ATA_SUPPORT_HAPST 0x2000 +#define ATA_SUPPORT_DAPST 0x4000 +#define ATA_SUPPORT_READLOGDMAEXT 0x8000 + +/*77*/ u_int16_t satacapabilities2; +#define ATA_SATA_CURR_GEN_MASK 0x0006 +#define ATA_SUPPORT_NCQ_STREAM 0x0010 +#define ATA_SUPPORT_NCQ_QMANAGEMENT 0x0020 +/*78*/ u_int16_t satasupport; #define ATA_SUPPORT_NONZERO 0x0002 #define ATA_SUPPORT_AUTOACTIVATE 0x0004 #define ATA_SUPPORT_IFPWRMNGT 0x0008 #define ATA_SUPPORT_INORDERDATA 0x0010 - u_int16_t sataenabled; +#define ATA_SUPPORT_SOFTSETPRESERVE 0x0040 +/*79*/ u_int16_t sataenabled; +#define ATA_ENABLED_DAPST 0x0080 /*080*/ u_int16_t version_major; /*081*/ u_int16_t version_minor; @@ -158,8 +172,8 @@ struct ata_params { #define ATA_SUPPORT_FLUSHCACHE48 0x2000 /*084/087*/ u_int16_t extension; -#define ATA_SUPPORT_SMARTTEST 0x0001 -#define ATA_SUPPORT_SMARTLOG 0x0002 +#define ATA_SUPPORT_SMARTLOG 0x0001 +#define ATA_SUPPORT_SMARTTEST 0x0002 #define ATA_SUPPORT_MEDIASN 0x0004 #define ATA_SUPPORT_MEDIAPASS 0x0008 #define ATA_SUPPORT_STREAMING 0x0010 @@ -167,6 +181,7 @@ struct ata_params { #define ATA_SUPPORT_WRITEDMAFUAEXT 0x0040 #define ATA_SUPPORT_WRITEDMAQFUAEXT 0x0080 #define ATA_SUPPORT_64BITWWN 0x0100 +#define ATA_SUPPORT_UNLOAD 0x2000 } __packed support, enabled; /*088*/ u_int16_t udmamodes; /* UltraDMA modes */ @@ -189,14 +204,52 @@ struct ata_params { u_int16_t lba_size48_2; u_int16_t lba_size48_3; u_int16_t lba_size48_4; - u_int16_t reserved104[23]; + u_int16_t reserved104[2]; +/*106*/ u_int16_t pss; +#define ATA_PSS_LSPPS 0x000F +#define ATA_PSS_LSSABOVE512 0x1000 +#define ATA_PSS_MULTLS 0x2000 +/*107*/ u_int16_t isd; +/*108*/ u_int16_t wwn[4]; + u_int16_t reserved112[5]; +/*117*/ u_int16_t lss_1; +/*118*/ u_int16_t lss_2; +/*119*/ u_int16_t support2; +#define ATA_SUPPORT_WRITEREADVERIFY 0x0002 +#define ATA_SUPPORT_WRITEUNCORREXT 0x0004 +#define ATA_SUPPORT_RWLOGDMAEXT 0x0008 +#define ATA_SUPPORT_MICROCODE3 0x0010 +#define ATA_SUPPORT_FREEFALL 0x0020 +/*120*/ u_int16_t enabled2; + u_int16_t reserved121[6]; /*127*/ u_int16_t removable_status; /*128*/ u_int16_t security_status; u_int16_t reserved129[31]; /*160*/ u_int16_t cfa_powermode1; - u_int16_t reserved161[15]; -/*176*/ u_int16_t media_serial[30]; - u_int16_t reserved206[49]; + u_int16_t reserved161; +/*162*/ u_int16_t cfa_kms_support; +/*163*/ u_int16_t cfa_trueide_modes; +/*164*/ u_int16_t cfa_memory_modes; + u_int16_t reserved165[11]; +/*176*/ u_int8_t media_serial[60]; +/*206*/ u_int16_t sct; + u_int16_t reserved206[2]; +/*209*/ u_int16_t lbalign; +/*210*/ u_int16_t wrv_sectors_m3_1; + u_int16_t wrv_sectors_m3_2; +/*212*/ u_int16_t wrv_sectors_m2_1; + u_int16_t wrv_sectors_m2_2; +/*214*/ u_int16_t nv_cache_caps; +/*215*/ u_int16_t nv_cache_size_1; + u_int16_t nv_cache_size_2; +/*217*/ u_int16_t media_rotation_rate; + u_int16_t reserved218; +/*219*/ u_int16_t nv_cache_opt; +/*220*/ u_int16_t wrv_mode; + u_int16_t reserved221; +/*222*/ u_int16_t transport_major; +/*223*/ u_int16_t transport_minor; + u_int16_t reserved224[31]; /*255*/ u_int16_t integrity; } __packed; From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 19:16:28 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 283F3106564A; Sun, 19 Sep 2010 19:16:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F11798FC0A; Sun, 19 Sep 2010 19:16:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJGRxo012356; Sun, 19 Sep 2010 19:16:27 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJGRhk012355; Sun, 19 Sep 2010 19:16:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191916.o8JJGRhk012355@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 19:16:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212871 - stable/7/sbin/atacontrol X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 19:16:28 -0000 Author: mav Date: Sun Sep 19 19:16:27 2010 New Revision: 212871 URL: http://svn.freebsd.org/changeset/base/212871 Log: Mark r174034,174665,174683,177262 as merged. Modified: Directory Properties: stable/7/sbin/atacontrol/ (props changed) From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 19:18:35 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C284C1065670; Sun, 19 Sep 2010 19:18:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B16A68FC1F; Sun, 19 Sep 2010 19:18:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJIZ8l012467; Sun, 19 Sep 2010 19:18:35 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJIZwr012465; Sun, 19 Sep 2010 19:18:35 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191918.o8JJIZwr012465@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 19:18:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212872 - stable/7/sbin/atacontrol X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 19:18:36 -0000 Author: mav Date: Sun Sep 19 19:18:35 2010 New Revision: 212872 URL: http://svn.freebsd.org/changeset/base/212872 Log: MFC r199644: Add some missing WDMA/UDMA modes. Modified: stable/7/sbin/atacontrol/atacontrol.c Directory Properties: stable/7/sbin/atacontrol/ (props changed) Modified: stable/7/sbin/atacontrol/atacontrol.c ============================================================================== --- stable/7/sbin/atacontrol/atacontrol.c Sun Sep 19 19:16:27 2010 (r212871) +++ stable/7/sbin/atacontrol/atacontrol.c Sun Sep 19 19:18:35 2010 (r212872) @@ -49,8 +49,13 @@ mode2str(int mode) case ATA_PIO2: return "PIO2"; case ATA_PIO3: return "PIO3"; case ATA_PIO4: return "PIO4"; + case ATA_WDMA0: return "WDMA0"; + case ATA_WDMA1: return "WDMA1"; case ATA_WDMA2: return "WDMA2"; + case ATA_UDMA0: return "UDMA0"; + case ATA_UDMA1: return "UDMA1"; case ATA_UDMA2: return "UDMA33"; + case ATA_UDMA3: return "UDMA44"; case ATA_UDMA4: return "UDMA66"; case ATA_UDMA5: return "UDMA100"; case ATA_UDMA6: return "UDMA133"; @@ -73,9 +78,15 @@ str2mode(char *str) if (!strcasecmp(str, "PIO2")) return ATA_PIO2; if (!strcasecmp(str, "PIO3")) return ATA_PIO3; if (!strcasecmp(str, "PIO4")) return ATA_PIO4; + if (!strcasecmp(str, "WDMA0")) return ATA_WDMA0; + if (!strcasecmp(str, "WDMA1")) return ATA_WDMA1; if (!strcasecmp(str, "WDMA2")) return ATA_WDMA2; + if (!strcasecmp(str, "UDMA0")) return ATA_UDMA0; + if (!strcasecmp(str, "UDMA1")) return ATA_UDMA1; if (!strcasecmp(str, "UDMA2")) return ATA_UDMA2; if (!strcasecmp(str, "UDMA33")) return ATA_UDMA2; + if (!strcasecmp(str, "UDMA3")) return ATA_UDMA3; + if (!strcasecmp(str, "UDMA44")) return ATA_UDMA3; if (!strcasecmp(str, "UDMA4")) return ATA_UDMA4; if (!strcasecmp(str, "UDMA66")) return ATA_UDMA4; if (!strcasecmp(str, "UDMA5")) return ATA_UDMA5; From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 19:43:05 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 675761065698; Sun, 19 Sep 2010 19:43:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55EA78FC0A; Sun, 19 Sep 2010 19:43:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJh5G1013431; Sun, 19 Sep 2010 19:43:05 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJh52m013429; Sun, 19 Sep 2010 19:43:05 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191943.o8JJh52m013429@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 19:43:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212874 - stable/7/sys/geom/mirror X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 19:43:05 -0000 Author: mav Date: Sun Sep 19 19:43:05 2010 New Revision: 212874 URL: http://svn.freebsd.org/changeset/base/212874 Log: MFC r201566: Move wakeup() out of mutex to reduce contention. Modified: stable/7/sys/geom/mirror/g_mirror.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/7/sys/geom/mirror/g_mirror.c Sun Sep 19 19:42:04 2010 (r212873) +++ stable/7/sys/geom/mirror/g_mirror.c Sun Sep 19 19:43:05 2010 (r212874) @@ -853,8 +853,8 @@ g_mirror_done(struct bio *bp) bp->bio_cflags = G_MIRROR_BIO_FLAG_REGULAR; mtx_lock(&sc->sc_queue_mtx); bioq_disksort(&sc->sc_queue, bp); - wakeup(sc); mtx_unlock(&sc->sc_queue_mtx); + wakeup(sc); } static void @@ -939,9 +939,9 @@ g_mirror_regular_request(struct bio *bp) pbp->bio_error = 0; mtx_lock(&sc->sc_queue_mtx); bioq_disksort(&sc->sc_queue, pbp); + mtx_unlock(&sc->sc_queue_mtx); G_MIRROR_DEBUG(4, "%s: Waking up %p.", __func__, sc); wakeup(sc); - mtx_unlock(&sc->sc_queue_mtx); } break; case BIO_DELETE: @@ -979,8 +979,8 @@ g_mirror_sync_done(struct bio *bp) bp->bio_cflags = G_MIRROR_BIO_FLAG_SYNC; mtx_lock(&sc->sc_queue_mtx); bioq_disksort(&sc->sc_queue, bp); - wakeup(sc); mtx_unlock(&sc->sc_queue_mtx); + wakeup(sc); } static void @@ -1092,9 +1092,9 @@ g_mirror_start(struct bio *bp) } mtx_lock(&sc->sc_queue_mtx); bioq_disksort(&sc->sc_queue, bp); + mtx_unlock(&sc->sc_queue_mtx); G_MIRROR_DEBUG(4, "%s: Waking up %p.", __func__, sc); wakeup(sc); - mtx_unlock(&sc->sc_queue_mtx); } /* From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 19:51:15 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A906106564A; Sun, 19 Sep 2010 19:51:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 392338FC18; Sun, 19 Sep 2010 19:51:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJpFnq013841; Sun, 19 Sep 2010 19:51:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJpFGR013839; Sun, 19 Sep 2010 19:51:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191951.o8JJpFGR013839@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 19:51:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212875 - stable/7/sys/geom X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 19:51:15 -0000 Author: mav Date: Sun Sep 19 19:51:14 2010 New Revision: 212875 URL: http://svn.freebsd.org/changeset/base/212875 Log: MFC r196904: Remove msleep() timeout from g_io_schedule_up/down(). It works fine without it, saving few percents of CPU on high request rates without need to rearm callout twice per request. Modified: stable/7/sys/geom/geom_io.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/geom_io.c ============================================================================== --- stable/7/sys/geom/geom_io.c Sun Sep 19 19:43:05 2010 (r212874) +++ stable/7/sys/geom/geom_io.c Sun Sep 19 19:51:14 2010 (r212875) @@ -485,7 +485,7 @@ g_io_schedule_down(struct thread *tp __u if (bp == NULL) { CTR0(KTR_GEOM, "g_down going to sleep"); msleep(&g_wait_down, &g_bio_run_down.bio_queue_lock, - PRIBIO | PDROP, "-", hz/10); + PRIBIO | PDROP, "-", 0); continue; } CTR0(KTR_GEOM, "g_down has work to do"); @@ -590,7 +590,7 @@ g_io_schedule_up(struct thread *tp __unu } CTR0(KTR_GEOM, "g_up going to sleep"); msleep(&g_wait_up, &g_bio_run_up.bio_queue_lock, - PRIBIO | PDROP, "-", hz/10); + PRIBIO | PDROP, "-", 0); } } From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 19:52:26 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF99D1065673; Sun, 19 Sep 2010 19:52:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE3348FC0C; Sun, 19 Sep 2010 19:52:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJqQjU013910; Sun, 19 Sep 2010 19:52:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJqQYK013908; Sun, 19 Sep 2010 19:52:26 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191952.o8JJqQYK013908@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 19:52:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212876 - stable/7/sys/geom X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 19:52:27 -0000 Author: mav Date: Sun Sep 19 19:52:26 2010 New Revision: 212876 URL: http://svn.freebsd.org/changeset/base/212876 Log: MFC r201264: Call wakeup() only for the first request on the queue. Modified: stable/7/sys/geom/geom_io.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/geom_io.c ============================================================================== --- stable/7/sys/geom/geom_io.c Sun Sep 19 19:51:14 2010 (r212875) +++ stable/7/sys/geom/geom_io.c Sun Sep 19 19:52:26 2010 (r212876) @@ -322,6 +322,7 @@ void g_io_request(struct bio *bp, struct g_consumer *cp) { struct g_provider *pp; + int first; KASSERT(cp != NULL, ("NULL cp in g_io_request")); KASSERT(bp != NULL, ("NULL bp in g_io_request")); @@ -388,12 +389,14 @@ g_io_request(struct bio *bp, struct g_co pp->nstart++; cp->nstart++; + first = TAILQ_EMPTY(&g_bio_run_down.bio_queue); TAILQ_INSERT_TAIL(&g_bio_run_down.bio_queue, bp, bio_queue); g_bio_run_down.bio_queue_length++; g_bioq_unlock(&g_bio_run_down); /* Pass it on down. */ - wakeup(&g_wait_down); + if (first) + wakeup(&g_wait_down); } void @@ -401,6 +404,7 @@ g_io_deliver(struct bio *bp, int error) { struct g_consumer *cp; struct g_provider *pp; + int first; KASSERT(bp != NULL, ("NULL bp in g_io_deliver")); pp = bp->bio_to; @@ -454,11 +458,13 @@ g_io_deliver(struct bio *bp, int error) pp->nend++; if (error != ENOMEM) { bp->bio_error = error; + first = TAILQ_EMPTY(&g_bio_run_up.bio_queue); TAILQ_INSERT_TAIL(&g_bio_run_up.bio_queue, bp, bio_queue); bp->bio_flags |= BIO_ONQUEUE; g_bio_run_up.bio_queue_length++; g_bioq_unlock(&g_bio_run_up); - wakeup(&g_wait_up); + if (first) + wakeup(&g_wait_up); return; } g_bioq_unlock(&g_bio_run_up); From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 19:53:42 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48178106566B; Sun, 19 Sep 2010 19:53:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 370368FC16; Sun, 19 Sep 2010 19:53:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJrgFb013981; Sun, 19 Sep 2010 19:53:42 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJrgZp013979; Sun, 19 Sep 2010 19:53:42 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191953.o8JJrgZp013979@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 19:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212877 - stable/7/sys/geom X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 19:53:42 -0000 Author: mav Date: Sun Sep 19 19:53:41 2010 New Revision: 212877 URL: http://svn.freebsd.org/changeset/base/212877 Log: MFC r205619: Do not fetch precise time of request start when stats collection disabled. Modified: stable/7/sys/geom/geom_io.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/geom_io.c ============================================================================== --- stable/7/sys/geom/geom_io.c Sun Sep 19 19:52:26 2010 (r212876) +++ stable/7/sys/geom/geom_io.c Sun Sep 19 19:53:41 2010 (r212877) @@ -374,7 +374,10 @@ g_io_request(struct bio *bp, struct g_co ("Bio already on queue bp=%p", bp)); bp->bio_flags |= BIO_ONQUEUE; - binuptime(&bp->bio_t0); + if (g_collectstats) + binuptime(&bp->bio_t0); + else + getbinuptime(&bp->bio_t0); /* * The statistics collection is lockless, as such, but we From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 19:57:16 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2427A106564A; Sun, 19 Sep 2010 19:57:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 12FC28FC0A; Sun, 19 Sep 2010 19:57:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJvFV4014129; Sun, 19 Sep 2010 19:57:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJvFNX014126; Sun, 19 Sep 2010 19:57:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191957.o8JJvFNX014126@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 19:57:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212878 - stable/7/sys/geom X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 19:57:16 -0000 Author: mav Date: Sun Sep 19 19:57:15 2010 New Revision: 212878 URL: http://svn.freebsd.org/changeset/base/212878 Log: MFC r174669: Don't limit BIO_DELETE requests to MAXPHYS, they perform no data transfers, so they are not subject to the VM system limitation. Modified: stable/7/sys/geom/geom_dev.c stable/7/sys/geom/geom_io.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/geom_dev.c ============================================================================== --- stable/7/sys/geom/geom_dev.c Sun Sep 19 19:53:41 2010 (r212877) +++ stable/7/sys/geom/geom_dev.c Sun Sep 19 19:57:15 2010 (r212878) @@ -314,8 +314,7 @@ g_dev_ioctl(struct cdev *dev, u_long cmd offset = ((off_t *)data)[0]; length = ((off_t *)data)[1]; if ((offset % cp->provider->sectorsize) != 0 || - (length % cp->provider->sectorsize) != 0 || - length <= 0 || length > MAXPHYS) { + (length % cp->provider->sectorsize) != 0 || length <= 0) { printf("%s: offset=%jd length=%jd\n", __func__, offset, length); error = EINVAL; Modified: stable/7/sys/geom/geom_io.c ============================================================================== --- stable/7/sys/geom/geom_io.c Sun Sep 19 19:53:41 2010 (r212877) +++ stable/7/sys/geom/geom_io.c Sun Sep 19 19:57:15 2010 (r212878) @@ -661,9 +661,8 @@ g_delete_data(struct g_consumer *cp, off struct bio *bp; int error; - KASSERT(length > 0 && length >= cp->provider->sectorsize && - length <= MAXPHYS, ("g_delete_data(): invalid length %jd", - (intmax_t)length)); + KASSERT(length > 0 && length >= cp->provider->sectorsize, + ("g_delete_data(): invalid length %jd", (intmax_t)length)); bp = g_alloc_bio(); bp->bio_cmd = BIO_DELETE; From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 20:02:31 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67E051065672; Sun, 19 Sep 2010 20:02:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56AB68FC08; Sun, 19 Sep 2010 20:02:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JK2Vi3014378; Sun, 19 Sep 2010 20:02:31 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JK2VcK014376; Sun, 19 Sep 2010 20:02:31 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009192002.o8JK2VcK014376@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 20:02:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212879 - stable/7/sys/geom X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 20:02:31 -0000 Author: mav Date: Sun Sep 19 20:02:31 2010 New Revision: 212879 URL: http://svn.freebsd.org/changeset/base/212879 Log: MFC r196964: Do not check proper request alignment here in geom_dev in production. It will be checked any way later by g_io_check() in g_io_schedule_down(). It is only needed here to not trigger panic from additional check, when INVARIANTS enabled. So cover it with #ifdef INVARIANTS. It saves two 64bit divisions per request. Modified: stable/7/sys/geom/geom_dev.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/geom_dev.c ============================================================================== --- stable/7/sys/geom/geom_dev.c Sun Sep 19 19:57:15 2010 (r212878) +++ stable/7/sys/geom/geom_dev.c Sun Sep 19 20:02:31 2010 (r212879) @@ -373,14 +373,14 @@ g_dev_strategy(struct bio *bp) cp = dev->si_drv2; KASSERT(cp->acr || cp->acw, ("Consumer with zero access count in g_dev_strategy")); - +#ifdef INVARIANTS if ((bp->bio_offset % cp->provider->sectorsize) != 0 || (bp->bio_bcount % cp->provider->sectorsize) != 0) { bp->bio_resid = bp->bio_bcount; biofinish(bp, NULL, EINVAL); return; } - +#endif for (;;) { /* * XXX: This is not an ideal solution, but I belive it to From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 20:07:41 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26E871065674; Sun, 19 Sep 2010 20:07:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 154DF8FC15; Sun, 19 Sep 2010 20:07:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JK7exQ014585; Sun, 19 Sep 2010 20:07:40 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JK7eDv014583; Sun, 19 Sep 2010 20:07:40 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009192007.o8JK7eDv014583@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 20:07:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212880 - stable/7/sys/geom/raid3 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 20:07:41 -0000 Author: mav Date: Sun Sep 19 20:07:40 2010 New Revision: 212880 URL: http://svn.freebsd.org/changeset/base/212880 Log: MFC r201545: Slightly optimize XOR calculation. Modified: stable/7/sys/geom/raid3/g_raid3.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/raid3/g_raid3.c ============================================================================== --- stable/7/sys/geom/raid3/g_raid3.c Sun Sep 19 20:02:31 2010 (r212879) +++ stable/7/sys/geom/raid3/g_raid3.c Sun Sep 19 20:07:40 2010 (r212880) @@ -231,31 +231,31 @@ g_raid3_uma_dtor(void *mem, int size, vo sz->sz_inuse--; } -#define g_raid3_xor(src1, src2, dst, size) \ - _g_raid3_xor((uint64_t *)(src1), (uint64_t *)(src2), \ +#define g_raid3_xor(src, dst, size) \ + _g_raid3_xor((uint64_t *)(src), \ (uint64_t *)(dst), (size_t)size) static void -_g_raid3_xor(uint64_t *src1, uint64_t *src2, uint64_t *dst, size_t size) +_g_raid3_xor(uint64_t *src, uint64_t *dst, size_t size) { KASSERT((size % 128) == 0, ("Invalid size: %zu.", size)); for (; size > 0; size -= 128) { - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); } } @@ -1049,6 +1049,7 @@ g_raid3_scatter(struct bio *pbp) struct g_raid3_disk *disk; struct bio *bp, *cbp, *tmpbp; off_t atom, cadd, padd, left; + int first; sc = pbp->bio_to->geom->softc; bp = NULL; @@ -1079,12 +1080,18 @@ g_raid3_scatter(struct bio *pbp) /* * Calculate parity. */ - bzero(bp->bio_data, bp->bio_length); + first = 1; G_RAID3_FOREACH_SAFE_BIO(pbp, cbp, tmpbp) { if (cbp == bp) continue; - g_raid3_xor(cbp->bio_data, bp->bio_data, bp->bio_data, - bp->bio_length); + if (first) { + bcopy(cbp->bio_data, bp->bio_data, + bp->bio_length); + first = 0; + } else { + g_raid3_xor(cbp->bio_data, bp->bio_data, + bp->bio_length); + } if ((cbp->bio_cflags & G_RAID3_BIO_CFLAG_NODISK) != 0) g_raid3_destroy_bio(sc, cbp); } @@ -1216,7 +1223,7 @@ g_raid3_gather(struct bio *pbp) G_RAID3_FOREACH_BIO(pbp, cbp) { if ((cbp->bio_cflags & G_RAID3_BIO_CFLAG_PARITY) != 0) continue; - g_raid3_xor(cbp->bio_data, xbp->bio_data, xbp->bio_data, + g_raid3_xor(cbp->bio_data, xbp->bio_data, xbp->bio_length); } xbp->bio_cflags &= ~G_RAID3_BIO_CFLAG_PARITY; @@ -1639,7 +1646,7 @@ g_raid3_sync_request(struct bio *bp) bcopy(src, dst, atom); src += atom; for (n = 1; n < sc->sc_ndisks - 1; n++) { - g_raid3_xor(src, dst, dst, atom); + g_raid3_xor(src, dst, atom); src += atom; } dst += atom; From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 20:08:46 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F208106564A; Sun, 19 Sep 2010 20:08:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DE688FC12; Sun, 19 Sep 2010 20:08:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JK8kKl014654; Sun, 19 Sep 2010 20:08:46 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JK8kcg014652; Sun, 19 Sep 2010 20:08:46 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009192008.o8JK8kcg014652@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 20:08:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212881 - stable/7/sys/geom/raid3 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 20:08:46 -0000 Author: mav Date: Sun Sep 19 20:08:45 2010 New Revision: 212881 URL: http://svn.freebsd.org/changeset/base/212881 Log: MFC r201567: Move wakeup() out of mutex to reduce contention. Modified: stable/7/sys/geom/raid3/g_raid3.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/raid3/g_raid3.c ============================================================================== --- stable/7/sys/geom/raid3/g_raid3.c Sun Sep 19 20:07:40 2010 (r212880) +++ stable/7/sys/geom/raid3/g_raid3.c Sun Sep 19 20:08:45 2010 (r212881) @@ -1271,9 +1271,9 @@ g_raid3_done(struct bio *bp) G_RAID3_LOGREQ(3, bp, "Regular request done (error=%d).", bp->bio_error); mtx_lock(&sc->sc_queue_mtx); bioq_insert_head(&sc->sc_queue, bp); + mtx_unlock(&sc->sc_queue_mtx); wakeup(sc); wakeup(&sc->sc_queue); - mtx_unlock(&sc->sc_queue_mtx); } static void @@ -1379,9 +1379,9 @@ g_raid3_sync_done(struct bio *bp) bp->bio_cflags |= G_RAID3_BIO_CFLAG_SYNC; mtx_lock(&sc->sc_queue_mtx); bioq_insert_head(&sc->sc_queue, bp); + mtx_unlock(&sc->sc_queue_mtx); wakeup(sc); wakeup(&sc->sc_queue); - mtx_unlock(&sc->sc_queue_mtx); } static void @@ -1459,9 +1459,9 @@ g_raid3_start(struct bio *bp) } mtx_lock(&sc->sc_queue_mtx); bioq_insert_tail(&sc->sc_queue, bp); + mtx_unlock(&sc->sc_queue_mtx); G_RAID3_DEBUG(4, "%s: Waking up %p.", __func__, sc); wakeup(sc); - mtx_unlock(&sc->sc_queue_mtx); } /* From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 20:38:35 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB9D0106566C; Sun, 19 Sep 2010 20:38:34 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFBEB8FC15; Sun, 19 Sep 2010 20:38:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JKcYRa016126; Sun, 19 Sep 2010 20:38:34 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JKcYZm016124; Sun, 19 Sep 2010 20:38:34 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201009192038.o8JKcYZm016124@svn.freebsd.org> From: Navdeep Parhar Date: Sun, 19 Sep 2010 20:38:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212883 - stable/7/sys/dev/cxgb/common X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 20:38:35 -0000 Author: np Date: Sun Sep 19 20:38:34 2010 New Revision: 212883 URL: http://svn.freebsd.org/changeset/base/212883 Log: MFC r212710 Fix t3_gate_rx_traffic and t3_open_rx_traffic. Parts of them always operated on XGMAC0 instead of the specified XGMAC. Modified: stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c ============================================================================== --- stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c Sun Sep 19 20:22:48 2010 (r212882) +++ stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c Sun Sep 19 20:38:34 2010 (r212883) @@ -1444,16 +1444,18 @@ static void t3_gate_rx_traffic(struct cm t3_mac_disable_exact_filters(mac); /* stop broadcast, multicast, promiscuous mode traffic */ - *rx_cfg = t3_read_reg(mac->adapter, A_XGM_RX_CFG); - t3_set_reg_field(mac->adapter, A_XGM_RX_CFG, + *rx_cfg = t3_read_reg(mac->adapter, A_XGM_RX_CFG + mac->offset); + t3_set_reg_field(mac->adapter, A_XGM_RX_CFG + mac->offset, F_ENHASHMCAST | F_DISBCAST | F_COPYALLFRAMES, F_DISBCAST); - *rx_hash_high = t3_read_reg(mac->adapter, A_XGM_RX_HASH_HIGH); - t3_write_reg(mac->adapter, A_XGM_RX_HASH_HIGH, 0); - - *rx_hash_low = t3_read_reg(mac->adapter, A_XGM_RX_HASH_LOW); - t3_write_reg(mac->adapter, A_XGM_RX_HASH_LOW, 0); + *rx_hash_high = t3_read_reg(mac->adapter, A_XGM_RX_HASH_HIGH + + mac->offset); + t3_write_reg(mac->adapter, A_XGM_RX_HASH_HIGH + mac->offset, 0); + + *rx_hash_low = t3_read_reg(mac->adapter, A_XGM_RX_HASH_LOW + + mac->offset); + t3_write_reg(mac->adapter, A_XGM_RX_HASH_LOW + mac->offset, 0); /* Leave time to drain max RX fifo */ msleep(1); @@ -1463,11 +1465,13 @@ static void t3_open_rx_traffic(struct cm u32 rx_hash_high, u32 rx_hash_low) { t3_mac_enable_exact_filters(mac); - t3_set_reg_field(mac->adapter, A_XGM_RX_CFG, + t3_set_reg_field(mac->adapter, A_XGM_RX_CFG + mac->offset, F_ENHASHMCAST | F_DISBCAST | F_COPYALLFRAMES, rx_cfg); - t3_write_reg(mac->adapter, A_XGM_RX_HASH_HIGH, rx_hash_high); - t3_write_reg(mac->adapter, A_XGM_RX_HASH_LOW, rx_hash_low); + t3_write_reg(mac->adapter, A_XGM_RX_HASH_HIGH + mac->offset, + rx_hash_high); + t3_write_reg(mac->adapter, A_XGM_RX_HASH_LOW + mac->offset, + rx_hash_low); } static int t3_detect_link_fault(adapter_t *adapter, int port_id) From owner-svn-src-stable-7@FreeBSD.ORG Sun Sep 19 21:10:14 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B1101065670; Sun, 19 Sep 2010 21:10:14 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 151E18FC13; Sun, 19 Sep 2010 21:10:13 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 737D745C89; Sun, 19 Sep 2010 22:49:13 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 5F80945685; Sun, 19 Sep 2010 22:49:08 +0200 (CEST) Date: Sun, 19 Sep 2010 22:48:47 +0200 From: Pawel Jakub Dawidek To: Alexander Motin Message-ID: <20100919204847.GA21347@garage.freebsd.pl> References: <201009191957.o8JJvFNX014126@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mP3DRpeJDSE+ciuQ" Content-Disposition: inline In-Reply-To: <201009191957.o8JJvFNX014126@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r212878 - stable/7/sys/geom X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 21:10:14 -0000 --mP3DRpeJDSE+ciuQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Sep 19, 2010 at 07:57:15PM +0000, Alexander Motin wrote: > - KASSERT(length > 0 && length >=3D cp->provider->sectorsize && > - length <=3D MAXPHYS, ("g_delete_data(): invalid length %jd", > - (intmax_t)length)); > + KASSERT(length > 0 && length >=3D cp->provider->sectorsize, > + ("g_delete_data(): invalid length %jd", (intmax_t)length)); This check looks a bit strange. Leaving only 'length >=3D cp->provider->sectorsize' part should be enough. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --mP3DRpeJDSE+ciuQ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkyWdy8ACgkQForvXbEpPzR8AACcC9Wz829XIgQQzm6qkbek5oN+ lokAnjH/lEGEgQ1bCqDCXgmFInsHkg5I =rN7L -----END PGP SIGNATURE----- --mP3DRpeJDSE+ciuQ-- From owner-svn-src-stable-7@FreeBSD.ORG Mon Sep 20 05:46:15 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5CF14106566B; Mon, 20 Sep 2010 05:46:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BEF08FC12; Mon, 20 Sep 2010 05:46:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8K5kFsu028404; Mon, 20 Sep 2010 05:46:15 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8K5kFgl028402; Mon, 20 Sep 2010 05:46:15 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009200546.o8K5kFgl028402@svn.freebsd.org> From: Andriy Gapon Date: Mon, 20 Sep 2010 05:46:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212888 - stable/7/sys/dev/acpica X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2010 05:46:15 -0000 Author: avg Date: Mon Sep 20 05:46:15 2010 New Revision: 212888 URL: http://svn.freebsd.org/changeset/base/212888 Log: MFC r212549: acpi_cpu: do not apply P_LVLx_LAT rules to latencies returned by _CST Modified: stable/7/sys/dev/acpica/acpi_cpu.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/7/sys/dev/acpica/acpi_cpu.c Mon Sep 20 05:39:50 2010 (r212887) +++ stable/7/sys/dev/acpica/acpi_cpu.c Mon Sep 20 05:46:15 2010 (r212888) @@ -671,19 +671,11 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *s sc->cpu_cx_count++; continue; case ACPI_STATE_C2: - if (cx_ptr->trans_lat > 100) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "acpi_cpu%d: C2[%d] not available.\n", - device_get_unit(sc->cpu_dev), i)); - continue; - } sc->cpu_non_c3 = i; break; case ACPI_STATE_C3: default: - if (cx_ptr->trans_lat > 1000 || - (cpu_quirks & CPU_QUIRK_NO_C3) != 0) { - + if ((cpu_quirks & CPU_QUIRK_NO_C3) != 0) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "acpi_cpu%d: C3[%d] not available.\n", device_get_unit(sc->cpu_dev), i)); From owner-svn-src-stable-7@FreeBSD.ORG Mon Sep 20 05:58:56 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43F361065672; Mon, 20 Sep 2010 05:58:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 180C58FC0C; Mon, 20 Sep 2010 05:58:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8K5wtWU028783; Mon, 20 Sep 2010 05:58:55 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8K5wtZY028780; Mon, 20 Sep 2010 05:58:55 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009200558.o8K5wtZY028780@svn.freebsd.org> From: Andriy Gapon Date: Mon, 20 Sep 2010 05:58:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212890 - in stable/7/sys: kern sys X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2010 05:58:56 -0000 Author: avg Date: Mon Sep 20 05:58:55 2010 New Revision: 212890 URL: http://svn.freebsd.org/changeset/base/212890 Log: MFC r212213: struct device: widen type of flags and order fields to u_int Modified: stable/7/sys/kern/subr_bus.c stable/7/sys/sys/bus.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/subr_bus.c ============================================================================== --- stable/7/sys/kern/subr_bus.c Mon Sep 20 05:56:09 2010 (r212889) +++ stable/7/sys/kern/subr_bus.c Mon Sep 20 05:58:55 2010 (r212890) @@ -117,7 +117,7 @@ struct device { int busy; /**< count of calls to device_busy() */ device_state_t state; /**< current device state */ u_int32_t devflags; /**< api level flags for device_get_flags() */ - u_short flags; /**< internal device flags */ + u_int flags; /**< internal device flags */ #define DF_ENABLED 1 /* device should be probed/attached */ #define DF_FIXEDCLASS 2 /* devclass specified at create time */ #define DF_WILDCARD 4 /* unit was originally wildcard */ @@ -126,8 +126,7 @@ struct device { #define DF_DONENOMATCH 32 /* don't execute DEVICE_NOMATCH again */ #define DF_EXTERNALSOFTC 64 /* softc not allocated by us */ #define DF_REBID 128 /* Can rebid after attach */ - u_char order; /**< order from device_add_child_ordered() */ - u_char pad; + u_int order; /**< order from device_add_child_ordered() */ void *ivars; /**< instance variables */ void *softc; /**< current driver's variables */ @@ -1573,12 +1572,12 @@ device_add_child(device_t dev, const cha * @returns the new device */ device_t -device_add_child_ordered(device_t dev, int order, const char *name, int unit) +device_add_child_ordered(device_t dev, u_int order, const char *name, int unit) { device_t child; device_t place; - PDEBUG(("%s at %s with order %d as unit %d", + PDEBUG(("%s at %s with order %u as unit %d", name, DEVICENAME(dev), order, unit)); child = make_device(dev, name, unit); Modified: stable/7/sys/sys/bus.h ============================================================================== --- stable/7/sys/sys/bus.h Mon Sep 20 05:56:09 2010 (r212889) +++ stable/7/sys/sys/bus.h Mon Sep 20 05:58:55 2010 (r212890) @@ -388,7 +388,7 @@ bus_alloc_resource_any(device_t dev, int * Access functions for device. */ device_t device_add_child(device_t dev, const char *name, int unit); -device_t device_add_child_ordered(device_t dev, int order, +device_t device_add_child_ordered(device_t dev, u_int order, const char *name, int unit); void device_busy(device_t dev); int device_delete_child(device_t dev, device_t child); From owner-svn-src-stable-7@FreeBSD.ORG Mon Sep 20 11:09:31 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4E0B1065679; Mon, 20 Sep 2010 11:09:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F8A58FC1C; Mon, 20 Sep 2010 11:09:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KB9VeI049570; Mon, 20 Sep 2010 11:09:31 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KB9Vj8049546; Mon, 20 Sep 2010 11:09:31 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009201109.o8KB9Vj8049546@svn.freebsd.org> From: Andriy Gapon Date: Mon, 20 Sep 2010 11:09:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212893 - in stable/7/sys: amd64/amd64 arm/arm arm/xscale/ixp425 dev/acpica dev/atkbdc dev/firewire dev/iicbus dev/ppbus dev/spibus i386/i386 ia64/ia64 isa kern pc98/pc98 sparc64/sparc6... X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2010 11:09:31 -0000 Author: avg Date: Mon Sep 20 11:09:31 2010 New Revision: 212893 URL: http://svn.freebsd.org/changeset/base/212893 Log: MFC r212413: bus_add_child: change type of order parameter to u_int Modified: stable/7/sys/amd64/amd64/legacy.c stable/7/sys/amd64/amd64/nexus.c stable/7/sys/arm/arm/nexus.c stable/7/sys/arm/xscale/ixp425/ixp425.c stable/7/sys/dev/acpica/acpi.c stable/7/sys/dev/acpica/acpi_cpu.c stable/7/sys/dev/atkbdc/atkbdc_isa.c stable/7/sys/dev/firewire/firewire.c stable/7/sys/dev/firewire/fwohci_pci.c stable/7/sys/dev/iicbus/iicbus.c stable/7/sys/dev/ppbus/ppbconf.c stable/7/sys/dev/spibus/spibus.c stable/7/sys/i386/i386/legacy.c stable/7/sys/i386/i386/nexus.c stable/7/sys/ia64/ia64/nexus.c stable/7/sys/isa/isa_common.c stable/7/sys/kern/bus_if.m stable/7/sys/kern/subr_bus.c stable/7/sys/pc98/pc98/canbus.c stable/7/sys/sparc64/sparc64/nexus.c stable/7/sys/sun4v/sun4v/nexus.c stable/7/sys/sun4v/sun4v/vnex.c stable/7/sys/sys/bus.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/amd64/amd64/legacy.c ============================================================================== --- stable/7/sys/amd64/amd64/legacy.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/amd64/amd64/legacy.c Mon Sep 20 11:09:31 2010 (r212893) @@ -61,7 +61,7 @@ static void legacy_identify(driver_t *dr static int legacy_probe(device_t); static int legacy_attach(device_t); static int legacy_print_child(device_t, device_t); -static device_t legacy_add_child(device_t bus, int order, const char *name, +static device_t legacy_add_child(device_t bus, u_int order, const char *name, int unit); static int legacy_read_ivar(device_t, device_t, int, uintptr_t *); static int legacy_write_ivar(device_t, device_t, int, uintptr_t); @@ -170,7 +170,7 @@ legacy_print_child(device_t bus, device_ } static device_t -legacy_add_child(device_t bus, int order, const char *name, int unit) +legacy_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct legacy_device *atdev; @@ -234,7 +234,7 @@ legacy_write_ivar(device_t dev, device_t static void cpu_identify(driver_t *driver, device_t parent); static int cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); -static device_t cpu_add_child(device_t bus, int order, const char *name, +static device_t cpu_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource_list *cpu_get_rlist(device_t dev, device_t child); @@ -299,7 +299,7 @@ cpu_identify(driver_t *driver, device_t } static device_t -cpu_add_child(device_t bus, int order, const char *name, int unit) +cpu_add_child(device_t bus, u_int order, const char *name, int unit) { struct cpu_device *cd; device_t child; Modified: stable/7/sys/amd64/amd64/nexus.c ============================================================================== --- stable/7/sys/amd64/amd64/nexus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/amd64/amd64/nexus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -85,7 +85,7 @@ static int nexus_probe(device_t); static int nexus_attach(device_t); static int nexus_print_all_resources(device_t dev); static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t bus, int order, const char *name, +static device_t nexus_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -286,7 +286,7 @@ nexus_print_child(device_t bus, device_t } static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: stable/7/sys/arm/arm/nexus.c ============================================================================== --- stable/7/sys/arm/arm/nexus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/arm/arm/nexus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -74,7 +74,7 @@ static struct rman mem_rman; static int nexus_probe(device_t); static int nexus_attach(device_t); static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t, int, const char *, int); +static device_t nexus_add_child(device_t, u_int, const char *, int); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); static int nexus_activate_resource(device_t, device_t, int, int, @@ -176,7 +176,7 @@ nexus_print_child(device_t bus, device_t static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: stable/7/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- stable/7/sys/arm/xscale/ixp425/ixp425.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/arm/xscale/ixp425/ixp425.c Mon Sep 20 11:09:31 2010 (r212893) @@ -271,7 +271,7 @@ ixp425_hinted_child(device_t bus, const } static device_t -ixp425_add_child(device_t dev, int order, const char *name, int unit) +ixp425_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct ixp425_ivar *ivar; Modified: stable/7/sys/dev/acpica/acpi.c ============================================================================== --- stable/7/sys/dev/acpica/acpi.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/dev/acpica/acpi.c Mon Sep 20 11:09:31 2010 (r212893) @@ -100,7 +100,7 @@ static int acpi_attach(device_t dev); static int acpi_suspend(device_t dev); static int acpi_resume(device_t dev); static int acpi_shutdown(device_t dev); -static device_t acpi_add_child(device_t bus, int order, const char *name, +static device_t acpi_add_child(device_t bus, u_int order, const char *name, int unit); static int acpi_print_child(device_t bus, device_t child); static void acpi_probe_nomatch(device_t bus, device_t child); @@ -744,7 +744,7 @@ acpi_shutdown(device_t dev) * Handle a new device being added */ static device_t -acpi_add_child(device_t bus, int order, const char *name, int unit) +acpi_add_child(device_t bus, u_int order, const char *name, int unit) { struct acpi_device *ad; device_t child; Modified: stable/7/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/7/sys/dev/acpica/acpi_cpu.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/dev/acpica/acpi_cpu.c Mon Sep 20 11:09:31 2010 (r212893) @@ -146,7 +146,7 @@ static int acpi_cpu_resume(device_t dev) static int acpi_pcpu_get_id(uint32_t idx, uint32_t *acpi_id, uint32_t *cpu_id); static struct resource_list *acpi_cpu_get_rlist(device_t dev, device_t child); -static device_t acpi_cpu_add_child(device_t dev, int order, const char *name, +static device_t acpi_cpu_add_child(device_t dev, u_int order, const char *name, int unit); static int acpi_cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); @@ -460,7 +460,7 @@ acpi_cpu_get_rlist(device_t dev, device_ } static device_t -acpi_cpu_add_child(device_t dev, int order, const char *name, int unit) +acpi_cpu_add_child(device_t dev, u_int order, const char *name, int unit) { struct acpi_cpu_device *ad; device_t child; Modified: stable/7/sys/dev/atkbdc/atkbdc_isa.c ============================================================================== --- stable/7/sys/dev/atkbdc/atkbdc_isa.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/dev/atkbdc/atkbdc_isa.c Mon Sep 20 11:09:31 2010 (r212893) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); static int atkbdc_isa_probe(device_t dev); static int atkbdc_isa_attach(device_t dev); -static device_t atkbdc_isa_add_child(device_t bus, int order, char *name, +static device_t atkbdc_isa_add_child(device_t bus, u_int order, char *name, int unit); static device_method_t atkbdc_isa_methods[] = { @@ -227,7 +227,7 @@ atkbdc_isa_attach(device_t dev) } static device_t -atkbdc_isa_add_child(device_t bus, int order, char *name, int unit) +atkbdc_isa_add_child(device_t bus, u_int order, char *name, int unit) { atkbdc_device_t *ivar; device_t child; Modified: stable/7/sys/dev/firewire/firewire.c ============================================================================== --- stable/7/sys/dev/firewire/firewire.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/dev/firewire/firewire.c Mon Sep 20 11:09:31 2010 (r212893) @@ -101,7 +101,7 @@ static void firewire_xfer_timeout(void * #if 0 static int firewire_shutdown (device_t); #endif -static device_t firewire_add_child (device_t, int, const char *, int); +static device_t firewire_add_child(device_t, u_int, const char *, int); static void fw_try_bmr (void *); static void fw_try_bmr_callback (struct fw_xfer *); static void fw_asystart (struct fw_xfer *); @@ -460,7 +460,7 @@ firewire_attach(device_t dev) * Attach it as child. */ static device_t -firewire_add_child(device_t dev, int order, const char *name, int unit) +firewire_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct firewire_softc *sc; Modified: stable/7/sys/dev/firewire/fwohci_pci.c ============================================================================== --- stable/7/sys/dev/firewire/fwohci_pci.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/dev/firewire/fwohci_pci.c Mon Sep 20 11:09:31 2010 (r212893) @@ -490,7 +490,7 @@ fwohci_pci_shutdown(device_t dev) } static device_t -fwohci_pci_add_child(device_t dev, int order, const char *name, int unit) +fwohci_pci_add_child(device_t dev, u_int order, const char *name, int unit) { struct fwohci_softc *sc; device_t child; Modified: stable/7/sys/dev/iicbus/iicbus.c ============================================================================== --- stable/7/sys/dev/iicbus/iicbus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/dev/iicbus/iicbus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -186,7 +186,7 @@ iicbus_read_ivar(device_t bus, device_t } static device_t -iicbus_add_child(device_t dev, int order, const char *name, int unit) +iicbus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct iicbus_ivar *devi; Modified: stable/7/sys/dev/ppbus/ppbconf.c ============================================================================== --- stable/7/sys/dev/ppbus/ppbconf.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/dev/ppbus/ppbconf.c Mon Sep 20 11:09:31 2010 (r212893) @@ -85,7 +85,7 @@ ppbus_probe(device_t dev) * Add a ppbus device, allocate/initialize the ivars */ static device_t -ppbus_add_child(device_t dev, int order, const char *name, int unit) +ppbus_add_child(device_t dev, u_int order, const char *name, int unit) { struct ppb_device *ppbdev; device_t child; Modified: stable/7/sys/dev/spibus/spibus.c ============================================================================== --- stable/7/sys/dev/spibus/spibus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/dev/spibus/spibus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -127,7 +127,7 @@ spibus_read_ivar(device_t bus, device_t } static device_t -spibus_add_child(device_t dev, int order, const char *name, int unit) +spibus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct spibus_ivar *devi; Modified: stable/7/sys/i386/i386/legacy.c ============================================================================== --- stable/7/sys/i386/i386/legacy.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/i386/i386/legacy.c Mon Sep 20 11:09:31 2010 (r212893) @@ -66,7 +66,7 @@ static void legacy_identify(driver_t *dr static int legacy_probe(device_t); static int legacy_attach(device_t); static int legacy_print_child(device_t, device_t); -static device_t legacy_add_child(device_t bus, int order, const char *name, +static device_t legacy_add_child(device_t bus, u_int order, const char *name, int unit); static int legacy_read_ivar(device_t, device_t, int, uintptr_t *); static int legacy_write_ivar(device_t, device_t, int, uintptr_t); @@ -191,7 +191,7 @@ legacy_print_child(device_t bus, device_ } static device_t -legacy_add_child(device_t bus, int order, const char *name, int unit) +legacy_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct legacy_device *atdev; @@ -255,7 +255,7 @@ legacy_write_ivar(device_t dev, device_t static void cpu_identify(driver_t *driver, device_t parent); static int cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); -static device_t cpu_add_child(device_t bus, int order, const char *name, +static device_t cpu_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource_list *cpu_get_rlist(device_t dev, device_t child); @@ -320,7 +320,7 @@ cpu_identify(driver_t *driver, device_t } static device_t -cpu_add_child(device_t bus, int order, const char *name, int unit) +cpu_add_child(device_t bus, u_int order, const char *name, int unit) { struct cpu_device *cd; device_t child; Modified: stable/7/sys/i386/i386/nexus.c ============================================================================== --- stable/7/sys/i386/i386/nexus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/i386/i386/nexus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -89,7 +89,7 @@ static int nexus_probe(device_t); static int nexus_attach(device_t); static int nexus_print_all_resources(device_t dev); static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t bus, int order, const char *name, +static device_t nexus_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -298,7 +298,7 @@ nexus_print_child(device_t bus, device_t } static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: stable/7/sys/ia64/ia64/nexus.c ============================================================================== --- stable/7/sys/ia64/ia64/nexus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/ia64/ia64/nexus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -76,7 +76,7 @@ static struct rman irq_rman, drq_rman, p static int nexus_probe(device_t); static int nexus_attach(device_t); static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t bus, int order, const char *name, +static device_t nexus_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -248,7 +248,7 @@ nexus_print_child(device_t bus, device_t } static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: stable/7/sys/isa/isa_common.c ============================================================================== --- stable/7/sys/isa/isa_common.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/isa/isa_common.c Mon Sep 20 11:09:31 2010 (r212893) @@ -617,7 +617,7 @@ isa_probe_children(device_t dev) * Add a new child with default ivars. */ static device_t -isa_add_child(device_t dev, int order, const char *name, int unit) +isa_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct isa_device *idev; Modified: stable/7/sys/kern/bus_if.m ============================================================================== --- stable/7/sys/kern/bus_if.m Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/kern/bus_if.m Mon Sep 20 11:09:31 2010 (r212893) @@ -191,7 +191,7 @@ METHOD void driver_added { */ METHOD device_t add_child { device_t _dev; - int _order; + u_int _order; const char *_name; int _unit; }; Modified: stable/7/sys/kern/subr_bus.c ============================================================================== --- stable/7/sys/kern/subr_bus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/kern/subr_bus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -2879,7 +2879,7 @@ resource_list_purge(struct resource_list } device_t -bus_generic_add_child(device_t dev, int order, const char *name, int unit) +bus_generic_add_child(device_t dev, u_int order, const char *name, int unit) { return (device_add_child_ordered(dev, order, name, unit)); Modified: stable/7/sys/pc98/pc98/canbus.c ============================================================================== --- stable/7/sys/pc98/pc98/canbus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/pc98/pc98/canbus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -82,7 +82,7 @@ static int canbus_detach(device_t); /* Bus interface methods */ static int canbus_print_child(device_t, device_t); -static device_t canbus_add_child(device_t, int, const char *, int); +static device_t canbus_add_child(device_t, u_int, const char *, int); static struct resource * canbus_alloc_resource( device_t, device_t, int, int *, u_long, u_long, u_long, u_int); static int canbus_activate_resource( @@ -235,7 +235,7 @@ canbus_print_child(device_t dev, device_ } static device_t -canbus_add_child(device_t bus, int order, const char *name, int unit) +canbus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct canbus_device *cbdev; Modified: stable/7/sys/sparc64/sparc64/nexus.c ============================================================================== --- stable/7/sys/sparc64/sparc64/nexus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/sparc64/sparc64/nexus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -257,7 +257,7 @@ nexus_attach(device_t dev) } static device_t -nexus_add_child(device_t dev, int order, const char *name, int unit) +nexus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t cdev; struct nexus_devinfo *ndi; Modified: stable/7/sys/sun4v/sun4v/nexus.c ============================================================================== --- stable/7/sys/sun4v/sun4v/nexus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/sun4v/sun4v/nexus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -234,7 +234,7 @@ nexus_attach(device_t dev) } static device_t -nexus_add_child(device_t dev, int order, const char *name, int unit) +nexus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t cdev; struct nexus_devinfo *ndi; Modified: stable/7/sys/sun4v/sun4v/vnex.c ============================================================================== --- stable/7/sys/sun4v/sun4v/vnex.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/sun4v/sun4v/vnex.c Mon Sep 20 11:09:31 2010 (r212893) @@ -204,7 +204,7 @@ vnex_attach(device_t dev) } static device_t -vnex_add_child(device_t dev, int order, const char *name, int unit) +vnex_add_child(device_t dev, u_int order, const char *name, int unit) { device_t cdev; struct vnex_devinfo *vndi; Modified: stable/7/sys/sys/bus.h ============================================================================== --- stable/7/sys/sys/bus.h Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/sys/bus.h Mon Sep 20 11:09:31 2010 (r212893) @@ -279,7 +279,7 @@ void root_bus_configure(void); int bus_generic_activate_resource(device_t dev, device_t child, int type, int rid, struct resource *r); device_t - bus_generic_add_child(device_t dev, int order, const char *name, + bus_generic_add_child(device_t dev, u_int order, const char *name, int unit); struct resource * bus_generic_alloc_resource(device_t bus, device_t child, int type, From owner-svn-src-stable-7@FreeBSD.ORG Mon Sep 20 11:18:21 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 373AD1065781; Mon, 20 Sep 2010 11:18:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C4068FC14; Mon, 20 Sep 2010 11:18:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KBIKG6049907; Mon, 20 Sep 2010 11:18:20 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KBIKd2049905; Mon, 20 Sep 2010 11:18:20 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009201118.o8KBIKd2049905@svn.freebsd.org> From: Andriy Gapon Date: Mon, 20 Sep 2010 11:18:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212895 - stable/7/sys/kern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2010 11:18:21 -0000 Author: avg Date: Mon Sep 20 11:18:20 2010 New Revision: 212895 URL: http://svn.freebsd.org/changeset/base/212895 Log: MFC r212325: subr_bus: use hexadecimal representation for bit flags Modified: stable/7/sys/kern/subr_bus.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/subr_bus.c ============================================================================== --- stable/7/sys/kern/subr_bus.c Mon Sep 20 11:15:23 2010 (r212894) +++ stable/7/sys/kern/subr_bus.c Mon Sep 20 11:18:20 2010 (r212895) @@ -118,14 +118,14 @@ struct device { device_state_t state; /**< current device state */ u_int32_t devflags; /**< api level flags for device_get_flags() */ u_int flags; /**< internal device flags */ -#define DF_ENABLED 1 /* device should be probed/attached */ -#define DF_FIXEDCLASS 2 /* devclass specified at create time */ -#define DF_WILDCARD 4 /* unit was originally wildcard */ -#define DF_DESCMALLOCED 8 /* description was malloced */ -#define DF_QUIET 16 /* don't print verbose attach message */ -#define DF_DONENOMATCH 32 /* don't execute DEVICE_NOMATCH again */ -#define DF_EXTERNALSOFTC 64 /* softc not allocated by us */ -#define DF_REBID 128 /* Can rebid after attach */ +#define DF_ENABLED 0x01 /* device should be probed/attached */ +#define DF_FIXEDCLASS 0x02 /* devclass specified at create time */ +#define DF_WILDCARD 0x04 /* unit was originally wildcard */ +#define DF_DESCMALLOCED 0x08 /* description was malloced */ +#define DF_QUIET 0x10 /* don't print verbose attach message */ +#define DF_DONENOMATCH 0x20 /* don't execute DEVICE_NOMATCH again */ +#define DF_EXTERNALSOFTC 0x40 /* softc not allocated by us */ +#define DF_REBID 0x80 /* Can rebid after attach */ u_int order; /**< order from device_add_child_ordered() */ void *ivars; /**< instance variables */ void *softc; /**< current driver's variables */ From owner-svn-src-stable-7@FreeBSD.ORG Mon Sep 20 13:48:07 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C3DD1065694; Mon, 20 Sep 2010 13:48:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BAD28FC20; Mon, 20 Sep 2010 13:48:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KDm7AR053783; Mon, 20 Sep 2010 13:48:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KDm7TV053781; Mon, 20 Sep 2010 13:48:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009201348.o8KDm7TV053781@svn.freebsd.org> From: Alexander Motin Date: Mon, 20 Sep 2010 13:48:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212900 - stable/7/sys/dev/hptrr X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2010 13:48:07 -0000 Author: mav Date: Mon Sep 20 13:48:07 2010 New Revision: 212900 URL: http://svn.freebsd.org/changeset/base/212900 Log: MFC r196415: Fill cpi->transport in XPT_PATH_INQ. Modified: stable/7/sys/dev/hptrr/hptrr_osm_bsd.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/hptrr/hptrr_osm_bsd.c ============================================================================== --- stable/7/sys/dev/hptrr/hptrr_osm_bsd.c Mon Sep 20 13:23:43 2010 (r212899) +++ stable/7/sys/dev/hptrr/hptrr_osm_bsd.c Mon Sep 20 13:48:07 2010 (r212900) @@ -820,6 +820,10 @@ static void hpt_action(struct cam_sim *s strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strncpy(cpi->hba_vid, "HPT ", HBA_IDLEN); strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); + cpi->transport = XPORT_SPI; + cpi->transport_version = 2; + cpi->protocol = PROTO_SCSI; + cpi->protocol_version = SCSI_REV_2; cpi->ccb_h.status = CAM_REQ_CMP; break; } From owner-svn-src-stable-7@FreeBSD.ORG Mon Sep 20 14:58:08 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0337106566B; Mon, 20 Sep 2010 14:58:08 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 720DA8FC21; Mon, 20 Sep 2010 14:58:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KEw8eK055723; Mon, 20 Sep 2010 14:58:08 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KEw8qd055721; Mon, 20 Sep 2010 14:58:08 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201009201458.o8KEw8qd055721@svn.freebsd.org> From: Colin Percival Date: Mon, 20 Sep 2010 14:58:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212901 - head/contrib/bzip2 releng/6.4 releng/6.4/contrib/bzip2 releng/6.4/sys/conf releng/7.1 releng/7.1/contrib/bzip2 releng/7.1/sys/conf releng/7.3 releng/7.3/contrib/bzip2 releng/7... X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2010 14:58:08 -0000 Author: cperciva Date: Mon Sep 20 14:58:08 2010 New Revision: 212901 URL: http://svn.freebsd.org/changeset/base/212901 Log: Fix an integer overflow in RLE length parsing when decompressing corrupt bzip2 data. Approved by: so (cperciva) Security: FreeBSD-SA-10:08.bzip2 Modified: stable/7/contrib/bzip2/decompress.c Changes in other areas also in this revision: Modified: head/contrib/bzip2/decompress.c releng/6.4/UPDATING releng/6.4/contrib/bzip2/decompress.c releng/6.4/sys/conf/newvers.sh releng/7.1/UPDATING releng/7.1/contrib/bzip2/decompress.c releng/7.1/sys/conf/newvers.sh releng/7.3/UPDATING releng/7.3/contrib/bzip2/decompress.c releng/7.3/sys/conf/newvers.sh releng/8.0/UPDATING releng/8.0/contrib/bzip2/decompress.c releng/8.0/sys/conf/newvers.sh releng/8.1/UPDATING releng/8.1/contrib/bzip2/decompress.c releng/8.1/sys/conf/newvers.sh stable/6/contrib/bzip2/decompress.c stable/8/contrib/bzip2/decompress.c Modified: stable/7/contrib/bzip2/decompress.c ============================================================================== --- stable/7/contrib/bzip2/decompress.c Mon Sep 20 13:48:07 2010 (r212900) +++ stable/7/contrib/bzip2/decompress.c Mon Sep 20 14:58:08 2010 (r212901) @@ -381,6 +381,13 @@ Int32 BZ2_decompress ( DState* s ) es = -1; N = 1; do { + /* Check that N doesn't get too big, so that es doesn't + go negative. The maximum value that can be + RUNA/RUNB encoded is equal to the block size (post + the initial RLE), viz, 900k, so bounding N at 2 + million should guard against overflow without + rejecting any legitimate inputs. */ + if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); if (nextSym == BZ_RUNA) es = es + (0+1) * N; else if (nextSym == BZ_RUNB) es = es + (1+1) * N; N = N * 2; From owner-svn-src-stable-7@FreeBSD.ORG Mon Sep 20 18:26:37 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A63DD1065674; Mon, 20 Sep 2010 18:26:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 94B898FC1B; Mon, 20 Sep 2010 18:26:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KIQbOX062414; Mon, 20 Sep 2010 18:26:37 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KIQb0K062412; Mon, 20 Sep 2010 18:26:37 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201009201826.o8KIQb0K062412@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 20 Sep 2010 18:26:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212910 - stable/7/sys/contrib/pf/net X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2010 18:26:37 -0000 Author: bz Date: Mon Sep 20 18:26:37 2010 New Revision: 212910 URL: http://svn.freebsd.org/changeset/base/212910 Log: MFC r212403: When using pf routing options, properly handle IP fragmentation for interfaces with TSO enabled, otherwise one would see an extra ICMP unreach, frag needed pre matching packet on lo0. This syncs pf code to ip_output.c r162084. Submitted by: yongari via mlaier PR: kern/144311 Modified: stable/7/sys/contrib/pf/net/pf.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/contrib/pf/net/pf.c ============================================================================== --- stable/7/sys/contrib/pf/net/pf.c Mon Sep 20 18:20:35 2010 (r212909) +++ stable/7/sys/contrib/pf/net/pf.c Mon Sep 20 18:26:37 2010 (r212910) @@ -6376,6 +6376,7 @@ pf_route(struct mbuf **m, struct pf_rule m0->m_pkthdr.csum_flags &= ifp->if_hwassist; if (ntohs(ip->ip_len) <= ifp->if_mtu || + (m0->m_pkthdr.csum_flags & ifp->if_hwassist & CSUM_TSO) != 0 || (ifp->if_hwassist & CSUM_FRAGMENT && ((ip->ip_off & htons(IP_DF)) == 0))) { /* @@ -6450,7 +6451,7 @@ pf_route(struct mbuf **m, struct pf_rule * Too large for interface; fragment if possible. * Must be able to put at least 8 bytes per fragment. */ - if (ip->ip_off & htons(IP_DF)) { + if (ip->ip_off & htons(IP_DF) || (m0->m_pkthdr.csum_flags & CSUM_TSO)) { ipstat.ips_cantfrag++; if (r->rt != PF_DUPTO) { #ifdef __FreeBSD__ From owner-svn-src-stable-7@FreeBSD.ORG Mon Sep 20 18:41:16 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F4B1106566C; Mon, 20 Sep 2010 18:41:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E0E38FC12; Mon, 20 Sep 2010 18:41:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KIfFf2062957; Mon, 20 Sep 2010 18:41:15 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KIfFbN062955; Mon, 20 Sep 2010 18:41:15 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201841.o8KIfFbN062955@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 18:41:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212912 - stable/7/sys/netinet X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2010 18:41:16 -0000 Author: jhb Date: Mon Sep 20 18:41:15 2010 New Revision: 212912 URL: http://svn.freebsd.org/changeset/base/212912 Log: MFC 211888: Simplify the tcp pcblist estimate logic slightly. Modified: stable/7/sys/netinet/tcp_subr.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/netinet/tcp_subr.c ============================================================================== --- stable/7/sys/netinet/tcp_subr.c Mon Sep 20 18:40:54 2010 (r212911) +++ stable/7/sys/netinet/tcp_subr.c Mon Sep 20 18:41:15 2010 (r212912) @@ -937,11 +937,9 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) * resource-intensive to repeat twice on every request. */ if (req->oldptr == NULL) { - m = syncache_pcbcount(); - n = tcbinfo.ipi_count; - n += imax((m + n) / 8, 10); - req->oldidx = 2 * (sizeof xig) + - (m + n) * sizeof(struct xtcpcb); + n = tcbinfo.ipi_count + syncache_pcbcount(); + n += imax(n / 8, 10); + req->oldidx = 2 * (sizeof xig) + n * sizeof(struct xtcpcb); return (0); } From owner-svn-src-stable-7@FreeBSD.ORG Mon Sep 20 18:58:45 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AE621065670; Mon, 20 Sep 2010 18:58:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 09D9E8FC18; Mon, 20 Sep 2010 18:58:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KIwi9F063525; Mon, 20 Sep 2010 18:58:44 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KIwiAi063523; Mon, 20 Sep 2010 18:58:44 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201858.o8KIwiAi063523@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 18:58:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212915 - stable/7/sys/boot/forth X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2010 18:58:45 -0000 Author: jhb Date: Mon Sep 20 18:58:44 2010 New Revision: 212915 URL: http://svn.freebsd.org/changeset/base/212915 Log: MFC 212338: If autoboot_delay is set to -1, boot immediately without checking for a keypress to match the behavior of the loader. Modified: stable/7/sys/boot/forth/beastie.4th Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/boot/forth/beastie.4th ============================================================================== --- stable/7/sys/boot/forth/beastie.4th Mon Sep 20 18:58:24 2010 (r212914) +++ stable/7/sys/boot/forth/beastie.4th Mon Sep 20 18:58:44 2010 (r212915) @@ -240,7 +240,10 @@ set-current drop 10 else - 0 0 2swap >number drop drop drop + 2dup s" -1" compare 0= if + 0 boot + then + 0 s>d 2swap >number 2drop drop then begin dup tkey From owner-svn-src-stable-7@FreeBSD.ORG Mon Sep 20 19:17:32 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04BD51065674; Mon, 20 Sep 2010 19:17:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E78A38FC16; Mon, 20 Sep 2010 19:17:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KJHVI5064220; Mon, 20 Sep 2010 19:17:31 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KJHVbm064218; Mon, 20 Sep 2010 19:17:31 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201917.o8KJHVbm064218@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 19:17:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212919 - stable/7/usr.sbin/pciconf X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2010 19:17:32 -0000 Author: jhb Date: Mon Sep 20 19:17:31 2010 New Revision: 212919 URL: http://svn.freebsd.org/changeset/base/212919 Log: MFC 212329: Simplify chkattached(). The PCIOCATTACHED ioctl only needs the pi_sel field populated, it ignores the rest of the 'pci_io' structure. Modified: stable/7/usr.sbin/pciconf/pciconf.c Directory Properties: stable/7/usr.sbin/pciconf/ (props changed) Modified: stable/7/usr.sbin/pciconf/pciconf.c ============================================================================== --- stable/7/usr.sbin/pciconf/pciconf.c Mon Sep 20 19:17:21 2010 (r212918) +++ stable/7/usr.sbin/pciconf/pciconf.c Mon Sep 20 19:17:31 2010 (r212919) @@ -75,7 +75,7 @@ static const char *guess_subclass(struct static int load_vendors(void); static void readit(const char *, const char *, int); static void writeit(const char *, const char *, const char *, int); -static void chkattached(const char *, int); +static void chkattached(const char *); static int exitstatus = 0; @@ -148,8 +148,7 @@ main(int argc, char **argv) if (listmode) { list_devs(verbose, bars, caps); } else if (attachedmode) { - chkattached(argv[optind], - byte ? 1 : isshort ? 2 : 4); + chkattached(argv[optind]); } else if (readmode) { readit(argv[optind], argv[optind + 1], byte ? 1 : isshort ? 2 : 4); @@ -645,15 +644,12 @@ writeit(const char *name, const char *re } static void -chkattached(const char *name, int width) +chkattached(const char *name) { int fd; struct pci_io pi; pi.pi_sel = getsel(name); - pi.pi_reg = 0; - pi.pi_width = width; - pi.pi_data = 0; fd = open(_PATH_DEVPCI, O_RDWR, 0); if (fd < 0) From owner-svn-src-stable-7@FreeBSD.ORG Mon Sep 20 19:25:27 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85221106578D; Mon, 20 Sep 2010 19:25:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 739998FC0A; Mon, 20 Sep 2010 19:25:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KJPRYB064614; Mon, 20 Sep 2010 19:25:27 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KJPRie064612; Mon, 20 Sep 2010 19:25:27 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201925.o8KJPRie064612@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 19:25:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212922 - stable/7/usr.sbin/pciconf X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2010 19:25:27 -0000 Author: jhb Date: Mon Sep 20 19:25:27 2010 New Revision: 212922 URL: http://svn.freebsd.org/changeset/base/212922 Log: MFC 212369: - Use 'sta' to hold the PCIR_STATUS register value instead of 'cmd' when walking the capability list. - Use constants for PCI header types instead of magic numbers. Modified: stable/7/usr.sbin/pciconf/cap.c Directory Properties: stable/7/usr.sbin/pciconf/ (props changed) Modified: stable/7/usr.sbin/pciconf/cap.c ============================================================================== --- stable/7/usr.sbin/pciconf/cap.c Mon Sep 20 19:25:15 2010 (r212921) +++ stable/7/usr.sbin/pciconf/cap.c Mon Sep 20 19:25:27 2010 (r212922) @@ -458,20 +458,20 @@ cap_pciaf(int fd, struct pci_conf *p, ui void list_caps(int fd, struct pci_conf *p) { - uint16_t cmd; + uint16_t sta; uint8_t ptr, cap; /* Are capabilities present for this device? */ - cmd = read_config(fd, &p->pc_sel, PCIR_STATUS, 2); - if (!(cmd & PCIM_STATUS_CAPPRESENT)) + sta = read_config(fd, &p->pc_sel, PCIR_STATUS, 2); + if (!(sta & PCIM_STATUS_CAPPRESENT)) return; switch (p->pc_hdr & PCIM_HDRTYPE) { - case 0: - case 1: + case PCIM_HDRTYPE_NORMAL: + case PCIM_HDRTYPE_BRIDGE: ptr = PCIR_CAP_PTR; break; - case 2: + case PCIM_HDRTYPE_CARDBUS: ptr = PCIR_CAP_PTR_2; break; default: From owner-svn-src-stable-7@FreeBSD.ORG Mon Sep 20 19:30:21 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5EEAA1065697; Mon, 20 Sep 2010 19:30:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C83B8FC1D; Mon, 20 Sep 2010 19:30:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KJULul064854; Mon, 20 Sep 2010 19:30:21 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KJULNE064851; Mon, 20 Sep 2010 19:30:21 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201930.o8KJULNE064851@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 19:30:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212924 - in stable/7: sys/dev/pci usr.sbin/pciconf X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2010 19:30:21 -0000 Author: jhb Date: Mon Sep 20 19:30:20 2010 New Revision: 212924 URL: http://svn.freebsd.org/changeset/base/212924 Log: MFC 209907,212326,212368,212749: - Provide more defines for PCI-Express device ctrl. - Add register definitions related to extended capability IDs in PCI-express. I used PCIZ_* for ID constants (plain capability IDs use PCIY_*). - Add register definitions for the Advanced Error Reporting, Virtual Channels, and Device Serial Number extended capabilities. - Teach pciconf -c to list extended as well as plain capabilities for PCI-express devices. Adds more detailed parsing for AER, VC, and device serial numbers. Modified: stable/7/sys/dev/pci/pcireg.h stable/7/usr.sbin/pciconf/cap.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/usr.sbin/pciconf/ (props changed) Modified: stable/7/sys/dev/pci/pcireg.h ============================================================================== --- stable/7/sys/dev/pci/pcireg.h Mon Sep 20 19:29:48 2010 (r212923) +++ stable/7/sys/dev/pci/pcireg.h Mon Sep 20 19:30:20 2010 (r212924) @@ -36,6 +36,7 @@ * PCIV_xxx: PCI vendor ID (only required to fixup ancient devices) * PCID_xxx: device ID * PCIY_xxx: capability identification number + * PCIZ_xxx: extended capability identification number */ /* some PCI bus constants */ @@ -66,7 +67,8 @@ #define PCIM_STATUS_CAPPRESENT 0x0010 #define PCIM_STATUS_66CAPABLE 0x0020 #define PCIM_STATUS_BACKTOBACK 0x0080 -#define PCIM_STATUS_PERRREPORT 0x0100 +#define PCIM_STATUS_MDPERR 0x0100 +#define PCIM_STATUS_PERRREPORT PCIM_STATUS_MDPERR #define PCIM_STATUS_SEL_FAST 0x0000 #define PCIM_STATUS_SEL_MEDIMUM 0x0200 #define PCIM_STATUS_SEL_SLOW 0x0400 @@ -117,6 +119,28 @@ #define PCIY_SATA 0x12 /* SATA */ #define PCIY_PCIAF 0x13 /* PCI Advanced Features */ +/* Extended Capability Register Fields */ + +#define PCIR_EXTCAP 0x100 +#define PCIM_EXTCAP_ID 0x0000ffff +#define PCIM_EXTCAP_VER 0x000f0000 +#define PCIM_EXTCAP_NEXTPTR 0xfff00000 +#define PCI_EXTCAP_ID(ecap) ((ecap) & PCIM_EXTCAP_ID) +#define PCI_EXTCAP_VER(ecap) (((ecap) & PCIM_EXTCAP_VER) >> 16) +#define PCI_EXTCAP_NEXTPTR(ecap) (((ecap) & PCIM_EXTCAP_NEXTPTR) >> 20) + +/* Extended Capability Identification Numbers */ + +#define PCIZ_AER 0x0001 /* Advanced Error Reporting */ +#define PCIZ_VC 0x0002 /* Virtual Channel */ +#define PCIZ_SERNUM 0x0003 /* Device Serial Number */ +#define PCIZ_PWRBDGT 0x0004 /* Power Budgeting */ +#define PCIZ_VENDOR 0x000b /* Vendor Unique */ +#define PCIZ_ACS 0x000d /* Access Control Services */ +#define PCIZ_ARI 0x000e /* Alternative Routing-ID Interpretation */ +#define PCIZ_ATS 0x000f /* Address Translation Services */ +#define PCIZ_SRIOV 0x0010 /* Single Root IO Virtualization */ + /* config registers for header type 0 devices */ #define PCIR_BARS 0x10 @@ -605,6 +629,9 @@ #define PCIR_EXPRESS_DEVICE_CAP 0x4 #define PCIM_EXP_CAP_MAX_PAYLOAD 0x0007 #define PCIR_EXPRESS_DEVICE_CTL 0x8 +#define PCIM_EXP_CTL_NFER_ENABLE 0x0002 +#define PCIM_EXP_CTL_FER_ENABLE 0x0004 +#define PCIM_EXP_CTL_URR_ENABLE 0x0008 #define PCIM_EXP_CTL_RELAXED_ORD_ENABLE 0x0010 #define PCIM_EXP_CTL_MAX_PAYLOAD 0x00e0 #define PCIM_EXP_CTL_NOSNOOP_ENABLE 0x0800 @@ -660,3 +687,64 @@ #define PCIR_PCIAFCTRL_FLR 0x01 #define PCIR_PCIAF_STATUS 0x5 #define PCIR_PCIAFSTATUS_TP 0x01 + +/* Advanced Error Reporting */ +#define PCIR_AER_UC_STATUS 0x04 +#define PCIM_AER_UC_TRAINING_ERROR 0x00000001 +#define PCIM_AER_UC_DL_PROTOCOL_ERROR 0x00000010 +#define PCIM_AER_UC_POISONED_TLP 0x00001000 +#define PCIM_AER_UC_FC_PROTOCOL_ERROR 0x00002000 +#define PCIM_AER_UC_COMPLETION_TIMEOUT 0x00004000 +#define PCIM_AER_UC_COMPLETER_ABORT 0x00008000 +#define PCIM_AER_UC_UNEXPECTED_COMPLETION 0x00010000 +#define PCIM_AER_UC_RECEIVER_OVERFLOW 0x00020000 +#define PCIM_AER_UC_MALFORMED_TLP 0x00040000 +#define PCIM_AER_UC_ECRC_ERROR 0x00080000 +#define PCIM_AER_UC_UNSUPPORTED_REQUEST 0x00100000 +#define PCIM_AER_UC_ACS_VIOLATION 0x00200000 +#define PCIR_AER_UC_MASK 0x08 /* Shares bits with UC_STATUS */ +#define PCIR_AER_UC_SEVERITY 0x0c /* Shares bits with UC_STATUS */ +#define PCIR_AER_COR_STATUS 0x10 +#define PCIM_AER_COR_RECEIVER_ERROR 0x00000001 +#define PCIM_AER_COR_BAD_TLP 0x00000040 +#define PCIM_AER_COR_BAD_DLLP 0x00000080 +#define PCIM_AER_COR_REPLAY_ROLLOVER 0x00000100 +#define PCIM_AER_COR_REPLAY_TIMEOUT 0x00001000 +#define PCIR_AER_COR_MASK 0x14 /* Shares bits with COR_STATUS */ +#define PCIR_AER_CAP_CONTROL 0x18 +#define PCIM_AER_FIRST_ERROR_PTR 0x0000001f +#define PCIM_AER_ECRC_GEN_CAPABLE 0x00000020 +#define PCIM_AER_ECRC_GEN_ENABLE 0x00000040 +#define PCIM_AER_ECRC_CHECK_CAPABLE 0x00000080 +#define PCIM_AER_ECRC_CHECK_ENABLE 0x00000100 +#define PCIR_AER_HEADER_LOG 0x1c +#define PCIR_AER_ROOTERR_CMD 0x2c /* Only for root complex ports */ +#define PCIM_AER_ROOTERR_COR_ENABLE 0x00000001 +#define PCIM_AER_ROOTERR_NF_ENABLE 0x00000002 +#define PCIM_AER_ROOTERR_F_ENABLE 0x00000004 +#define PCIR_AER_ROOTERR_STATUS 0x30 /* Only for root complex ports */ +#define PCIM_AER_ROOTERR_COR_ERR 0x00000001 +#define PCIM_AER_ROOTERR_MULTI_COR_ERR 0x00000002 +#define PCIM_AER_ROOTERR_UC_ERR 0x00000004 +#define PCIM_AER_ROOTERR_MULTI_UC_ERR 0x00000008 +#define PCIM_AER_ROOTERR_FIRST_UC_FATAL 0x00000010 +#define PCIM_AER_ROOTERR_NF_ERR 0x00000020 +#define PCIM_AER_ROOTERR_F_ERR 0x00000040 +#define PCIM_AER_ROOTERR_INT_MESSAGE 0xf8000000 +#define PCIR_AER_COR_SOURCE_ID 0x34 /* Only for root complex ports */ +#define PCIR_AER_ERR_SOURCE_ID 0x36 /* Only for root complex ports */ + +/* Virtual Channel definitions */ +#define PCIR_VC_CAP1 0x04 +#define PCIM_VC_CAP1_EXT_COUNT 0x00000007 +#define PCIM_VC_CAP1_LOWPRI_EXT_COUNT 0x00000070 +#define PCIR_VC_CAP2 0x08 +#define PCIR_VC_CONTROL 0x0C +#define PCIR_VC_STATUS 0x0E +#define PCIR_VC_RESOURCE_CAP(n) (0x10 + (n) * 0x0C) +#define PCIR_VC_RESOURCE_CTL(n) (0x14 + (n) * 0x0C) +#define PCIR_VC_RESOURCE_STA(n) (0x18 + (n) * 0x0C) + +/* Serial Number definitions */ +#define PCIR_SERIAL_LOW 0x04 +#define PCIR_SERIAL_HIGH 0x08 Modified: stable/7/usr.sbin/pciconf/cap.c ============================================================================== --- stable/7/usr.sbin/pciconf/cap.c Mon Sep 20 19:29:48 2010 (r212923) +++ stable/7/usr.sbin/pciconf/cap.c Mon Sep 20 19:30:20 2010 (r212924) @@ -45,6 +45,8 @@ static const char rcsid[] = #include "pciconf.h" +static void list_ecaps(int fd, struct pci_conf *p); + static void cap_power(int fd, struct pci_conf *p, uint8_t ptr) { @@ -458,6 +460,7 @@ cap_pciaf(int fd, struct pci_conf *p, ui void list_caps(int fd, struct pci_conf *p) { + int express; uint16_t sta; uint8_t ptr, cap; @@ -479,6 +482,7 @@ list_caps(int fd, struct pci_conf *p) } /* Walk the capability list. */ + express = 0; ptr = read_config(fd, &p->pc_sel, ptr, 1); while (ptr != 0 && ptr != 0xff) { cap = read_config(fd, &p->pc_sel, ptr + PCICAP_ID, 1); @@ -512,6 +516,7 @@ list_caps(int fd, struct pci_conf *p) cap_subvendor(fd, p, ptr); break; case PCIY_EXPRESS: + express = 1; cap_express(fd, p, ptr); break; case PCIY_MSIX: @@ -530,4 +535,98 @@ list_caps(int fd, struct pci_conf *p) printf("\n"); ptr = read_config(fd, &p->pc_sel, ptr + PCICAP_NEXTPTR, 1); } + + if (express) + list_ecaps(fd, p); +} + +/* From . */ +static __inline uint32_t +bitcount32(uint32_t x) +{ + + x = (x & 0x55555555) + ((x & 0xaaaaaaaa) >> 1); + x = (x & 0x33333333) + ((x & 0xcccccccc) >> 2); + x = (x + (x >> 4)) & 0x0f0f0f0f; + x = (x + (x >> 8)); + x = (x + (x >> 16)) & 0x000000ff; + return (x); +} + +static void +ecap_aer(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) +{ + uint32_t sta, mask; + + printf("AER %d", ver); + if (ver != 1) + return; + sta = read_config(fd, &p->pc_sel, ptr + PCIR_AER_UC_STATUS, 4); + mask = read_config(fd, &p->pc_sel, ptr + PCIR_AER_UC_SEVERITY, 4); + printf(" %d fatal", bitcount32(sta & mask)); + printf(" %d non-fatal", bitcount32(sta & ~mask)); + sta = read_config(fd, &p->pc_sel, ptr + PCIR_AER_COR_STATUS, 4); + printf(" %d corrected", bitcount32(sta)); +} + +static void +ecap_vc(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) +{ + uint32_t cap1; + + printf("VC %d", ver); + if (ver != 1) + return; + cap1 = read_config(fd, &p->pc_sel, ptr + PCIR_VC_CAP1, 4); + printf(" max VC%d", cap1 & PCIM_VC_CAP1_EXT_COUNT); + if ((cap1 & PCIM_VC_CAP1_LOWPRI_EXT_COUNT) != 0) + printf(" lowpri VC0-VC%d", + (cap1 & PCIM_VC_CAP1_LOWPRI_EXT_COUNT) >> 4); +} + +static void +ecap_sernum(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) +{ + uint32_t high, low; + + printf("Serial %d", ver); + if (ver != 1) + return; + low = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_LOW, 4); + high = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_HIGH, 4); + printf(" %08x%08x", high, low); +} + +static void +list_ecaps(int fd, struct pci_conf *p) +{ + uint32_t ecap; + uint16_t ptr; + + ptr = PCIR_EXTCAP; + ecap = read_config(fd, &p->pc_sel, ptr, 4); + if (ecap == 0xffffffff || ecap == 0) + return; + for (;;) { + printf("ecap %04x[%03x] = ", PCI_EXTCAP_ID(ecap), ptr); + switch (PCI_EXTCAP_ID(ecap)) { + case PCIZ_AER: + ecap_aer(fd, p, ptr, PCI_EXTCAP_VER(ecap)); + break; + case PCIZ_VC: + ecap_vc(fd, p, ptr, PCI_EXTCAP_VER(ecap)); + break; + case PCIZ_SERNUM: + ecap_sernum(fd, p, ptr, PCI_EXTCAP_VER(ecap)); + break; + default: + printf("unknown %d", PCI_EXTCAP_VER(ecap)); + break; + } + printf("\n"); + ptr = PCI_EXTCAP_NEXTPTR(ecap); + if (ptr == 0) + break; + ecap = read_config(fd, &p->pc_sel, ptr, 4); + } } From owner-svn-src-stable-7@FreeBSD.ORG Mon Sep 20 19:59:09 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A77B1065745; Mon, 20 Sep 2010 19:59:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC9F38FC1C; Mon, 20 Sep 2010 19:59:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KJx8rQ065845; Mon, 20 Sep 2010 19:59:08 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KJx8aI065841; Mon, 20 Sep 2010 19:59:08 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201959.o8KJx8aI065841@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 19:59:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212930 - in stable/7/sys: nfs4client nfsclient X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2010 19:59:09 -0000 Author: jhb Date: Mon Sep 20 19:59:08 2010 New Revision: 212930 URL: http://svn.freebsd.org/changeset/base/212930 Log: MFC 212293: Store the full timestamp when caching timestamps of files and directories for purposes of validating name cache entries. This closes races where two updates to a file or directory within the same second could result in stale entries in the name cache. To preserve the ABI of 'struct nfsnode', the existing timestamp fields are left with 'n_unusedX' placeholders along with the unused 'n_expiry' field. The larger n_ctime and n_dmtime fields are added to the end of the structure. Modified: stable/7/sys/nfs4client/nfs4_vnops.c stable/7/sys/nfsclient/nfs_vnops.c stable/7/sys/nfsclient/nfsnode.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/nfs4client/nfs4_vnops.c ============================================================================== --- stable/7/sys/nfs4client/nfs4_vnops.c Mon Sep 20 19:58:50 2010 (r212929) +++ stable/7/sys/nfs4client/nfs4_vnops.c Mon Sep 20 19:59:08 2010 (r212930) @@ -965,8 +965,8 @@ nfs4_lookup(struct vop_lookup_args *ap) struct vattr vattr; newvp = *vpp; - if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred, td) - && vattr.va_ctime.tv_sec == VTONFS(newvp)->n_ctime) { + if (VOP_GETATTR(newvp, &vattr, cnp->cn_cred, td) == 0 && + timespeccmp(&vattr.va_ctime, &VTONFS(newvp)->n_ctime, ==)) { nfsstats.lookupcache_hits++; if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) @@ -1081,7 +1081,7 @@ nfs4_lookup(struct vop_lookup_args *ap) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) { - np->n_ctime = np->n_vattr.va_ctime.tv_sec; + np->n_ctime = np->n_vattr.va_ctime; cache_enter(dvp, newvp, cnp); } *vpp = newvp; Modified: stable/7/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/7/sys/nfsclient/nfs_vnops.c Mon Sep 20 19:58:50 2010 (r212929) +++ stable/7/sys/nfsclient/nfs_vnops.c Mon Sep 20 19:59:08 2010 (r212930) @@ -861,7 +861,7 @@ nfs_lookup(struct vop_lookup_args *ap) struct vnode *dvp = ap->a_dvp; struct vnode **vpp = ap->a_vpp; struct vattr vattr; - time_t dmtime; + struct timespec dmtime; int flags = cnp->cn_flags; struct vnode *newvp; struct nfsmount *nmp; @@ -914,7 +914,7 @@ nfs_lookup(struct vop_lookup_args *ap) mtx_unlock(&newnp->n_mtx); } if (VOP_GETATTR(newvp, &vattr, cnp->cn_cred, td) == 0 && - vattr.va_ctime.tv_sec == newnp->n_ctime) { + timespeccmp(&vattr.va_ctime, &newnp->n_ctime, ==)) { nfsstats.lookupcache_hits++; if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) @@ -938,13 +938,13 @@ nfs_lookup(struct vop_lookup_args *ap) */ if ((u_int)(ticks - np->n_dmtime_ticks) < (negnametimeo * hz) && VOP_GETATTR(dvp, &vattr, cnp->cn_cred, td) == 0 && - vattr.va_mtime.tv_sec == np->n_dmtime) { + timespeccmp(&vattr.va_mtime, &np->n_dmtime, ==)) { nfsstats.lookupcache_hits++; return (ENOENT); } cache_purge_negative(dvp); mtx_lock(&np->n_mtx); - np->n_dmtime = 0; + timespecclear(&np->n_dmtime); mtx_unlock(&np->n_mtx); } @@ -959,7 +959,7 @@ nfs_lookup(struct vop_lookup_args *ap) * the lookup RPC has been performed on the server but before * n_dmtime is set at the end of this function. */ - dmtime = np->n_vattr.va_mtime.tv_sec; + dmtime = np->n_vattr.va_mtime; error = 0; newvp = NULLVP; nfsstats.lookupcache_misses++; @@ -1046,7 +1046,7 @@ nfs_lookup(struct vop_lookup_args *ap) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) { - np->n_ctime = np->n_vattr.va_ctime.tv_sec; + np->n_ctime = np->n_vattr.va_ctime; cache_enter(dvp, newvp, cnp); } *vpp = newvp; @@ -1092,8 +1092,8 @@ nfsmout: * lookup. */ mtx_lock(&np->n_mtx); - if (np->n_dmtime <= dmtime) { - if (np->n_dmtime == 0) { + if (timespeccmp(&np->n_dmtime, &dmtime, <=)) { + if (!timespecisset(&np->n_dmtime)) { np->n_dmtime = dmtime; np->n_dmtime_ticks = ticks; } @@ -2550,8 +2550,11 @@ nfs_readdirplusrpc(struct vnode *vp, str dp->d_type = IFTODT(VTTOIF(np->n_vattr.va_type)); ndp->ni_vp = newvp; - /* Update n_ctime, so subsequent lookup doesn't purge entry */ - np->n_ctime = np->n_vattr.va_ctime.tv_sec; + /* + * Update n_ctime so subsequent lookup + * doesn't purge entry. + */ + np->n_ctime = np->n_vattr.va_ctime; cache_enter(ndp->ni_dvp, ndp->ni_vp, cnp); } } else { Modified: stable/7/sys/nfsclient/nfsnode.h ============================================================================== --- stable/7/sys/nfsclient/nfsnode.h Mon Sep 20 19:58:50 2010 (r212929) +++ stable/7/sys/nfsclient/nfsnode.h Mon Sep 20 19:59:08 2010 (r212930) @@ -104,10 +104,10 @@ struct nfsnode { uid_t n_modeuid; /* credentials having mode */ time_t n_modestamp; /* mode cache timestamp */ struct timespec n_mtime; /* Prev modify time. */ - time_t n_ctime; /* Prev create time. */ - time_t n_dmtime; /* Prev dir modify time. */ + time_t n_unused0; + time_t n_unused1; int n_dmtime_ticks; /* Tick of -ve cache entry */ - time_t n_expiry; /* Lease expiry time */ + time_t n_unused2; nfsfh_t *n_fhp; /* NFS File Handle */ struct vnode *n_vnode; /* associated vnode */ struct vnode *n_dvp; /* parent vnode */ @@ -135,6 +135,8 @@ struct nfsnode { int n_directio_opens; int n_directio_asyncwr; struct nfs_attrcache_timestamp n_unused; + struct timespec n_ctime; /* Prev create time. */ + struct timespec n_dmtime; /* Prev dir modify time. */ }; #define n_atim n_un1.nf_atim From owner-svn-src-stable-7@FreeBSD.ORG Tue Sep 21 07:44:40 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BC421065696; Tue, 21 Sep 2010 07:44:40 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8ABBF8FC1F; Tue, 21 Sep 2010 07:44:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8L7ieGP083778; Tue, 21 Sep 2010 07:44:40 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8L7iev9083776; Tue, 21 Sep 2010 07:44:40 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201009210744.o8L7iev9083776@svn.freebsd.org> From: Brian Somers Date: Tue, 21 Sep 2010 07:44:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212956 - stable/7/sbin/dhclient X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2010 07:44:40 -0000 Author: brian Date: Tue Sep 21 07:44:40 2010 New Revision: 212956 URL: http://svn.freebsd.org/changeset/base/212956 Log: MFC r212253: Document how to use dhclient-{enter,exit}-hooks. PR: 149351 Modified: stable/7/sbin/dhclient/dhclient-script.8 Directory Properties: stable/7/sbin/dhclient/ (props changed) Modified: stable/7/sbin/dhclient/dhclient-script.8 ============================================================================== --- stable/7/sbin/dhclient/dhclient-script.8 Tue Sep 21 07:43:56 2010 (r212955) +++ stable/7/sbin/dhclient/dhclient-script.8 Tue Sep 21 07:44:40 2010 (r212956) @@ -38,7 +38,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 1, 1997 +.Dd September 6, 2010 .Dt DHCLIENT-SCRIPT 8 .Os .Sh NAME @@ -218,6 +218,29 @@ if it has reason to believe they are val If not, it should exit with a nonzero value. .El .Pp +Before taking action according to +.Va $reason , +.Nm +will check for the existence of +.Pa /etc/dhclient-enter-hooks . +If found, it will be sourced +.Pq see Xr sh 1 . +After taking action according to +.Va $reason , +.Nm +will check for the existence of +.Pa /etc/dhclient-exit-hooks . +If found, it will be sourced +.Pq see Xr sh 1 . +These hooks scripts can be used to dynamically modify the enviornment at +appropriate times during the DHCP negotiations. +For example, if the administrator wishes to disable alias IP numbers on +the DHCP interface, they might want to put the following in +.Pa /etc/dhclient-enter-hooks : +.Bd -literal -offset indent +[ ."$reason" = .PREINIT ] && ifconfig $interface 0.0.0.0 +.Ed +.Pp The usual way to test a lease is to set up the network as with .Li REBIND (since this may be called to test more than one lease) and then ping @@ -239,6 +262,7 @@ but current scripts do not do this. .\" and bear the names of the operating systems on which they are intended .\" to work. .Sh SEE ALSO +.Xr sh 1 , .Xr dhclient.conf 5 , .Xr dhclient.leases 5 , .Xr dhclient 8 , From owner-svn-src-stable-7@FreeBSD.ORG Tue Sep 21 12:57:44 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45F081065670; Tue, 21 Sep 2010 12:57:44 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 348A88FC19; Tue, 21 Sep 2010 12:57:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LCviu5094953; Tue, 21 Sep 2010 12:57:44 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LCvi4a094950; Tue, 21 Sep 2010 12:57:44 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201009211257.o8LCvi4a094950@svn.freebsd.org> From: Tijl Coosemans Date: Tue, 21 Sep 2010 12:57:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212963 - stable/7/gnu/lib/libstdc++ X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2010 12:57:44 -0000 Author: tijl Date: Tue Sep 21 12:57:43 2010 New Revision: 212963 URL: http://svn.freebsd.org/changeset/base/212963 Log: MFC r212286: GCC defines built-ins for atomic instructions found on i486 and higher. Because FreeBSD no longer supports the 80386 cpu all code targeting FreeBSD/i386 necessarily runs on i486 or higher so the compiler built-ins can be used by default inside libstdc++ and in C++ headers. This allows newly compiled C++ code to inline some atomic operations. Old binaries continue to use libstdc++ functions. Approved by: kib (mentor) Modified: stable/7/gnu/lib/libstdc++/Makefile stable/7/gnu/lib/libstdc++/config.h Directory Properties: stable/7/gnu/lib/libstdc++/ (props changed) Modified: stable/7/gnu/lib/libstdc++/Makefile ============================================================================== --- stable/7/gnu/lib/libstdc++/Makefile Tue Sep 21 12:55:20 2010 (r212962) +++ stable/7/gnu/lib/libstdc++/Makefile Tue Sep 21 12:57:43 2010 (r212963) @@ -82,7 +82,7 @@ ATOMICITY_H= ${SRCDIR}/config/cpu/${MARC ATOMICITY_H= ${SRCDIR}/config/cpu/generic/atomicity_mutex/atomicity.h .endif -.if ${MACHINE_ARCH} == "amd64" +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" .if exists(${SRCDIR}/config/cpu/generic/atomicity_builtins/atomicity.h) ATOMICITY_H= ${SRCDIR}/config/cpu/generic/atomicity_builtins/atomicity.h .endif Modified: stable/7/gnu/lib/libstdc++/config.h ============================================================================== --- stable/7/gnu/lib/libstdc++/config.h Tue Sep 21 12:55:20 2010 (r212962) +++ stable/7/gnu/lib/libstdc++/config.h Tue Sep 21 12:57:43 2010 (r212963) @@ -671,7 +671,7 @@ /* #undef VERSION */ /* Define if builtin atomic operations are supported on this host. */ -#if defined(__amd64__) +#if defined(__amd64__) || defined(__i386__) #define _GLIBCXX_ATOMIC_BUILTINS 1 #endif From owner-svn-src-stable-7@FreeBSD.ORG Wed Sep 22 19:55:40 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C32B6106576A; Wed, 22 Sep 2010 19:55:40 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B23A98FC1C; Wed, 22 Sep 2010 19:55:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MJteZp041060; Wed, 22 Sep 2010 19:55:40 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MJtex4041058; Wed, 22 Sep 2010 19:55:40 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009221955.o8MJtex4041058@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 19:55:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213015 - stable/7/sys/sparc64/sparc64 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2010 19:55:41 -0000 Author: marius Date: Wed Sep 22 19:55:40 2010 New Revision: 213015 URL: http://svn.freebsd.org/changeset/base/213015 Log: MFC: r212663 - Update the comment in swi_vm() regarding busdma bounce buffers; it's unlikely that support for these ever will be implemented on sparc64 as the IOMMUs are able to translate to up to the maximum physical address supported by the respective machine, bypassing the IOMMU is affected by hardware errata and being able to support DMA engines which cannot do at least 32-bit DMA does not justify the costs. - The page zeroing in uma_small_alloc() may use the VIS-based block zero function so take advantage of it. Modified: stable/7/sys/sparc64/sparc64/vm_machdep.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/sparc64/vm_machdep.c ============================================================================== --- stable/7/sys/sparc64/sparc64/vm_machdep.c Wed Sep 22 19:55:37 2010 (r213014) +++ stable/7/sys/sparc64/sparc64/vm_machdep.c Wed Sep 22 19:55:40 2010 (r213015) @@ -456,10 +456,7 @@ void swi_vm(void *v) { - /* - * Nothing to do here yet - busdma bounce buffers are not yet - * implemented. - */ + /* Nothing to do here - busdma bounce buffers are not implemented. */ } void * @@ -504,7 +501,7 @@ uma_small_alloc(uma_zone_t zone, int byt } va = (void *)TLB_PHYS_TO_DIRECT(pa); if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - bzero(va, PAGE_SIZE); + cpu_block_zero(va, PAGE_SIZE); return (va); } From owner-svn-src-stable-7@FreeBSD.ORG Wed Sep 22 19:59:12 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 302B01065674; Wed, 22 Sep 2010 19:59:12 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F45C8FC16; Wed, 22 Sep 2010 19:59:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MJxCwE041387; Wed, 22 Sep 2010 19:59:12 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MJxBsu041384; Wed, 22 Sep 2010 19:59:11 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009221959.o8MJxBsu041384@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 19:59:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213017 - in stable/7/sys: sparc64/sparc64 sun4v/sun4v X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2010 19:59:12 -0000 Author: marius Date: Wed Sep 22 19:59:11 2010 New Revision: 213017 URL: http://svn.freebsd.org/changeset/base/213017 Log: MFC: r212676 Sync with other platforms: - make dflt_lock() always panic, - add kludge to use contigmalloc() when the alignment is larger than the size and print a diagnostic when we didn't satisfy the alignment. Modified: stable/7/sys/sparc64/sparc64/bus_machdep.c stable/7/sys/sun4v/sun4v/bus_machdep.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/sparc64/bus_machdep.c ============================================================================== --- stable/7/sys/sparc64/sparc64/bus_machdep.c Wed Sep 22 19:59:11 2010 (r213016) +++ stable/7/sys/sparc64/sparc64/bus_machdep.c Wed Sep 22 19:59:11 2010 (r213017) @@ -182,11 +182,8 @@ busdma_lock_mutex(void *arg, bus_dma_loc static void dflt_lock(void *arg, bus_dma_lock_op_t op) { -#ifdef INVARIANTS + panic("driver error: busdma dflt_lock called"); -#else - printf("DRIVER_ERROR: busdma dflt_lock called\n"); -#endif } /* @@ -638,9 +635,18 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v if (flags & BUS_DMA_ZERO) mflags |= M_ZERO; - if ((dmat->dt_maxsize <= PAGE_SIZE)) { + /* + * XXX: + * (dmat->dt_alignment < dmat->dt_maxsize) is just a quick hack; the + * exact alignment guarantees of malloc need to be nailed down, and + * the code below should be rewritten to take that into account. + * + * In the meantime, we'll warn the user if malloc gets it wrong. + */ + if (dmat->dt_maxsize <= PAGE_SIZE && + dmat->dt_alignment < dmat->dt_maxsize) *vaddr = malloc(dmat->dt_maxsize, M_DEVBUF, mflags); - } else { + else { /* * XXX use contigmalloc until it is merged into this * facility and handles multi-seg allocations. Nobody @@ -653,6 +659,8 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v } if (*vaddr == NULL) return (ENOMEM); + if ((uintptr_t)*vaddr % dmat->dt_alignment) + printf("%s: failed to align memory properly.\n", __func__); return (0); } @@ -664,11 +672,11 @@ static void nexus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) { - if ((dmat->dt_maxsize <= PAGE_SIZE)) + if (dmat->dt_maxsize <= PAGE_SIZE && + dmat->dt_alignment < dmat->dt_maxsize) free(vaddr, M_DEVBUF); - else { + else contigfree(vaddr, dmat->dt_maxsize, M_DEVBUF); - } } struct bus_dma_methods nexus_dma_methods = { Modified: stable/7/sys/sun4v/sun4v/bus_machdep.c ============================================================================== --- stable/7/sys/sun4v/sun4v/bus_machdep.c Wed Sep 22 19:59:11 2010 (r213016) +++ stable/7/sys/sun4v/sun4v/bus_machdep.c Wed Sep 22 19:59:11 2010 (r213017) @@ -181,11 +181,8 @@ busdma_lock_mutex(void *arg, bus_dma_loc static void dflt_lock(void *arg, bus_dma_lock_op_t op) { -#ifdef INVARIANTS + panic("driver error: busdma dflt_lock called"); -#else - printf("DRIVER_ERROR: busdma dflt_lock called\n"); -#endif } /* @@ -647,9 +644,18 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v if (flags & BUS_DMA_ZERO) mflags |= M_ZERO; - if ((dmat->dt_maxsize <= PAGE_SIZE)) { + /* + * XXX: + * (dmat->dt_alignment < dmat->dt_maxsize) is just a quick hack; the + * exact alignment guarantees of malloc need to be nailed down, and + * the code below should be rewritten to take that into account. + * + * In the meantime, we'll warn the user if malloc gets it wrong. + */ + if (dmat->dt_maxsize <= PAGE_SIZE && + dmat->dt_alignment < dmat->dt_maxsize) *vaddr = malloc(dmat->dt_maxsize, M_DEVBUF, mflags); - } else { + else { /* * XXX use contigmalloc until it is merged into this * facility and handles multi-seg allocations. Nobody @@ -662,6 +668,8 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v } if (*vaddr == NULL) return (ENOMEM); + if ((uintptr_t)*vaddr % dmat->dt_alignment) + printf("%s: failed to align memory properly.\n", __func__); return (0); } @@ -673,11 +681,11 @@ static void nexus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) { - if ((dmat->dt_maxsize <= PAGE_SIZE)) + if (dmat->dt_maxsize <= PAGE_SIZE && + dmat->dt_alignment < dmat->dt_maxsize) free(vaddr, M_DEVBUF); - else { + else contigfree(vaddr, dmat->dt_maxsize, M_DEVBUF); - } } struct bus_dma_methods nexus_dma_methods = { From owner-svn-src-stable-7@FreeBSD.ORG Wed Sep 22 20:01:36 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71B911065804; Wed, 22 Sep 2010 20:01:36 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE0B18FC0A; Wed, 22 Sep 2010 20:01:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MK1Za0041563; Wed, 22 Sep 2010 20:01:35 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MK1Zcm041561; Wed, 22 Sep 2010 20:01:35 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222001.o8MK1Zcm041561@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 20:01:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213019 - stable/7/sys/sparc64/include X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2010 20:01:36 -0000 Author: marius Date: Wed Sep 22 20:01:35 2010 New Revision: 213019 URL: http://svn.freebsd.org/changeset/base/213019 Log: MFC: r212705 Add macros for alternate entry points. Modified: stable/7/sys/sparc64/include/asm.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/include/asm.h ============================================================================== --- stable/7/sys/sparc64/include/asm.h Wed Sep 22 20:01:33 2010 (r213018) +++ stable/7/sys/sparc64/include/asm.h Wed Sep 22 20:01:35 2010 (r213019) @@ -76,7 +76,7 @@ _ALIGN_TEXT /* - * Define a function entry point. + * Define function entry and alternate entry points. * * The compiler produces #function for the .type pseudo-op, but the '#' * character has special meaning in cpp macros, so we use @function like @@ -86,12 +86,19 @@ * value. Since this is difficult to predict and its expected that * assembler code is already optimized, we leave it out. */ + +#define _ALTENTRY(x) \ + .globl CNAME(x) ; \ + .type CNAME(x),@function ; \ +CNAME(x): + #define _ENTRY(x) \ _START_ENTRY ; \ .globl CNAME(x) ; \ .type CNAME(x),@function ; \ CNAME(x): +#define ALTENTRY(x) _ALTENTRY(x) #define ENTRY(x) _ENTRY(x) #define END(x) .size x, . - x From owner-svn-src-stable-7@FreeBSD.ORG Wed Sep 22 20:04:04 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D45F1065769; Wed, 22 Sep 2010 20:04:04 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C5B08FC12; Wed, 22 Sep 2010 20:04:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MK44dA041744; Wed, 22 Sep 2010 20:04:04 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MK444o041739; Wed, 22 Sep 2010 20:04:04 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222004.o8MK444o041739@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 20:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213021 - in stable/7/sys/sparc64: include sparc64 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2010 20:04:04 -0000 Author: marius Date: Wed Sep 22 20:04:03 2010 New Revision: 213021 URL: http://svn.freebsd.org/changeset/base/213021 Log: MFC: rr212709, r212730 Add a VIS-based block copy function for SPARC64 V and later, which additionally takes advantage of the prefetch cache of these CPUs. Unlike the uncommitted US-III version, which provide no measurable speedup or even resulted in a slight slowdown on certain CPUs models compared to using the US-I version with these, the SPARC64 version actually results in a slight improvement. Modified: stable/7/sys/sparc64/include/md_var.h stable/7/sys/sparc64/sparc64/machdep.c stable/7/sys/sparc64/sparc64/support.S Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/include/md_var.h ============================================================================== --- stable/7/sys/sparc64/include/md_var.h Wed Sep 22 20:03:59 2010 (r213020) +++ stable/7/sys/sparc64/include/md_var.h Wed Sep 22 20:04:03 2010 (r213021) @@ -58,6 +58,8 @@ struct md_utrap *utrap_hold(struct md_ut cpu_block_copy_t spitfire_block_copy; cpu_block_zero_t spitfire_block_zero; +cpu_block_copy_t zeus_block_copy; +cpu_block_zero_t zeus_block_zero; extern cpu_block_copy_t *cpu_block_copy; extern cpu_block_zero_t *cpu_block_zero; Modified: stable/7/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/7/sys/sparc64/sparc64/machdep.c Wed Sep 22 20:03:59 2010 (r213020) +++ stable/7/sys/sparc64/sparc64/machdep.c Wed Sep 22 20:04:03 2010 (r213021) @@ -486,7 +486,6 @@ sparc64_init(caddr_t mdp, u_long o1, u_l if (cpu_use_vis) { switch (cpu_impl) { case CPU_IMPL_SPARC64: - case CPU_IMPL_SPARC64V: case CPU_IMPL_ULTRASPARCI: case CPU_IMPL_ULTRASPARCII: case CPU_IMPL_ULTRASPARCIIi: @@ -500,6 +499,10 @@ sparc64_init(caddr_t mdp, u_long o1, u_l cpu_block_copy = spitfire_block_copy; cpu_block_zero = spitfire_block_zero; break; + case CPU_IMPL_SPARC64V: + cpu_block_copy = zeus_block_copy; + cpu_block_zero = zeus_block_zero; + break; } } Modified: stable/7/sys/sparc64/sparc64/support.S ============================================================================== --- stable/7/sys/sparc64/sparc64/support.S Wed Sep 22 20:03:59 2010 (r213020) +++ stable/7/sys/sparc64/sparc64/support.S Wed Sep 22 20:04:03 2010 (r213021) @@ -661,8 +661,121 @@ ENTRY(spitfire_block_copy) END(spitfire_block_copy) /* + * void zeus_block_copy(void *src, void *dst, size_t len) + */ +ENTRY(zeus_block_copy) + prefetch [%o0 + (0 * 64)], 0 + + rdpr %pil, %o3 + wrpr %g0, PIL_TICK, %pil + + wr %g0, ASI_BLK_S, %asi + wr %g0, FPRS_FEF, %fprs + + sub PCB_REG, TF_SIZEOF, %o4 + ldx [%o4 + TF_FPRS], %o5 + andcc %o5, FPRS_FEF, %g0 + bz,a,pt %xcc, 1f + nop + stda %f0, [PCB_REG + PCB_UFP + (0 * 64)] %asi + stda %f16, [PCB_REG + PCB_UFP + (1 * 64)] %asi + stda %f32, [PCB_REG + PCB_UFP + (2 * 64)] %asi + stda %f48, [PCB_REG + PCB_UFP + (3 * 64)] %asi + membar #Sync + + andn %o5, FPRS_FEF, %o5 + stx %o5, [%o4 + TF_FPRS] + ldx [PCB_REG + PCB_FLAGS], %o4 + or %o4, PCB_FEF, %o4 + stx %o4, [PCB_REG + PCB_FLAGS] + +1: wrpr %o3, 0, %pil + + ldd [%o0 + (0 * 8)], %f0 + prefetch [%o0 + (1 * 64)], 0 + ldd [%o0 + (1 * 8)], %f2 + prefetch [%o0 + (2 * 64)], 0 + fmovd %f0, %f32 + ldd [%o0 + (2 * 8)], %f4 + prefetch [%o0 + (3 * 64)], 0 + fmovd %f2, %f34 + ldd [%o0 + (3 * 8)], %f6 + prefetch [%o0 + (4 * 64)], 1 + fmovd %f4, %f36 + ldd [%o0 + (4 * 8)], %f8 + prefetch [%o0 + (8 * 64)], 1 + fmovd %f6, %f38 + ldd [%o0 + (5 * 8)], %f10 + prefetch [%o0 + (12 * 64)], 1 + fmovd %f8, %f40 + ldd [%o0 + (6 * 8)], %f12 + prefetch [%o0 + (16 * 64)], 1 + fmovd %f10, %f42 + ldd [%o0 + (7 * 8)], %f14 + ldd [%o0 + (8 * 8)], %f0 + sub %o2, 64, %o2 + add %o0, 64, %o0 + prefetch [%o0 + (19 * 64)], 1 + ba,pt %xcc, 2f + prefetch [%o0 + (23 * 64)], 1 + .align 32 + +2: ldd [%o0 + (1 * 8)], %f2 + fmovd %f12, %f44 + ldd [%o0 + (2 * 8)], %f4 + fmovd %f14, %f46 + stda %f32, [%o1] %asi + ldd [%o0 + (3 * 8)], %f6 + fmovd %f0, %f32 + ldd [%o0 + (4 * 8)], %f8 + fmovd %f2, %f34 + ldd [%o0 + (5 * 8)], %f10 + fmovd %f4, %f36 + ldd [%o0 + (6 * 8)], %f12 + fmovd %f6, %f38 + ldd [%o0 + (7 * 8)], %f14 + fmovd %f8, %f40 + ldd [%o0 + (8 * 8)], %f0 + fmovd %f10, %f42 + sub %o2, 64, %o2 + prefetch [%o0 + (3 * 64)], 0 + add %o1, 64, %o1 + prefetch [%o0 + (24 * 64)], 1 + add %o0, 64, %o0 + cmp %o2, 64 + 8 + bgu,pt %xcc, 2b + prefetch [%o0 + (12 * 64)], 1 + ldd [%o0 + (1 * 8)], %f2 + fsrc1 %f12, %f44 + ldd [%o0 + (2 * 8)], %f4 + fsrc1 %f14, %f46 + stda %f32, [%o1] %asi + ldd [%o0 + (3 * 8)], %f6 + fsrc1 %f0, %f32 + ldd [%o0 + (4 * 8)], %f8 + fsrc1 %f2, %f34 + ldd [%o0 + (5 * 8)], %f10 + fsrc1 %f4, %f36 + ldd [%o0 + (6 * 8)], %f12 + fsrc1 %f6, %f38 + ldd [%o0 + (7 * 8)], %f14 + fsrc1 %f8, %f40 + add %o1, 64, %o1 + fsrc1 %f10, %f42 + fsrc1 %f12, %f44 + fsrc1 %f14, %f46 + stda %f32, [%o1] %asi + membar #Sync + + retl + wr %g0, 0, %fprs +END(zeus_block_copy) + +/* * void spitfire_block_zero(void *dst, size_t len) + * void zeus_block_zero(void *dst, size_t len) */ +ALTENTRY(zeus_block_zero) ENTRY(spitfire_block_zero) rdpr %pil, %o3 wrpr %g0, PIL_TICK, %pil From owner-svn-src-stable-7@FreeBSD.ORG Wed Sep 22 20:15:38 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87DA71065674; Wed, 22 Sep 2010 20:15:38 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 708D68FC0A; Wed, 22 Sep 2010 20:15:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MKFcns042189; Wed, 22 Sep 2010 20:15:38 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MKFcQe042184; Wed, 22 Sep 2010 20:15:38 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222015.o8MKFcQe042184@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 20:15:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213024 - in stable/7/sys: dev/gem modules/gem X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2010 20:15:38 -0000 Author: marius Date: Wed Sep 22 20:15:38 2010 New Revision: 213024 URL: http://svn.freebsd.org/changeset/base/213024 Log: MFC: r212725 Merge r207585 (MFC'ed to stable/7 in r208087) from cas(4): - Don't probe for PHYs if we already know to use a SERDES. Unlike as with cas(4) this only serves to speed up the the device attach though and can only be determined via the OFW device tree but not from the VPD. - Don't touch the MIF when using a SERDES. - Add some missing bus space barriers, mainly in the PCS code path. Modified: stable/7/sys/dev/gem/if_gem.c stable/7/sys/dev/gem/if_gem_pci.c stable/7/sys/dev/gem/if_gem_sbus.c stable/7/sys/modules/gem/Makefile Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/gem/if_gem.c ============================================================================== --- stable/7/sys/dev/gem/if_gem.c Wed Sep 22 20:15:34 2010 (r213023) +++ stable/7/sys/dev/gem/if_gem.c Wed Sep 22 20:15:38 2010 (r213024) @@ -268,10 +268,17 @@ gem_attach(struct gem_softc *sc) sc->sc_rxsoft[i].rxs_mbuf = NULL; } + /* Bypass probing PHYs if we already know for sure to use a SERDES. */ + if ((sc->sc_flags & GEM_SERDES) != 0) + goto serdes; + /* Bad things will happen when touching this register on ERI. */ - if (sc->sc_variant != GEM_SUN_ERI) + if (sc->sc_variant != GEM_SUN_ERI) { GEM_BANK1_WRITE_4(sc, GEM_MII_DATAPATH_MODE, GEM_MII_DATAPATH_MII); + GEM_BANK1_BARRIER(sc, GEM_MII_DATAPATH_MODE, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + } gem_mifinit(sc); @@ -283,6 +290,8 @@ gem_attach(struct gem_softc *sc) if ((v & GEM_MIF_CONFIG_MDI1) != 0) { v |= GEM_MIF_CONFIG_PHY_SEL; GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v); + GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); switch (sc->sc_variant) { case GEM_SUN_ERI: sc->sc_phyad = GEM_PHYAD_EXTERNAL; @@ -304,6 +313,8 @@ gem_attach(struct gem_softc *sc) ((v & GEM_MIF_CONFIG_MDI0) != 0 || GEM_IS_APPLE(sc))) { v &= ~GEM_MIF_CONFIG_PHY_SEL; GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v); + GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); switch (sc->sc_variant) { case GEM_SUN_ERI: case GEM_APPLE_K2_GMAC: @@ -324,17 +335,23 @@ gem_attach(struct gem_softc *sc) * Try the external PCS SERDES if we didn't find any PHYs. */ if (error != 0 && sc->sc_variant == GEM_SUN_GEM) { + serdes: GEM_BANK1_WRITE_4(sc, GEM_MII_DATAPATH_MODE, GEM_MII_DATAPATH_SERDES); + GEM_BANK1_BARRIER(sc, GEM_MII_DATAPATH_MODE, 4, + BUS_SPACE_BARRIER_WRITE); GEM_BANK1_WRITE_4(sc, GEM_MII_SLINK_CONTROL, GEM_MII_SLINK_LOOPBACK | GEM_MII_SLINK_EN_SYNC_D); + GEM_BANK1_BARRIER(sc, GEM_MII_SLINK_CONTROL, 4, + BUS_SPACE_BARRIER_WRITE); GEM_BANK1_WRITE_4(sc, GEM_MII_CONFIG, GEM_MII_CONFIG_ENABLE); + GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4, + BUS_SPACE_BARRIER_WRITE); sc->sc_flags |= GEM_SERDES; sc->sc_phyad = GEM_PHYAD_EXTERNAL; error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, gem_mediachange, gem_mediastatus); } - if (error != 0) { device_printf(sc->sc_dev, "PHY probe failed: %d\n", error); goto fail_rxd; @@ -918,8 +935,9 @@ gem_init_locked(struct gem_softc *sc) __func__); #endif - /* Re-initialize the MIF. */ - gem_mifinit(sc); + if ((sc->sc_flags & GEM_SERDES) == 0) + /* Re-initialize the MIF. */ + gem_mifinit(sc); /* step 3. Setup data structures in host memory. */ if (gem_meminit(sc) != 0) @@ -1800,6 +1818,8 @@ gem_mifinit(struct gem_softc *sc) /* Configure the MIF in frame mode. */ GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, GEM_BANK1_READ_4(sc, GEM_MIF_CONFIG) & ~GEM_MIF_CONFIG_BB_ENA); + GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } /* @@ -1914,10 +1934,16 @@ gem_mii_writereg(device_t dev, int phy, GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4, BUS_SPACE_BARRIER_WRITE); GEM_BANK1_WRITE_4(sc, GEM_MII_ANAR, val); + GEM_BANK1_BARRIER(sc, GEM_MII_ANAR, 4, + BUS_SPACE_BARRIER_WRITE); GEM_BANK1_WRITE_4(sc, GEM_MII_SLINK_CONTROL, GEM_MII_SLINK_LOOPBACK | GEM_MII_SLINK_EN_SYNC_D); + GEM_BANK1_BARRIER(sc, GEM_MII_SLINK_CONTROL, 4, + BUS_SPACE_BARRIER_WRITE); GEM_BANK1_WRITE_4(sc, GEM_MII_CONFIG, GEM_MII_CONFIG_ENABLE); + GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4, + BUS_SPACE_BARRIER_WRITE); return (0); case MII_ANLPAR: reg = GEM_MII_ANLPAR; @@ -1928,6 +1954,8 @@ gem_mii_writereg(device_t dev, int phy, return (0); } GEM_BANK1_WRITE_4(sc, reg, val); + GEM_BANK1_BARRIER(sc, reg, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); return (0); } Modified: stable/7/sys/dev/gem/if_gem_pci.c ============================================================================== --- stable/7/sys/dev/gem/if_gem_pci.c Wed Sep 22 20:15:34 2010 (r213023) +++ stable/7/sys/dev/gem/if_gem_pci.c Wed Sep 22 20:15:38 2010 (r213024) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #if defined(__powerpc__) || defined(__sparc64__) +#include #include #include #endif @@ -140,12 +141,17 @@ static struct resource_spec gem_pci_res_ { -1, 0 } }; +#define GEM_SHARED_PINS "shared-pins" +#define GEM_SHARED_PINS_SERDES "serdes" + static int gem_pci_attach(device_t dev) { struct gem_softc *sc; int i; -#if !(defined(__powerpc__) || defined(__sparc64__)) +#if defined(__powerpc__) || defined(__sparc64__) + char buf[sizeof(GEM_SHARED_PINS)]; +#else int j; #endif @@ -207,6 +213,12 @@ gem_pci_attach(device_t dev) #if defined(__powerpc__) || defined(__sparc64__) OF_getetheraddr(dev, sc->sc_enaddr); + if (OF_getprop(ofw_bus_get_node(dev), GEM_SHARED_PINS, buf, + sizeof(buf)) > 0) { + buf[sizeof(buf) - 1] = '\0'; + if (strcmp(buf, GEM_SHARED_PINS_SERDES) == 0) + sc->sc_flags |= GEM_SERDES; + } #else /* * Dig out VPD (vital product data) and read NA (network address). Modified: stable/7/sys/dev/gem/if_gem_sbus.c ============================================================================== --- stable/7/sys/dev/gem/if_gem_sbus.c Wed Sep 22 20:15:34 2010 (r213023) +++ stable/7/sys/dev/gem/if_gem_sbus.c Wed Sep 22 20:15:38 2010 (r213024) @@ -131,6 +131,8 @@ gem_sbus_attach(device_t dev) sc = device_get_softc(dev); sc->sc_variant = GEM_SUN_GEM; sc->sc_dev = dev; + /* All known SBus models use a SERDES. */ + sc->sc_flags = GEM_SERDES; if (bus_alloc_resources(dev, gem_sbus_res_spec, sc->sc_res)) { device_printf(dev, "failed to allocate resources\n"); Modified: stable/7/sys/modules/gem/Makefile ============================================================================== --- stable/7/sys/modules/gem/Makefile Wed Sep 22 20:15:34 2010 (r213023) +++ stable/7/sys/modules/gem/Makefile Wed Sep 22 20:15:38 2010 (r213024) @@ -3,10 +3,15 @@ .PATH: ${.CURDIR}/../../dev/gem KMOD= if_gem -SRCS= bus_if.h device_if.h if_gem.c if_gem_pci.c miibus_if.h pci_if.h +SRCS= bus_if.h device_if.h if_gem.c if_gem_pci.c ${if_gem_sbus} miibus_if.h +SRCS+= ${ofw_bus_if} pci_if.h .if ${MACHINE} == "sparc64" -SRCS+= if_gem_sbus.c ofw_bus_if.h +if_gem_sbus= if_gem_sbus.c +.endif + +.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64" +ofw_bus_if= ofw_bus_if.h .endif .include From owner-svn-src-stable-7@FreeBSD.ORG Wed Sep 22 20:17:36 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3470E106576D; Wed, 22 Sep 2010 20:17:35 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D78B8FC13; Wed, 22 Sep 2010 20:17:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MKHZ7S042322; Wed, 22 Sep 2010 20:17:35 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MKHZT5042320; Wed, 22 Sep 2010 20:17:35 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222017.o8MKHZT5042320@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 20:17:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213026 - stable/7/sys/boot/sparc64/boot1 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2010 20:17:36 -0000 Author: marius Date: Wed Sep 22 20:17:34 2010 New Revision: 213026 URL: http://svn.freebsd.org/changeset/base/213026 Log: MFC: r212729 Merge from powerpc: - Change putc_func_t to use a char instead of an int for the character. - Make functions and variables not used outside of this source file static. - Remove unused prototypes and variables. - The OFW read and seek methods take 3 and not 4 input arguments. Modified: stable/7/sys/boot/sparc64/boot1/boot1.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/boot/sparc64/boot1/boot1.c ============================================================================== --- stable/7/sys/boot/sparc64/boot1/boot1.c Wed Sep 22 20:17:33 2010 (r213025) +++ stable/7/sys/boot/sparc64/boot1/boot1.c Wed Sep 22 20:17:34 2010 (r213026) @@ -26,9 +26,7 @@ __FBSDID("$FreeBSD$"); #define _PATH_LOADER "/boot/loader" #define _PATH_KERNEL "/boot/kernel/kernel" -#define BSIZEMAX 16384 - -typedef int putc_func_t(int c, void *arg); +typedef int putc_func_t(char c, void *arg); typedef int32_t ofwh_t; struct sp_data { @@ -44,11 +42,6 @@ static char bootargs[128]; static ofwh_t bootdev; -static struct fs fs; -static ino_t inomap; -static char blkbuf[BSIZEMAX]; -static unsigned int fsblks; - static uint32_t fs_off; int main(int ac, char **av); @@ -66,14 +59,13 @@ static int mount(const char *device); static void panic(const char *fmt, ...) __dead2; static int printf(const char *fmt, ...); -static int putchar(int c, void *arg); +static int putchar(char c, void *arg); static int vprintf(const char *fmt, va_list ap); static int vsnprintf(char *str, size_t sz, const char *fmt, va_list ap); static int __printf(const char *fmt, putc_func_t *putc, void *arg, va_list ap); -static int __putc(int c, void *arg); static int __puts(const char *s, putc_func_t *putc, void *arg); -static int __sputc(int c, void *arg); +static int __sputc(char c, void *arg); static char *__uitoa(char *buf, u_int val, int base); static char *__ultoa(char *buf, u_long val, int base); @@ -83,19 +75,18 @@ static char *__ultoa(char *buf, u_long v typedef u_int64_t ofwcell_t; typedef u_int32_t u_ofwh_t; typedef int (*ofwfp_t)(ofwcell_t []); -ofwfp_t ofw; /* the prom Open Firmware entry */ +static ofwfp_t ofw; /* the PROM Open Firmware entry */ void ofw_init(int, int, int, int, ofwfp_t); -ofwh_t ofw_finddevice(const char *); -ofwh_t ofw_open(const char *); -int ofw_getprop(ofwh_t, const char *, void *, size_t); -int ofw_read(ofwh_t, void *, size_t); -int ofw_write(ofwh_t, const void *, size_t); -int ofw_seek(ofwh_t, u_int64_t); -void ofw_exit(void) __dead2; +static ofwh_t ofw_finddevice(const char *); +static ofwh_t ofw_open(const char *); +static int ofw_getprop(ofwh_t, const char *, void *, size_t); +static int ofw_read(ofwh_t, void *, size_t); +static int ofw_write(ofwh_t, const void *, size_t); +static int ofw_seek(ofwh_t, u_int64_t); +static void ofw_exit(void) __dead2; -ofwh_t bootdevh; -ofwh_t stdinh, stdouth; +static ofwh_t stdinh, stdouth; /* * This has to stay here, as the PROM seems to ignore the @@ -138,7 +129,7 @@ ofw_init(int d, int d1, int d2, int d3, exit(main(ac, av)); } -ofwh_t +static ofwh_t ofw_finddevice(const char *name) { ofwcell_t args[] = { @@ -156,7 +147,7 @@ ofw_finddevice(const char *name) return (args[4]); } -int +static int ofw_getprop(ofwh_t ofwh, const char *name, void *buf, size_t len) { ofwcell_t args[] = { @@ -178,7 +169,7 @@ ofw_getprop(ofwh_t ofwh, const char *nam return (0); } -ofwh_t +static ofwh_t ofw_open(const char *path) { ofwcell_t args[] = { @@ -196,7 +187,7 @@ ofw_open(const char *path) return (args[4]); } -int +static int ofw_close(ofwh_t devh) { ofwcell_t args[] = { @@ -213,12 +204,12 @@ ofw_close(ofwh_t devh) return (0); } -int +static int ofw_read(ofwh_t devh, void *buf, size_t len) { ofwcell_t args[] = { (ofwcell_t)"read", - 4, + 3, 1, (u_ofwh_t)devh, (ofwcell_t)buf, @@ -233,7 +224,7 @@ ofw_read(ofwh_t devh, void *buf, size_t return (0); } -int +static int ofw_write(ofwh_t devh, const void *buf, size_t len) { ofwcell_t args[] = { @@ -253,12 +244,12 @@ ofw_write(ofwh_t devh, const void *buf, return (0); } -int +static int ofw_seek(ofwh_t devh, u_int64_t off) { ofwcell_t args[] = { (ofwcell_t)"seek", - 4, + 3, 1, (u_ofwh_t)devh, off >> 32, @@ -273,7 +264,7 @@ ofw_seek(ofwh_t devh, u_int64_t off) return (0); } -void +static void ofw_exit(void) { ofwcell_t args[3]; @@ -299,6 +290,7 @@ bcopy(const void *src, void *dst, size_t static void memcpy(void *dst, const void *src, size_t len) { + bcopy(src, dst, len); } @@ -314,6 +306,7 @@ bzero(void *b, size_t len) static int strcmp(const char *s1, const char *s2) { + for (; *s1 == *s2 && *s1; s1++, s2++) ; return ((u_char)*s1 - (u_char)*s2); @@ -431,6 +424,7 @@ load(const char *fname) static int dskread(void *buf, u_int64_t lba, int nblk) { + /* * The Open Firmware should open the correct partition for us. * That means, if we read from offset zero on an open instance handle, @@ -468,7 +462,7 @@ printf(const char *fmt, ...) } static int -putchar(int c, void *arg) +putchar(char c, void *arg) { char buf; @@ -614,7 +608,7 @@ reswitch: c = *fmt++; } static int -__sputc(int c, void *arg) +__sputc(char c, void *arg) { struct sp_data *sp; From owner-svn-src-stable-7@FreeBSD.ORG Wed Sep 22 20:27:59 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A3351065673; Wed, 22 Sep 2010 20:27:59 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 698118FC1C; Wed, 22 Sep 2010 20:27:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MKRxWB042601; Wed, 22 Sep 2010 20:27:59 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MKRxCq042597; Wed, 22 Sep 2010 20:27:59 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222027.o8MKRxCq042597@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 20:27:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213027 - stable/7/libexec/tftpd X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2010 20:27:59 -0000 Author: marius Date: Wed Sep 22 20:27:59 2010 New Revision: 213027 URL: http://svn.freebsd.org/changeset/base/213027 Log: MFC: r173852 Add the -W options, which acts the same as -w but will generate unique names based on the submitted filename, a strftime(3) format string and a two digit sequence number. By default the strftime(3) format string is %Y%m%d (YYYYMMDD), but this can be changed by the -F option. PR: bin/106049 (based on patch in that PR) Approved by: grog@ (mentor) Modified: stable/7/libexec/tftpd/Makefile stable/7/libexec/tftpd/tftpd.8 stable/7/libexec/tftpd/tftpd.c Directory Properties: stable/7/libexec/tftpd/ (props changed) Modified: stable/7/libexec/tftpd/Makefile ============================================================================== --- stable/7/libexec/tftpd/Makefile Wed Sep 22 20:17:34 2010 (r213026) +++ stable/7/libexec/tftpd/Makefile Wed Sep 22 20:27:59 2010 (r213027) @@ -5,6 +5,7 @@ PROG= tftpd SRCS= tftpd.c tftpsubs.c DPADD= ${LIBUTIL} LDADD= -lutil +WFORMAT=0 MAN= tftpd.8 CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp .PATH: ${.CURDIR}/../../usr.bin/tftp Modified: stable/7/libexec/tftpd/tftpd.8 ============================================================================== --- stable/7/libexec/tftpd/tftpd.8 Wed Sep 22 20:17:34 2010 (r213026) +++ stable/7/libexec/tftpd/tftpd.8 Wed Sep 22 20:27:59 2010 (r213027) @@ -40,7 +40,8 @@ .Nd Internet Trivial File Transfer Protocol server .Sh SYNOPSIS .Nm tftpd -.Op Fl cClnw +.Op Fl cClnwW +.Op Fl F Ar strftime-format .Op Fl s Ar directory .Op Fl u Ar user .Op Fl U Ar umask @@ -142,6 +143,13 @@ except it falls back to specified via .Fl s if a directory does not exist for the client's IP. +.It Fl F +Use this +.Xr strftime 3 +compatible format string for the creation of the suffix if +.Fl W +is specified. +By default the string "%Y%m%d" is used. .It Fl l Log all requests using .Xr syslog 3 @@ -184,6 +192,17 @@ Allow write requests to create new files By default .Nm requires that the file specified in a write request exist. +Note that this only works in directories writable by the user +specified with +.Fl u +option +.It Fl W +As +.Fl w +but append a YYYYMMDD.nn sequence number to the end of the filename. +Note that the string YYYYMMDD can be changed the +.Fl F +option. .El .Sh SEE ALSO .Xr tftp 1 , @@ -212,10 +231,17 @@ the .Fl u option was introduced in .Fx 4.2 , -and the +the .Fl c option was introduced in -.Fx 4.3 . +.Fx 4.3 , +and the +.Fl F +and +.Fl W +options were introduced in +.Fx 7 . +.Pp .Sh BUGS Files larger than 33488896 octets (65535 blocks) cannot be transferred without client and server supporting blocksize negotiation (RFC1783). Modified: stable/7/libexec/tftpd/tftpd.c ============================================================================== --- stable/7/libexec/tftpd/tftpd.c Wed Sep 22 20:17:34 2010 (r213026) +++ stable/7/libexec/tftpd/tftpd.c Wed Sep 22 20:27:59 2010 (r213027) @@ -110,6 +110,8 @@ static int suppress_naks; static int logging; static int ipchroot; static int create_new = 0; +static char *newfile_format = "%Y%m%d"; +static int increase_name = 0; static mode_t mask = S_IWGRP|S_IWOTH; static const char *errtomsg(int); @@ -134,7 +136,7 @@ main(int argc, char *argv[]) tzset(); /* syslog in localtime */ openlog("tftpd", LOG_PID | LOG_NDELAY, LOG_FTP); - while ((ch = getopt(argc, argv, "cClns:u:U:w")) != -1) { + while ((ch = getopt(argc, argv, "cCF:lns:u:U:wW")) != -1) { switch (ch) { case 'c': ipchroot = 1; @@ -142,6 +144,9 @@ main(int argc, char *argv[]) case 'C': ipchroot = 2; break; + case 'F': + newfile_format = optarg; + break; case 'l': logging = 1; break; @@ -160,6 +165,10 @@ main(int argc, char *argv[]) case 'w': create_new = 1; break; + case 'W': + create_new = 1; + increase_name = 1; + break; default: syslog(LOG_WARNING, "ignoring unknown option -%c", ch); } @@ -513,6 +522,57 @@ option_fail: FILE *file; /* + * Find the next value for YYYYMMDD.nn when the file to be written should + * be unique. Due to the limitations of nn, we will fail if nn reaches 100. + * Besides, that is four updates per hour on a file, which is kind of + * execessive anyway. + */ +static int +find_next_name(char *filename, int *fd) +{ + int i; + time_t tval; + size_t len; + struct tm lt; + char yyyymmdd[MAXPATHLEN]; + char newname[MAXPATHLEN]; + struct stat sb; + int ret; + + /* Create the YYYYMMDD part of the filename */ + time(&tval); + lt = *localtime(&tval); + len = strftime(yyyymmdd, sizeof(yyyymmdd), newfile_format, <); + if (len == 0) { + syslog(LOG_WARNING, + "Filename suffix too long (%d characters maximum)", + MAXPATHLEN); + return (EACCESS); + } + + /* Make sure the new filename is not too long */ + if (strlen(filename) > MAXPATHLEN - len - 5) { + syslog(LOG_WARNING, + "Filename too long (%d characters, %d maximum)", + strlen(filename), MAXPATHLEN - len - 5); + return (EACCESS); + } + + /* Find the first file which doesn't exist */ + for (i = 0; i < 100; i++) { + sprintf(newname, "%s.%s.%02d", filename, yyyymmdd, i); + *fd = open(newname, + O_WRONLY | O_CREAT | O_EXCL, + S_IRUSR | S_IWUSR | S_IRGRP | + S_IWGRP | S_IROTH | S_IWOTH); + if (*fd > 0) + return 0; + } + + return (EEXIST); +} + +/* * Validate file access. Since we * have no uid or gid, for now require * file to exist and be publicly @@ -528,6 +588,7 @@ validate_access(char **filep, int mode) { struct stat stbuf; int fd; + int error; struct dirlist *dirp; static char pathname[MAXPATHLEN]; char *filename = *filep; @@ -610,10 +671,18 @@ validate_access(char **filep, int mode) if (mode == RRQ) fd = open(filename, O_RDONLY); else { - if (create_new) - fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0666); - else - fd = open(filename, O_WRONLY|O_TRUNC); + if (create_new) { + if (increase_name) { + error = find_next_name(filename, &fd); + if (error > 0) + return (error + 100); + } else + fd = open(filename, + O_WRONLY | O_TRUNC | O_CREAT, + S_IRUSR | S_IWUSR | S_IRGRP | + S_IWGRP | S_IROTH | S_IWOTH ); + } else + fd = open(filename, O_WRONLY | O_TRUNC); } if (fd < 0) return (errno + 100); From owner-svn-src-stable-7@FreeBSD.ORG Wed Sep 22 21:02:51 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAB8E10656C4; Wed, 22 Sep 2010 21:02:51 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA87F8FC21; Wed, 22 Sep 2010 21:02:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8ML2pIZ043422; Wed, 22 Sep 2010 21:02:51 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ML2psV043420; Wed, 22 Sep 2010 21:02:51 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222102.o8ML2psV043420@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 21:02:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213029 - stable/7/libexec/tftpd X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2010 21:02:52 -0000 Author: marius Date: Wed Sep 22 21:02:51 2010 New Revision: 213029 URL: http://svn.freebsd.org/changeset/base/213029 Log: MFC: r173854 Add "with" to make the line go smoother. Modified: stable/7/libexec/tftpd/tftpd.8 Directory Properties: stable/7/libexec/tftpd/ (props changed) Modified: stable/7/libexec/tftpd/tftpd.8 ============================================================================== --- stable/7/libexec/tftpd/tftpd.8 Wed Sep 22 21:02:43 2010 (r213028) +++ stable/7/libexec/tftpd/tftpd.8 Wed Sep 22 21:02:51 2010 (r213029) @@ -200,7 +200,7 @@ option As .Fl w but append a YYYYMMDD.nn sequence number to the end of the filename. -Note that the string YYYYMMDD can be changed the +Note that the string YYYYMMDD can be changed with the .Fl F option. .El From owner-svn-src-stable-7@FreeBSD.ORG Wed Sep 22 21:06:44 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04A551065695; Wed, 22 Sep 2010 21:06:44 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E7EA68FC2D; Wed, 22 Sep 2010 21:06:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8ML6hlt043592; Wed, 22 Sep 2010 21:06:43 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ML6h5N043590; Wed, 22 Sep 2010 21:06:43 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222106.o8ML6h5N043590@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 21:06:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213031 - stable/7/libexec/tftpd X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2010 21:06:44 -0000 Author: marius Date: Wed Sep 22 21:06:43 2010 New Revision: 213031 URL: http://svn.freebsd.org/changeset/base/213031 Log: MFC: r205076 (partial) Fix several typos in macros or macro misusage. Found by: make manlint Reviewed by: ru Approved by: philip (mentor) Modified: stable/7/libexec/tftpd/tftpd.8 Directory Properties: stable/7/libexec/tftpd/ (props changed) Modified: stable/7/libexec/tftpd/tftpd.8 ============================================================================== --- stable/7/libexec/tftpd/tftpd.8 Wed Sep 22 21:06:41 2010 (r213030) +++ stable/7/libexec/tftpd/tftpd.8 Wed Sep 22 21:06:43 2010 (r213031) @@ -240,7 +240,7 @@ and the and .Fl W options were introduced in -.Fx 7 . +.Fx 8.0 . .Pp .Sh BUGS Files larger than 33488896 octets (65535 blocks) cannot be transferred From owner-svn-src-stable-7@FreeBSD.ORG Wed Sep 22 21:43:49 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24AAA1065673; Wed, 22 Sep 2010 21:43:49 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 143FC8FC14; Wed, 22 Sep 2010 21:43:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MLhmN1044579; Wed, 22 Sep 2010 21:43:48 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MLhma0044577; Wed, 22 Sep 2010 21:43:48 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222143.o8MLhma0044577@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 21:43:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213034 - stable/7/usr.bin/tftp X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2010 21:43:49 -0000 Author: marius Date: Wed Sep 22 21:43:48 2010 New Revision: 213034 URL: http://svn.freebsd.org/changeset/base/213034 Log: MFC: r183857 Use strlcpy() instead of strncpy() when we want the string to be NUL-terminated. Modified: stable/7/usr.bin/tftp/main.c Directory Properties: stable/7/usr.bin/tftp/ (props changed) Modified: stable/7/usr.bin/tftp/main.c ============================================================================== --- stable/7/usr.bin/tftp/main.c Wed Sep 22 21:14:18 2010 (r213033) +++ stable/7/usr.bin/tftp/main.c Wed Sep 22 21:43:48 2010 (r213034) @@ -233,11 +233,10 @@ setpeer0(host, port) /* res->ai_addr <= sizeof(peeraddr) is guaranteed */ memcpy(&peeraddr, res->ai_addr, res->ai_addrlen); if (res->ai_canonname) { - (void) strncpy(hostname, res->ai_canonname, + (void) strlcpy(hostname, res->ai_canonname, sizeof(hostname)); } else - (void) strncpy(hostname, host, sizeof(hostname)); - hostname[sizeof(hostname)-1] = 0; + (void) strlcpy(hostname, host, sizeof(hostname)); connected = 1; } From owner-svn-src-stable-7@FreeBSD.ORG Wed Sep 22 21:44:55 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF79C1065675; Wed, 22 Sep 2010 21:44:55 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD9B08FC21; Wed, 22 Sep 2010 21:44:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MLitNU044674; Wed, 22 Sep 2010 21:44:55 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MLitlM044669; Wed, 22 Sep 2010 21:44:55 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222144.o8MLitlM044669@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 21:44:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213035 - stable/7/usr.bin/tftp X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2010 21:44:55 -0000 Author: marius Date: Wed Sep 22 21:44:55 2010 New Revision: 213035 URL: http://svn.freebsd.org/changeset/base/213035 Log: MFC: r183858 ANSIfy, plus constify interfaces where possible. Modified: stable/7/usr.bin/tftp/extern.h stable/7/usr.bin/tftp/main.c stable/7/usr.bin/tftp/tftp.c stable/7/usr.bin/tftp/tftpsubs.c Directory Properties: stable/7/usr.bin/tftp/ (props changed) Modified: stable/7/usr.bin/tftp/extern.h ============================================================================== --- stable/7/usr.bin/tftp/extern.h Wed Sep 22 21:43:48 2010 (r213034) +++ stable/7/usr.bin/tftp/extern.h Wed Sep 22 21:44:55 2010 (r213035) @@ -34,5 +34,5 @@ * $FreeBSD$ */ -void recvfile(int, char *, char *); -void xmitfile(int, char *, char *); +void recvfile(int, const char *, const char *); +void xmitfile(int, const char *, const char *); Modified: stable/7/usr.bin/tftp/main.c ============================================================================== --- stable/7/usr.bin/tftp/main.c Wed Sep 22 21:43:48 2010 (r213034) +++ stable/7/usr.bin/tftp/main.c Wed Sep 22 21:44:55 2010 (r213035) @@ -109,9 +109,9 @@ void status(int, char **); static void command(void) __dead2; static const char *command_prompt(void); -static void getusage(char *); +static void getusage(const char *); static void makeargv(void); -static void putusage(char *); +static void putusage(const char *); static void settftpmode(const char *); char *tail(char *); @@ -157,9 +157,7 @@ struct cmd cmdtab[] = { }; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { f = -1; strcpy(mode, "netascii"); @@ -177,9 +175,7 @@ main(argc, argv) char hostname[MAXHOSTNAMELEN]; void -setpeer0(host, port) - char *host; - const char *port; +setpeer0(char *host, const char *port) { struct addrinfo hints, *res0, *res; int error; @@ -244,9 +240,7 @@ setpeer0(host, port) } void -setpeer(argc, argv) - int argc; - char *argv[]; +setpeer(int argc, char *argv[]) { if (argc < 2) { @@ -281,9 +275,7 @@ struct modes { }; void -modecmd(argc, argv) - int argc; - char *argv[]; +modecmd(int argc, char *argv[]) { struct modes *p; const char *sep; @@ -316,26 +308,21 @@ modecmd(argc, argv) } void -setbinary(argc, argv) - int argc __unused; - char *argv[] __unused; +setbinary(int argc __unused, char *argv[] __unused) { settftpmode("octet"); } void -setascii(argc, argv) - int argc __unused; - char *argv[] __unused; +setascii(int argc __unused, char *argv[] __unused) { settftpmode("netascii"); } static void -settftpmode(newmode) - const char *newmode; +settftpmode(const char *newmode) { strcpy(mode, newmode); if (verbose) @@ -347,9 +334,7 @@ settftpmode(newmode) * Send file(s). */ void -put(argc, argv) - int argc; - char *argv[]; +put(int argc, char *argv[]) { int fd; int n; @@ -421,8 +406,7 @@ put(argc, argv) } static void -putusage(s) - char *s; +putusage(const char *s) { printf("usage: %s file [[host:]remotename]\n", s); printf(" %s file1 file2 ... fileN [[host:]remote-directory]\n", s); @@ -432,9 +416,7 @@ putusage(s) * Receive file(s). */ void -get(argc, argv) - int argc; - char *argv[]; +get(int argc, char *argv[]) { int fd; int n; @@ -504,8 +486,7 @@ get(argc, argv) } static void -getusage(s) - char *s; +getusage(const char *s) { printf("usage: %s [host:]file [localname]\n", s); printf(" %s [host1:]file1 [host2:]file2 ... [hostN:]fileN\n", s); @@ -514,9 +495,7 @@ getusage(s) int rexmtval = TIMEOUT; void -setrexmt(argc, argv) - int argc; - char *argv[]; +setrexmt(int argc, char *argv[]) { int t; @@ -542,9 +521,7 @@ setrexmt(argc, argv) int maxtimeout = 5 * TIMEOUT; void -settimeout(argc, argv) - int argc; - char *argv[]; +settimeout(int argc, char *argv[]) { int t; @@ -568,9 +545,7 @@ settimeout(argc, argv) } void -status(argc, argv) - int argc __unused; - char *argv[] __unused; +status(int argc __unused, char *argv[] __unused) { if (connected) printf("Connected to %s.\n", hostname); @@ -583,8 +558,7 @@ status(argc, argv) } void -intr(dummy) - int dummy __unused; +intr(int dummy __unused) { signal(SIGALRM, SIG_IGN); @@ -593,8 +567,7 @@ intr(dummy) } char * -tail(filename) - char *filename; +tail(char *filename) { char *s; @@ -610,7 +583,7 @@ tail(filename) } static const char * -command_prompt() +command_prompt(void) { return ("tftp> "); @@ -620,7 +593,7 @@ command_prompt() * Command parser. */ static void -command() +command(void) { HistEvent he; struct cmd *c; @@ -679,8 +652,7 @@ command() } struct cmd * -getcmd(name) - char *name; +getcmd(char *name) { const char *p, *q; struct cmd *c, *found; @@ -711,7 +683,7 @@ getcmd(name) * Slice a string up into argc/argv. */ static void -makeargv() +makeargv(void) { char *cp; char **argp = margv; @@ -736,9 +708,7 @@ makeargv() } void -quit(argc, argv) - int argc __unused; - char *argv[] __unused; +quit(int argc __unused, char *argv[] __unused) { exit(txrx_error); } @@ -747,9 +717,7 @@ quit(argc, argv) * Help command. */ void -help(argc, argv) - int argc; - char *argv[]; +help(int argc, char *argv[]) { struct cmd *c; @@ -773,18 +741,14 @@ help(argc, argv) } void -settrace(argc, argv) - int argc __unused; - char **argv __unused; +settrace(int argc __unused, char **argv __unused) { trace = !trace; printf("Packet tracing %s.\n", trace ? "on" : "off"); } void -setverbose(argc, argv) - int argc __unused; - char **argv __unused; +setverbose(int argc __unused, char **argv __unused) { verbose = !verbose; printf("Verbose mode %s.\n", verbose ? "on" : "off"); Modified: stable/7/usr.bin/tftp/tftp.c ============================================================================== --- stable/7/usr.bin/tftp/tftp.c Wed Sep 22 21:43:48 2010 (r213034) +++ stable/7/usr.bin/tftp/tftp.c Wed Sep 22 21:44:55 2010 (r213035) @@ -80,23 +80,20 @@ int timeout; jmp_buf toplevel; jmp_buf timeoutbuf; -static void nak(int, struct sockaddr *); +static void nak(int, const struct sockaddr *); static int makerequest(int, const char *, struct tftphdr *, const char *); static void printstats(const char *, unsigned long); static void startclock(void); static void stopclock(void); static void timer(int); static void tpacket(const char *, struct tftphdr *, int); -static int cmpport(struct sockaddr *, struct sockaddr *); +static int cmpport(const struct sockaddr *, const struct sockaddr *); /* * Send the requested file. */ void -xmitfile(fd, name, mode) - int fd; - char *name; - char *mode; +xmitfile(int fd, const char *name, const char *mode) { struct tftphdr *ap; /* data and ack packets */ struct tftphdr *dp; @@ -214,10 +211,7 @@ abort: * Receive a file. */ void -recvfile(fd, name, mode) - int fd; - char *name; - char *mode; +recvfile(int fd, const char *name, const char *mode) { struct tftphdr *ap; struct tftphdr *dp; @@ -339,11 +333,7 @@ abort: /* ok to ack, since user */ } static int -makerequest(request, name, tp, mode) - int request; - const char *name; - struct tftphdr *tp; - const char *mode; +makerequest(int request, const char *name, struct tftphdr *tp, const char *mode) { char *cp; @@ -380,9 +370,7 @@ struct errmsg { * offset by 100. */ static void -nak(error, peer) - int error; - struct sockaddr *peer; +nak(int error, const struct sockaddr *peer) { struct errmsg *pe; struct tftphdr *tp; @@ -407,10 +395,7 @@ nak(error, peer) } static void -tpacket(s, tp, n) - const char *s; - struct tftphdr *tp; - int n; +tpacket(const char *s, struct tftphdr *tp, int n) { static const char *opcodes[] = { "#0", "RRQ", "WRQ", "DATA", "ACK", "ERROR" }; @@ -449,23 +434,21 @@ struct timeval tstart; struct timeval tstop; static void -startclock() +startclock(void) { (void)gettimeofday(&tstart, NULL); } static void -stopclock() +stopclock(void) { (void)gettimeofday(&tstop, NULL); } static void -printstats(direction, amount) - const char *direction; - unsigned long amount; +printstats(const char *direction, unsigned long amount) { double delta; /* compute delta in 1/10's second units */ @@ -479,8 +462,7 @@ printstats(direction, amount) } static void -timer(sig) - int sig __unused; +timer(int sig __unused) { timeout += rexmtval; @@ -493,9 +475,7 @@ timer(sig) } static int -cmpport(sa, sb) - struct sockaddr *sa; - struct sockaddr *sb; +cmpport(const struct sockaddr *sa, const struct sockaddr *sb) { char a[NI_MAXSERV], b[NI_MAXSERV]; Modified: stable/7/usr.bin/tftp/tftpsubs.c ============================================================================== --- stable/7/usr.bin/tftp/tftpsubs.c Wed Sep 22 21:43:48 2010 (r213034) +++ stable/7/usr.bin/tftp/tftpsubs.c Wed Sep 22 21:44:55 2010 (r213035) @@ -85,9 +85,8 @@ static struct tftphdr *rw_init(int); struct tftphdr *w_init(void) { return rw_init(0); } /* write-behind */ struct tftphdr *r_init(void) { return rw_init(1); } /* read-ahead */ -static struct tftphdr * -rw_init(x) /* init for either read-ahead or write-behind */ - int x; /* zero for write-behind, one for read-head */ +static struct tftphdr * /* init for either read-ahead or write-behind */ +rw_init(int x) /* zero for write-behind, one for read-head */ { newline = 0; /* init crlf flag */ prevchar = -1; @@ -103,10 +102,9 @@ rw_init(x) /* init for either read-ahe Free it and return next buffer filled with data. */ int -readit(file, dpp, convert) - FILE *file; /* file opened for read */ - struct tftphdr **dpp; - int convert; /* if true, convert to ascii */ +readit(FILE *file, /* file opened for read */ + struct tftphdr **dpp, + int convert) /* if true, convert to ascii */ { struct bf *b; @@ -126,9 +124,8 @@ readit(file, dpp, convert) * conversions are lf -> cr,lf and cr -> cr, nul */ void -read_ahead(file, convert) - FILE *file; /* file opened for read */ - int convert; /* if true, convert to ascii */ +read_ahead(FILE *file, /* file opened for read */ + int convert) /* if true, convert to ascii */ { register int i; register char *p; @@ -175,10 +172,7 @@ read_ahead(file, convert) available. */ int -writeit(file, dpp, ct, convert) - FILE *file; - struct tftphdr **dpp; - int ct, convert; +writeit(FILE *file, struct tftphdr **dpp, int ct, int convert) { bfs[current].counter = ct; /* set size of data to write */ current = !current; /* switch to other buffer */ @@ -196,9 +190,7 @@ writeit(file, dpp, ct, convert) * CR followed by anything else. In this case we leave it alone. */ int -write_behind(file, convert) - FILE *file; - int convert; +write_behind(FILE *file, int convert) { char *buf; int count; @@ -255,8 +247,7 @@ skipit: */ int -synchnet(f) - int f; /* socket to flush */ +synchnet(int f) /* socket to flush */ { int i, j = 0; char rbuf[PKTSIZE]; From owner-svn-src-stable-7@FreeBSD.ORG Wed Sep 22 21:54:16 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5885A1065679; Wed, 22 Sep 2010 21:54:16 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 46B0F8FC1D; Wed, 22 Sep 2010 21:54:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MLsGi3045103; Wed, 22 Sep 2010 21:54:16 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MLsGtr045099; Wed, 22 Sep 2010 21:54:16 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222154.o8MLsGtr045099@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 21:54:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213037 - stable/7/usr.bin/tftp X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2010 21:54:16 -0000 Author: marius Date: Wed Sep 22 21:54:16 2010 New Revision: 213037 URL: http://svn.freebsd.org/changeset/base/213037 Log: MFC: r207607, r207621, r209112, r209550, r209551 Go ahead and merge the work edwin@ on tftpd into the tree. It is a lot better than what's in the tree now. Edwin tested it at a prior employer, but can't test it today. I've found that it works a lot better with the various uboot versions that I've used in my embedded work. Here's the pkg-descr from the port that describes the changes: It all started when we got some new routers, which told me the following when trying to upload configuration or download images from it: The TFTP server doesn't support the blocksize option. My curiousity was triggered, it took me some reading of RFCs and other documentation to find out what was possible and what could be done. Was plain TFTP very simple in its handshake, TFTP with options was kind of messy because of its backwards capability: The first packet returned could either be an acknowledgement of options, or the first data packet. Going through the source code of src/libexec/tftpd and going through the code of src/usr.bin/tftp showed that there was a lot of duplicate code, and the addition of options would only increase the amount of duplicate code. After all, both the client and the server can act as a sender and receiver. At the end, it ended up with a nearly complete rewrite of the tftp client and server. It has been tested against the following TFTP clients and servers: - Itself (yay!) - The standard FreeBSD tftp client and server - The Fedora Core 6 tftp client and server - Cisco router tftp client - Extreme Networks tftp client It supports the following RFCs: RFC1350 - THE TFTP PROTOCOL (REVISION 2) RFC2347 - TFTP Option Extension RFC2348 - TFTP Blocksize Option RFC2349 - TFTP Timeout Interval and Transfer Size Options RFC3617 - Uniform Resource Identifier (URI) Scheme and Applicability Statement for the Trivial File Transfer Protocol (TFTP) It supports the following unofficial TFTP Options as described at http://www.compuphase.com/tftp.htm: blksize2 - Block size restricted to powers of 2, excluding protocol headers rollover - Block counter roll-over (roll back to zero or to one) From the tftp program point of view the following things are changed: - New commands: "blocksize", "blocksize2", "rollover" and "options" - Development features: "debug" and "packetdrop" If you try this tftp/tftpd implementation, please let me know if it works (or doesn't work) and against which implementaion so I can get a list of confirmed working systems. Author: Edwin Groothuis Added: stable/7/usr.bin/tftp/tftp.h - copied unchanged from r207621, head/usr.bin/tftp/tftp.h Deleted: stable/7/usr.bin/tftp/extern.h stable/7/usr.bin/tftp/tftpsubs.c stable/7/usr.bin/tftp/tftpsubs.h Modified: stable/7/usr.bin/tftp/Makefile stable/7/usr.bin/tftp/main.c stable/7/usr.bin/tftp/tftp.1 stable/7/usr.bin/tftp/tftp.c Directory Properties: stable/7/usr.bin/tftp/ (props changed) Modified: stable/7/usr.bin/tftp/Makefile ============================================================================== --- stable/7/usr.bin/tftp/Makefile Wed Sep 22 21:54:13 2010 (r213036) +++ stable/7/usr.bin/tftp/Makefile Wed Sep 22 21:54:16 2010 (r213037) @@ -1,9 +1,13 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +CFLAGS=-g -Wall +WARNS= 3 PROG= tftp -SRCS= main.c tftp.c tftpsubs.c +SRCS= main.c tftp.c tftp-utils.c tftp-io.c tftp-file.c tftp-transfer.c tftp-options.c DPADD= ${LIBEDIT} ${LIBTERMCAP} LDADD= -ledit -ltermcap +CFLAGS+=-I${.CURDIR}/../../libexec/tftpd -I${.CURDIR}/../../usr.bin/tftp +.PATH: ${.CURDIR}/../../libexec/tftpd .include Modified: stable/7/usr.bin/tftp/main.c ============================================================================== --- stable/7/usr.bin/tftp/main.c Wed Sep 22 21:54:13 2010 (r213036) +++ stable/7/usr.bin/tftp/main.c Wed Sep 22 21:54:16 2010 (r213037) @@ -54,12 +54,14 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include - #include +#include #include #include @@ -72,119 +74,212 @@ __FBSDID("$FreeBSD$"); #include #include -#include "extern.h" +#include "tftp-utils.h" +#include "tftp-io.h" +#include "tftp-options.h" +#include "tftp.h" #define MAXLINE 200 #define TIMEOUT 5 /* secs between rexmt's */ -struct sockaddr_storage peeraddr; -int f; -int trace; -int verbose; -int connected; -char mode[32]; -char line[MAXLINE]; -int margc; +static struct sockaddr_storage peeraddr; +static int connected; +static char mode[32]; +jmp_buf toplevel; +volatile int txrx_error; +static int peer; + #define MAX_MARGV 20 -char *margv[MAX_MARGV]; -jmp_buf toplevel; -volatile int txrx_error; - -void get(int, char **); -void help(int, char **); -void intr(int); -void modecmd(int, char **); -void put(int, char **); -void quit(int, char **); -void setascii(int, char **); -void setbinary(int, char **); -void setpeer0(char *, const char *); -void setpeer(int, char **); -void setrexmt(int, char **); -void settimeout(int, char **); -void settrace(int, char **); -void setverbose(int, char **); -void status(int, char **); +static int margc; +static char *margv[MAX_MARGV]; + +int verbose; +char *port = NULL; + +static void get(int, char **); +static void help(int, char **); +static void intr(int); +static void modecmd(int, char **); +static void put(int, char **); +static void quit(int, char **); +static void setascii(int, char **); +static void setbinary(int, char **); +static void setpeer0(char *, const char *); +static void setpeer(int, char **); +static void settimeoutpacket(int, char **); +static void settimeoutnetwork(int, char **); +static void setdebug(int, char **); +static void setverbose(int, char **); +static void showstatus(int, char **); +static void setblocksize(int, char **); +static void setblocksize2(int, char **); +static void setoptions(int, char **); +static void setrollover(int, char **); +static void setpacketdrop(int, char **); static void command(void) __dead2; static const char *command_prompt(void); -static void getusage(const char *); -static void makeargv(void); -static void putusage(const char *); +static void urihandling(char *URI); +static void getusage(char *); +static void makeargv(char *line); +static void putusage(char *); static void settftpmode(const char *); -char *tail(char *); -struct cmd *getcmd(char *); +static char *tail(char *); +static struct cmd *getcmd(char *); #define HELPINDENT (sizeof("connect")) struct cmd { const char *name; - char *help; void (*handler)(int, char **); + const char *help; }; -char vhelp[] = "toggle verbose mode"; -char thelp[] = "toggle packet tracing"; -char chelp[] = "connect to remote tftp"; -char qhelp[] = "exit tftp"; -char hhelp[] = "print help information"; -char shelp[] = "send file"; -char rhelp[] = "receive file"; -char mhelp[] = "set file transfer mode"; -char sthelp[] = "show current status"; -char xhelp[] = "set per-packet retransmission timeout"; -char ihelp[] = "set total retransmission timeout"; -char ashelp[] = "set mode to netascii"; -char bnhelp[] = "set mode to octet"; - -struct cmd cmdtab[] = { - { "connect", chelp, setpeer }, - { "mode", mhelp, modecmd }, - { "put", shelp, put }, - { "get", rhelp, get }, - { "quit", qhelp, quit }, - { "verbose", vhelp, setverbose }, - { "trace", thelp, settrace }, - { "status", sthelp, status }, - { "binary", bnhelp, setbinary }, - { "ascii", ashelp, setascii }, - { "rexmt", xhelp, setrexmt }, - { "timeout", ihelp, settimeout }, - { "?", hhelp, help }, - { NULL, NULL, NULL } +static struct cmd cmdtab[] = { + { "connect", setpeer, "connect to remote tftp" }, + { "mode", modecmd, "set file transfer mode" }, + { "put", put, "send file" }, + { "get", get, "receive file" }, + { "quit", quit, "exit tftp" }, + { "verbose", setverbose, "toggle verbose mode" }, + { "status", showstatus, "show current status" }, + { "binary", setbinary, "set mode to octet" }, + { "ascii", setascii, "set mode to netascii" }, + { "rexmt", settimeoutpacket, + "set per-packet retransmission timeout[-]" }, + { "timeout", settimeoutnetwork, + "set total retransmission timeout" }, + { "trace", setdebug, "enable 'debug packet'[-]" }, + { "debug", setdebug, "enable verbose output" }, + { "blocksize", setblocksize, "set blocksize[*]" }, + { "blocksize2", setblocksize2, "set blocksize as a power of 2[**]" }, + { "rollover", setrollover, "rollover after 64K packets[**]" }, + { "options", setoptions, + "enable or disable RFC2347 style options" }, + { "help", help, "print help information" }, + { "packetdrop", setpacketdrop, "artifical packetloss feature" }, + { "?", help, "print help information" }, + { NULL, NULL, NULL } +}; + +static struct modes { + const char *m_name; + const char *m_mode; +} modes[] = { + { "ascii", "netascii" }, + { "netascii", "netascii" }, + { "binary", "octet" }, + { "image", "octet" }, + { "octet", "octet" }, + { NULL, NULL } }; int main(int argc, char *argv[]) { - f = -1; + + acting_as_client = 1; + peer = -1; strcpy(mode, "netascii"); signal(SIGINT, intr); if (argc > 1) { if (setjmp(toplevel) != 0) exit(txrx_error); + + if (strncmp(argv[1], "tftp://", 7) == 0) { + urihandling(argv[1]); + exit(txrx_error); + } + setpeer(argc, argv); } if (setjmp(toplevel) != 0) (void)putchar('\n'); + + init_options(); command(); } -char hostname[MAXHOSTNAMELEN]; +/* + * RFC3617 handling of TFTP URIs: + * + * tftpURI = "tftp://" host "/" file [ mode ] + * mode = ";" "mode=" ( "netascii" / "octet" ) + * file = *( unreserved / escaped ) + * host = + * unreserved = + * escaped = + * + * We are cheating a little bit by allowing any mode as specified in the + * modes table defined earlier on in this file and mapping it on the real + * mode. + */ +static void +urihandling(char *URI) +{ + char uri[ARG_MAX]; + char *host = NULL; + char *path = NULL; + char *options = NULL; + char *mode = "octet"; + char *s; + char line[MAXLINE]; + int i; + + strncpy(uri, URI, ARG_MAX); + host = uri + 7; + + if ((s = strchr(host, '/')) == NULL) { + fprintf(stderr, + "Invalid URI: Couldn't find / after hostname\n"); + exit(1); + } + *s = '\0'; + path = s + 1; + + if ((s = strchr(path, ';')) != NULL) { + *s = '\0'; + options = s + 1; + + if (strncmp(options, "mode=", 5) == 0) { + mode = options; + mode += 5; + + for (i = 0; modes[i].m_name != NULL; i++) { + if (strcmp(modes[i].m_name, mode) == 0) + break; + } + if (modes[i].m_name == NULL) { + fprintf(stderr, "Invalid mode: '%s'\n", mode); + exit(1); + } + settftpmode(modes[i].m_mode); + } + } else { + settftpmode("octet"); + } + + setpeer0(host, NULL); + + sprintf(line, "get %s", path); + makeargv(line); + get(margc, margv); +} + +static char hostname[MAXHOSTNAMELEN]; -void -setpeer0(char *host, const char *port) +static void +setpeer0(char *host, const char *lport) { struct addrinfo hints, *res0, *res; int error; - struct sockaddr_storage ss; const char *cause = "unknown"; if (connected) { - close(f); - f = -1; + close(peer); + peer = -1; } connected = 0; @@ -193,9 +288,9 @@ setpeer0(char *host, const char *port) hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; hints.ai_flags = AI_CANONNAME; - if (!port) - port = "tftp"; - error = getaddrinfo(host, port, &hints, &res0); + if (!lport) + lport = "tftp"; + error = getaddrinfo(host, lport, &hints, &res0); if (error) { warnx("%s", gai_strerror(error)); return; @@ -204,50 +299,53 @@ setpeer0(char *host, const char *port) for (res = res0; res; res = res->ai_next) { if (res->ai_addrlen > sizeof(peeraddr)) continue; - f = socket(res->ai_family, res->ai_socktype, res->ai_protocol); - if (f < 0) { + peer = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if (peer < 0) { cause = "socket"; continue; } - memset(&ss, 0, sizeof(ss)); - ss.ss_family = res->ai_family; - ss.ss_len = res->ai_addrlen; - if (bind(f, (struct sockaddr *)&ss, ss.ss_len) < 0) { + memset(&peer_sock, 0, sizeof(peer_sock)); + peer_sock.ss_family = res->ai_family; + peer_sock.ss_len = res->ai_addrlen; + if (bind(peer, (struct sockaddr *)&peer_sock, peer_sock.ss_len) < 0) { cause = "bind"; - close(f); - f = -1; + close(peer); + peer = -1; continue; } break; } - if (f < 0) + if (peer < 0) warn("%s", cause); else { /* res->ai_addr <= sizeof(peeraddr) is guaranteed */ - memcpy(&peeraddr, res->ai_addr, res->ai_addrlen); + memcpy(&peer_sock, res->ai_addr, res->ai_addrlen); if (res->ai_canonname) { - (void) strlcpy(hostname, res->ai_canonname, + (void) strncpy(hostname, res->ai_canonname, sizeof(hostname)); } else - (void) strlcpy(hostname, host, sizeof(hostname)); + (void) strncpy(hostname, host, sizeof(hostname)); + hostname[sizeof(hostname)-1] = 0; connected = 1; } freeaddrinfo(res0); } -void +static void setpeer(int argc, char *argv[]) { + char line[MAXLINE]; if (argc < 2) { strcpy(line, "Connect "); printf("(to) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -255,26 +353,14 @@ setpeer(int argc, char *argv[]) printf("usage: %s [host [port]]\n", argv[0]); return; } - if (argc == 3) + if (argc == 3) { + port = argv[2]; setpeer0(argv[1], argv[2]); - else + } else setpeer0(argv[1], NULL); } -struct modes { - const char *m_name; - const char *m_mode; -} modes[] = { - { "ascii", "netascii" }, - { "netascii", "netascii" }, - { "binary", "octet" }, - { "image", "octet" }, - { "octet", "octet" }, -/* { "mail", "mail" }, */ - { 0, 0 } -}; - -void +static void modecmd(int argc, char *argv[]) { struct modes *p; @@ -298,7 +384,7 @@ modecmd(int argc, char *argv[]) printf("usage: %s [", argv[0]); sep = " "; - for (p = modes; p->m_name; p++) { + for (p = modes; p->m_name != NULL; p++) { printf("%s%s", sep, p->m_name); if (*sep == ' ') sep = " | "; @@ -307,14 +393,14 @@ modecmd(int argc, char *argv[]) return; } -void +static void setbinary(int argc __unused, char *argv[] __unused) { settftpmode("octet"); } -void +static void setascii(int argc __unused, char *argv[] __unused) { @@ -324,6 +410,7 @@ setascii(int argc __unused, char *argv[] static void settftpmode(const char *newmode) { + strcpy(mode, newmode); if (verbose) printf("mode set to %s\n", mode); @@ -333,18 +420,20 @@ settftpmode(const char *newmode) /* * Send file(s). */ -void +static void put(int argc, char *argv[]) { - int fd; - int n; - char *cp, *targ; + int fd; + int n; + char *cp, *targ; + char line[MAXLINE]; + struct stat sb; if (argc < 2) { strcpy(line, "send "); printf("(file) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -381,10 +470,14 @@ put(int argc, char *argv[]) warn("%s", cp); return; } + + stat(cp, &sb); + asprintf(&options[OPT_TSIZE].o_request, "%ju", sb.st_size); + if (verbose) printf("putting %s to %s:%s [%s]\n", - cp, hostname, targ, mode); - xmitfile(fd, targ, mode); + cp, hostname, targ, mode); + xmitfile(peer, port, fd, targ, mode); return; } /* this assumes the target is a directory */ @@ -398,36 +491,43 @@ put(int argc, char *argv[]) warn("%s", argv[n]); continue; } + + stat(cp, &sb); + asprintf(&options[OPT_TSIZE].o_request, "%ju", sb.st_size); + if (verbose) printf("putting %s to %s:%s [%s]\n", - argv[n], hostname, targ, mode); - xmitfile(fd, targ, mode); + argv[n], hostname, targ, mode); + xmitfile(peer, port, fd, targ, mode); } } static void -putusage(const char *s) +putusage(char *s) { - printf("usage: %s file [[host:]remotename]\n", s); + + printf("usage: %s file [remotename]\n", s); + printf(" %s file host:remotename\n", s); printf(" %s file1 file2 ... fileN [[host:]remote-directory]\n", s); } /* * Receive file(s). */ -void +static void get(int argc, char *argv[]) { int fd; int n; char *cp; char *src; + char line[MAXLINE]; if (argc < 2) { strcpy(line, "get "); printf("(files) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -438,6 +538,8 @@ get(int argc, char *argv[]) if (!connected) { for (n = 1; n < argc ; n++) if (rindex(argv[n], ':') == 0) { + printf("No remote host specified and " + "no host given for file '%s'\n", argv[n]); getusage(argv[0]); return; } @@ -468,8 +570,8 @@ get(int argc, char *argv[]) } if (verbose) printf("getting from %s:%s to %s [%s]\n", - hostname, src, cp, mode); - recvfile(fd, src, mode); + hostname, src, cp, mode); + recvfile(peer, port, fd, src, mode); break; } cp = tail(src); /* new .. jdg */ @@ -480,30 +582,31 @@ get(int argc, char *argv[]) } if (verbose) printf("getting from %s:%s to %s [%s]\n", - hostname, src, cp, mode); - recvfile(fd, src, mode); + hostname, src, cp, mode); + recvfile(peer, port, fd, src, mode); } } static void -getusage(const char *s) +getusage(char *s) { - printf("usage: %s [host:]file [localname]\n", s); + + printf("usage: %s file [localname]\n", s); + printf(" %s [host:]file [localname]\n", s); printf(" %s [host1:]file1 [host2:]file2 ... [hostN:]fileN\n", s); } -int rexmtval = TIMEOUT; - -void -setrexmt(int argc, char *argv[]) +static void +settimeoutpacket(int argc, char *argv[]) { int t; + char line[MAXLINE]; if (argc < 2) { - strcpy(line, "Rexmt-timeout "); + strcpy(line, "Packet timeout "); printf("(value) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -512,24 +615,25 @@ setrexmt(int argc, char *argv[]) return; } t = atoi(argv[1]); - if (t < 0) + if (t < 0) { printf("%s: bad value\n", argv[1]); - else - rexmtval = t; -} + return; + } -int maxtimeout = 5 * TIMEOUT; + settimeouts(t, timeoutnetwork, maxtimeouts); +} -void -settimeout(int argc, char *argv[]) +static void +settimeoutnetwork(int argc, char *argv[]) { int t; + char line[MAXLINE]; if (argc < 2) { - strcpy(line, "Maximum-timeout "); + strcpy(line, "Network timeout "); printf("(value) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -538,26 +642,36 @@ settimeout(int argc, char *argv[]) return; } t = atoi(argv[1]); - if (t < 0) + if (t < 0) { printf("%s: bad value\n", argv[1]); - else - maxtimeout = t; + return; + } + + settimeouts(timeoutpacket, t, maxtimeouts); } -void -status(int argc __unused, char *argv[] __unused) +static void +showstatus(int argc __unused, char *argv[] __unused) { - if (connected) - printf("Connected to %s.\n", hostname); - else - printf("Not connected.\n"); - printf("Mode: %s Verbose: %s Tracing: %s\n", mode, - verbose ? "on" : "off", trace ? "on" : "off"); - printf("Rexmt-interval: %d seconds, Max-timeout: %d seconds\n", - rexmtval, maxtimeout); + + printf("Remote host: %s\n", + connected ? hostname : "none specified yet"); + printf("RFC2347 Options support: %s\n", + options_rfc_enabled ? "enabled" : "disabled"); + printf("Non-RFC defined options support: %s\n", + options_extra_enabled ? "enabled" : "disabled"); + printf("Mode: %s\n", mode); + printf("Verbose: %s\n", verbose ? "on" : "off"); + printf("Debug: %s\n", debug_show(debug)); + printf("Artificial packetloss: %d in 100 packets\n", + packetdroppercentage); + printf("Segment size: %d bytes\n", segsize); + printf("Network timeout: %d seconds\n", timeoutpacket); + printf("Maximum network timeout: %d seconds\n", timeoutnetwork); + printf("Maximum timeouts: %d \n", maxtimeouts); } -void +static void intr(int dummy __unused) { @@ -566,7 +680,7 @@ intr(int dummy __unused) longjmp(toplevel, -1); } -char * +static char * tail(char *filename) { char *s; @@ -583,7 +697,7 @@ tail(char *filename) } static const char * -command_prompt(void) +command_prompt() { return ("tftp> "); @@ -602,6 +716,7 @@ command(void) const char *bp; char *cp; int len, num, vrbose; + char line[MAXLINE]; vrbose = isatty(0); if (vrbose) { @@ -623,6 +738,7 @@ command(void) line[len] = '\0'; history(hist, &he, H_ENTER, bp); } else { + line[0] = 0; if (fgets(line, sizeof line , stdin) == 0) { if (feof(stdin)) { exit(txrx_error); @@ -635,7 +751,7 @@ command(void) *cp = '\0'; if (line[0] == 0) continue; - makeargv(); + makeargv(line); if (margc == 0) continue; c = getcmd(margv[0]); @@ -651,7 +767,7 @@ command(void) } } -struct cmd * +static struct cmd * getcmd(char *name) { const char *p, *q; @@ -683,15 +799,15 @@ getcmd(char *name) * Slice a string up into argc/argv. */ static void -makeargv(void) +makeargv(char *line) { char *cp; char **argp = margv; margc = 0; - if ((cp = strchr(line, '\n'))) + if ((cp = strchr(line, '\n')) != NULL) *cp = '\0'; - for (cp = line; margc < MAX_MARGV - 1 && *cp;) { + for (cp = line; margc < MAX_MARGV - 1 && *cp != '\0';) { while (isspace(*cp)) cp++; if (*cp == '\0') @@ -707,16 +823,17 @@ makeargv(void) *argp++ = 0; } -void +static void quit(int argc __unused, char *argv[] __unused) { + exit(txrx_error); } /* * Help command. */ -void +static void help(int argc, char *argv[]) { struct cmd *c; @@ -725,6 +842,10 @@ help(int argc, char *argv[]) printf("Commands may be abbreviated. Commands are:\n\n"); for (c = cmdtab; c->name; c++) printf("%-*s\t%s\n", (int)HELPINDENT, c->name, c->help); + + printf("\n[-] : You shouldn't use these ones anymore.\n"); + printf("[*] : RFC2834 options support required.\n"); + printf("[**] : Non-standard RFC2834 option.\n"); return; } while (--argc > 0) { @@ -732,24 +853,211 @@ help(int argc, char *argv[]) arg = *++argv; c = getcmd(arg); if (c == (struct cmd *)-1) - printf("?Ambiguous help command %s\n", arg); + printf("?Ambiguous help command: %s\n", arg); else if (c == (struct cmd *)0) - printf("?Invalid help command %s\n", arg); + printf("?Invalid help command: %s\n", arg); else printf("%s\n", c->help); } } -void -settrace(int argc __unused, char **argv __unused) +static void +setverbose(int argc __unused, char *argv[] __unused) { - trace = !trace; - printf("Packet tracing %s.\n", trace ? "on" : "off"); -} -void -setverbose(int argc __unused, char **argv __unused) -{ verbose = !verbose; printf("Verbose mode %s.\n", verbose ? "on" : "off"); } + +static void +setoptions(int argc, char *argv[]) +{ + + if (argc == 2) { + if (strcasecmp(argv[1], "enable") == 0 || + strcasecmp(argv[1], "on") == 0) { + options_extra_enabled = 1; + options_rfc_enabled = 1; + } + if (strcasecmp(argv[1], "disable") == 0 || + strcasecmp(argv[1], "off") == 0) { + options_extra_enabled = 0; + options_rfc_enabled = 0; + } + if (strcasecmp(argv[1], "extra") == 0) + options_extra_enabled = !options_extra_enabled; + } + printf("Support for RFC2347 style options are now %s.\n", + options_rfc_enabled ? "enabled" : "disabled"); + printf("Support for non-RFC defined options are now %s.\n", + options_extra_enabled ? "enabled" : "disabled"); + + printf("\nThe following options are available:\n" + "\toptions on : enable support for RFC2347 style options\n" + "\toptions off : disable support for RFC2347 style options\n" + "\toptions extra : toggle support for non-RFC defined options\n" + ); +} + +static void +setrollover(int argc, char *argv[]) +{ + + if (argc == 2) { + if (strcasecmp(argv[1], "never") == 0 || + strcasecmp(argv[1], "none") == 0) { + free(options[OPT_ROLLOVER].o_request); + options[OPT_ROLLOVER].o_request = NULL; + } + if (strcasecmp(argv[1], "1") == 0) { + free(options[OPT_ROLLOVER].o_request); + options[OPT_ROLLOVER].o_request = strdup("1"); + } + if (strcasecmp(argv[1], "0") == 0) { + free(options[OPT_ROLLOVER].o_request); + options[OPT_ROLLOVER].o_request = strdup("0"); + } + } + printf("Support for the rollover options is %s.\n", + options[OPT_ROLLOVER].o_request != NULL ? "enabled" : "disabled"); + if (options[OPT_ROLLOVER].o_request != NULL) + printf("Block rollover will be to block %s.\n", + options[OPT_ROLLOVER].o_request); + + + printf("\nThe following rollover options are available:\n" + "\trollover 0 : rollover to block zero (default)\n" + "\trollover 1 : rollover to block one\n" + "\trollover never : do not support the rollover option\n" + "\trollover none : do not support the rollover option\n" + ); +} + +static void +setdebug(int argc, char *argv[]) +{ + int i; + + if (argc != 1) { + i = 1; + while (i < argc) + debug ^= debug_find(argv[i++]); + } + printf("The following debugging is enabled: %s\n", debug_show(debug)); + + printf("\nThe following debugs are available:\n"); + i = 0; + while (debugs[i].name != NULL) { + printf("\t%s\t%s\n", debugs[i].name, debugs[i].desc); + i++; + } +} + +static void +setblocksize(int argc, char *argv[]) +{ + + if (!options_rfc_enabled) + printf("RFC2347 style options are not enabled " + "(but proceding anyway)\n"); + + if (argc != 1) { + int size = atoi(argv[1]); + size_t max; + char maxbuffer[100]; + int *maxdgram; + + max = sizeof(maxbuffer); + if (sysctlbyname("net.inet.udp.maxdgram", + maxbuffer, &max, NULL, 0) < 0) { + perror("sysctl: net.inet.udp.maxdgram"); + return; + } + maxdgram = (int *)maxbuffer; + + if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) { + printf("Blocksize should be between %d and %d bytes.\n", + BLKSIZE_MIN, BLKSIZE_MAX); + return; + } else if (size > *maxdgram - 4) { + printf("Blocksize can't be bigger than %d bytes due " + "to the net.inet.udp.maxdgram sysctl limitation.\n", + *maxdgram - 4); + asprintf(&options[OPT_BLKSIZE].o_request, + "%d", *maxdgram - 4); + } else { + asprintf(&options[OPT_BLKSIZE].o_request, "%d", size); + } + } + printf("Blocksize is now %s bytes.\n", options[OPT_BLKSIZE].o_request); +} + +static void +setblocksize2(int argc, char *argv[]) +{ + + if (!options_rfc_enabled || !options_extra_enabled) + printf( + "RFC2347 style or non-RFC defined options are not enabled " + "(but proceding anyway)\n"); + + if (argc != 1) { + int size = atoi(argv[1]); + int i; + size_t max; + char maxbuffer[100]; + int *maxdgram; + + int sizes[] = { + 8, 16, 32, 64, 128, 256, 512, 1024, + 2048, 4096, 8192, 16384, 32768, 0 + }; + + max = sizeof(maxbuffer); + if (sysctlbyname("net.inet.udp.maxdgram", + maxbuffer, &max, NULL, 0) < 0) { + perror("sysctl: net.inet.udp.maxdgram"); + return; + } + maxdgram = (int *)maxbuffer; + + for (i = 0; sizes[i] != 0; i++) { + if (sizes[i] == size) break; + } + if (sizes[i] == 0) { + printf("Blocksize2 should be a power of two between " + "8 and 32768.\n"); + return; + } + + if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) { + printf("Blocksize2 should be between " *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-7@FreeBSD.ORG Wed Sep 22 21:54:34 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 962CD106577D; Wed, 22 Sep 2010 21:54:34 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 612A28FC12; Wed, 22 Sep 2010 21:54:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MLsYl9045198; Wed, 22 Sep 2010 21:54:34 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MLsYn1045188; Wed, 22 Sep 2010 21:54:34 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222154.o8MLsYn1045188@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 21:54:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213039 - stable/7/libexec/tftpd X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2010 21:54:34 -0000 Author: marius Date: Wed Sep 22 21:54:34 2010 New Revision: 213039 URL: http://svn.freebsd.org/changeset/base/213039 Log: MFC: r207608, r207614, r212651, r212665 Go ahead and merge the work edwin@ on tftpd into the tree. It is a lot better than what's in the tree now. Edwin tested it at a prior employer, but can't test it today. I've found that it works a lot better with the various uboot versions that I've used in my embedded work. Here's the pkg-descr from the port that describes the changes: It all started when we got some new routers, which told me the following when trying to upload configuration or download images from it: The TFTP server doesn't support the blocksize option. My curiousity was triggered, it took me some reading of RFCs and other documentation to find out what was possible and what could be done. Was plain TFTP very simple in its handshake, TFTP with options was kind of messy because of its backwards capability: The first packet returned could either be an acknowledgement of options, or the first data packet. Going through the source code of src/libexec/tftpd and going through the code of src/usr.bin/tftp showed that there was a lot of duplicate code, and the addition of options would only increase the amount of duplicate code. After all, both the client and the server can act as a sender and receiver. At the end, it ended up with a nearly complete rewrite of the tftp client and server. It has been tested against the following TFTP clients and servers: - Itself (yay!) - The standard FreeBSD tftp client and server - The Fedora Core 6 tftp client and server - Cisco router tftp client - Extreme Networks tftp client It supports the following RFCs: RFC1350 - THE TFTP PROTOCOL (REVISION 2) RFC2347 - TFTP Option Extension RFC2348 - TFTP Blocksize Option RFC2349 - TFTP Timeout Interval and Transfer Size Options RFC3617 - Uniform Resource Identifier (URI) Scheme and Applicability Statement for the Trivial File Transfer Protocol (TFTP) It supports the following unofficial TFTP Options as described at http://www.compuphase.com/tftp.htm: blksize2 - Block size restricted to powers of 2, excluding protocol headers rollover - Block counter roll-over (roll back to zero or to one) From the tftp program point of view the following things are changed: - New commands: "blocksize", "blocksize2", "rollover" and "options" - Development features: "debug" and "packetdrop" If you try this tftp/tftpd implementation, please let me know if it works (or doesn't work) and against which implementaion so I can get a list of confirmed working systems. Author: Edwin Groothuis Added: stable/7/libexec/tftpd/tftp-file.c - copied unchanged from r207614, head/libexec/tftpd/tftp-file.c stable/7/libexec/tftpd/tftp-file.h - copied unchanged from r207614, head/libexec/tftpd/tftp-file.h stable/7/libexec/tftpd/tftp-io.c - copied, changed from r207614, head/libexec/tftpd/tftp-io.c stable/7/libexec/tftpd/tftp-io.h - copied unchanged from r207614, head/libexec/tftpd/tftp-io.h stable/7/libexec/tftpd/tftp-options.c - copied unchanged from r207614, head/libexec/tftpd/tftp-options.c stable/7/libexec/tftpd/tftp-options.h - copied unchanged from r207614, head/libexec/tftpd/tftp-options.h stable/7/libexec/tftpd/tftp-transfer.c - copied unchanged from r207614, head/libexec/tftpd/tftp-transfer.c stable/7/libexec/tftpd/tftp-transfer.h - copied unchanged from r207614, head/libexec/tftpd/tftp-transfer.h stable/7/libexec/tftpd/tftp-utils.c - copied unchanged from r207614, head/libexec/tftpd/tftp-utils.c stable/7/libexec/tftpd/tftp-utils.h - copied unchanged from r207614, head/libexec/tftpd/tftp-utils.h Modified: stable/7/libexec/tftpd/Makefile stable/7/libexec/tftpd/tftpd.8 stable/7/libexec/tftpd/tftpd.c Directory Properties: stable/7/libexec/tftpd/ (props changed) Modified: stable/7/libexec/tftpd/Makefile ============================================================================== --- stable/7/libexec/tftpd/Makefile Wed Sep 22 21:54:30 2010 (r213038) +++ stable/7/libexec/tftpd/Makefile Wed Sep 22 21:54:34 2010 (r213039) @@ -2,12 +2,13 @@ # $FreeBSD$ PROG= tftpd -SRCS= tftpd.c tftpsubs.c -DPADD= ${LIBUTIL} -LDADD= -lutil +SRCS= tftpd.c tftp-io.c tftp-utils.c tftp-file.c tftp-transfer.c tftp-options.c +WARNS= 3 WFORMAT=0 MAN= tftpd.8 -CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp +CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp -I${.CURDIR}/../../libexec/tftpd .PATH: ${.CURDIR}/../../usr.bin/tftp +COPTFLAGS = -O +LDFLAGS= -lwrap .include Copied: stable/7/libexec/tftpd/tftp-file.c (from r207614, head/libexec/tftpd/tftp-file.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/libexec/tftpd/tftp-file.c Wed Sep 22 21:54:34 2010 (r213039, copy of r207614, head/libexec/tftpd/tftp-file.c) @@ -0,0 +1,257 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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 +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "tftp-file.h" +#include "tftp-utils.h" + +static FILE *file; +static int convert; + +static char convbuffer[66000]; +static int gotcr = 0; + +static size_t +convert_from_net(char *buffer, size_t count) +{ + size_t i, n; + + /* + * Convert all CR/LF to LF and all CR,NUL to CR + */ + + n = 0; + for (i = 0; i < count; i++) { + + if (gotcr == 0) { + convbuffer[n++] = buffer[i]; + gotcr = (buffer[i] == '\r'); + continue; + } + + /* CR, NULL -> CR */ + if (buffer[i] == '\0') { + gotcr = 0; + continue; + } + + /* CR, LF -> LF */ + if (buffer[i] == '\n') { + if (n == 0) { + if (ftell(file) != 0) { + fseek(file, -1, SEEK_END); + convbuffer[n++] = '\n'; + } else { + /* This shouldn't happen */ + tftp_log(LOG_ERR, + "Received LF as first character"); + abort(); + } + } else + convbuffer[n-1] = '\n'; + gotcr = 0; + continue; + } + + /* Everything else just accept as is */ + convbuffer[n++] = buffer[i]; + gotcr = (buffer[i] == '\r'); + continue; + } + + return fwrite(convbuffer, 1, n, file); +} + +static size_t +convert_to_net(char *buffer, size_t count, int init) +{ + size_t i; + static size_t n = 0, read = 0; + static int newline = 0; + + if (init) { + newline = 0; + n = 0; + read = 0; + return 0 ; + } + + /* + * Convert all LF to CR,LF and all CR to CR,NUL + */ + i = 0; + + if (newline) { + buffer[i++] = newline; + newline = 0; + } + + while (i < count) { + if (n == read) { + /* When done we're done */ + if (feof(file)) break; + + /* Otherwise read another bunch */ + read = fread(convbuffer, 1, count, file); + if (read == 0) break; + n = 0; + } + + /* CR -> CR,NULL */ + if (convbuffer[n] == '\r') { + buffer[i++] = '\r'; + buffer[i++] = '\0'; + n++; + continue; + } + + /* LF -> CR,LF */ + if (convbuffer[n] == '\n') { + buffer[i++] = '\r'; + buffer[i++] = '\n'; + n++; + continue; + } + + buffer[i++] = convbuffer[n++]; + } + + if (i > count) { + /* + * Whoops... that isn't alllowed (but it will happen + * when there is a CR or LF at the end of the buffer) + */ + newline = buffer[i-1]; + } + + if (i < count) { + /* We are done! */ + return i; + } else + return count; + +} + +int +write_init(int fd, FILE *f, const char *mode) +{ + + if (f == NULL) { + file = fdopen(fd, "w"); + if (file == NULL) { + int en = errno; + tftp_log(LOG_ERR, "fdopen() failed: %s", + strerror(errno)); + return en; + } + } else + file = f; + convert = !strcmp(mode, "netascii"); + return 0; +} + +size_t +write_file(char *buffer, int count) +{ + + if (convert == 0) + return fwrite(buffer, 1, count, file); + + return convert_from_net(buffer, count); +} + +int +write_close(void) +{ + + if (fclose(file) != 0) { + tftp_log(LOG_ERR, "fclose() failed: %s", strerror(errno)); + return 1; + } + return 0; +} + +int +read_init(int fd, FILE *f, const char *mode) +{ + + convert_to_net(NULL, 0, 1); + if (f == NULL) { + file = fdopen(fd, "r"); + if (file == NULL) { + int en = errno; + tftp_log(LOG_ERR, "fdopen() failed: %s", + strerror(errno)); + return en; + } + } else + file = f; + convert = !strcmp(mode, "netascii"); + return 0; +} + +size_t +read_file(char *buffer, int count) +{ + + if (convert == 0) + return fread(buffer, 1, count, file); + + return convert_to_net(buffer, count, 0); +} + +int +read_close(void) +{ + + if (fclose(file) != 0) { + tftp_log(LOG_ERR, "fclose() failed: %s", strerror(errno)); + return 1; + } + return 0; +} + + +int +synchnet(int peer) +{ + + return 0; +} Copied: stable/7/libexec/tftpd/tftp-file.h (from r207614, head/libexec/tftpd/tftp-file.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/libexec/tftpd/tftp-file.h Wed Sep 22 21:54:34 2010 (r213039, copy of r207614, head/libexec/tftpd/tftp-file.h) @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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$"); + +int write_init(int fd, FILE *f, const char *mode); +size_t write_file(char *buffer, int count); +int write_close(void); + +int read_init(int fd, FILE *f, const char *mode); +size_t read_file(char *buffer, int count); +int read_close(void); + +int synchnet(int peer); Copied and modified: stable/7/libexec/tftpd/tftp-io.c (from r207614, head/libexec/tftpd/tftp-io.c) ============================================================================== --- head/libexec/tftpd/tftp-io.c Tue May 4 13:07:40 2010 (r207614, copy source) +++ stable/7/libexec/tftpd/tftp-io.c Wed Sep 22 21:54:34 2010 (r213039) @@ -398,8 +398,6 @@ receive_packet(int peer, char *data, int int n; static int waiting; - pfrom = (from == NULL) ? &from_local : from; - if (debug&DEBUG_PACKETS) tftp_log(LOG_DEBUG, "Waiting %d seconds for packet", timeoutpacket); @@ -423,6 +421,7 @@ receive_packet(int peer, char *data, int } waiting++; + pfrom = (from == NULL) ? &from_local : from; fromlen = sizeof(*pfrom); n = recvfrom(peer, data, size, 0, (struct sockaddr *)pfrom, &fromlen); Copied: stable/7/libexec/tftpd/tftp-io.h (from r207614, head/libexec/tftpd/tftp-io.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/libexec/tftpd/tftp-io.h Wed Sep 22 21:54:34 2010 (r213039, copy of r207614, head/libexec/tftpd/tftp-io.h) @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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$"); + +#define RP_NONE 0 +#define RP_RECVFROM -1 +#define RP_TOOSMALL -2 +#define RP_ERROR -3 +#define RP_WRONGSOURCE -4 +#define RP_TIMEOUT -5 +#define RP_TOOBIG -6 + +const char *errtomsg(int); +void send_error(int peer, int); +int send_wrq(int peer, char *, char *); +int send_rrq(int peer, char *, char *); +int send_oack(int peer); +int send_ack(int peer, unsigned short); +int send_data(int peer, uint16_t, char *, int); +int receive_packet(int peer, char *, int, struct sockaddr_storage *, int); + +extern struct sockaddr_storage peer_sock; +extern struct sockaddr_storage me_sock; Copied: stable/7/libexec/tftpd/tftp-options.c (from r207614, head/libexec/tftpd/tftp-options.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/libexec/tftpd/tftp-options.c Wed Sep 22 21:54:34 2010 (r213039, copy of r207614, head/libexec/tftpd/tftp-options.c) @@ -0,0 +1,390 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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 +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include "tftp-utils.h" +#include "tftp-io.h" +#include "tftp-options.h" + +/* + * Option handlers + */ + +struct options options[] = { + { "tsize", NULL, NULL, NULL /* option_tsize */, 1 }, + { "timeout", NULL, NULL, option_timeout, 1 }, + { "blksize", NULL, NULL, option_blksize, 1 }, + { "blksize2", NULL, NULL, option_blksize2, 0 }, + { "rollover", NULL, NULL, option_rollover, 0 }, + { NULL, NULL, NULL, NULL, 0 } +}; + +/* By default allow them */ +int options_rfc_enabled = 1; +int options_extra_enabled = 1; + +/* + * Rules for the option handlers: + * - If there is no o_request, there will be no processing. + * + * For servers + * - Logging is done as warnings. + * - The handler exit()s if there is a serious problem with the + * values submitted in the option. + * + * For clients + * - Logging is done as errors. After all, the server shouldn't + * return rubbish. + * - The handler returns if there is a serious problem with the + * values submitted in the option. + * - Sending the EBADOP packets is done by the handler. + */ + +int +option_tsize(int peer, struct tftphdr *tp, int mode, struct stat *stbuf) +{ + + if (options[OPT_TSIZE].o_request == NULL) + return (0); + + if (mode == RRQ) + asprintf(&options[OPT_TSIZE].o_reply, + "%ju", stbuf->st_size); + else + /* XXX Allows writes of all sizes. */ + options[OPT_TSIZE].o_reply = + strdup(options[OPT_TSIZE].o_request); + return (0); +} + +int +option_timeout(int peer) +{ + + if (options[OPT_TIMEOUT].o_request == NULL) + return (0); + + int to = atoi(options[OPT_TIMEOUT].o_request); + if (to < TIMEOUT_MIN || to > TIMEOUT_MAX) { + tftp_log(acting_as_client ? LOG_ERR : LOG_WARNING, + "Received bad value for timeout. " + "Should be between %d and %d, received %s", + TIMEOUT_MIN, TIMEOUT_MAX); + send_error(peer, EBADOP); + if (acting_as_client) + return (1); + exit(1); + } else { + timeoutpacket = to; + options[OPT_TIMEOUT].o_reply = + strdup(options[OPT_TIMEOUT].o_request); + } + settimeouts(timeoutpacket, timeoutnetwork, maxtimeouts); + + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, "Setting timeout to '%s'", + options[OPT_TIMEOUT].o_reply); + + return (0); +} + +int +option_rollover(int peer) +{ + + if (options[OPT_ROLLOVER].o_request == NULL) + return (0); + + if (strcmp(options[OPT_ROLLOVER].o_request, "0") != 0 + && strcmp(options[OPT_ROLLOVER].o_request, "1") != 0) { + tftp_log(acting_as_client ? LOG_ERR : LOG_WARNING, + "Bad value for rollover, " + "should be either 0 or 1, received '%s', " + "ignoring request", + options[OPT_ROLLOVER].o_request); + if (acting_as_client) { + send_error(peer, EBADOP); + return (1); + } + return (0); + } + options[OPT_ROLLOVER].o_reply = + strdup(options[OPT_ROLLOVER].o_request); + + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, "Setting rollover to '%s'", + options[OPT_ROLLOVER].o_reply); + + return (0); +} + +int +option_blksize(int peer) +{ + int *maxdgram; + char maxbuffer[100]; + size_t len; + + if (options[OPT_BLKSIZE].o_request == NULL) + return (0); + + /* maximum size of an UDP packet according to the system */ + len = sizeof(maxbuffer); + if (sysctlbyname("net.inet.udp.maxdgram", + maxbuffer, &len, NULL, 0) < 0) { + tftp_log(LOG_ERR, "sysctl: net.inet.udp.maxdgram"); + return (acting_as_client ? 1 : 0); + } + maxdgram = (int *)maxbuffer; + + int size = atoi(options[OPT_BLKSIZE].o_request); + if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) { + if (acting_as_client) { + tftp_log(LOG_ERR, + "Invalid blocksize (%d bytes), aborting", + size); + send_error(peer, EBADOP); + return (1); + } else { + tftp_log(LOG_WARNING, + "Invalid blocksize (%d bytes), ignoring request", + size); + return (0); + } + } + + if (size > *maxdgram) { + if (acting_as_client) { + tftp_log(LOG_ERR, + "Invalid blocksize (%d bytes), " + "net.inet.udp.maxdgram sysctl limits it to " + "%d bytes.\n", size, *maxdgram); + send_error(peer, EBADOP); + return (1); + } else { + tftp_log(LOG_WARNING, + "Invalid blocksize (%d bytes), " + "net.inet.udp.maxdgram sysctl limits it to " + "%d bytes.\n", size, *maxdgram); + size = *maxdgram; + /* No reason to return */ + } + } + + asprintf(&options[OPT_BLKSIZE].o_reply, "%d", size); + segsize = size; + pktsize = size + 4; + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, "Setting blksize to '%s'", + options[OPT_BLKSIZE].o_reply); + + return (0); +} + +int +option_blksize2(int peer) +{ + int *maxdgram; + char maxbuffer[100]; + int size, i; + size_t len; + + int sizes[] = { + 8, 16, 32, 64, 128, 256, 512, 1024, + 2048, 4096, 8192, 16384, 32768, 0 + }; + + if (options[OPT_BLKSIZE2].o_request == NULL) + return (0); + + /* maximum size of an UDP packet according to the system */ + len = sizeof(maxbuffer); + if (sysctlbyname("net.inet.udp.maxdgram", + maxbuffer, &len, NULL, 0) < 0) { + tftp_log(LOG_ERR, "sysctl: net.inet.udp.maxdgram"); + return (acting_as_client ? 1 : 0); + } + maxdgram = (int *)maxbuffer; + + size = atoi(options[OPT_BLKSIZE2].o_request); + for (i = 0; sizes[i] != 0; i++) { + if (size == sizes[i]) break; + } + if (sizes[i] == 0) { + tftp_log(LOG_INFO, + "Invalid blocksize2 (%d bytes), ignoring request", size); + return (acting_as_client ? 1 : 0); + } + + if (size > *maxdgram) { + for (i = 0; sizes[i+1] != 0; i++) { + if (*maxdgram < sizes[i+1]) break; + } + tftp_log(LOG_INFO, + "Invalid blocksize2 (%d bytes), net.inet.udp.maxdgram " + "sysctl limits it to %d bytes.\n", size, *maxdgram); + size = sizes[i]; + /* No need to return */ + } + + asprintf(&options[OPT_BLKSIZE2].o_reply, "%d", size); + segsize = size; + pktsize = size + 4; + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, "Setting blksize2 to '%s'", + options[OPT_BLKSIZE2].o_reply); + + return (0); +} + +/* + * Append the available options to the header + */ +uint16_t +make_options(int peer, char *buffer, uint16_t size) { + int i; + char *value; + const char *option; + uint16_t length; + uint16_t returnsize = 0; + + if (!options_rfc_enabled) return (0); + + for (i = 0; options[i].o_type != NULL; i++) { + if (options[i].rfc == 0 && !options_extra_enabled) + continue; + + option = options[i].o_type; + if (acting_as_client) + value = options[i].o_request; + else + value = options[i].o_reply; + if (value == NULL) + continue; + + length = strlen(value) + strlen(option) + 2; + if (size <= length) { + tftp_log(LOG_ERR, + "Running out of option space for " + "option '%s' with value '%s': " + "needed %d bytes, got %d bytes", + option, value, size, length); + continue; + } + + sprintf(buffer, "%s%c%s%c", option, '\000', value, '\000'); + size -= length; + buffer += length; + returnsize += length; + } + + return (returnsize); +} + +/* + * Parse the received options in the header + */ +int +parse_options(int peer, char *buffer, uint16_t size) +{ + int i, options_failed; + char *c, *cp, *option, *value; + + if (!options_rfc_enabled) return (0); + + /* Parse the options */ + cp = buffer; + options_failed = 0; + while (size > 0) { + option = cp; + i = get_field(peer, cp, size); + cp += i; + + value = cp; + i = get_field(peer, cp, size); + cp += i; + + /* We are at the end */ + if (*option == '\0') break; + + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, + "option: '%s' value: '%s'", option, value); + + for (c = option; *c; c++) + if (isupper(*c)) + *c = tolower(*c); + for (i = 0; options[i].o_type != NULL; i++) { + if (strcmp(option, options[i].o_type) == 0) { + if (!acting_as_client) + options[i].o_request = value; + if (!options_extra_enabled && !options[i].rfc) { + tftp_log(LOG_INFO, + "Option '%s' with value '%s' found " + "but it is not an RFC option", + option, value); + continue; + } + if (options[i].o_handler) + options_failed += + (options[i].o_handler)(peer); + break; + } + } + if (options[i].o_type == NULL) + tftp_log(LOG_WARNING, + "Unknown option: '%s'", option); + + size -= strlen(option) + strlen(value) + 2; + } + + return (options_failed); +} + +/* + * Set some default values in the options + */ +void +init_options(void) +{ + + options[OPT_ROLLOVER].o_request = strdup("0"); +} Copied: stable/7/libexec/tftpd/tftp-options.h (from r207614, head/libexec/tftpd/tftp-options.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/libexec/tftpd/tftp-options.h Wed Sep 22 21:54:34 2010 (r213039, copy of r207614, head/libexec/tftpd/tftp-options.h) @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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$"); + +/* + * Options + */ + +void init_options(void); +uint16_t make_options(int peer, char *buffer, uint16_t size); +int parse_options(int peer, char *buffer, uint16_t size); + +/* Call back functions */ +int option_tsize(int peer, struct tftphdr *, int, struct stat *); +int option_timeout(int peer); +int option_blksize(int peer); +int option_blksize2(int peer); +int option_rollover(int peer); + +extern int options_extra_enabled; +extern int options_rfc_enabled; + +struct options { + const char *o_type; + char *o_request; + char *o_reply; + int (*o_handler)(int peer); + int rfc; +}; + +extern struct options options[]; +enum opt_enum { + OPT_TSIZE = 0, + OPT_TIMEOUT, + OPT_BLKSIZE, + OPT_BLKSIZE2, + OPT_ROLLOVER, +}; Copied: stable/7/libexec/tftpd/tftp-transfer.c (from r207614, head/libexec/tftpd/tftp-transfer.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/libexec/tftpd/tftp-transfer.c Wed Sep 22 21:54:34 2010 (r213039, copy of r207614, head/libexec/tftpd/tftp-transfer.c) @@ -0,0 +1,318 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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 +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include "tftp-file.h" +#include "tftp-io.h" +#include "tftp-utils.h" +#include "tftp-options.h" +#include "tftp-transfer.h" + +/* + * Send a file via the TFTP data session. + */ +void +tftp_send(int peer, uint16_t *block, struct tftp_stats *ts) +{ + struct tftphdr *rp; + int size, n_data, n_ack, try; + uint16_t oldblock; + char sendbuffer[MAXPKTSIZE]; + char recvbuffer[MAXPKTSIZE]; + + rp = (struct tftphdr *)recvbuffer; + *block = 1; + ts->amount = 0; + do { + if (debug&DEBUG_SIMPLE) + tftp_log(LOG_DEBUG, "Sending block %d", *block); + + size = read_file(sendbuffer, segsize); + if (size < 0) { + tftp_log(LOG_ERR, "read_file returned %d", size); + send_error(peer, errno + 100); + goto abort; + } + + for (try = 0; ; try++) { + n_data = send_data(peer, *block, sendbuffer, size); + if (n_data > 0) { + if (try == maxtimeouts) { + tftp_log(LOG_ERR, + "Cannot send DATA packet #%d, " + "giving up", *block); + return; + } + tftp_log(LOG_ERR, + "Cannot send DATA packet #%d, trying again", + *block); + continue; + } + + n_ack = receive_packet(peer, recvbuffer, + MAXPKTSIZE, NULL, timeoutpacket); + if (n_ack < 0) { + if (n_ack == RP_TIMEOUT) { + if (try == maxtimeouts) { + tftp_log(LOG_ERR, + "Timeout #%d send ACK %d " + "giving up", try, *block); + return; + } + tftp_log(LOG_WARNING, + "Timeout #%d on ACK %d", + try, *block); + continue; + } + + /* Either read failure or ERROR packet */ + if (debug&DEBUG_SIMPLE) + tftp_log(LOG_ERR, "Aborting: %s", + rp_strerror(n_ack)); + goto abort; + } + if (rp->th_opcode == ACK) { + ts->blocks++; + if (rp->th_block == *block) { + ts->amount += size; + break; + } + + /* Re-synchronize with the other side */ + (void) synchnet(peer); + if (rp->th_block == (*block - 1)) { + ts->retries++; + continue; + } + } + + } + oldblock = *block; + (*block)++; + if (oldblock > *block) { + if (options[OPT_ROLLOVER].o_request == NULL) { + tftp_log(LOG_ERR, + "Block rollover but not allowed."); + send_error(peer, EBADOP); + gettimeofday(&(ts->tstop), NULL); + return; + } + + *block = atoi(options[OPT_ROLLOVER].o_request); + ts->rollovers++; + } + gettimeofday(&(ts->tstop), NULL); + } while (size == segsize); +abort: + return; +} + +/* + * Receive a file via the TFTP data session. + * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-7@FreeBSD.ORG Wed Sep 22 22:17:40 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54F121065674; Wed, 22 Sep 2010 22:17:40 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A0BB8FC25; Wed, 22 Sep 2010 22:17:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MMHeOM045854; Wed, 22 Sep 2010 22:17:40 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MMHeTQ045852; Wed, 22 Sep 2010 22:17:40 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201009222217.o8MMHeTQ045852@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 22 Sep 2010 22:17:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213041 - stable/7/sys/dev/syscons X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2010 22:17:40 -0000 Author: jkim Date: Wed Sep 22 22:17:39 2010 New Revision: 213041 URL: http://svn.freebsd.org/changeset/base/213041 Log: MFC: r212806 Rework r210248. Although it fixed most of problems, it did not fix one particular edge case where X-axis resolution is not multiple of font width. Now we just advance enough scan lines, then deduct a partial scan line. It is more intuitive than the previous code. Apply the same wisdom to EGA and VGA planar renderers for consistency. Modified: stable/7/sys/dev/syscons/scvgarndr.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/syscons/scvgarndr.c ============================================================================== --- stable/7/sys/dev/syscons/scvgarndr.c Wed Sep 22 22:16:48 2010 (r213040) +++ stable/7/sys/dev/syscons/scvgarndr.c Wed Sep 22 22:17:39 2010 (r213041) @@ -705,8 +705,7 @@ vga_egadraw(scr_stat *scp, int from, int } ++d; if ((i % scp->xsize) == scp->xsize - 1) - d += scp->xoff*2 - + (scp->font_size - 1)*line_width; + d += scp->font_size * line_width - scp->xsize; } outw(GDCIDX, 0x0000); /* set/reset */ outw(GDCIDX, 0x0001); /* set/reset enable */ @@ -758,9 +757,8 @@ vga_vgadraw_direct(scr_stat *scp, int fr d += 8 * pixel_size; if ((i % scp->xsize) == scp->xsize - 1) - d += scp->xoff * scp->font_size * pixel_size + - scp->font_size * line_width - - scp->xpixel * pixel_size; + d += scp->font_size * line_width - + scp->xsize * 8 * pixel_size; } } @@ -816,8 +814,7 @@ vga_vgadraw_planar(scr_stat *scp, int fr } ++d; if ((i % scp->xsize) == scp->xsize - 1) - d += scp->xoff*2 - + (scp->font_size - 1)*line_width; + d += scp->font_size * line_width - scp->xsize; } outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ outw(GDCIDX, 0x0000); /* set/reset */ From owner-svn-src-stable-7@FreeBSD.ORG Thu Sep 23 01:38:53 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0484106566C; Thu, 23 Sep 2010 01:38:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EF4B8FC0C; Thu, 23 Sep 2010 01:38:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8N1cqXH050385; Thu, 23 Sep 2010 01:38:52 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8N1cqJI050383; Thu, 23 Sep 2010 01:38:52 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201009230138.o8N1cqJI050383@svn.freebsd.org> From: Xin LI Date: Thu, 23 Sep 2010 01:38:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213046 - stable/7/sys/dev/alc X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2010 01:38:53 -0000 Author: delphij Date: Thu Sep 23 01:38:52 2010 New Revision: 213046 URL: http://svn.freebsd.org/changeset/base/213046 Log: MFC r212764: status bits should be &'ed against status to be really functional. Reported by: Jike Song Reviewed by: yongari Modified: stable/7/sys/dev/alc/if_alc.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/alc/if_alc.c ============================================================================== --- stable/7/sys/dev/alc/if_alc.c Thu Sep 23 01:30:50 2010 (r213045) +++ stable/7/sys/dev/alc/if_alc.c Thu Sep 23 01:38:52 2010 (r213046) @@ -2948,8 +2948,8 @@ alc_rxeof(struct alc_softc *sc, struct r * errored frames. */ status |= RRD_TCP_UDPCSUM_NOK | RRD_IPCSUM_NOK; - if ((RRD_ERR_CRC | RRD_ERR_ALIGN | RRD_ERR_TRUNC | - RRD_ERR_RUNT) != 0) + if ((status & (RRD_ERR_CRC | RRD_ERR_ALIGN | + RRD_ERR_TRUNC | RRD_ERR_RUNT)) != 0) return; } From owner-svn-src-stable-7@FreeBSD.ORG Thu Sep 23 19:21:49 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7443F106564A; Thu, 23 Sep 2010 19:21:49 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4863B8FC0A; Thu, 23 Sep 2010 19:21:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NJLnFV078197; Thu, 23 Sep 2010 19:21:49 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NJLn0E078195; Thu, 23 Sep 2010 19:21:49 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009231921.o8NJLn0E078195@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 23 Sep 2010 19:21:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213082 - stable/7/bin/expr X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2010 19:21:49 -0000 Author: jilles Date: Thu Sep 23 19:21:49 2010 New Revision: 213082 URL: http://svn.freebsd.org/changeset/base/213082 Log: MFC r212390: expr(1): Add sh(1) versions of examples, remove an incorrect example. The three examples are better done using sh(1) itself these days. The example expr -- "$a" : ".*" is incorrect in the general case, as "$a" may be an operator. Modified: stable/7/bin/expr/expr.1 Directory Properties: stable/7/bin/expr/ (props changed) Modified: stable/7/bin/expr/expr.1 ============================================================================== --- stable/7/bin/expr/expr.1 Thu Sep 23 18:55:54 2010 (r213081) +++ stable/7/bin/expr/expr.1 Thu Sep 23 19:21:49 2010 (r213082) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 12, 2004 +.Dd September 9, 2010 .Dt EXPR 1 .Os .Sh NAME @@ -217,6 +217,9 @@ command, one might rearrange the express More generally, parenthesize possibly-negative values: .Dl "a=$(expr \e( $a \e) + 1)" .It +With shell arithmetic, no escaping is required: +.Dl "a=$((a + 1))" +.It This example prints the filename portion of a pathname stored in variable .Va a . @@ -229,6 +232,12 @@ The .Li // characters resolve this ambiguity. .Dl "expr \*q//$a\*q \&: '.*/\e(.*\e)'" +.It +With modern +.Xr sh 1 +syntax, +.Dl "\*q${a##*/}\*q" +expands to the same value. .El .Pp The following examples output the number of characters in variable @@ -237,19 +246,21 @@ Again, if .Va a might begin with a hyphen, it is necessary to prevent it from being interpreted as an option to -.Nm . +.Nm , +and +.Va a +might be interpreted as an operator. .Bl -bullet .It -If the -.Nm -command conforms to -.St -p1003.1-2001 , -this is simple: -.Dl "expr -- \*q$a\*q \&: \*q.*\*q" -.It -For portability to older systems, however, a more complicated command +To deal with all of this, a complicated command is required: .Dl "expr \e( \*qX$a\*q \&: \*q.*\*q \e) - 1" +.It +With modern +.Xr sh 1 +syntax, this can be done much more easily: +.Dl "${#a}" +expands to the required number. .El .Sh SEE ALSO .Xr sh 1 , From owner-svn-src-stable-7@FreeBSD.ORG Thu Sep 23 19:36:34 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8F46106567A; Thu, 23 Sep 2010 19:36:34 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D7AD18FC1A; Thu, 23 Sep 2010 19:36:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NJaYi4078541; Thu, 23 Sep 2010 19:36:34 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NJaYI2078539; Thu, 23 Sep 2010 19:36:34 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009231936.o8NJaYI2078539@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 23 Sep 2010 19:36:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213083 - stable/7/bin/test X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2010 19:36:35 -0000 Author: jilles Date: Thu Sep 23 19:36:34 2010 New Revision: 213083 URL: http://svn.freebsd.org/changeset/base/213083 Log: MFC r212418: test(1): Clarify grammar ambiguity and -a/-o vs shell &&/||. Modified: stable/7/bin/test/test.1 Directory Properties: stable/7/bin/test/ (props changed) Modified: stable/7/bin/test/test.1 ============================================================================== --- stable/7/bin/test/test.1 Thu Sep 23 19:21:49 2010 (r213082) +++ stable/7/bin/test/test.1 Thu Sep 23 19:36:34 2010 (r213083) @@ -32,7 +32,7 @@ .\" @(#)test.1 8.1 (Berkeley) 5/31/93 .\" $FreeBSD$ .\" -.Dd July 31, 2006 +.Dd September 10, 2010 .Dt TEST 1 .Os .Sh NAME @@ -310,6 +310,14 @@ are evaluated consistently according to standards document. All other cases are subject to the ambiguity in the command semantics. +.Pp +In particular, only expressions containing +.Fl a , +.Fl o , +.Cm \&( +or +.Cm \&) +can be ambiguous. .Sh EXIT STATUS The .Nm @@ -338,12 +346,11 @@ specification. Both sides are always evaluated in .Fl a and -.Fl o , -unlike in the logical operators of -.Xr sh 1 . +.Fl o . For instance, the writable status of .Pa file will be tested by the following command even though the former expression indicated false, which results in a gratuitous access to the file system: -.Pp .Dl "[ -z abc -a -w file ]" +To avoid this, write +.Dl "[ -z abc ] && [ -w file ]" From owner-svn-src-stable-7@FreeBSD.ORG Thu Sep 23 19:38:09 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51363106567A; Thu, 23 Sep 2010 19:38:09 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 401E78FC23; Thu, 23 Sep 2010 19:38:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NJc9gl078616; Thu, 23 Sep 2010 19:38:09 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NJc94V078614; Thu, 23 Sep 2010 19:38:09 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009231938.o8NJc94V078614@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 23 Sep 2010 19:38:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213084 - stable/7/bin/test X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2010 19:38:09 -0000 Author: jilles Date: Thu Sep 23 19:38:08 2010 New Revision: 213084 URL: http://svn.freebsd.org/changeset/base/213084 Log: MFC r212419: test(1): Fix markup, ( and ) must be separate arguments so leave spaces. Modified: stable/7/bin/test/test.1 Directory Properties: stable/7/bin/test/ (props changed) Modified: stable/7/bin/test/test.1 ============================================================================== --- stable/7/bin/test/test.1 Thu Sep 23 19:36:34 2010 (r213083) +++ stable/7/bin/test/test.1 Thu Sep 23 19:38:08 2010 (r213084) @@ -282,7 +282,7 @@ True if either or .Ar expression2 are true. -.It Cm \&( Ns Ar expression Ns Cm \&) +.It Cm \&( Ar expression Cm \&) True if expression is true. .El .Pp From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 07:29:29 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEECA1065670; Fri, 24 Sep 2010 07:29:29 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BECF48FC0A; Fri, 24 Sep 2010 07:29:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8O7TTOM093608; Fri, 24 Sep 2010 07:29:29 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8O7TT9E093606; Fri, 24 Sep 2010 07:29:29 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009240729.o8O7TT9E093606@svn.freebsd.org> From: Andriy Gapon Date: Fri, 24 Sep 2010 07:29:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213095 - stable/7/sbin/reboot X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 07:29:29 -0000 Author: avg Date: Fri Sep 24 07:29:29 2010 New Revision: 213095 URL: http://svn.freebsd.org/changeset/base/213095 Log: MFC r212789: nextboot: warn about limitations of /boot/nextboot.conf on ZFS Modified: stable/7/sbin/reboot/nextboot.sh Directory Properties: stable/7/sbin/reboot/ (props changed) Modified: stable/7/sbin/reboot/nextboot.sh ============================================================================== --- stable/7/sbin/reboot/nextboot.sh Fri Sep 24 07:27:53 2010 (r213094) +++ stable/7/sbin/reboot/nextboot.sh Fri Sep 24 07:29:29 2010 (r213095) @@ -50,6 +50,14 @@ if [ ${force} = "NO" -a ! -d /boot/${ker exit 1 fi +df -Tn "/boot/" 2>/dev/null | while read _fs _type _other ; do + [ "zfs" = "${_type}" ] || continue + cat 1>&2 <<-EOF + WARNING: loader(8) has only R/O support for ZFS + nextboot.conf will NOT be reset in case of kernel boot failure + EOF +done + cat > ${nextboot_file} << EOF nextboot_enable="YES" kernel="${kernel}" From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 17:56:12 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 851E31065673; Fri, 24 Sep 2010 17:56:12 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59DAF8FC18; Fri, 24 Sep 2010 17:56:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OHuCxj033739; Fri, 24 Sep 2010 17:56:12 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OHuCNr033737; Fri, 24 Sep 2010 17:56:12 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241756.o8OHuCNr033737@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 17:56:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213108 - stable/7/sys/dev/bge X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 17:56:12 -0000 Author: yongari Date: Fri Sep 24 17:56:12 2010 New Revision: 213108 URL: http://svn.freebsd.org/changeset/base/213108 Log: MFC r211594: Load tunable from loader.conf(5) instead of device.hints(5). Modified: stable/7/sys/dev/bge/if_bge.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Fri Sep 24 17:53:32 2010 (r213107) +++ stable/7/sys/dev/bge/if_bge.c Fri Sep 24 17:56:12 2010 (r213108) @@ -4894,6 +4894,8 @@ bge_add_sysctls(struct bge_softc *sc) struct sysctl_ctx_list *ctx; struct sysctl_oid_list *children, *schildren; struct sysctl_oid *tree; + char tn[32]; + int unit; ctx = device_get_sysctl_ctx(sc->bge_dev); children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->bge_dev)); @@ -4913,6 +4915,7 @@ bge_add_sysctls(struct bge_softc *sc) #endif + unit = device_get_unit(sc->bge_dev); /* * A common design characteristic for many Broadcom client controllers * is that they only support a single outstanding DMA read operation @@ -4925,13 +4928,13 @@ bge_add_sysctls(struct bge_softc *sc) * performance is about 850Mbps. However forcing coalescing mbufs * consumes a lot of CPU cycles, so leave it off by default. */ + sc->bge_forced_collapse = 0; + snprintf(tn, sizeof(tn), "dev.bge.%d.forced_collapse", unit); + TUNABLE_INT_FETCH(tn, &sc->bge_forced_collapse); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "forced_collapse", CTLFLAG_RW, &sc->bge_forced_collapse, 0, "Number of fragmented TX buffers of a frame allowed before " "forced collapsing"); - resource_int_value(device_get_name(sc->bge_dev), - device_get_unit(sc->bge_dev), "forced_collapse", - &sc->bge_forced_collapse); if (BGE_IS_5705_PLUS(sc)) return; From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 18:01:43 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7634C106564A; Fri, 24 Sep 2010 18:01:43 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 646848FC13; Fri, 24 Sep 2010 18:01:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OI1hW7034020; Fri, 24 Sep 2010 18:01:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OI1hEp034017; Fri, 24 Sep 2010 18:01:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241801.o8OI1hEp034017@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 18:01:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213110 - stable/7/sys/dev/bge X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 18:01:43 -0000 Author: yongari Date: Fri Sep 24 18:01:43 2010 New Revision: 213110 URL: http://svn.freebsd.org/changeset/base/213110 Log: MFC r211596: It seems all Broadcom controllers have a bug that can generate UDP datagrams with checksum value 0 when TX UDP checksum offloading is enabled. Generating UDP checksum value 0 is RFC 768 violation. Even though the probability of generating such UDP datagrams is low, I don't want to see FreeBSD boxes to inject such datagrams into network so disable UDP checksum offloading by default. Users still override this behavior by setting a sysctl variable or loader tunable, dev.bge.%d.forced_udpcsum. I have no idea why this issue was not reported so far given that bge(4) is one of the most commonly used controller on high-end server class systems. Thanks to andre@ who passed the PR to me. PR: kern/104826 Modified: stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Fri Sep 24 17:59:58 2010 (r213109) +++ stable/7/sys/dev/bge/if_bge.c Fri Sep 24 18:01:43 2010 (r213110) @@ -120,7 +120,7 @@ __FBSDID("$FreeBSD$"); #include -#define BGE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) +#define BGE_CSUM_FEATURES (CSUM_IP | CSUM_TCP) #define ETHER_MIN_NOPAD (ETHER_MIN_LEN - ETHER_CRC_LEN) /* i.e., 60 */ MODULE_DEPEND(bge, pci, 1, 1, 1); @@ -2795,6 +2795,8 @@ bge_attach(device_t dev) goto fail; } + bge_add_sysctls(sc); + /* Set default tuneable values. */ sc->bge_stat_ticks = BGE_TICKS_PER_SEC; sc->bge_rx_coal_ticks = 150; @@ -2802,6 +2804,11 @@ bge_attach(device_t dev) sc->bge_rx_max_coal_bds = 10; sc->bge_tx_max_coal_bds = 10; + /* Initialize checksum features to use. */ + sc->bge_csum_features = BGE_CSUM_FEATURES; + if (sc->bge_forced_udpcsum != 0) + sc->bge_csum_features |= CSUM_UDP; + /* Set up ifnet structure */ ifp = sc->bge_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { @@ -2818,7 +2825,7 @@ bge_attach(device_t dev) ifp->if_snd.ifq_drv_maxlen = BGE_TX_RING_CNT - 1; IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); IFQ_SET_READY(&ifp->if_snd); - ifp->if_hwassist = BGE_CSUM_FEATURES; + ifp->if_hwassist = sc->bge_csum_features; ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; if ((sc->bge_flags & BGE_FLAG_TSO) != 0) { @@ -2975,8 +2982,6 @@ again: device_printf(sc->bge_dev, "couldn't set up irq\n"); } - bge_add_sysctls(sc); - return (0); fail: @@ -3956,7 +3961,7 @@ bge_encap(struct bge_softc *sc, struct m return (ENOBUFS); csum_flags |= BGE_TXBDFLAG_CPU_PRE_DMA | BGE_TXBDFLAG_CPU_POST_DMA; - } else if ((m->m_pkthdr.csum_flags & BGE_CSUM_FEATURES) != 0) { + } else if ((m->m_pkthdr.csum_flags & sc->bge_csum_features) != 0) { if (m->m_pkthdr.csum_flags & CSUM_IP) csum_flags |= BGE_TXBDFLAG_IP_CSUM; if (m->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)) { @@ -4233,6 +4238,17 @@ bge_init_locked(struct bge_softc *sc) /* Program VLAN tag stripping. */ bge_setvlan(sc); + /* Override UDP checksum offloading. */ + if (sc->bge_forced_udpcsum == 0) + sc->bge_csum_features &= ~CSUM_UDP; + else + sc->bge_csum_features |= CSUM_UDP; + if (ifp->if_capabilities & IFCAP_TXCSUM && + ifp->if_capenable & IFCAP_TXCSUM) { + ifp->if_hwassist &= ~(BGE_CSUM_FEATURES | CSUM_UDP); + ifp->if_hwassist |= sc->bge_csum_features; + } + /* Init RX ring. */ if (bge_init_rx_ring_std(sc) != 0) { device_printf(sc->bge_dev, "no memory for std Rx buffers.\n"); @@ -4558,9 +4574,9 @@ bge_ioctl(struct ifnet *ifp, u_long comm ifp->if_capenable ^= IFCAP_HWCSUM; if (IFCAP_HWCSUM & ifp->if_capenable && IFCAP_HWCSUM & ifp->if_capabilities) - ifp->if_hwassist |= BGE_CSUM_FEATURES; + ifp->if_hwassist |= sc->bge_csum_features; else - ifp->if_hwassist &= ~BGE_CSUM_FEATURES; + ifp->if_hwassist &= ~sc->bge_csum_features; } if ((mask & IFCAP_TSO4) != 0 && @@ -4936,6 +4952,24 @@ bge_add_sysctls(struct bge_softc *sc) "Number of fragmented TX buffers of a frame allowed before " "forced collapsing"); + /* + * It seems all Broadcom controllers have a bug that can generate UDP + * datagrams with checksum value 0 when TX UDP checksum offloading is + * enabled. Generating UDP checksum value 0 is RFC 768 violation. + * Even though the probability of generating such UDP datagrams is + * low, I don't want to see FreeBSD boxes to inject such datagrams + * into network so disable UDP checksum offloading by default. Users + * still override this behavior by setting a sysctl variable, + * dev.bge.0.forced_udpcsum. + */ + sc->bge_forced_udpcsum = 0; + snprintf(tn, sizeof(tn), "dev.bge.%d.bge_forced_udpcsum", unit); + TUNABLE_INT_FETCH(tn, &sc->bge_forced_udpcsum); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "forced_udpcsum", + CTLFLAG_RW, &sc->bge_forced_udpcsum, 0, + "Enable UDP checksum offloading even if controller can " + "generate UDP checksum value 0"); + if (BGE_IS_5705_PLUS(sc)) return; Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Fri Sep 24 17:59:58 2010 (r213109) +++ stable/7/sys/dev/bge/if_bgereg.h Fri Sep 24 18:01:43 2010 (r213110) @@ -2644,6 +2644,8 @@ struct bge_softc { int bge_link_evt; /* pending link event */ int bge_timer; int bge_forced_collapse; + int bge_forced_udpcsum; + int bge_csum_features; struct callout bge_stat_ch; uint32_t bge_rx_discards; uint32_t bge_tx_discards; From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 18:14:23 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 239E91065673; Fri, 24 Sep 2010 18:14:23 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1220D8FC0C; Fri, 24 Sep 2010 18:14:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OIEMfP034481; Fri, 24 Sep 2010 18:14:22 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OIEMA6034479; Fri, 24 Sep 2010 18:14:22 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241814.o8OIEMA6034479@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 18:14:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213112 - stable/7/share/man/man4 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 18:14:23 -0000 Author: yongari Date: Fri Sep 24 18:14:22 2010 New Revision: 213112 URL: http://svn.freebsd.org/changeset/base/213112 Log: MFC r211597: Document newly introduced tunable dev.bge.%d.forced_udpcsum. While I'm here also mention tunable dev.bge.%d.forced_collapse. Modified: stable/7/share/man/man4/bge.4 Directory Properties: stable/7/share/man/man4/ (props changed) Modified: stable/7/share/man/man4/bge.4 ============================================================================== --- stable/7/share/man/man4/bge.4 Fri Sep 24 18:12:19 2010 (r213111) +++ stable/7/share/man/man4/bge.4 Fri Sep 24 18:14:22 2010 (r213112) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 15, 2009 +.Dd August 21, 2010 .Dt BGE 4 .Os .Sh NAME @@ -215,6 +215,26 @@ Allow the ASF feature for cooperating wi Can cause system lockup problems on a small number of systems. Disabled by default. .El +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +tunables: +.Bl -tag -width indent +.It Va dev.bge.%d.forced_collapse +Allow collapsing multiple transmit buffers into a single buffer +to increase transmit performance with the cost of CPU cycles. +The default value is 0 to disable transmit buffer collapsing. +.It Va dev.bge.%d.forced_udpcsum +Enable UDP transmit checksum offloading even if controller can generate +UDP datagrams with checksum value 0. +UDP datagrams with checksum value 0 can confuse receiver host as it means +sender did not compute UDP checksum. +The default value is 0 which disables UDP transmit checksum offloading. +The interface need to be brought down and up again before a change takes +effect. +.El .Sh DIAGNOSTICS .Bl -diag .It "bge%d: couldn't map memory" From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 18:54:07 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3BA7106566C; Fri, 24 Sep 2010 18:54:06 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E22A08FC14; Fri, 24 Sep 2010 18:54:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OIs64O035441; Fri, 24 Sep 2010 18:54:06 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OIs6ia035439; Fri, 24 Sep 2010 18:54:06 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241854.o8OIs6ia035439@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 18:54:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213114 - stable/7/sys/pci X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 18:54:07 -0000 Author: yongari Date: Fri Sep 24 18:54:06 2010 New Revision: 213114 URL: http://svn.freebsd.org/changeset/base/213114 Log: MFC r211670: Clean up SIOCSIFCAP handler and allow RX checksum offloading could be controlled by user. Modified: stable/7/sys/pci/if_xl.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pci/if_xl.c ============================================================================== --- stable/7/sys/pci/if_xl.c Fri Sep 24 18:33:15 2010 (r213113) +++ stable/7/sys/pci/if_xl.c Fri Sep 24 18:54:06 2010 (r213114) @@ -3107,7 +3107,7 @@ xl_ioctl(struct ifnet *ifp, u_long comma { struct xl_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; - int error = 0; + int error = 0, mask; struct mii_data *mii = NULL; u_int8_t rxfilt; @@ -3167,40 +3167,47 @@ xl_ioctl(struct ifnet *ifp, u_long comma &mii->mii_media, command); break; case SIOCSIFCAP: + mask = ifr->ifr_reqcap ^ ifp->if_capenable; #ifdef DEVICE_POLLING - if (ifr->ifr_reqcap & IFCAP_POLLING && - !(ifp->if_capenable & IFCAP_POLLING)) { - error = ether_poll_register(xl_poll, ifp); - if (error) - return(error); - XL_LOCK(sc); - /* Disable interrupts */ - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ENB|0); - ifp->if_capenable |= IFCAP_POLLING; - XL_UNLOCK(sc); - return (error); - } - if (!(ifr->ifr_reqcap & IFCAP_POLLING) && - ifp->if_capenable & IFCAP_POLLING) { - error = ether_poll_deregister(ifp); - /* Enable interrupts. */ - XL_LOCK(sc); - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ACK|0xFF); - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ENB|XL_INTRS); - if (sc->xl_flags & XL_FLAG_FUNCREG) - bus_space_write_4(sc->xl_ftag, sc->xl_fhandle, - 4, 0x8000); - ifp->if_capenable &= ~IFCAP_POLLING; - XL_UNLOCK(sc); - return (error); + if ((mask & IFCAP_POLLING) != 0 && + (ifp->if_capabilities & IFCAP_POLLING) != 0) { + ifp->if_capenable ^= IFCAP_POLLING; + if ((ifp->if_capenable & IFCAP_POLLING) != 0) { + error = ether_poll_register(xl_poll, ifp); + if (error) + break; + XL_LOCK(sc); + /* Disable interrupts */ + CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ENB|0); + ifp->if_capenable |= IFCAP_POLLING; + XL_UNLOCK(sc); + } else { + error = ether_poll_deregister(ifp); + /* Enable interrupts. */ + XL_LOCK(sc); + CSR_WRITE_2(sc, XL_COMMAND, + XL_CMD_INTR_ACK | 0xFF); + CSR_WRITE_2(sc, XL_COMMAND, + XL_CMD_INTR_ENB | XL_INTRS); + if (sc->xl_flags & XL_FLAG_FUNCREG) + bus_space_write_4(sc->xl_ftag, + sc->xl_fhandle, 4, 0x8000); + XL_UNLOCK(sc); + } } #endif /* DEVICE_POLLING */ XL_LOCK(sc); - ifp->if_capenable = ifr->ifr_reqcap; - if (ifp->if_capenable & IFCAP_TXCSUM) - ifp->if_hwassist = XL905B_CSUM_FEATURES; - else - ifp->if_hwassist = 0; + if ((mask & IFCAP_TXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_TXCSUM; + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) + ifp->if_hwassist |= XL905B_CSUM_FEATURES; + else + ifp->if_hwassist &= ~XL905B_CSUM_FEATURES; + } + if ((mask & IFCAP_RXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_RXCSUM) != 0) + ifp->if_capenable ^= IFCAP_RXCSUM; XL_UNLOCK(sc); break; default: From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 19:00:16 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50B97106564A; Fri, 24 Sep 2010 19:00:16 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 254CB8FC0C; Fri, 24 Sep 2010 19:00:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJ0GUR035725; Fri, 24 Sep 2010 19:00:16 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJ0Gjw035723; Fri, 24 Sep 2010 19:00:16 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241900.o8OJ0Gjw035723@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:00:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213116 - stable/7/sys/pci X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 19:00:16 -0000 Author: yongari Date: Fri Sep 24 19:00:15 2010 New Revision: 213116 URL: http://svn.freebsd.org/changeset/base/213116 Log: MFC r211671: Remove unnecessary controller reinitialization by checking IFF_DRV_RUNNING flag. Modified: stable/7/sys/pci/if_xl.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pci/if_xl.c ============================================================================== --- stable/7/sys/pci/if_xl.c Fri Sep 24 18:58:04 2010 (r213115) +++ stable/7/sys/pci/if_xl.c Fri Sep 24 19:00:15 2010 (r213116) @@ -2275,6 +2275,7 @@ xl_intr(void *arg) if (status & XL_STAT_ADFAIL) { xl_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2343,6 +2344,7 @@ xl_poll_locked(struct ifnet *ifp, enum p if (status & XL_STAT_ADFAIL) { xl_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2769,6 +2771,8 @@ xl_init_locked(struct xl_softc *sc) XL_LOCK_ASSERT(sc); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; /* * Cancel pending I/O and free all RX/TX buffers. */ @@ -3017,6 +3021,7 @@ xl_ifmedia_upd(struct ifnet *ifp) if (sc->xl_media & XL_MEDIAOPT_MII || sc->xl_media & XL_MEDIAOPT_BTX || sc->xl_media & XL_MEDIAOPT_BT4) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } else { xl_setmode(sc, ifm->ifm_media); @@ -3132,10 +3137,8 @@ xl_ioctl(struct ifnet *ifp, u_long comma CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt); XL_SEL_WIN(7); - } else { - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - xl_init_locked(sc); - } + } else + xl_init_locked(sc); } else { if (ifp->if_drv_flags & IFF_DRV_RUNNING) xl_stop(sc); @@ -3258,6 +3261,7 @@ xl_watchdog(struct xl_softc *sc) "no carrier - transceiver cable problem?\n"); xl_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { @@ -3388,8 +3392,10 @@ xl_resume(device_t dev) XL_LOCK(sc); xl_reset(sc); - if (ifp->if_flags & IFF_UP) + if (ifp->if_flags & IFF_UP) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); + } XL_UNLOCK(sc); From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 19:07:14 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76747106574D; Fri, 24 Sep 2010 19:07:14 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AD108FC08; Fri, 24 Sep 2010 19:07:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJ7EYW035995; Fri, 24 Sep 2010 19:07:14 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJ7EpX035993; Fri, 24 Sep 2010 19:07:14 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241907.o8OJ7EpX035993@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:07:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213118 - stable/7/sys/pci X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 19:07:14 -0000 Author: yongari Date: Fri Sep 24 19:07:14 2010 New Revision: 213118 URL: http://svn.freebsd.org/changeset/base/213118 Log: MFC r211716: Move xl_reset() to xl_init_locked(). This will make driver initialize controller from a known good state. Previously driver used to issue controller reset while TX/RX DMA are in progress. I guess resetting controller in active TX/RX DMA cycle is to ensure stopping I/Os in xl_shutdown(). I remember some buggy controllers didn't respond with stop command if controller is under high network load at the time of shutdown so resetting controller was the only safe way to stop the I/Os. However, from my experiments, controller always responded with stop command under high network load so I think it's okay to remove the xl_reset() in device_shutdown handler. Resetting controller also will clear configured RX filter which in turn will make WOL support hard because driver have to reprogram RX filter in WOL handler as well as setting station address. Modified: stable/7/sys/pci/if_xl.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pci/if_xl.c ============================================================================== --- stable/7/sys/pci/if_xl.c Fri Sep 24 19:04:17 2010 (r213117) +++ stable/7/sys/pci/if_xl.c Fri Sep 24 19:07:14 2010 (r213118) @@ -1666,7 +1666,6 @@ xl_detach(device_t dev) /* These should only be active if attach succeeded */ if (device_is_attached(dev)) { XL_LOCK(sc); - xl_reset(sc); xl_stop(sc); XL_UNLOCK(sc); taskqueue_drain(taskqueue_swi, &sc->xl_task); @@ -2274,7 +2273,6 @@ xl_intr(void *arg) } if (status & XL_STAT_ADFAIL) { - xl_reset(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2343,7 +2341,6 @@ xl_poll_locked(struct ifnet *ifp, enum p } if (status & XL_STAT_ADFAIL) { - xl_reset(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2778,6 +2775,9 @@ xl_init_locked(struct xl_softc *sc) */ xl_stop(sc); + /* Reset the chip to a known state. */ + xl_reset(sc); + if (sc->xl_miibus == NULL) { CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_RESET); xl_wait(sc); @@ -3260,7 +3260,6 @@ xl_watchdog(struct xl_softc *sc) device_printf(sc->xl_dev, "no carrier - transceiver cable problem?\n"); - xl_reset(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); @@ -3359,7 +3358,6 @@ xl_shutdown(device_t dev) sc = device_get_softc(dev); XL_LOCK(sc); - xl_reset(sc); xl_stop(sc); XL_UNLOCK(sc); @@ -3391,7 +3389,6 @@ xl_resume(device_t dev) XL_LOCK(sc); - xl_reset(sc); if (ifp->if_flags & IFF_UP) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 19:11:23 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B7B2106566B; Fri, 24 Sep 2010 19:11:23 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 105228FC16; Fri, 24 Sep 2010 19:11:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJBM9t036350; Fri, 24 Sep 2010 19:11:22 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJBMg9036347; Fri, 24 Sep 2010 19:11:22 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241911.o8OJBMg9036347@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:11:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213121 - stable/7/sys/pci X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 19:11:23 -0000 Author: yongari Date: Fri Sep 24 19:11:22 2010 New Revision: 213121 URL: http://svn.freebsd.org/changeset/base/213121 Log: MFC r211717: Implement basic WOL support. Note, not all xl(4) controllers support WOL. Some controllers require additional 3-wire auxiliary remote wakeup connector to draw power. More recent xl(4) controllers may not need the wakeup connector though. Modified: stable/7/sys/pci/if_xl.c stable/7/sys/pci/if_xlreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pci/if_xl.c ============================================================================== --- stable/7/sys/pci/if_xl.c Fri Sep 24 19:09:23 2010 (r213120) +++ stable/7/sys/pci/if_xl.c Fri Sep 24 19:11:22 2010 (r213121) @@ -249,6 +249,7 @@ static int xl_watchdog(struct xl_softc * static int xl_shutdown(device_t); static int xl_suspend(device_t); static int xl_resume(device_t); +static void xl_setwol(struct xl_softc *); #ifdef DEVICE_POLLING static void xl_poll(struct ifnet *ifp, enum poll_cmd cmd, int count); @@ -1175,10 +1176,10 @@ static int xl_attach(device_t dev) { u_char eaddr[ETHER_ADDR_LEN]; - u_int16_t xcvr[2]; + u_int16_t sinfo2, xcvr[2]; struct xl_softc *sc; struct ifnet *ifp; - int media; + int media, pmcap; int unit, error = 0, rid, res; uint16_t did; @@ -1436,6 +1437,18 @@ xl_attach(device_t dev) else sc->xl_type = XL_TYPE_90X; + /* Check availability of WOL. */ + if ((sc->xl_caps & XL_CAPS_PWRMGMT) != 0 && + pci_find_extcap(dev, PCIY_PMG, &pmcap) == 0) { + sc->xl_pmcap = pmcap; + sc->xl_flags |= XL_FLAG_WOL; + sinfo2 = 0; + xl_read_eeprom(sc, (caddr_t)&sinfo2, XL_EE_SOFTINFO2, 1, 0); + if ((sinfo2 & XL_SINFO2_AUX_WOL_CON) == 0 && bootverbose) + device_printf(dev, + "No auxiliary remote wakeup connector!\n"); + } + /* Set the TX start threshold for best performance. */ sc->xl_tx_thresh = XL_MIN_FRAMELEN; @@ -1450,6 +1463,8 @@ xl_attach(device_t dev) ifp->if_capabilities |= IFCAP_HWCSUM; #endif } + if ((sc->xl_flags & XL_FLAG_WOL) != 0) + ifp->if_capabilities |= IFCAP_WOL_MAGIC; ifp->if_capenable = ifp->if_capabilities; #ifdef DEVICE_POLLING ifp->if_capabilities |= IFCAP_POLLING; @@ -2789,6 +2804,15 @@ xl_init_locked(struct xl_softc *sc) if (sc->xl_miibus != NULL) mii = device_get_softc(sc->xl_miibus); + /* + * Clear WOL status and disable all WOL feature as WOL + * would interfere Rx operation under normal environments. + */ + if ((sc->xl_flags & XL_FLAG_WOL) != 0) { + XL_SEL_WIN(7); + CSR_READ_2(sc, XL_W7_BM_PME); + CSR_WRITE_2(sc, XL_W7_BM_PME, 0); + } /* Init our MAC address */ XL_SEL_WIN(2); for (i = 0; i < ETHER_ADDR_LEN; i++) { @@ -3211,6 +3235,9 @@ xl_ioctl(struct ifnet *ifp, u_long comma if ((mask & IFCAP_RXCSUM) != 0 && (ifp->if_capabilities & IFCAP_RXCSUM) != 0) ifp->if_capenable ^= IFCAP_RXCSUM; + if ((mask & IFCAP_WOL_MAGIC) != 0 && + (ifp->if_capabilities & IFCAP_WOL_MAGIC) != 0) + ifp->if_capenable ^= IFCAP_WOL_MAGIC; XL_UNLOCK(sc); break; default: @@ -3353,15 +3380,8 @@ xl_stop(struct xl_softc *sc) static int xl_shutdown(device_t dev) { - struct xl_softc *sc; - - sc = device_get_softc(dev); - - XL_LOCK(sc); - xl_stop(sc); - XL_UNLOCK(sc); - return (0); + return (xl_suspend(dev)); } static int @@ -3373,6 +3393,7 @@ xl_suspend(device_t dev) XL_LOCK(sc); xl_stop(sc); + xl_setwol(sc); XL_UNLOCK(sc); return (0); @@ -3398,3 +3419,34 @@ xl_resume(device_t dev) return (0); } + +static void +xl_setwol(struct xl_softc *sc) +{ + struct ifnet *ifp; + u_int16_t cfg, pmstat; + + if ((sc->xl_flags & XL_FLAG_WOL) == 0) + return; + + ifp = sc->xl_ifp; + XL_SEL_WIN(7); + /* Clear any pending PME events. */ + CSR_READ_2(sc, XL_W7_BM_PME); + cfg = 0; + if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) + cfg |= XL_BM_PME_MAGIC; + CSR_WRITE_2(sc, XL_W7_BM_PME, cfg); + /* Enable RX. */ + if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) + CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_ENABLE); + /* Request PME. */ + pmstat = pci_read_config(sc->xl_dev, + sc->xl_pmcap + PCIR_POWER_STATUS, 2); + if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) + pmstat |= PCIM_PSTAT_PMEENABLE; + else + pmstat &= ~PCIM_PSTAT_PMEENABLE; + pci_write_config(sc->xl_dev, + sc->xl_pmcap + PCIR_POWER_STATUS, pmstat, 2); +} Modified: stable/7/sys/pci/if_xlreg.h ============================================================================== --- stable/7/sys/pci/if_xlreg.h Fri Sep 24 19:09:23 2010 (r213120) +++ stable/7/sys/pci/if_xlreg.h Fri Sep 24 19:11:22 2010 (r213121) @@ -81,6 +81,17 @@ #define XL_CAPS_100MBPS 0x1000 #define XL_CAPS_PWRMGMT 0x2000 +/* + * Bits in the software information 2 word + */ +#define XL_SINFO2_FIXED_BCAST_RX_BUG 0x0002 +#define XL_SINFO2_FIXED_ENDEC_LOOP_BUG 0x0004 +#define XL_SINFO2_AUX_WOL_CON 0x0008 +#define XL_SINFO2_PME_PULSED 0x0010 +#define XL_SINFO2_FIXED_MWI_BUG 0x0020 +#define XL_SINFO2_WOL_AFTER_PWR_LOSS 0x0040 +#define XL_SINFO2_AUTO_RST_TO_D0 0x0080 + #define XL_PACKET_SIZE 1540 #define XL_MAX_FRAMELEN (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN) @@ -408,7 +419,12 @@ #define XL_W7_BM_LEN 0x06 #define XL_W7_BM_STATUS 0x0B #define XL_W7_BM_TIMEr 0x0A +#define XL_W7_BM_PME 0x0C +#define XL_BM_PME_WAKE 0x0001 +#define XL_BM_PME_MAGIC 0x0002 +#define XL_BM_PME_LINKCHG 0x0004 +#define XL_BM_PME_WAKETIMER 0x0008 /* * bus master control registers */ @@ -577,6 +593,7 @@ struct xl_mii_frame { #define XL_FLAG_NO_XCVR_PWR 0x0080 #define XL_FLAG_USE_MMIO 0x0100 #define XL_FLAG_NO_MMIO 0x0200 +#define XL_FLAG_WOL 0x0400 #define XL_NO_XCVR_PWR_MAGICBITS 0x0900 @@ -600,6 +617,7 @@ struct xl_softc { u_int16_t xl_caps; u_int8_t xl_stats_no_timeout; u_int16_t xl_tx_thresh; + int xl_pmcap; int xl_if_flags; struct xl_list_data xl_ldata; struct xl_chain_data xl_cdata; From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 19:15:00 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FED6106566B; Fri, 24 Sep 2010 19:15:00 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E8468FC13; Fri, 24 Sep 2010 19:15:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJF0KE036509; Fri, 24 Sep 2010 19:15:00 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJF09n036506; Fri, 24 Sep 2010 19:15:00 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241915.o8OJF09n036506@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:15:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213123 - stable/7/sys/dev/ed X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 19:15:00 -0000 Author: yongari Date: Fri Sep 24 19:14:59 2010 New Revision: 213123 URL: http://svn.freebsd.org/changeset/base/213123 Log: MFC r211721: Fix a possible unaligned access to savebyte array. PR: kern/122195 Modified: stable/7/sys/dev/ed/if_ed.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ed/if_ed.c ============================================================================== --- stable/7/sys/dev/ed/if_ed.c Fri Sep 24 19:13:43 2010 (r213122) +++ stable/7/sys/dev/ed/if_ed.c Fri Sep 24 19:14:59 2010 (r213123) @@ -1457,9 +1457,12 @@ ed_pio_write_mbufs(struct ed_softc *sc, } } else { /* NE2000s are a pain */ - unsigned char *data; + uint8_t *data; int len, wantbyte; - unsigned char savebyte[2]; + union { + uint16_t w; + uint8_t b[2]; + } saveword; wantbyte = 0; @@ -1469,9 +1472,9 @@ ed_pio_write_mbufs(struct ed_softc *sc, data = mtod(m, caddr_t); /* finish the last word */ if (wantbyte) { - savebyte[1] = *data; + saveword.b[1] = *data; ed_asic_outw(sc, ED_NOVELL_DATA, - *(u_short *)savebyte); + saveword.w); data++; len--; wantbyte = 0; @@ -1485,7 +1488,7 @@ ed_pio_write_mbufs(struct ed_softc *sc, } /* save last byte, if necessary */ if (len == 1) { - savebyte[0] = *data; + saveword.b[0] = *data; wantbyte = 1; } } @@ -1493,7 +1496,7 @@ ed_pio_write_mbufs(struct ed_softc *sc, } /* spit last byte */ if (wantbyte) - ed_asic_outw(sc, ED_NOVELL_DATA, *(u_short *)savebyte); + ed_asic_outw(sc, ED_NOVELL_DATA, saveword.w); } /* From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 19:18:03 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD580106564A; Fri, 24 Sep 2010 19:18:03 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC30B8FC21; Fri, 24 Sep 2010 19:18:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJI3lK036674; Fri, 24 Sep 2010 19:18:03 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJI3R5036672; Fri, 24 Sep 2010 19:18:03 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241918.o8OJI3R5036672@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:18:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213125 - stable/7/sys/dev/ed X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 19:18:04 -0000 Author: yongari Date: Fri Sep 24 19:18:03 2010 New Revision: 213125 URL: http://svn.freebsd.org/changeset/base/213125 Log: MFC r211764: Add PNP id for Compex RL2000. I'm not sure whether adding this logical id is correct or not because Compex RL2000 is in the list of supported hardware list. I guess the Compex RL2000 could be PCI variant while the controller in question is ISA controller. It seems PNP compat id didn't match or it had multiple compat ids so isa_pnp_probe() seemed to return ENOENT. PR: kern/80853 Modified: stable/7/sys/dev/ed/if_ed_isa.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ed/if_ed_isa.c ============================================================================== --- stable/7/sys/dev/ed/if_ed_isa.c Fri Sep 24 19:16:42 2010 (r213124) +++ stable/7/sys/dev/ed/if_ed_isa.c Fri Sep 24 19:18:03 2010 (r213125) @@ -58,6 +58,7 @@ static struct isa_pnp_id ed_ids[] = { { 0x0131d805, NULL }, /* ANX3101 */ { 0x4cf48906, NULL }, /* ATIf44c */ { 0x01200507, NULL }, /* AXE2001 */ + { 0x0115180e, NULL }, /* CPX1501 */ { 0x0090252a, NULL }, /* JQE9000 */ { 0x0020832e, NULL }, /* KTC2000 */ { 0xd680d041, NULL }, /* PNP80d6 */ From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 19:22:41 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80C901065670; Fri, 24 Sep 2010 19:22:41 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F82B8FC20; Fri, 24 Sep 2010 19:22:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJMfPq036872; Fri, 24 Sep 2010 19:22:41 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJMfvT036870; Fri, 24 Sep 2010 19:22:41 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241922.o8OJMfvT036870@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:22:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213127 - stable/7/sys/dev/vr X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 19:22:41 -0000 Author: yongari Date: Fri Sep 24 19:22:41 2010 New Revision: 213127 URL: http://svn.freebsd.org/changeset/base/213127 Log: MFC r211765: Remove unnecessary controller reinitialization. CAM filter handling was rewritten long time ago so it should not require controller reinitialization. PR: kern/87506 Modified: stable/7/sys/dev/vr/if_vr.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/vr/if_vr.c ============================================================================== --- stable/7/sys/dev/vr/if_vr.c Fri Sep 24 19:19:53 2010 (r213126) +++ stable/7/sys/dev/vr/if_vr.c Fri Sep 24 19:22:41 2010 (r213127) @@ -1557,6 +1557,7 @@ vr_tick(void *xsc) sc->vr_stat.num_restart++; vr_stop(sc); vr_reset(sc); + sc->vr_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vr_init_locked(sc); sc->vr_flags &= ~VR_F_RESTART; } @@ -2008,6 +2009,9 @@ vr_init_locked(struct vr_softc *sc) ifp = sc->vr_ifp; mii = device_get_softc(sc->vr_miibus); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; + /* Cancel pending I/O and free all RX/TX buffers. */ vr_stop(sc); vr_reset(sc); @@ -2279,6 +2283,7 @@ vr_watchdog(struct vr_softc *sc) if_printf(sc->vr_ifp, "watchdog timeout " "(missed link)\n"); ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vr_init_locked(sc); return; } @@ -2288,6 +2293,7 @@ vr_watchdog(struct vr_softc *sc) vr_stop(sc); vr_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vr_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 19:26:27 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2E49106566B; Fri, 24 Sep 2010 19:26:27 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1C0A8FC18; Fri, 24 Sep 2010 19:26:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJQRFK037050; Fri, 24 Sep 2010 19:26:27 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJQRsS037048; Fri, 24 Sep 2010 19:26:27 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241926.o8OJQRsS037048@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:26:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213129 - stable/7/sys/dev/vr X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 19:26:27 -0000 Author: yongari Date: Fri Sep 24 19:26:27 2010 New Revision: 213129 URL: http://svn.freebsd.org/changeset/base/213129 Log: MFC r211766: vr_init_locked() will stop and reset the controller. Remove unnecessary vr_stop()/vr_reset() calls. Modified: stable/7/sys/dev/vr/if_vr.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/vr/if_vr.c ============================================================================== --- stable/7/sys/dev/vr/if_vr.c Fri Sep 24 19:24:45 2010 (r213128) +++ stable/7/sys/dev/vr/if_vr.c Fri Sep 24 19:26:27 2010 (r213129) @@ -1555,8 +1555,6 @@ vr_tick(void *xsc) if ((sc->vr_flags & VR_F_RESTART) != 0) { device_printf(sc->vr_dev, "restarting\n"); sc->vr_stat.num_restart++; - vr_stop(sc); - vr_reset(sc); sc->vr_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vr_init_locked(sc); sc->vr_flags &= ~VR_F_RESTART; @@ -2291,8 +2289,6 @@ vr_watchdog(struct vr_softc *sc) ifp->if_oerrors++; if_printf(ifp, "watchdog timeout\n"); - vr_stop(sc); - vr_reset(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vr_init_locked(sc); From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 19:29:02 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46B371065672; Fri, 24 Sep 2010 19:29:02 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B4078FC0C; Fri, 24 Sep 2010 19:29:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJT2mg037200; Fri, 24 Sep 2010 19:29:02 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJT1wP037198; Fri, 24 Sep 2010 19:29:01 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241929.o8OJT1wP037198@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:29:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213131 - stable/7/sys/pci X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 19:29:02 -0000 Author: yongari Date: Fri Sep 24 19:29:01 2010 New Revision: 213131 URL: http://svn.freebsd.org/changeset/base/213131 Log: MFC r211767: Remove unnecessary controller reinitialization. PR: kern/87506 Modified: stable/7/sys/pci/if_rl.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pci/if_rl.c ============================================================================== --- stable/7/sys/pci/if_rl.c Fri Sep 24 19:27:47 2010 (r213130) +++ stable/7/sys/pci/if_rl.c Fri Sep 24 19:29:01 2010 (r213131) @@ -1301,6 +1301,7 @@ rl_rxeof(struct rl_softc *sc) total_len < ETHER_MIN_LEN || total_len > ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN) { ifp->if_ierrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; rl_init_locked(sc); return; } @@ -1410,6 +1411,7 @@ rl_txeof(struct rl_softc *sc) CSR_WRITE_4(sc, RL_TXCFG, RL_TXCFG_CONFIG); oldthresh = sc->rl_txthresh; /* error recovery */ + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; rl_init_locked(sc); /* restore original threshold */ sc->rl_txthresh = oldthresh; @@ -1600,8 +1602,10 @@ rl_poll_locked(struct ifnet *ifp, enum p /* XXX We should check behaviour on receiver stalls. */ - if (status & RL_ISR_SYSTEM_ERR) + if (status & RL_ISR_SYSTEM_ERR) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; rl_init_locked(sc); + } } } #endif /* DEVICE_POLLING */ @@ -1638,8 +1642,10 @@ rl_intr(void *arg) rl_rxeof(sc); if ((status & RL_ISR_TX_OK) || (status & RL_ISR_TX_ERR)) rl_txeof(sc); - if (status & RL_ISR_SYSTEM_ERR) + if (status & RL_ISR_SYSTEM_ERR) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; rl_init_locked(sc); + } } if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) @@ -1801,6 +1807,9 @@ rl_init_locked(struct rl_softc *sc) mii = device_get_softc(sc->rl_miibus); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; + /* * Cancel pending I/O and free all RX/TX buffers. */ @@ -2029,6 +2038,7 @@ rl_watchdog(struct rl_softc *sc) rl_txeof(sc); rl_rxeof(sc); + sc->rl_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; rl_init_locked(sc); } From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 19:31:53 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 756801065674; Fri, 24 Sep 2010 19:31:53 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A04C8FC1A; Fri, 24 Sep 2010 19:31:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJVra4037394; Fri, 24 Sep 2010 19:31:53 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJVrbv037392; Fri, 24 Sep 2010 19:31:53 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241931.o8OJVrbv037392@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:31:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213134 - stable/7/sys/dev/age X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 19:31:53 -0000 Author: yongari Date: Fri Sep 24 19:31:53 2010 New Revision: 213134 URL: http://svn.freebsd.org/changeset/base/213134 Log: MFC r211768: Remove unnecessary controller reinitialization. PR: kern/87506 Modified: stable/7/sys/dev/age/if_age.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/age/if_age.c ============================================================================== --- stable/7/sys/dev/age/if_age.c Fri Sep 24 19:31:08 2010 (r213133) +++ stable/7/sys/dev/age/if_age.c Fri Sep 24 19:31:53 2010 (r213134) @@ -1781,6 +1781,7 @@ age_watchdog(struct age_softc *sc) if ((sc->age_flags & AGE_FLAG_LINK) == 0) { if_printf(sc->age_ifp, "watchdog timeout (missed link)\n"); ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; age_init_locked(sc); return; } @@ -1793,6 +1794,7 @@ age_watchdog(struct age_softc *sc) } if_printf(sc->age_ifp, "watchdog timeout\n"); ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; age_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) taskqueue_enqueue(sc->age_tq, &sc->age_tx_task); @@ -1817,8 +1819,10 @@ age_ioctl(struct ifnet *ifp, u_long cmd, else if (ifp->if_mtu != ifr->ifr_mtu) { AGE_LOCK(sc); ifp->if_mtu = ifr->ifr_mtu; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; age_init_locked(sc); + } AGE_UNLOCK(sc); } break; @@ -2165,6 +2169,7 @@ age_int_task(void *arg, int pending) if ((status & INTR_DMA_WR_TO_RST) != 0) device_printf(sc->age_dev, "DMA write error! -- resetting\n"); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; age_init_locked(sc); } if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) @@ -2529,6 +2534,9 @@ age_init_locked(struct age_softc *sc) ifp = sc->age_ifp; mii = device_get_softc(sc->age_miibus); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; + /* * Cancel any pending I/O. */ From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 20:04:24 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32B25106564A; Fri, 24 Sep 2010 20:04:24 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 215A68FC13; Fri, 24 Sep 2010 20:04:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OK4OW7038312; Fri, 24 Sep 2010 20:04:24 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OK4OZQ038310; Fri, 24 Sep 2010 20:04:24 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009242004.o8OK4OZQ038310@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 20:04:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213138 - stable/7/sys/pci X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 20:04:24 -0000 Author: yongari Date: Fri Sep 24 20:04:23 2010 New Revision: 213138 URL: http://svn.freebsd.org/changeset/base/213138 Log: MFC r195484: Make xl(4) build with Tx checksum offload. PR: kern/136409 Modified: stable/7/sys/pci/if_xl.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pci/if_xl.c ============================================================================== --- stable/7/sys/pci/if_xl.c Fri Sep 24 19:53:55 2010 (r213137) +++ stable/7/sys/pci/if_xl.c Fri Sep 24 20:04:23 2010 (r213138) @@ -2509,12 +2509,12 @@ xl_encap(struct xl_softc *sc, struct xl_ status = XL_TXSTAT_RND_DEFEAT; #ifndef XL905B_TXCSUM_BROKEN - if (m_head->m_pkthdr.csum_flags) { - if (m_head->m_pkthdr.csum_flags & CSUM_IP) + if ((*m_head)->m_pkthdr.csum_flags) { + if ((*m_head)->m_pkthdr.csum_flags & CSUM_IP) status |= XL_TXSTAT_IPCKSUM; - if (m_head->m_pkthdr.csum_flags & CSUM_TCP) + if ((*m_head)->m_pkthdr.csum_flags & CSUM_TCP) status |= XL_TXSTAT_TCPCKSUM; - if (m_head->m_pkthdr.csum_flags & CSUM_UDP) + if ((*m_head)->m_pkthdr.csum_flags & CSUM_UDP) status |= XL_TXSTAT_UDPCKSUM; } #endif From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 20:09:00 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20CBB106564A; Fri, 24 Sep 2010 20:09:00 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F5178FC13; Fri, 24 Sep 2010 20:09:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OK8xtJ038457; Fri, 24 Sep 2010 20:08:59 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OK8xYj038455; Fri, 24 Sep 2010 20:08:59 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009242008.o8OK8xYj038455@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 20:08:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213139 - stable/7/sys/pci X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 20:09:00 -0000 Author: yongari Date: Fri Sep 24 20:08:59 2010 New Revision: 213139 URL: http://svn.freebsd.org/changeset/base/213139 Log: MFC r191609: remove dead code with reference to IFQ_HANDOFF Modified: stable/7/sys/pci/if_xl.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pci/if_xl.c ============================================================================== --- stable/7/sys/pci/if_xl.c Fri Sep 24 20:04:23 2010 (r213138) +++ stable/7/sys/pci/if_xl.c Fri Sep 24 20:08:59 2010 (r213139) @@ -803,32 +803,6 @@ xl_setmulti_hash(struct xl_softc *sc) CSR_WRITE_2(sc, XL_COMMAND, rxfilt | XL_CMD_RX_SET_FILT); } -#ifdef notdef -static void -xl_testpacket(struct xl_softc *sc) -{ - struct mbuf *m; - struct ifnet *ifp = sc->xl_ifp; - - MGETHDR(m, M_DONTWAIT, MT_DATA); - - if (m == NULL) - return; - - bcopy(IF_LLADDR(sc->xl_ifp), - mtod(m, struct ether_header *)->ether_dhost, ETHER_ADDR_LEN); - bcopy(IF_LLADDR(sc->xl_ifp), - mtod(m, struct ether_header *)->ether_shost, ETHER_ADDR_LEN); - mtod(m, struct ether_header *)->ether_type = htons(3); - mtod(m, unsigned char *)[14] = 0; - mtod(m, unsigned char *)[15] = 0; - mtod(m, unsigned char *)[16] = 0xE3; - m->m_len = m->m_pkthdr.len = sizeof(struct ether_header) + 3; - IFQ_ENQUEUE(&ifp->if_snd, m); - xl_start(ifp); -} -#endif - static void xl_setcfg(struct xl_softc *sc) { From owner-svn-src-stable-7@FreeBSD.ORG Fri Sep 24 23:48:29 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89BDC1065674; Fri, 24 Sep 2010 23:48:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 77D918FC0A; Fri, 24 Sep 2010 23:48:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8ONmThX043167; Fri, 24 Sep 2010 23:48:29 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ONmTl8043165; Fri, 24 Sep 2010 23:48:29 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201009242348.o8ONmTl8043165@svn.freebsd.org> From: Xin LI Date: Fri, 24 Sep 2010 23:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213145 - stable/7/lib/libutil X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 23:48:29 -0000 Author: delphij Date: Fri Sep 24 23:48:29 2010 New Revision: 213145 URL: http://svn.freebsd.org/changeset/base/213145 Log: MFC r211393 (by des): In setusercontext(), do not apply user settings unless running as the user in question (usually but not necessarily because we were called with LOGIN_SETUSER). This plugs a hole where users could raise their resource limits and expand their CPU mask. Approved by: des Modified: stable/7/lib/libutil/login_class.c Directory Properties: stable/7/lib/libutil/ (props changed) Modified: stable/7/lib/libutil/login_class.c ============================================================================== --- stable/7/lib/libutil/login_class.c Fri Sep 24 23:47:42 2010 (r213144) +++ stable/7/lib/libutil/login_class.c Fri Sep 24 23:48:29 2010 (r213145) @@ -523,7 +523,7 @@ setusercontext(login_cap_t *lc, const st /* * Now, we repeat some of the above for the user's private entries */ - if ((lc = login_getuserclass(pwd)) != NULL) { + if (getuid() == uid && (lc = login_getuserclass(pwd)) != NULL) { mymask = setlogincontext(lc, pwd, mymask, flags); login_close(lc); }